Home | Trees | Indices | Help |
|
---|
|
1 # $Id: ppp.py 65 2010-03-26 02:53:51Z dugsong $ 2 3 """Point-to-Point Protocol.""" 4 5 import struct 6 import dpkt 7 8 # XXX - finish later 9 10 # http://www.iana.org/assignments/ppp-numbers 11 PPP_IP = 0x21 # Internet Protocol 12 PPP_IP6 = 0x57 # Internet Protocol v6 13 14 # Protocol field compression 15 PFC_BIT = 0x01 1618 __hdr__ = ( 19 ('p', 'B', PPP_IP), 20 ) 21 _protosw = {} 22 25 set_p = classmethod(set_p) 26 29 get_p = classmethod(get_p) 3049 61 62 if not PPP._protosw: 63 __load_protos() 6432 dpkt.Packet.unpack(self, buf) 33 if self.p & PFC_BIT == 0: 34 self.p = struct.unpack('>H', buf[:2])[0] 35 self.data = self.data[1:] 36 try: 37 self.data = self._protosw[self.p](self.data) 38 setattr(self, self.data.__class__.__name__.lower(), self.data) 39 except (KeyError, struct.error, dpkt.UnpackError): 40 pass41
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Mar 19 07:50:08 2015 | http://epydoc.sourceforge.net |