MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sppp_to_event

Function sppp_to_event

freebsd/net/if_spppsubr.c:2021–2075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2019}
2020
2021static void
2022sppp_to_event(const struct cp *cp, struct sppp *sp)
2023{
2024 STDDCL;
2025
2026 SPPP_LOCK(sp);
2027 if (debug)
2028 log(LOG_DEBUG, SPP_FMT "%s TO(%s) rst_counter = %d\n",
2029 SPP_ARGS(ifp), cp->name,
2030 sppp_state_name(sp->state[cp->protoidx]),
2031 sp->rst_counter[cp->protoidx]);
2032
2033 if (--sp->rst_counter[cp->protoidx] < 0)
2034 /* TO- event */
2035 switch (sp->state[cp->protoidx]) {
2036 case STATE_CLOSING:
2037 sppp_cp_change_state(cp, sp, STATE_CLOSED);
2038 (cp->tlf)(sp);
2039 break;
2040 case STATE_STOPPING:
2041 sppp_cp_change_state(cp, sp, STATE_STOPPED);
2042 (cp->tlf)(sp);
2043 break;
2044 case STATE_REQ_SENT:
2045 case STATE_ACK_RCVD:
2046 case STATE_ACK_SENT:
2047 sppp_cp_change_state(cp, sp, STATE_STOPPED);
2048 (cp->tlf)(sp);
2049 break;
2050 }
2051 else
2052 /* TO+ event */
2053 switch (sp->state[cp->protoidx]) {
2054 case STATE_CLOSING:
2055 case STATE_STOPPING:
2056 sppp_cp_send(sp, cp->proto, TERM_REQ,
2057 ++sp->pp_seq[cp->protoidx], 0, 0);
2058 callout_reset(&sp->ch[cp->protoidx], sp->lcp.timeout,
2059 cp->TO, (void *)sp);
2060 break;
2061 case STATE_REQ_SENT:
2062 case STATE_ACK_RCVD:
2063 (cp->scr)(sp);
2064 /* sppp_cp_change_state() will restart the timer */
2065 sppp_cp_change_state(cp, sp, STATE_REQ_SENT);
2066 break;
2067 case STATE_ACK_SENT:
2068 (cp->scr)(sp);
2069 callout_reset(&sp->ch[cp->protoidx], sp->lcp.timeout,
2070 cp->TO, (void *)sp);
2071 break;
2072 }
2073
2074 SPPP_UNLOCK(sp);
2075}
2076
2077/*
2078 * Change the state of a control protocol in the state automaton.

Callers 3

sppp_lcp_TOFunction · 0.85
sppp_ipcp_TOFunction · 0.85
sppp_ipv6cp_TOFunction · 0.85

Calls 4

sppp_state_nameFunction · 0.85
sppp_cp_change_stateFunction · 0.85
sppp_cp_sendFunction · 0.85
logFunction · 0.50

Tested by

no test coverage detected