OLD | NEW |
1 #ifndef _NETINET_IP6_H | 1 #ifndef _NETINET_IP6_H |
2 #define _NETINET_IP6_H | 2 #define _NETINET_IP6_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
10 #include <endian.h> | 10 #include <endian.h> |
11 | 11 |
12 struct ip6_hdr { | 12 struct ip6_hdr { |
13 » union { | 13 union { |
14 » » struct ip6_hdrctl { | 14 struct ip6_hdrctl { |
15 » » » uint32_t ip6_un1_flow; | 15 uint32_t ip6_un1_flow; |
16 » » » uint16_t ip6_un1_plen; | 16 uint16_t ip6_un1_plen; |
17 » » » uint8_t ip6_un1_nxt; | 17 uint8_t ip6_un1_nxt; |
18 » » » uint8_t ip6_un1_hlim; | 18 uint8_t ip6_un1_hlim; |
19 » » } ip6_un1; | 19 } ip6_un1; |
20 » » uint8_t ip6_un2_vfc; | 20 uint8_t ip6_un2_vfc; |
21 » } ip6_ctlun; | 21 } ip6_ctlun; |
22 » struct in6_addr ip6_src; | 22 struct in6_addr ip6_src; |
23 » struct in6_addr ip6_dst; | 23 struct in6_addr ip6_dst; |
24 }; | 24 }; |
25 | 25 |
26 #define ip6_vfc ip6_ctlun.ip6_un2_vfc | 26 #define ip6_vfc ip6_ctlun.ip6_un2_vfc |
27 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow | 27 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow |
28 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen | 28 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen |
29 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt | 29 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt |
30 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim | 30 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim |
31 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim | 31 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim |
32 | 32 |
33 struct ip6_ext { | 33 struct ip6_ext { |
34 » uint8_t ip6e_nxt; | 34 uint8_t ip6e_nxt; |
35 » uint8_t ip6e_len; | 35 uint8_t ip6e_len; |
36 }; | 36 }; |
37 | 37 |
38 struct ip6_hbh { | 38 struct ip6_hbh { |
39 » uint8_t ip6h_nxt; | 39 uint8_t ip6h_nxt; |
40 » uint8_t ip6h_len; | 40 uint8_t ip6h_len; |
41 }; | 41 }; |
42 | 42 |
43 struct ip6_dest { | 43 struct ip6_dest { |
44 » uint8_t ip6d_nxt; | 44 uint8_t ip6d_nxt; |
45 » uint8_t ip6d_len; | 45 uint8_t ip6d_len; |
46 }; | 46 }; |
47 | 47 |
48 struct ip6_rthdr { | 48 struct ip6_rthdr { |
49 » uint8_t ip6r_nxt; | 49 uint8_t ip6r_nxt; |
50 » uint8_t ip6r_len; | 50 uint8_t ip6r_len; |
51 » uint8_t ip6r_type; | 51 uint8_t ip6r_type; |
52 » uint8_t ip6r_segleft; | 52 uint8_t ip6r_segleft; |
53 }; | 53 }; |
54 | 54 |
55 struct ip6_rthdr0 { | 55 struct ip6_rthdr0 { |
56 » uint8_t ip6r0_nxt; | 56 uint8_t ip6r0_nxt; |
57 » uint8_t ip6r0_len; | 57 uint8_t ip6r0_len; |
58 » uint8_t ip6r0_type; | 58 uint8_t ip6r0_type; |
59 » uint8_t ip6r0_segleft; | 59 uint8_t ip6r0_segleft; |
60 » uint8_t ip6r0_reserved; | 60 uint8_t ip6r0_reserved; |
61 » uint8_t ip6r0_slmap[3]; | 61 uint8_t ip6r0_slmap[3]; |
62 » struct in6_addr ip6r0_addr[]; | 62 struct in6_addr ip6r0_addr[]; |
63 }; | 63 }; |
64 | 64 |
65 struct ip6_frag { | 65 struct ip6_frag { |
66 » uint8_t ip6f_nxt; | 66 uint8_t ip6f_nxt; |
67 » uint8_t ip6f_reserved; | 67 uint8_t ip6f_reserved; |
68 » uint16_t ip6f_offlg; | 68 uint16_t ip6f_offlg; |
69 » uint32_t ip6f_ident; | 69 uint32_t ip6f_ident; |
70 }; | 70 }; |
71 | 71 |
72 #if __BYTE_ORDER == __BIG_ENDIAN | 72 #if __BYTE_ORDER == __BIG_ENDIAN |
73 #define IP6F_OFF_MASK 0xfff8 | 73 #define IP6F_OFF_MASK 0xfff8 |
74 #define IP6F_RESERVED_MASK 0x0006 | 74 #define IP6F_RESERVED_MASK 0x0006 |
75 #define IP6F_MORE_FRAG 0x0001 | 75 #define IP6F_MORE_FRAG 0x0001 |
76 #else | 76 #else |
77 #define IP6F_OFF_MASK 0xf8ff | 77 #define IP6F_OFF_MASK 0xf8ff |
78 #define IP6F_RESERVED_MASK 0x0600 | 78 #define IP6F_RESERVED_MASK 0x0600 |
79 #define IP6F_MORE_FRAG 0x0100 | 79 #define IP6F_MORE_FRAG 0x0100 |
80 #endif | 80 #endif |
81 | 81 |
82 struct ip6_opt { | 82 struct ip6_opt { |
83 » uint8_t ip6o_type; | 83 uint8_t ip6o_type; |
84 » uint8_t ip6o_len; | 84 uint8_t ip6o_len; |
85 }; | 85 }; |
86 | 86 |
87 #define IP6OPT_TYPE(o)» » ((o) & 0xc0) | 87 #define IP6OPT_TYPE(o) ((o)&0xc0) |
88 #define IP6OPT_TYPE_SKIP» 0x00 | 88 #define IP6OPT_TYPE_SKIP 0x00 |
89 #define IP6OPT_TYPE_DISCARD» 0x40 | 89 #define IP6OPT_TYPE_DISCARD 0x40 |
90 #define IP6OPT_TYPE_FORCEICMP» 0x80 | 90 #define IP6OPT_TYPE_FORCEICMP 0x80 |
91 #define IP6OPT_TYPE_ICMP» 0xc0 | 91 #define IP6OPT_TYPE_ICMP 0xc0 |
92 #define IP6OPT_TYPE_MUTABLE» 0x20 | 92 #define IP6OPT_TYPE_MUTABLE 0x20 |
93 | 93 |
94 #define IP6OPT_PAD1» 0 | 94 #define IP6OPT_PAD1 0 |
95 #define IP6OPT_PADN» 1 | 95 #define IP6OPT_PADN 1 |
96 | 96 |
97 #define IP6OPT_JUMBO» » 0xc2 | 97 #define IP6OPT_JUMBO 0xc2 |
98 #define IP6OPT_NSAP_ADDR» 0xc3 | 98 #define IP6OPT_NSAP_ADDR 0xc3 |
99 #define IP6OPT_TUNNEL_LIMIT» 0x04 | 99 #define IP6OPT_TUNNEL_LIMIT 0x04 |
100 #define IP6OPT_ROUTER_ALERT» 0x05 | 100 #define IP6OPT_ROUTER_ALERT 0x05 |
101 | 101 |
102 struct ip6_opt_jumbo { | 102 struct ip6_opt_jumbo { |
103 » uint8_t ip6oj_type; | 103 uint8_t ip6oj_type; |
104 » uint8_t ip6oj_len; | 104 uint8_t ip6oj_len; |
105 » uint8_t ip6oj_jumbo_len[4]; | 105 uint8_t ip6oj_jumbo_len[4]; |
106 }; | 106 }; |
107 #define IP6OPT_JUMBO_LEN» 6 | 107 #define IP6OPT_JUMBO_LEN 6 |
108 | 108 |
109 struct ip6_opt_nsap { | 109 struct ip6_opt_nsap { |
110 » uint8_t ip6on_type; | 110 uint8_t ip6on_type; |
111 » uint8_t ip6on_len; | 111 uint8_t ip6on_len; |
112 » uint8_t ip6on_src_nsap_len; | 112 uint8_t ip6on_src_nsap_len; |
113 » uint8_t ip6on_dst_nsap_len; | 113 uint8_t ip6on_dst_nsap_len; |
114 }; | 114 }; |
115 | 115 |
116 struct ip6_opt_tunnel { | 116 struct ip6_opt_tunnel { |
117 » uint8_t ip6ot_type; | 117 uint8_t ip6ot_type; |
118 » uint8_t ip6ot_len; | 118 uint8_t ip6ot_len; |
119 » uint8_t ip6ot_encap_limit; | 119 uint8_t ip6ot_encap_limit; |
120 }; | 120 }; |
121 | 121 |
122 struct ip6_opt_router { | 122 struct ip6_opt_router { |
123 » uint8_t ip6or_type; | 123 uint8_t ip6or_type; |
124 » uint8_t ip6or_len; | 124 uint8_t ip6or_len; |
125 » uint8_t ip6or_value[2]; | 125 uint8_t ip6or_value[2]; |
126 }; | 126 }; |
127 | 127 |
128 #if __BYTE_ORDER == __BIG_ENDIAN | 128 #if __BYTE_ORDER == __BIG_ENDIAN |
129 #define IP6_ALERT_MLD» 0x0000 | 129 #define IP6_ALERT_MLD 0x0000 |
130 #define IP6_ALERT_RSVP» 0x0001 | 130 #define IP6_ALERT_RSVP 0x0001 |
131 #define IP6_ALERT_AN» 0x0002 | 131 #define IP6_ALERT_AN 0x0002 |
132 #else | 132 #else |
133 #define IP6_ALERT_MLD» 0x0000 | 133 #define IP6_ALERT_MLD 0x0000 |
134 #define IP6_ALERT_RSVP» 0x0100 | 134 #define IP6_ALERT_RSVP 0x0100 |
135 #define IP6_ALERT_AN» 0x0200 | 135 #define IP6_ALERT_AN 0x0200 |
136 #endif | 136 #endif |
137 | 137 |
138 #ifdef __cplusplus | 138 #ifdef __cplusplus |
139 } | 139 } |
140 #endif | 140 #endif |
141 | 141 |
142 #endif | 142 #endif |
OLD | NEW |