25 #ifndef ROHC_PROTOCOLS_IPV4_H
26 #define ROHC_PROTOCOLS_IPV4_H
40 #define IPV4_ADDR_FORMAT \
41 "%02x%02x%02x%02x (%u.%u.%u.%u)"
45 #define IPV4_ADDR_RAW(x) \
46 (x)[0], (x)[1], (x)[2], (x)[3], \
47 (x)[0], (x)[1], (x)[2], (x)[3]
55 #if WORDS_BIGENDIAN == 1
70 #if WORDS_BIGENDIAN == 1
77 } __attribute__((packed));
78 } __attribute__((packed));
87 #define IPV4_RF 0x8000
88 #define IPV4_DF 0x4000
89 #define IPV4_MF 0x2000
90 #define IPV4_OFFMASK 0x1fff
93 #if WORDS_BIGENDIAN == 1
105 } __attribute__((packed));
106 } __attribute__((packed));
116 } __attribute__((packed));
120 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
121 (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
122 (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
123 _Static_assert(
sizeof(
struct ipv4_hdr) == 20,
124 "IPv4 header should exactly 20-byte long");
129 __attribute__((warn_unused_result, nonnull(1), pure));
uint8_t options[0]
Definition: ipv4.h:114
uint8_t dscp_ecn
Definition: ipv4.h:67
static bool ipv4_is_fragment(const struct ipv4_hdr *const ipv4_hdr)
Whether the IPv4 packet is fragmented or not.
Definition: ipv4.h:140
uint8_t mf
Definition: ipv4.h:100
uint8_t ttl
Definition: ipv4.h:108
uint8_t df
Definition: ipv4.h:101
uint8_t frag_off2
Definition: ipv4.h:104
uint8_t ihl
Definition: ipv4.h:59
uint16_t check
Definition: ipv4.h:110
uint32_t saddr
Definition: ipv4.h:111
Miscellaneous utils for ROHC libraries.
uint16_t rohc_ntoh16(const uint16_t net16)
Convert a 16-bit short integer from network to host byte orders.
Definition: rohc_utils.c:71
uint16_t frag_off
Definition: ipv4.h:86
The IPv4 header.
Definition: ipv4.h:53
uint8_t reserved
Definition: ipv4.h:102
uint32_t daddr
Definition: ipv4.h:112
uint8_t frag_off1
Definition: ipv4.h:99
uint8_t ecn
Definition: ipv4.h:74
uint8_t protocol
Definition: ipv4.h:109
uint8_t version
Definition: ipv4.h:60
uint16_t tot_len
Definition: ipv4.h:80
uint16_t id
Definition: ipv4.h:81
uint8_t tos
Definition: ipv4.h:66
uint8_t dscp
Definition: ipv4.h:75
#define IPV4_DF
Definition: ipv4.h:88