Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decode/tcp: fix some macros #12431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions src/decode-tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,35 +105,35 @@
#define TCP_GET_SACK_CNT(p) (p)->l4.vars.tcp.sack_cnt
#define TCP_GET_MSS(p) (p)->l4.vars.tcp.mss

#define TCP_GET_OFFSET(p) TCP_GET_RAW_OFFSET((p)->tcph)
#define TCP_GET_X2(p) TCP_GET_RAW_X2((p)->tcph)
#define TCP_GET_OFFSET(p) TCP_GET_RAW_OFFSET((p)->l4.hdrs.tcph)
#define TCP_GET_X2(p) TCP_GET_RAW_X2((p)->l4.hdrs.tcph)
#define TCP_GET_HLEN(p) ((uint8_t)(TCP_GET_OFFSET((p)) << 2))
#define TCP_GET_SRC_PORT(p) TCP_GET_RAW_SRC_PORT((p)->tcph)
#define TCP_GET_DST_PORT(p) TCP_GET_RAW_DST_PORT((p)->tcph)
#define TCP_GET_SEQ(p) TCP_GET_RAW_SEQ((p)->tcph)
#define TCP_GET_ACK(p) TCP_GET_RAW_ACK((p)->tcph)
#define TCP_GET_WINDOW(p) TCP_GET_RAW_WINDOW((p)->tcph)
#define TCP_GET_URG_POINTER(p) TCP_GET_RAW_URG_POINTER((p)->tcph)
#define TCP_GET_SUM(p) TCP_GET_RAW_SUM((p)->tcph)
#define TCP_GET_FLAGS(p) (p)->tcph->th_flags

#define TCP_ISSET_FLAG_RAW_FIN(p) ((tcph)->th_flags & TH_FIN)
#define TCP_ISSET_FLAG_RAW_SYN(p) ((tcph)->th_flags & TH_SYN)
#define TCP_ISSET_FLAG_RAW_RST(p) ((tcph)->th_flags & TH_RST)
#define TCP_ISSET_FLAG_RAW_PUSH(p) ((tcph)->th_flags & TH_PUSH)
#define TCP_ISSET_FLAG_RAW_ACK(p) ((tcph)->th_flags & TH_ACK)
#define TCP_ISSET_FLAG_RAW_URG(p) ((tcph)->th_flags & TH_URG)
#define TCP_ISSET_FLAG_RAW_RES2(p) ((tcph)->th_flags & TH_RES2)
#define TCP_ISSET_FLAG_RAW_RES1(p) ((tcph)->th_flags & TH_RES1)

#define TCP_ISSET_FLAG_FIN(p) ((p)->tcph->th_flags & TH_FIN)
#define TCP_ISSET_FLAG_SYN(p) ((p)->tcph->th_flags & TH_SYN)
#define TCP_ISSET_FLAG_RST(p) ((p)->tcph->th_flags & TH_RST)
#define TCP_ISSET_FLAG_PUSH(p) ((p)->tcph->th_flags & TH_PUSH)
#define TCP_ISSET_FLAG_ACK(p) ((p)->tcph->th_flags & TH_ACK)
#define TCP_ISSET_FLAG_URG(p) ((p)->tcph->th_flags & TH_URG)
#define TCP_ISSET_FLAG_RES2(p) ((p)->tcph->th_flags & TH_RES2)
#define TCP_ISSET_FLAG_RES1(p) ((p)->tcph->th_flags & TH_RES1)
#define TCP_GET_SRC_PORT(p) TCP_GET_RAW_SRC_PORT((p)->l4.hdrs.tcph)
#define TCP_GET_DST_PORT(p) TCP_GET_RAW_DST_PORT((p)->l4.hdrs.tcph)
#define TCP_GET_SEQ(p) TCP_GET_RAW_SEQ((p)->l4.hdrs.tcph)
#define TCP_GET_ACK(p) TCP_GET_RAW_ACK((p)->l4.hdrs.tcph)
#define TCP_GET_WINDOW(p) TCP_GET_RAW_WINDOW((p)->l4.hdrs.tcph)
#define TCP_GET_URG_POINTER(p) TCP_GET_RAW_URG_POINTER((p)->l4.hdrs.tcph)
#define TCP_GET_SUM(p) TCP_GET_RAW_SUM((p)->l4.hdrs.tcph)
#define TCP_GET_FLAGS(p) (p)->l4.hdrs.tcph->th_flags

#define TCP_ISSET_FLAG_RAW_FIN(tcph) ((tcph)->th_flags & TH_FIN)
#define TCP_ISSET_FLAG_RAW_SYN(tcph) ((tcph)->th_flags & TH_SYN)
#define TCP_ISSET_FLAG_RAW_RST(tcph) ((tcph)->th_flags & TH_RST)
#define TCP_ISSET_FLAG_RAW_PUSH(tcph) ((tcph)->th_flags & TH_PUSH)
#define TCP_ISSET_FLAG_RAW_ACK(tcph) ((tcph)->th_flags & TH_ACK)
#define TCP_ISSET_FLAG_RAW_URG(tcph) ((tcph)->th_flags & TH_URG)
#define TCP_ISSET_FLAG_RAW_RES2(tcph) ((tcph)->th_flags & TH_RES2)
#define TCP_ISSET_FLAG_RAW_RES1(tcph) ((tcph)->th_flags & TH_RES1)

#define TCP_ISSET_FLAG_FIN(p) ((p)->l4.hdrs.tcph->th_flags & TH_FIN)
#define TCP_ISSET_FLAG_SYN(p) ((p)->l4.hdrs.tcph->th_flags & TH_SYN)
#define TCP_ISSET_FLAG_RST(p) ((p)->l4.hdrs.tcph->th_flags & TH_RST)
#define TCP_ISSET_FLAG_PUSH(p) ((p)->l4.hdrs.tcph->th_flags & TH_PUSH)
#define TCP_ISSET_FLAG_ACK(p) ((p)->l4.hdrs.tcph->th_flags & TH_ACK)
#define TCP_ISSET_FLAG_URG(p) ((p)->l4.hdrs.tcph->th_flags & TH_URG)
#define TCP_ISSET_FLAG_RES2(p) ((p)->l4.hdrs.tcph->th_flags & TH_RES2)
#define TCP_ISSET_FLAG_RES1(p) ((p)->l4.hdrs.tcph->th_flags & TH_RES1)

typedef struct TCPOpt_ {
uint8_t type;
Expand Down
Loading