Corrected bitfields -- the smallest datatype required for each bitfield is now used...
[pub/USBasp.git] / Demos / Device / RNDISEthernet / IP.h
index 119d219..be928e6 100644 (file)
                /** Type define of an IP packet header. */\r
                typedef struct\r
                {\r
-                       unsigned int  HeaderLength   : 4; /**< Total length of the packet header, in 4-byte blocks */\r
-                       unsigned int  Version        : 4; /**< IP protocol version */\r
-                       unsigned int  TypeOfService  : 8; /**< Special service type identifier, indicating delay/throughput/reliability levels */\r
-                       unsigned int  TotalLength    : 16; /**< Total length of the IP packet, in bytes */\r
+                       unsigned char  HeaderLength   : 4; /**< Total length of the packet header, in 4-byte blocks */\r
+                       unsigned char  Version        : 4; /**< IP protocol version */\r
+                       uint8_t        TypeOfService; /**< Special service type identifier, indicating delay/throughput/reliability levels */\r
+                       uint16_t       TotalLength; /**< Total length of the IP packet, in bytes */\r
 \r
-                       unsigned int  Identification : 16; /**< Idenfication value for identifying fragmented packets */\r
-                       unsigned int  FragmentOffset : 13; /**< Offset of this IP fragment */\r
-                       unsigned int  Flags          : 3; /**< Fragment flags, to indicate if a packet is fragmented */\r
+                       uint16_t       Identification; /**< Idenfication value for identifying fragmented packets */\r
+                       unsigned int   FragmentOffset : 13; /**< Offset of this IP fragment */\r
+                       unsigned int   Flags          : 3; /**< Fragment flags, to indicate if a packet is fragmented */\r
 \r
-                       unsigned int  TTL            : 8; /**< Maximum allowable number of hops to reach the packet destination */\r
-                       unsigned int  Protocol       : 8; /**< Encapsulated protocol type */\r
-                       unsigned int  HeaderChecksum : 16; /**< Ethernet checksum of the IP header */\r
+                       uint8_t        TTL; /**< Maximum allowable number of hops to reach the packet destination */\r
+                       uint8_t        Protocol; /**< Encapsulated protocol type */\r
+                       uint16_t       HeaderChecksum; /**< Ethernet checksum of the IP header */\r
                        \r
                        IP_Address_t  SourceAddress; /**< Source protocol IP address of the packet */\r
                        IP_Address_t  DestinationAddress; /**< Destination protocol IP address of the packet */\r