Changeset 3173
- Timestamp:
- 07/19/08 13:01:24 (5 years ago)
- Files:
-
- 1 modified
-
branch/UMPA/umpa/protocols/IP.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/UMPA/umpa/protocols/IP.py
r3169 r3173 20 20 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 22 import base 23 24 from base import Field, Flags 22 from base import * 25 23 from umpa.utils.my_exceptions import UMPAAttributeException 26 24 27 class HIHL(base.Field): 28 _bits = 4 25 class HIHL(IntField): 26 bits = 4 27 def generate_value(self): 28 pass 29 # FIXME: how to get length of every fields in this scope? 30 31 class HTotalLength(Field): 32 bits = 16 29 33 def fillout(self): 30 34 pass 31 35 32 class H TotalLength(base.Field):33 _bits = 1636 class HIdentification(Field): 37 bits = 16 34 38 def fillout(self): 35 39 pass 36 40 37 class H Identification(base.Field):38 _bits = 1641 class HFragmentOffset(Field): 42 bits = 13 39 43 def fillout(self): 40 44 pass 41 45 42 class H FragmentOffset(base.Field):43 _bits = 1346 class HProtocol(Field): 47 bits = 8 44 48 def fillout(self): 45 49 pass 46 50 47 class H Protocol(base.Field):48 _bits = 851 class HHeaderChecksum(Field): 52 bits = 16 49 53 def fillout(self): 50 54 pass 51 55 52 class HHeaderChecksum(base.Field): 53 _bits = 16 54 def fillout(self): 55 pass 56 57 class HPadding(base.Field): 58 _bits = 0 56 class HPadding(Field): 57 bits = 0 59 58 def fillout(self): 60 59 pass … … 62 61 # main IP class 63 62 64 class IP( base.Protocol):63 class IP(Protocol): 65 64 """This is Internet Protocol. 66 65 The main protocol in third layer of OSI model. … … 74 73 75 74 def __init__(self, **kw): 76 base.Protocol.__init__(self, kw)75 Protocol.__init__(self, kw) 77 76 78 77 … … 81 80 flags = ('reserved', 'df', 'mf') 82 81 83 fields_list = [ Field(4, 4), HIHL(), Flags(tos), HTotalLength(),82 fields_list = [ IntField(4, 4), HIHL(), Flags(tos), HTotalLength(), 84 83 HIdentification(), Flags(flags, reserved=0), 85 84 HFragmentOffset(), Field(255, 8), HProtocol(),
