NetBurner 3.5.0
PDF Version
 
ipv6_frames.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#ifndef IPV6_FRAMES_H
6#define IPV6_FRAMES_H
7
8#include <basictypes.h>
9#include <ipv6/ipv6_addr.h>
10#include <nettypes.h>
11
12#define ND_OPTION_SL_ADDR (1)
13#define ND_OPTION_TL_ADDR (2)
14#define ND_OPTION_PREFIX (3)
15#define ND_OPTION_REDIR (4)
16#define ND_OPTION_MTU (5)
17#define ND_OPTION_AD_INTVL (7)
18#define ND_OPTION_HOME_AGENT (8)
19#define ND_OPTION_ROUTE_INFO (9)
20#define ND_OPTION_DNS (25)
21
22#define ND_FLAG_ROUTER (0x80000000)
23#define ND_FLAG_SOLICITED (0x40000000)
24#define ND_FLAG_OVERRIDE (0x20000000)
25
26#define RA_FLAG_MANAGED_IP (0x80)
27#define RA_FLAG_OTHER_AVAIL (0x40)
28
29struct IP6FRAME
30{
31 beuint16_t ver_ihl_flowmsb;
32 beuint16_t flowlsb;
33 beuint16_t length;
34 uint8_t next_header;
35 uint8_t hop_limit;
36 IPADDR6 source_ip;
37 IPADDR6 dest_ip;
38 uint8_t pData[];
39} __attribute__((packed));
40
41struct IP6_FRAG
42{
43 uint8_t frag_next_header;
44 uint8_t reserved;
45 beuint16_t offset_and_flags;
46 beuint32_t packetid;
47 uint8_t pData[];
48} __attribute__((packed));
49
50struct IP6_ROUTE_HEADER
51{
52 uint8_t next_header;
53 uint8_t ext_len;
54 uint8_t route_type;
55 uint8_t seg_left;
56 uint8_t pData[];
57} __attribute__((packed));
58
59struct ICMPV6_PSEUDO_HDR
60{
61 IPADDR6 source_ip;
62 IPADDR6 dest_ip;
63 beuint32_t icmplength;
64 uint8_t zero_0;
65 uint8_t zero_1;
66 uint8_t zero_2;
67 uint8_t next_hdr;
68} __attribute__((packed));
69
70struct ICMPV6_HDR
71{
72 uint8_t icmp_type;
73 uint8_t icmp_code;
74 uint16_t checksum; // checksum, leave as native
75} __attribute__((packed));
76
77struct ICMPV6_ND_SOLICIT
78{
79 uint8_t icmp_type; // 135
80 uint8_t icmp_code; // 0
81 uint16_t checksum; // checksum, leave as native
82 beuint32_t pad;
83 IPADDR6 target_ip;
84
85} __attribute__((packed));
86
87struct ICMP6_ND_ADVERT_RSP
88{
89 uint8_t icmp_type; // 136
90 uint8_t icmp_code; // 0
91 uint16_t checksum; // checksum, leave as native
92 beuint32_t flags;
93 IPADDR6 target_ip;
94 uint8_t option_type; // 1
95 uint8_t len_type; // 1
96 MACADR the_mac;
97} __attribute__((packed));
98
99struct ICMP6_ND_ADVERT
100{
101 uint8_t icmp_type; // 136
102 uint8_t icmp_code; // 0
103 uint16_t checksum; // checksum, leave as native
104 beuint32_t flags;
105 IPADDR6 target_ip;
106} __attribute__((packed));
107
108struct ICMPV6_PARAM_PROB
109{
110 uint8_t icmp_type; // 4
111 uint8_t icmp_code;
112 uint16_t checksum; // checksum, leave as native
113 beuint32_t pointer;
114} __attribute__((packed));
115
116struct ICMPV6_TOOBIG
117{
118 uint8_t icmp_type; // 4
119 uint8_t icmp_code;
120 uint16_t checksum; // checksum, leave as native
121 beuint32_t mtu;
122} __attribute__((packed));
123
124struct ICMPV6_DEST_UNREACH
125{
126 uint8_t icmp_type; // 4
127 uint8_t icmp_code;
128 uint16_t checksum; // checksum, leave as native
129 beuint32_t unused;
130} __attribute__((packed));
131
132struct ICMP6_ERROR
133{
134 uint8_t icmp_type;
135 uint8_t icmp_code;
136 uint16_t checksum; // checksum, leave as native
137 beuint32_t pointer;
138 uint8_t pData[];
139} __attribute__((packed));
140
141struct ICMPV6_TIME_EXCEEDED
142{
143 uint8_t icmp_type; // 4
144 uint8_t icmp_code;
145 uint16_t checksum; // checksum, leave as native
146 beuint32_t unused;
147} __attribute__((packed));
148
149struct ICMP6_RS_PKT
150{
151 uint8_t icmp_type; // 133
152 uint8_t icmp_code; // 0
153 uint16_t checksum; // checksum, leave as native
154 beuint32_t reserved;
155 uint8_t pData[]; // Allow us to send link-layer option
156} __attribute__((packed));
157
158struct ICMPV6_REDIR
159{
160 uint8_t icmp_type; // 137
161 uint8_t icmp_code; // 0
162 uint16_t checksum; // checksum, leave as native
163 beuint32_t reserved;
164 IPADDR6 better_target_ip; // Better first hop
165 IPADDR6 destination_ip; // Whee the origional was headed
166} __attribute__((packed));
167
168struct ICMPV6_RD_ADVERT
169{
170 uint8_t icmp_type; // 134
171 uint8_t icmp_code; // 0
172 uint16_t checksum; // checksum, leave as native
173 uint8_t cur_hop_limit;
174 uint8_t flags;
175 beuint16_t Lifetime;
176 beuint32_t ReachableTime;
177 beuint32_t RetranstimeTime;
178} __attribute__((packed));
179
180struct ICMPV6_RA_PREFIX
181{
182 uint8_t option_type;
183 uint8_t option_len;
184 uint8_t prefix_len;
185 uint8_t LA_Flags;
186 beuint32_t ValidTime;
187 beuint32_t PreferedLifeTime;
188 beuint32_t Reserved;
189 IPADDR6 prefix_ip;
190} __attribute__((packed));
191
192struct ICMPV6_RA_MTU
193{
194 uint8_t option_type;
195 uint8_t option_len;
196 uint16_t reserved;
197 beuint32_t link_mtu;
198} __attribute__((packed));
199
200struct ICMPV6_RA_DNS
201{
202 uint8_t option_type;
203 uint8_t option_len;
204 uint16_t reserved;
205 beuint32_t lifetime;
206 IPADDR6 list[1];
207} __attribute__((packed));
208
209struct ICMP6_ECHO
210{
211 uint8_t icmp_type; // 128 request 129 respond
212 uint8_t icmp_code; // 0
213 uint16_t checksum; // checksum, leave as native
214 beuint16_t id;
215 beuint16_t seq;
216 uint8_t pData[];
217} __attribute__((packed));
218
219struct ICMPV6_MCV2_REC
220{
221 uint8_t rec_type;
222 uint8_t aux_len;
223 beuint16_t src_count;
224 IPADDR6 mcast_addr;
225 IPADDR6 src_addr[];
226} __attribute__((packed));
227
228struct ICMPV6_MCV2_REP
229{
230 uint8_t icmp_type; // 143
231 uint8_t icmp_code; // 0
232 uint16_t checksum; // checksum, leave as native
233 beuint16_t reserved;
234 beuint16_t rec_count;
235 ICMPV6_MCV2_REC pRec[];
236} __attribute__((packed));
237
238struct UDPV6_HEADER
239{
240 beuint16_t src_port;
241 beuint16_t dst_port;
242 beuint16_t length;
243 uint16_t csum; // checksum, leave as native
244 uint8_t data[];
245} __attribute__((packed));
246
247#endif
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
NetBurner IPADDR6 Class.
NetBurner IPADDR4 Class. See the IPADDR4 Class page for complete documentation.