## Network Layer Decodes

### Class Internet

'Internet' is not a user-accessible class - you can't create an Internet object. Rather, it's a parent for the IP, IP6, TCP, UDP, ICMP6 and ICMP classes, providing access to the fields in an IP or IP6 header, and functions for testing and setting checksums.

Instance Variables
version | internet.version -> anInteger
| IP version: 4 for IPv4, 6 for IPv6
proto | internet.proto -> anInteger
| IP Protocol, e.g. 6 = TCP, 17 = UDP, 1 = ICMP, 58 = ICMPv6
traffic_class | internet.traffic_class -> anInteger
| Originally IPv4 Type-Of-Service, now used for DSCP and ECN. Traffic Class is its IPv6 name
hop_limit | internet.hop_limit -> anInteger
| Max number of hops IP packet can pass through. IPv4 used its 'Time to Live' (TTL) field in the same way
pkt_len | internet.pkt_len -> anInteger
| Total Length of IPv4 packet, Nonel for an IPv6 packet
hdr_len | internet.pkt_len -> anInteger
| IPv4 Header Length in 4-byte units, None for an IPv6 packet
src_prefix | internet.src_prefix -> anIPprefix
| IP source address (see IPprefix page for details)
dst_prefix | internet.dst_prefix -> anIPprefix
| IP destination address (see IPprefix page for details)

Class Functions
test_l3_cksm() | internet.test_l3_cksm() -> True, False or None
| Tests the IP header (layer 3) checksum for IPv4 Packets. Returns True if the checksum is correct, False if it is incorrect, or None if the checksum could not be computed (i.e. too few bytes were captured).
set_l3_cksm() | i nternet.set_l3_cksm() -> True or None
| Computes and sets the IP header (layer 3) checksum for IPv4 Packets. Returns True if the checksum was set, or None if the checksum could not be computed (i.e. too few bytes were captured).
test_trans_cksm() | i nternet.test_trans_cksm() -> True, False or None
| Tests the TCP, UDP, ICMP or ICMP6 (transport) checksum for IPv4 and IPv6 packets. Returns True if the checksum is correct, False if it is incorrect, or None if the checksum could not be computed (i.e. too few bytes were captured).
set_trans_cksm() | i nternet.tset_trans_cksm() -> True or None
| Tests the TCP, UDP, ICMP or ICMP6 (transport) checksum for IPv4 and IPv6 packets. Returns True if the checksum was set, or None if the checksum could not be computed (i.e. too few bytes were captured).

Nevil Brownlee
Tue, 3 Jun 14 (NZST)