typedef struct Tcpc Tcpc; typedef struct Pstate Pstate; typedef struct Chap Chap; typedef struct Qualstats Qualstats; typedef struct Comptype Comptype; typedef struct Uncomptype Uncomptype; typedef struct PPP PPP; typedef struct Lcpmsg Lcpmsg; typedef struct Lcpopt Lcpopt; typedef struct Qualpkt Qualpkt; typedef struct Block Block; typedef uchar Ipaddr[IPaddrlen]; #pragma incomplete Tcpc /* * data blocks */ struct Block { Block *next; Block *flist; Block *list; /* chain of block lists */ uchar *rptr; /* first unconsumed uchar */ uchar *wptr; /* first empty uchar */ uchar *lim; /* 1 past the end of the buffer */ uchar *base; /* start of the buffer */ uchar flags; void *flow; ulong pc; ulong bsz; }; #define BLEN(b) ((b)->wptr-(b)->rptr) enum { /* block flags */ S_DELIM = (1<<0), S_HANGUP = (1<<1), S_RHANGUP = (1<<2), /* queue states */ QHUNGUP = (1<<0), QFLOW = (1<<1), /* queue is flow controlled */ }; Block* allocb(int); void freeb(Block*); Block* concat(Block*); int blen(Block*); Block* pullup(Block*, int); Block* padb(Block*, int); Block* btrim(Block*, int, int); Block* copyb(Block*, int); int pullb(Block**, int); enum { HDLC_frame= 0x7e, HDLC_esc= 0x7d, /* PPP frame fields */ PPP_addr= 0xff, PPP_ctl= 0x3, PPP_initfcs= 0xffff, PPP_goodfcs= 0xf0b8, /* PPP phases */ Pdead= 0, Plink, /* doing LCP */ Pauth, /* doing chap */ Pnet, /* doing IPCP, CCP */ Pterm, /* closing down */ /* PPP protocol types */ Pip= 0x21, /* ip v4 */ Pipv6= 0x57, /* ip v6 */ Pvjctcp= 0x2d, /* compressing van jacobson tcp */ Pvjutcp= 0x2f, /* uncompressing van jacobson tcp */ Pcdata= 0xfd, /* compressed datagram */ Pipcp= 0x8021, /* ip control */ Pecp= 0x8053, /* encryption control */ Pccp= 0x80fd, /* compressed datagram control */ Plcp= 0xc021, /* link control */ Ppasswd= 0xc023, /* passwd authentication */ Plqm= 0xc025, /* link quality monitoring */ Pchap= 0xc223, /* challenge/response */ /* LCP codes */ Lconfreq= 1, Lconfack= 2, Lconfnak= 3, Lconfrej= 4, Ltermreq= 5, Ltermack= 6, Lcoderej= 7, Lprotorej= 8, Lechoreq= 9, Lechoack= 10, Ldiscard= 11, Lresetreq= 14, Lresetack= 15, /* Lcp configure options */ Omtu= 1, Octlmap= 2, Oauth= 3, Oquality= 4, Omagic= 5, Opc= 7, Oac= 8, /* authentication protocols */ APmd5= 5, APmschap= 128, APpasswd= Ppasswd, /* use Pap, not Chap */ /* lcp flags */ Fmtu= 1<