Graphics Programs Reference
In-Depth Information
u_int16_t frag_off;
u_int8_t ttl;
u_int8_t protocol;
u_int16_t check;
u_int32_t saddr;
u_int32_t daddr;
/*The options start here. */
};
From RFC 791
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| IHL |Type of Service| Total Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |Flags| Fragment Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Time to Live | Protocol | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Example Internet Datagram Header
Each element in the structure corresponds to the fields shown in the
RFC header diagram. Since the first two fields, Version and IHL (Internet
Header Length) are only four bits in size and there aren't any 4-bit variable
types in C, the Linux header definition splits the byte differently depending
on the byte order of the host. These fields are in the network byte order, so,
if the host is little-endian, the IHL should come before Version since the byte
order is reversed. For our purposes, we won't really be using either of these
fields, so we don't even need to split up the byte.
Added to hacking-network.h
struct ip_hdr {
unsigned char ip_version_and_header_length; // Version and header length
unsigned char ip_tos; // Type of service
unsigned short ip_len; // Total length
unsigned short ip_id; // Identification number
unsigned short ip_frag_offset; // Fragment offset and flags
unsigned char ip_ttl; // Time to live
unsigned char ip_type; // Protocol type
unsigned short ip_checksum; // Checksum
unsigned int ip_src_addr; // Source IP address
unsigned int ip_dest_addr; // Destination IP address
} ;
Search WWH ::




Custom Search