37 #ifndef LWIP_HDR_PROT_IP4_H
38 #define LWIP_HDR_PROT_IP4_H
49 #ifdef PACK_STRUCT_USE_INCLUDES
57 #ifdef PACK_STRUCT_USE_INCLUDES
66 #define IP_HLEN_MAX 60
68 #ifdef PACK_STRUCT_USE_INCLUDES
92 #define IP_OFFMASK 0x1fffU
108 #ifdef PACK_STRUCT_USE_INCLUDES
113 #define IPH_V(hdr) ((hdr)->_v_hl >> 4)
114 #define IPH_HL(hdr) ((hdr)->_v_hl & 0x0f)
115 #define IPH_HL_BYTES(hdr) ((u8_t)(IPH_HL(hdr) * 4))
116 #define IPH_TOS(hdr) ((hdr)->_tos)
117 #define IPH_LEN(hdr) ((hdr)->_len)
118 #define IPH_ID(hdr) ((hdr)->_id)
119 #define IPH_OFFSET(hdr) ((hdr)->_offset)
120 #define IPH_OFFSET_BYTES(hdr) ((u16_t)((lwip_ntohs(IPH_OFFSET(hdr)) & IP_OFFMASK) * 8U))
121 #define IPH_TTL(hdr) ((hdr)->_ttl)
122 #define IPH_PROTO(hdr) ((hdr)->_proto)
123 #define IPH_CHKSUM(hdr) ((hdr)->_chksum)
126 #define IPH_VHL_SET(hdr, v, hl) (hdr)->_v_hl = (u8_t)((((v) << 4) | (hl)))
127 #define IPH_TOS_SET(hdr, tos) (hdr)->_tos = (tos)
128 #define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
129 #define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
130 #define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
131 #define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl = (u8_t)(ttl)
132 #define IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto)
133 #define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
#define PACK_STRUCT_END
Definition: arch.h:316
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
#define PACK_STRUCT_BEGIN
Definition: arch.h:307
uint16_t u16_t
Definition: arch.h:127
PACK_STRUCT_BEGIN struct ip4_addr_packed PACK_STRUCT_STRUCT
typedefPACK_STRUCT_END struct ip4_addr_packed ip4_addr_p_t
Definition: ip4.h:61
PACK_STRUCT_FIELD(u32_t addr)
PACK_STRUCT_FLD_8(u8_t _proto)
PACK_STRUCT_FIELD(u16_t _offset)
PACK_STRUCT_FLD_8(u8_t _v_hl)
PACK_STRUCT_FIELD(u16_t _chksum)
PACK_STRUCT_FIELD(u16_t _id)
PACK_STRUCT_FLD_8(u8_t _tos)
PACK_STRUCT_FLD_S(ip4_addr_p_t src)
PACK_STRUCT_FIELD(u16_t _len)
PACK_STRUCT_FLD_S(ip4_addr_p_t dest)
PACK_STRUCT_FLD_8(u8_t _ttl)