initial version, corresponding to ipfw3-2012
[ipfw-google.git] / sys / netinet / ip6.h
1 #ifndef _NETINET_IP6_H_
2 #define _NETINET_IP6_H_
3 #define IN6_ARE_ADDR_EQUAL(a, b)                        \
4 (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
5
6 struct ip6_hdr {
7         union {
8                 struct ip6_hdrctl {
9                         u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */  
10                         u_int16_t ip6_un1_plen; /* payload length */
11                         u_int8_t  ip6_un1_nxt;  /* next header */
12                         u_int8_t  ip6_un1_hlim; /* hop limit */
13                 } ip6_un1;
14                 u_int8_t ip6_un2_vfc;   /* 4 bits version, top 4 bits class */
15         } ip6_ctlun;
16         struct in6_addr ip6_src;        /* source address */
17         struct in6_addr ip6_dst;        /* destination address */
18 };
19 #define ip6_nxt         ip6_ctlun.ip6_un1.ip6_un1_nxt
20 #define ip6_flow        ip6_ctlun.ip6_un1.ip6_un1_flow
21
22
23 struct icmp6_hdr {
24         u_int8_t        icmp6_type;     /* type field */
25         u_int8_t        icmp6_code;     /* code field */
26         u_int16_t       icmp6_cksum;    /* checksum field */
27         union {
28                 u_int32_t       icmp6_un_data32[1]; /* type-specific field */
29                 u_int16_t       icmp6_un_data16[2]; /* type-specific field */
30                 u_int8_t        icmp6_un_data8[4];  /* type-specific field */
31         } icmp6_dataun;
32 };
33
34 struct ip6_hbh {
35         u_int8_t ip6h_nxt;      /* next header */
36         u_int8_t ip6h_len;      /* length in units of 8 octets */
37         /* followed by options */
38 }; 
39 struct ip6_rthdr {
40         u_int8_t  ip6r_nxt;     /* next header */
41         u_int8_t  ip6r_len;     /* length in units of 8 octets */
42         u_int8_t  ip6r_type;    /* routing type */
43         u_int8_t  ip6r_segleft; /* segments left */
44         /* followed by routing type specific data */
45 };
46 struct ip6_frag {
47         u_int8_t  ip6f_nxt;             /* next header */
48         u_int8_t  ip6f_reserved;        /* reserved field */
49         u_int16_t ip6f_offlg;           /* offset, reserved, and flag */
50         u_int32_t ip6f_ident;           /* identification */
51 };
52 #define IP6F_OFF_MASK           0xfff8  /* mask out offset from _offlg */
53 #define IP6F_MORE_FRAG          0x0001  /* more-fragments flag */
54 struct  ip6_ext {
55         u_int8_t ip6e_nxt;
56         u_int8_t ip6e_len;
57 };
58 #endif /* _NETINET_IP6_H_ */