Network Layer Decodes

Class IP

Provides access to fields in an IPv4 header.   Further, you can see any following IP Options by using  pkt.Layer3;  see the Layers Decode page.


Instance Variables
version ip.version -> anInteger
IP Version, 4 for IPv4
hdr_len ip.hdr_len -> anInteger
IP Header Length, in 4-byte units
traffic_class ip.traffic_class -> anInteger
Originally IPv4 Type-Of-Service, now used for DSCP and ECN.  (Traffic Class is its IPv6 name)
pkt_len ip.pkt_len -> anInteger
Total Length of IP packet
ident ip.iden t-> anInteger
IP Identification
rf? ip.rf? -> true or false
True if 'Reserved' IP flag is 1
df? ip.df? -> true or false
True if 'Don't Fragment' IP flag is 1
mf? ip.mf? -> true or false
True if 'More Fragments' IP flag is 1
frag_offset ip.frag_offset -> anInteger
Fragment Offset, in 8-byte units
ttl ip.ttl -> anInteger
IP Time to Live (TTL)
proto ip.proto -> anInteger
IP Protocol, e.g. 6 = TCP, 17 = UDP, 1 = ICMP
hdr_checksum ip.hdr_checksum -> anInteger
IP Header Checksum
src_prefix ip.src_prefix -> anIPprefix
IPv4 source address
dst_prefix ip.dst_prefix -> anIPprefix
IPv4 destination address

A few of the fields in an IP objects may be set to new values, as follows:

Class set  Methods
traffic_class= ip.traffic_class = anInteger
Sets the traffic_class value in an IP
ttl= ip.ttl = anInteger
Sets the Time to Live (TTL) in an IP
src_prefix= ip.src_prefix = anIPprefix
Sets the IPv4 source address in an IP
dst_prefix= ip.dst_prefix = anIPprefix
Sets the IPv4 destination address in an IP

Nevil Brownlee
Thu, 20 Nov 08 (CST)