14 The IP protocol
The IP protocol
The IP protocol is the communication base through the internet network,
not at all IP is for Internet Protocol; its role is to permit the packets forwarding through the network, so that these can arrive to the recipient.
The fundamental element is the IP address (we already talk about it), through the medium of it can be identify sender and recipient unambiguous at the internal from the same network; attention!not at the world-wide how it is for the MAC address. In a private network, the IP address can be chose at will.
The IP heading
Like you already understood, an IP heading (IP Header) contains the sender and recipient IP address. Beyond these,
there are some informations, more or less, important; let's see some:
- Version: the IP protocol version in use; we'll use just the 4th version.
- Header Length: the heading length in words of 4 byte.
- Total Length: the IP packet total length (heading + dates).
- Identification: the sequential number used to identify an IP packet during a communication.
- Time To Live (TTL):contains the passages number (through the router) feasible first that the packet is eliminated (destination unreachable).
- Protocol: indicates the fourth level protocol type contained in the dates field.
- Checksum: field for the heading integrity control; concern just the heading not hte dates.
There are then others fields, but aren't used.

Which in C becomes:
typedef struct {
u8 b[4];
} IPAddr;
typedef struct {
u8 verlen;
u8 typeOfService;
u16 totalLength;
u16 id;
u16 fragmentInfo;
u8 TTL;
u8 protocol;
u16 checksum;
IPAddr sourceIP;
IPAddr destIP;
} IP_Header;


