Adding several modules to the Tree, plus some files that escaped earlier
[tpg/acess2.git] / Modules / IPStack / ipv4.h
1 /*
2  * Acess2 IP Stack
3  * - IPv4 Definitions
4  */
5 #ifndef _IPV4_H_
6 #define _IPV4_H_
7
8 #include "ipstack.h"
9
10 typedef struct sIPv4Header      tIPv4Header;
11
12 struct sIPv4Header
13 {
14         struct {
15                 unsigned Version:       4;      // = 4
16                 unsigned HeaderLength:  4;      // in 4-byte chunks
17         };
18         Uint8   DiffServices;   // Differentiated Services
19         Uint16  TotalLength;
20         Uint16  Identifcation;
21         
22         struct {
23                 unsigned Reserved:      1;
24                 unsigned DontFragment:  1;
25                 unsigned MoreFragments: 1;
26                 unsigned FragOffLow:    5;
27         };
28         Uint8   FragOffHi;      // Number of 8-byte blocks from the original start
29         
30         Uint8   TTL;    // Max number of hops effectively
31         Uint8   Protocol;
32         Uint16  HeaderChecksum; // One's Complement Sum of the entire header must equal zero
33         
34         tIPv4   Source;
35         tIPv4   Destination;
36         
37         Uint8   Options[];
38 };
39
40 #define IP4PROT_ICMP    1
41 #define IP4PROT_TCP     6
42 #define IP4PROT_UDP     17
43
44 #define IPV4_ETHERNET_ID        0x0800
45
46 #endif

UCC git Repository :: git.ucc.asn.au