diff options
Diffstat (limited to 'libexec/pppd/fsm.h')
-rw-r--r-- | libexec/pppd/fsm.h | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/libexec/pppd/fsm.h b/libexec/pppd/fsm.h index 82af3039ca558..abb242e21db58 100644 --- a/libexec/pppd/fsm.h +++ b/libexec/pppd/fsm.h @@ -15,6 +15,8 @@ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: fsm.h,v 1.2 1994/03/30 09:31:27 jkh Exp $ */ /* @@ -45,32 +47,35 @@ */ typedef struct fsm_callbacks { void (*resetci)(); /* Reset our Configuration Information */ - int (*cilen)(); /* Length of our Configuration Information */ + int (*cilen)(); /* Length of our Configuration Information */ void (*addci)(); /* Add our Configuration Information */ - int (*ackci)(); /* ACK our Configuration Information */ - void (*nakci)(); /* NAK our Configuration Information */ - void (*rejci)(); /* Reject our Configuration Information */ - u_char (*reqci)(); /* Request peer's Configuration Information */ - void (*up)(); /* Called when fsm reaches OPEN state */ - void (*down)(); /* Called when fsm leaves OPEN state */ - void (*closed)(); /* Called when fsm reaches CLOSED state */ + int (*ackci)(); /* ACK our Configuration Information */ + int (*nakci)(); /* NAK our Configuration Information */ + int (*rejci)(); /* Reject our Configuration Information */ + int (*reqci)(); /* Request peer's Configuration Information */ + void (*up)(); /* Called when fsm reaches OPENED state */ + void (*down)(); /* Called when fsm leaves OPENED state */ + void (*starting)(); /* Called when we want the lower layer */ + void (*finished)(); /* Called when we don't want the lower layer */ void (*protreject)(); /* Called when Protocol-Reject received */ void (*retransmit)(); /* Retransmission is necessary */ + int (*extcode)(); /* Called when unknown code received */ + char *proto_name; /* String name for protocol (for messages) */ } fsm_callbacks; typedef struct fsm { int unit; /* Interface unit number */ - u_short protocol; /* Data Link Layer Protocol field value */ + int protocol; /* Data Link Layer Protocol field value */ int state; /* State */ - int flags; /* Flags */ + int flags; /* Contains option bits */ u_char id; /* Current id */ u_char reqid; /* Current request id */ int timeouttime; /* Timeout time in milliseconds */ int maxconfreqtransmits; /* Maximum Configure-Request transmissions */ - int retransmits; /* Number of retransmissions */ + int retransmits; /* Number of retransmissions left */ int maxtermtransmits; /* Maximum Terminate-Request transmissions */ - int nakloops; /* Number of nak loops since last timeout */ + int nakloops; /* Number of nak loops since last ack */ int maxnakloops; /* Maximum number of nak loops tolerated */ fsm_callbacks *callbacks; /* Callback routines */ } fsm; @@ -79,40 +84,49 @@ typedef struct fsm { /* * Link states. */ -#define CLOSED 1 /* Connection closed */ -#define LISTEN 2 /* Listening for a Config Request */ -#define REQSENT 3 /* We've sent a Config Request */ -#define ACKSENT 4 /* We've sent a Config Ack */ -#define ACKRCVD 5 /* We've received a Config Ack */ -#define OPEN 6 /* Connection open */ -#define TERMSENT 7 /* We've sent a Terminate Request */ +#define INITIAL 0 /* Down, hasn't been opened */ +#define STARTING 1 /* Down, been opened */ +#define CLOSED 2 /* Up, hasn't been opened */ +#define STOPPED 3 /* Open, waiting for down event */ +#define CLOSING 4 /* Terminating the connection, not open */ +#define STOPPING 5 /* Terminating, but open */ +#define REQSENT 6 /* We've sent a Config Request */ +#define ACKRCVD 7 /* We've received a Config Ack */ +#define ACKSENT 8 /* We've sent a Config Ack */ +#define OPENED 9 /* Connection available */ /* - * Flags. + * Flags - indicate options controlling FSM operation */ -#define LOWERUP 1 /* The lower level is UP */ -#define AOPENDING 2 /* Active Open pending timeout of request */ -#define POPENDING 4 /* Passive Open pending timeout of request */ +#define OPT_PASSIVE 1 /* Don't die if we don't get a response */ +#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */ +#define OPT_SILENT 4 /* Wait for peer to speak first */ /* * Timeouts. */ #define DEFTIMEOUT 3 /* Timeout time in seconds */ -#define DEFMAXTERMTRANSMITS 10 /* Maximum Terminate-Request transmissions */ -#define DEFMAXCONFIGREQS 10 /* Maximum Configure-Request transmissions */ - - +#define DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */ +#define DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */ #define DEFMAXNAKLOOPS 10 /* Maximum number of nak loops */ +/* + * Prototypes + */ void fsm_init __ARGS((fsm *)); -void fsm_activeopen __ARGS((fsm *)); -void fsm_passiveopen __ARGS((fsm *)); -void fsm_close __ARGS((fsm *)); void fsm_lowerup __ARGS((fsm *)); void fsm_lowerdown __ARGS((fsm *)); -void fsm_protreject __ARGS((fsm *)); +void fsm_open __ARGS((fsm *)); +void fsm_close __ARGS((fsm *)); void fsm_input __ARGS((fsm *, u_char *, int)); +void fsm_protreject __ARGS((fsm *)); void fsm_sdata __ARGS((fsm *, int, int, u_char *, int)); + + +/* + * Variables + */ +extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */ |