Go to the documentation of this file.
24 #ifndef __DECODE_IPV6_H__
25 #define __DECODE_IPV6_H__
27 #define IPV6_HEADER_LEN 40
28 #define IPV6_MAXPACKET 65535
29 #define IPV6_MAX_OPT 40
52 #define s_ip6_src ip6_hdrun2.ip6_un2.ip6_src
53 #define s_ip6_dst ip6_hdrun2.ip6_un2.ip6_dst
54 #define s_ip6_addrs ip6_hdrun2.ip6_addrs
56 #define s_ip6_vfc ip6_hdrun.ip6_un2_vfc
57 #define s_ip6_flow ip6_hdrun.ip6_un1.ip6_un1_flow
58 #define s_ip6_plen ip6_hdrun.ip6_un1.ip6_un1_plen
59 #define s_ip6_nxt ip6_hdrun.ip6_un1.ip6_un1_nxt
60 #define s_ip6_hlim ip6_hdrun.ip6_un1.ip6_un1_hlim
62 #define IPV6_GET_RAW_VER(ip6h) (((ip6h)->s_ip6_vfc & 0xf0) >> 4)
63 #define IPV6_GET_RAW_CLASS(ip6h) ((SCNtohl((ip6h)->s_ip6_flow) & 0x0FF00000) >> 20)
64 #define IPV6_GET_RAW_FLOW(ip6h) (SCNtohl((ip6h)->s_ip6_flow) & 0x000FFFFF)
65 #define IPV6_GET_RAW_NH(ip6h) ((ip6h)->s_ip6_nxt)
66 #define IPV6_GET_RAW_PLEN(ip6h) (SCNtohs((ip6h)->s_ip6_plen))
67 #define IPV6_GET_RAW_HLIM(ip6h) ((ip6h)->s_ip6_hlim)
69 #define IPV6_SET_RAW_VER(ip6h, value) ((ip6h)->s_ip6_vfc = (((ip6h)->s_ip6_vfc & 0x0f) | (value << 4)))
70 #define IPV6_SET_RAW_NH(ip6h, value) ((ip6h)->s_ip6_nxt = (value))
72 #define IPV6_SET_L4PROTO(p,proto) (p)->ip6vars.l4proto = (proto)
73 #define IPV6_SET_EXTHDRS_LEN(p,len) (p)->ip6vars.exthdrs_len = (len)
80 #define IPV6_GET_VER(p) \
81 IPV6_GET_RAW_VER((p)->ip6h)
82 #define IPV6_GET_CLASS(p) \
83 IPV6_GET_RAW_CLASS((p)->ip6h)
84 #define IPV6_GET_FLOW(p) \
85 IPV6_GET_RAW_FLOW((p)->ip6h)
86 #define IPV6_GET_NH(p) \
87 (IPV6_GET_RAW_NH((p)->ip6h))
88 #define IPV6_GET_PLEN(p) \
89 IPV6_GET_RAW_PLEN((p)->ip6h)
90 #define IPV6_GET_HLIM(p) \
91 (IPV6_GET_RAW_HLIM((p)->ip6h))
93 #define IPV6_GET_L4PROTO(p) \
94 ((p)->ip6vars.l4proto)
95 #define IPV6_GET_EXTHDRS_LEN(p) \
96 ((p)->ip6vars.exthdrs_len)
111 #define CLEAR_IPV6_PACKET(p) do { \
113 (p)->ip6vars.l4proto = 0; \
114 (p)->ip6vars.exthdrs_len = 0; \
115 memset(&(p)->ip6eh, 0x00, sizeof((p)->ip6eh)); \
127 #define IPV6_EXTHDR_GET_FH_NH(p) (p)->ip6eh.fh_nh
128 #define IPV6_EXTHDR_GET_FH_OFFSET(p) (p)->ip6eh.fh_offset
129 #define IPV6_EXTHDR_GET_FH_FLAG(p) (p)->ip6eh.fh_more_frags_set
130 #define IPV6_EXTHDR_GET_FH_ID(p) (p)->ip6eh.fh_id
162 #define IPV6OPT_PAD1 0x00
163 #define IPV6OPT_PADN 0x01
164 #define IPV6OPT_RA 0x05
165 #define IPV6OPT_JUMBO 0xC2
166 #define IPV6OPT_HAO 0xC9
238 #define IPV6_EXTHDR_SET_FH(p) (p)->ip6eh.fh_set = true
239 #define IPV6_EXTHDR_ISSET_FH(p) (p)->ip6eh.fh_set
240 #define IPV6_EXTHDR_SET_RH(p) (p)->ip6eh.rh_set = true
241 #define IPV6_EXTHDR_ISSET_RH(p) (p)->ip6eh.rh_set
struct IPV6Vars_ IPV6Vars
get the highest proto/next header field we know
struct IPV6Hdr_::@28::ip6_un1_ ip6_un1
struct in6_addr ip6hao_hoa
union IPV6Hdr_::@28 ip6_hdrun
struct IPV6FragHdr_ __attribute__((__packed__)) IPV6FragHdr
DNP3 link header.
struct IPV6OptHAO_ IPV6OptHAO
get the highest proto/next header field we know
void DecodeIPV6RegisterTests(void)
this function registers unit tests for IPV6 decoder
struct IPV6ExtHdrs_ IPV6ExtHdrs
uint32_t ip6j_payload_len
struct IPV6OptJumbo_ IPV6OptJumbo
uint16_t fh_header_offset
uint16_t fh_prev_hdr_offset
union IPV6Hdr_::@29 ip6_hdrun2
struct IPV6Hdr_::@29::@30 ip6_un2
struct IPV6OptRA_ IPV6OptRA
struct IPV6GenOptHdr_ IPV6GenOptHdr