37 #ifndef LWIP_HDR_PROT_TCP_H
38 #define LWIP_HDR_PROT_TCP_H
52 #ifdef PACK_STRUCT_USE_INCLUDES
67 #ifdef PACK_STRUCT_USE_INCLUDES
81 #define TCP_FLAGS 0x3fU
83 #define TCP_MAX_OPTION_BYTES 40
85 #define TCPH_HDRLEN(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) >> 12))
86 #define TCPH_HDRLEN_BYTES(phdr) ((u8_t)(TCPH_HDRLEN(phdr) << 2))
87 #define TCPH_FLAGS(phdr) ((u8_t)((lwip_ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)))
89 #define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = lwip_htons(((len) << 12) | TCPH_FLAGS(phdr))
90 #define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS(~TCP_FLAGS)) | lwip_htons(flags))
91 #define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = (u16_t)(lwip_htons((u16_t)((len) << 12) | (flags)))
93 #define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | lwip_htons(flags))
94 #define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags & ~lwip_htons(flags))
#define PACK_STRUCT_END
Definition: arch.h:316
uint32_t u32_t
Definition: arch.h:129
#define PACK_STRUCT_BEGIN
Definition: arch.h:307
uint16_t u16_t
Definition: arch.h:127
PACK_STRUCT_BEGIN struct tcp_hdr PACK_STRUCT_STRUCT
PACK_STRUCT_FIELD(u16_t chksum)
PACK_STRUCT_FIELD(u16_t urgp)
PACK_STRUCT_FIELD(u16_t dest)
PACK_STRUCT_FIELD(u32_t ackno)
PACK_STRUCT_FIELD(u32_t seqno)
PACK_STRUCT_FIELD(u16_t src)
PACK_STRUCT_FIELD(u16_t wnd)
PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags)