State Pseudocode: Stopped, Closing & Stopping
Stopped: The Stopped state is the Open counterpart to the Closed state. It is entered when the automaton is waiting for a Down event after the This-Layer-Finished action, or after sending a Terminate-Ack. The Restart timer is not running in the Stopped state.
[10-1]
|
stopped (){
if (event) {
= DOWN : tls(); //action
transition(STARTING) ; //transition to starting state
end DOWN;
= OPEN : initializeLink(); //initialize variables
end OPEN;
= CLOSE : transition(CLOSED) ; //transition to closed state
end CLOSE;
= RCRP : irc(event); //action
scr(true); //action
sca(... ); //action
transition(ACKSENT) ; //transition to ACKSENT state
end RCRP;
= RCRN : irc(event); //action
scr(true); //action
scn(... ); //action
transition(REQSENT) ; //transition to REQSENT state
end RCRN;
= RCA ,RCN or RTR : sta(... ); //action
end EVENT;
= RTA, RXJP, or RXR :
end EVENT;
= RUC : scj(... ); //action
end RUC;
= RXJN : tlf(); //action
end RXJN;
= any other event :
wrongEvent; //indicate that when PPP in stopped state no other event is processed
}
}
|
Closing: In the Closing state, an attempt is made to terminate the connection. A Terminate-Request has been sent and the Restart timer is running, but a Terminate-Ack has not yet been received. Upon reception of a Terminate-Ack, the Closed state is entered. Upon the expiration of the Restart timer, a new Terminate-Request is transmitted, and the Restart timer is restarted. After the Restart timer has expired Max-Terminate times, the Closed state is entered. [10-1]
|
closing (){
if (event) {
= DOWN : transition(INITIAL) ; //transition to initial state
end DOWN;
= OPEN : transition(STOPPING); //transition to stopping state
initializeLink(); //initialize variables
end OPEN;
= TOP : str(... ); //action
initializePPPTimer; //initialize PPP Timer variable
end TOP;
= TON : tlf(); //action
initializePPPTimer; //initialize PPP Timer variable
transition(CLOSED); //transition to CLOSED state
end TON;
= RTR : sta(... ); //action
end RTR;
= CLOSE, RCRP, RCRN, RCA,RCN, RXR, or RXJP:
end EVENT; //no action or state transition
= RTA : tlf(); //action
transition(CLOSED); //transition to CLOSED state
end RTA;
= RUC : scj(... ); //action
end RUC;
= RXJN : tlf(); //action
end RXJN;
= any other event :
wrongEvent; //indicate that when PPP in closing state no other event is processed
}
}
|
Stopping: The Stopping state is the Open counterpart to the Closing state. A Terminate-Request has been sent and the Restart timer is running, but a Terminate-Ack has not yet been received. [10-1]
|
stopping (){
if (event) {
= DOWN : transition(STARTING) ; //transition to STARTING state
end DOWN;
= OPEN : initializeLink(); //initialize variables
end OPEN;
= CLOSE : transition(CLOSING); //transition to CLOSE state
end CLOSE;
= TOP : str(... .); //action
initialize PPPTimer(); //initialize PPP timer
end TOP;
= TON : tlf(); //action
initialize PPPTimer(); //initialize PPP timer
transition(STOPPED); //transition to STOPPED state
end TON;
= RCRP, RCRN, RCA , RCN, RXJP, RXR :
end EVENT; // no action or state transition
= RTR : sta(... ); //action
end RTR;
= RTA : tlf(); //action
transition(STOPPED); //transition to STOPPED state
end RTA;
= RUC : scj(... ); //action
end RUC;
= RXJN : tlf(); //action
transition(STOPPED); //transition to STOPPED state
end RXJN;
= any other event :
wrongEvent; //indicate that when PPP in stopping state no other event is processed
}
}
|