enum { STACK = 8*1024, SMALLSTACK = 2*1024, Pktlen = 1514, Npkt = 3, Buflen = 9600, Nbuf = 3, Blen = 256, ETHERMINTU=60, ETHERMAXTU=1514, }; enum { ETEAPOL = 0x888e, EapolTpEap = 0, EapolTpStart = 1, EapolTpLogoff = 2, EapolTpKey = 3, EapolTpAsf = 4, EapolVersion = 2, EapRequest = 1, EapResponse = 2, EapSuccess = 3, EapFailure = 4, EapTpIdentity = 1, EapTpNotification = 2, EapTpNak = 3, EapTpMd5 = 4, EapTpOtp = 5, // one time password EapTpGtc = 6, // generic token card EapTpTtls = 21, EapTpExtp = 254, // expanded types EapTpExus = 255, // experimental use }; typedef struct Ether { uchar d[6]; uchar s[6]; uchar t[2]; uchar data[1]; } Ether; enum { ETHERHDR = 14, }; typedef struct Eapol { uchar ver; uchar tp; uchar ln[2]; uchar data[1]; } Eapol; enum { EAPOLHDR = 4, }; typedef struct Eap { uchar code; uchar id; uchar ln[2]; uchar data[1]; } Eap; enum { EAPHDR = 4, }; typedef struct KeyDesc { uchar tp; uchar data[1]; // min 1016 } KeyDesc; enum { KeyDescHlen = 1, KeyTpRC4 = 1, }; typedef struct RC4KeyDesc { uchar ln[2]; uchar rpc[8]; uchar iv[16]; uchar idx; uchar md[16]; uchar data[1]; } RC4KeyDesc; enum { RC4KeyDescHlen = 43, RC4KeyUnicast = 1<<7, RC4KeyIdx = (~0^1<<7), }; typedef struct Buf { uchar b[Buflen];// the data uchar *p; // reassemble/fragment pointer in b uchar *e; // end of data (e-b == length) } Buf; typedef struct Packet { uchar b[Pktlen];// the data uchar *e; // end of data (e-b == length) Ether *ether; // points to start of Ether in b Eapol *eapol; // points to start of Eapol in b Eap *eap; // points to start of Eapl in b } Packet; // Timers enum { Off = 0, Ticking, Expired, TickPerSec = 10, Tick = 1000/TickPerSec, }; typedef struct Timer { int counter; char *name; int state; } Timer; typedef struct Timers { Timer **timer; int ntimer; Channel *timerchan; } Timers; // Globals uchar theSessionKey[64]; char *myId; char *myPasswd; int debug; int debugTLS; char *logname;