Add macro for TCP and UDP header access

pull/2353/head
Thomas Andrejak 9 years ago committed by Victor Julien
parent 4eca40ac34
commit 18c9312380

@ -210,7 +210,8 @@ typedef struct ICMPV4Vars_
/** macro for icmpv4 "code" access */
#define ICMPV4_GET_CODE(p) (p)->icmpv4h->code
/** macro for icmpv4 "csum" access */
#define ICMPV4_GET_CSUM(p) (p)->icmpv4h->csum
#define ICMPV4_GET_RAW_CSUM(p) ntohs((p)->icmpv4h->checksum)
#define ICMPV4_GET_CSUM(p) (p)->icmpv4h->checksum
/* If message is informational */

@ -80,6 +80,7 @@
/** macro for icmpv6 "code" access */
#define ICMPV6_GET_CODE(p) (p)->icmpv6h->code
/** macro for icmpv6 "csum" access */
#define ICMPV6_GET_RAW_CSUM(p) ntohs((p)->icmpv6h->csum)
#define ICMPV6_GET_CSUM(p) (p)->icmpv6h->csum
/** If message is informational */

@ -75,6 +75,7 @@
#define TCP_GET_RAW_WINDOW(tcph) ntohs((tcph)->th_win)
#define TCP_GET_RAW_URG_POINTER(tcph) ntohs((tcph)->th_urp)
#define TCP_GET_RAW_SUM(tcph) ntohs((tcph)->th_sum)
/** macro for getting the first timestamp from the packet in host order */
#define TCP_GET_TSVAL(p) ((p)->tcpvars.ts_val)
@ -98,6 +99,7 @@
#define TCP_GET_SACK_CNT(p) (TCP_HAS_SACK((p)) ? (((p)->tcpvars.sack.len - 2) / 8) : 0)
#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_HLEN(p) (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)
@ -105,6 +107,8 @@
#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_FIN(p) ((p)->tcph->th_flags & TH_FIN)
#define TCP_ISSET_FLAG_SYN(p) ((p)->tcph->th_flags & TH_SYN)

@ -30,10 +30,12 @@
#define UDP_GET_RAW_LEN(udph) ntohs((udph)->uh_len)
#define UDP_GET_RAW_SRC_PORT(udph) ntohs((udph)->uh_sport)
#define UDP_GET_RAW_DST_PORT(udph) ntohs((udph)->uh_dport)
#define UDP_GET_RAW_SUM(udph) ntohs((udph)->uh_sum)
#define UDP_GET_LEN(p) UDP_GET_RAW_LEN(p->udph)
#define UDP_GET_SRC_PORT(p) UDP_GET_RAW_SRC_PORT(p->udph)
#define UDP_GET_DST_PORT(p) UDP_GET_RAW_DST_PORT(p->udph)
#define UDP_GET_SUM(p) UDP_GET_RAW_SUM(p->udph)
/* UDP header structure */
typedef struct UDPHdr_

Loading…
Cancel
Save