Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

SRC/ppp.h

Go to the documentation of this file.
00001 00003 #ifndef _w32_PPP_H 00004 #define _w32_PPP_H 00005 00006 #include <time.h> 00007 #include <sys/socket.h> /* <sys/wtypes.h> */ 00008 #include <net/ppp_defs.h> /* PPP_MRU etc. */ 00009 00010 void ppp_start (int debug); 00011 void ppp_input (const BYTE *inbuf, WORD len); 00012 00013 00014 /* Standard link phases 00015 */ 00016 enum ppp_phase { 00017 phDead, phEstablish, phAuthenticate, 00018 phNetwork, phTerminate 00019 }; 00020 00021 /* Standard set of events 00022 */ 00023 enum ppp_event { 00024 evUp, evDown, evOpen, evClose, evTOp, 00025 evTOm, evRCRp, evRCRm, evRCA, evRCN, 00026 evRTR, evRTA, evRUC, evRXJp, evRXJm, evRXR 00027 }; 00028 00029 /* Standard negotiation states 00030 */ 00031 enum xcp_state { 00032 stInitial, stStarting, stClosed, stStopped, 00033 stClosing, stStopping, stReqSent, stAckRcvd, 00034 stAckSent, stOpened, stNoChange 00035 }; 00036 00037 /* Standard set of actions 00038 */ 00039 enum xcp_action { 00040 acNull, acIrc, acScr, acTls, acTlf, acStr, acSta, 00041 acSca, acScn, acScj, acTld, acTlu, acZrc, acSer 00042 }; 00043 00044 /* Standard message code numbers 00045 */ 00046 #define CODE_CONF_REQ 1 00047 #define CODE_CONF_ACK 2 00048 #define CODE_CONF_NAK 3 00049 #define CODE_CONF_REJ 4 00050 #define CODE_TERM_REQ 5 00051 #define CODE_TERM_ACK 6 00052 #define CODE_CODE_REJ 7 00053 #define CODE_PROTO_REJ 8 00054 #define CODE_ECHO_REQ 9 00055 #define CODE_ECHO_REP 10 00056 #define CODE_DISCARD_REQ 11 00057 00058 00059 struct ppp_xcp; 00060 struct ppp_state; 00061 struct xcp_type; 00062 00063 typedef void (*xcp_func) (struct ppp_state *state, 00064 struct ppp_xcp *xcp, 00065 const struct xcp_type *tp, 00066 const BYTE *buf, int len); 00067 00068 typedef void (*ppp_func) (struct ppp_state *state, 00069 struct ppp_xcp *xcp); 00070 00071 /* Basic information about an option. 00072 */ 00073 struct xcp_type { 00074 char *name; /* Printable name */ 00075 short type; /* option number (-1 to end) */ 00076 short flag; /* set to ignore default value */ 00077 BYTE minlen; /* minimum overall length */ 00078 BYTE maxlen; /* maximum overall length */ 00079 DWORD default_value; /* default */ 00080 xcp_func validate_req; 00081 xcp_func validate_nak; 00082 xcp_func show; 00083 }; 00084 00085 enum os_state { 00086 osUsable, 00087 osUnusable 00088 }; 00089 00090 struct option_state { 00091 DWORD my_value; /* sent in Configure-Request */ 00092 DWORD peer_value; /* last received */ 00093 enum os_state state; /* flag for rejects */ 00094 }; 00095 00096 struct ppp_xcp { 00097 const char *name; /* name of control protocol */ 00098 enum xcp_state state; /* state machine */ 00099 int restart; /* standard restart count */ 00100 time_t timeout; /* standard restart timer */ 00101 int naks_sent;/* consecutive naks sent */ 00102 ppp_func deliver; /* handler */ 00103 struct xcp_type *types; /* option types supported here */ 00104 struct option_state *opts; /* current negotiation state */ 00105 WORD proto; /* PPP protocol ID */ 00106 BYTE ident; /* current ID number */ 00107 }; 00108 00109 enum parse_state { 00110 psOK, psNak, 00111 psRej, psBad 00112 }; 00113 00114 struct ppp_state { 00115 enum ppp_phase phase; /* link phase */ 00116 enum parse_state parse_state; /* request parsing state */ 00117 struct ppp_xcp xcps[2]; /* installed XCPs */ 00118 #define XCP_LCP 0 00119 #define XCP_IPCP 1 00120 int timeout_period; /* value for restart timer */ 00121 int mlen; /* packet length */ 00122 DWORD mymagic, hismagic; /* magic numbers (for echo) */ 00123 BYTE *bp, *up; /* pointers to packet buffers */ 00124 BYTE *inbuffer; 00125 BYTE outbuffer [PPP_MRU]; 00126 }; 00127 00128 #endif /* _w32_PPP_H */

Generated on Wed Aug 4 08:55:52 2010 for Watt-32 tcp/ip by doxygen 1.3.8