67,10 → 67,20 |
#define IP_HEADER_CHECKSUM( header ) ( htons( ip_checksum(( uint8_t * )( header ), IP_HEADER_LENGTH( header )))) |
|
/** Returns the fragment offest. |
* @param header The IP packet header. Input parameter. |
*/ |
#define IP_FRAGMENT_OFFSET( header ) (((( header )->fragment_offset_high << 8 ) + ( header )->fragment_offset_low ) * 8u ) |
|
/** Returns the fragment offest high bits. |
* @param length The prefixed data total length. Input parameter. |
*/ |
#define IP_COMPUTE_FRAGMENT_OFFSET( length ) (( length ) / 8 ) |
#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH( length ) (((( length ) / 8u ) & 0x1F00 ) >> 8 ) |
|
/** Returns the fragment offest low bits. |
* @param length The prefixed data total length. Input parameter. |
*/ |
#define IP_COMPUTE_FRAGMENT_OFFSET_LOW( length ) ((( length ) / 8u ) & 0xFF ) |
|
/** Type definition of the internet header. |
* @see ip_header |
*/ |
117,20 → 127,25 |
uint16_t identification; |
#ifdef ARCH_IS_BIG_ENDIAN |
/** Various control flags. |
* @see |
*/ |
uint16_t flags:3; |
uint8_t flags:3; |
/** This field indicates where in the datagram this fragment belongs. |
* High bits. |
*/ |
uint16_t fragment_offset:3; |
uint8_t fragment_offset_high:5; |
#else |
/** This field indicates where in the datagram this fragment belongs. |
* High bits. |
*/ |
uint16_t fragment_offset:13; |
uint8_t fragment_offset_high:5; |
/** Various control flags. |
*/ |
uint16_t flags:3; |
uint8_t flags:3; |
#endif |
/** This field indicates where in the datagram this fragment belongs. |
* Low bits. |
*/ |
uint8_t fragment_offset_low; |
/** This field indicates the maximum time the datagram is allowed to remain in the internet system. |
* If this field contains the value zero, then the datagram must be destroyed. |
* This field is modified in internet header processing. |