7 typedef struct Hdr Hdr;
12 uchar length[2]; /* of payload */
33 static Field p_fields[] =
35 {"v", Fnum, Overs, "version", } ,
36 {"t", Fnum, Otype, "type", } ,
37 {"c", Fnum, Ocode, "code" } ,
38 {"s", Fnum, Osess, "sessid" } ,
43 p_compilesess(Filter *f)
48 compile_cmp(pppoe_sess.name, f, p_fields);
52 for(m = p_mux; m->name != nil; m++)
53 if(strcmp(f->s, m->name) == 0){
60 sysfatal("unknown pppoe field or protocol: %s", f->s);
63 p_compiledisc(Filter *f)
68 compile_cmp(pppoe_disc.name, f, p_fields);
72 for(m = p_mux; m->name != nil; m++)
73 if(strcmp(f->s, m->name) == 0){
80 sysfatal("unknown pppoe field or protocol: %s", f->s);
84 p_filter(Filter *f, Msg *m)
88 if(m->pe - m->ps < HDRSIZE)
96 return (h->verstype>>4) == f->ulv;
98 return (h->verstype&0xF) == f->ulv;
100 return h->code == f->ulv;
102 return NetS(h->sessid) == f->ulv;
107 /* BUG: print all the discovery types */
109 p_seprintdisc(Msg *m)
123 m->p = seprint(m->p, m->e, "v=%d t=%d c=0x%x s=0x%ux, len=%d",
124 h->verstype>>4, h->verstype&0xF, h->code, NetS(h->sessid), NetS(h->length));
130 p_seprintsess(Msg *m)
142 /* this will call ppp for me */
143 demux(p_mux, 0, 0, m, &dump);
145 m->p = seprint(m->p, m->e, "v=%d t=%d c=0x%x s=0x%ux, len=%d",
146 h->verstype>>4, h->verstype&0xF, h->code, NetS(h->sessid), NetS(h->length));