datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com  
Events
UBM Tech
UBM Tech

Design Article

Guide to Embedded Systems Architecture - Part 2: PPP state pseudocode and Internet Protocol

Tammy Noergaard

4/26/2010 2:51 PM EDT

PPP (LCP) State Pseudocode
[Part 1 of this article begins by defining "middleware" and looking at some networking middleware driver examples.]

PPP (LCP) State Pseudocode
Initial: PPP link is in the Initial state, the lower layer is unavailable (Down), and no Open event has occurred. The Restart timer is not running in the Initial state. [10-1]

Starting: The Starting state is the Open counterpart to the Initial state. An administrative Open has been initiated, but the lower layer is still unavailable (Down). The Restart timer is not running in the Starting state. When the lower layer becomes available (Up), a Configure-Request is sent. [10-1]

starting() {
    if (event) {
        = UP:
                irc(event); //action
                scr(true); //action
                transition(REQSENT); //transition to REQSENT state
                end UP;
        = OPEN:
                end OPEN; //no action or state transition
        = CLOSE:
                tlf(); //action
                transition(INITIAL); //transition to initial state
                end CLOSE;
    = any other event :
                wrongEvent++; //indicate that when PPP in starting state no other event is processed
    }
}

Closed: In the Closed state, the link is available (Up), but no Open has occurred. The Restart timer is not running in the Closed state. Upon reception of Configure-Request packets, a Terminate-Ack is sent. Terminate-Acks are silently discarded to avoid creating a loop. [10-1]

closed (){
    if (event) {
        = DOWN :
                transition(INITIAL) ; //transition to initial state
                end DOWN;
        = OPEN :
                irc(event); //action
                scr(true); //action
                transition(REQSENT); //transition to REQSENT state
                end OPEN;
        = RCRP, RCRN, RCA, RCN, or RTR:
                sta(... ); //action
                end EVENT;
        = RTA, RXJP, RXR, CLOSE :
                end EVENT; //no action or state transition
        = RUC:
                scj(... ); //action
                end RUC;
        = RXJN:
                tlf(); //action
                end RXJN;
        = any other event :
                wrongEvent; //indicate that when PPP in closed state no other event is processed
    }
}





Please sign in to post comment

Navigate to related information

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)