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
has_rf ip.has_rf -> true or false

True if 'Reserved' IP flag is 1
has_df ip.has_df --> true or false

True if 'Don't Fragment' IP flag is 1
has_mf ip.has_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
payload ip.payload -> aByteArray

Byte array containing the IP object's payload

A few of the fields in an IP object 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
checksum= ip.checksum = anInteger

Sets Header Checksum 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
Mon,  30 Jun 14 (NZST)