1
10
13
14
20
21
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
66
67
68
69
77
78
79
87
88
89
90
91
92
93
94
95
96
97
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
175
176
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
...
...
...
...
...
#ifndef NX_IPV6_H
#define NX_IPV6_H
#include "nx_api.h"
#ifdef FEATURE_NX_IPV6
/* ... */
typedef struct NX_IPV6_HEADER_STRUCT
{
/* ... */
ULONG nx_ip_header_word_0;
/* ... */
ULONG nx_ip_header_word_1;
ULONG nx_ip_header_source_ip[4];
ULONG nx_ip_header_destination_ip[4];
...} NX_IPV6_HEADER;
/* ... */
typedef struct NX_IPV6_HEADER_OPTION_STRUCT
{
UCHAR nx_ipv6_header_option_next_header;
UCHAR nx_ipv6_header_option_ext_length;
UCHAR nx_ipv6_header_option_type;
UCHAR nx_ipv6_header_option_data;
...} NX_IPV6_HEADER_OPTION;
typedef struct NX_IPV6_HOP_BY_HOP_OPTION_STRUCT
{
UCHAR nx_ipv6_hop_by_hop_option_type;
UCHAR nx_ipv6_hop_by_hop_length;
USHORT nx_ipv6_hop_by_hop_data;
...} NX_IPV6_HOP_BY_HOP_OPTION;
typedef struct NX_IPV6_HEADER_ROUTING_OPTION_STRUCT
{
UCHAR nx_ipv6_header_routing_option_next_header;
UCHAR nx_ipv6_header_routing_option_hdr_ext_len;
UCHAR nx_ipv6_header_routing_option_routing_type;
UCHAR nx_ipv6_header_routing_option_segments_left;
ULONG *nx_ipv6_header_routing_option_data;
...} NX_IPV6_HEADER_ROUTING_OPTION;
typedef struct NX_IPV6_HEADER_FRAGMENT_OPTION_STRUCT
{
UCHAR nx_ipv6_header_fragment_option_next_header;
UCHAR nx_ipv6_header_fragment_option_reserved;
USHORT nx_ipv6_header_fragment_option_offset_flag;
ULONG nx_ipv6_header_fragment_option_packet_id;
...} NX_IPV6_HEADER_FRAGMENT_OPTION;
/* ... */
#define IPV6_ADDRESS_LINKLOCAL 0x00000001
/* ... */
#define IPV6_ADDRESS_GLOBAL 0x00000004
#define IPV6_ALL_NODE_MCAST 0x00000010
#define IPV6_ALL_ROUTER_MCAST 0x00000020
#define IPV6_SOLICITED_NODE_MCAST 0x00000040
#define IPV6_ADDRESS_UNICAST 0x80000000
#define IPV6_ADDRESS_MULTICAST 0x40000000
#define IPV6_ADDRESS_UNSPECIFIED 0x20000000
#define IPV6_ADDRESS_LOOPBACK 0x10000000
9 defines
/* ... */
enum NX_IPV6_OPTION_STATE
{
IPV6_BASE_HEADER,
HOP_BY_HOP_HEADER,
DESTINATION_HEADER_1,
ROUTING_HEADER,
FRAGMENT_HEADER,
#ifdef NX_IPSEC_ENABLE
AUTHENTICATION_HEADER,
ENCAP_SECURITY_HEADER, /* ... */
#endif
DESTINATION_HEADER_2
...};
UINT _nxd_ipv6_default_router_add_internal(NX_IP *ip_ptr, ULONG *router_addr, ULONG router_lifetime, NX_INTERFACE *if_ptr, INT router_type, NX_IPV6_DEFAULT_ROUTER_ENTRY **_new_entry);
VOID _nxd_ipv6_default_router_table_init(NX_IP *ip_ptr);
UINT _nxd_ipv6_find_max_prefix_length(ULONG *addr1, ULONG *addr, UINT max_length);
VOID _nx_ipv6_fragment_process(struct NX_IP_DRIVER_STRUCT *driver_req_ptr, UINT mtu);
UINT _nx_ipv6_header_add(NX_IP *ip_ptr, NX_PACKET **packet_pptr,
ULONG protocol, ULONG payload_size, ULONG hop_limit,
ULONG *src_address, ULONG *dest_address, ULONG *fragment);
UINT _nx_ipv6_packet_copy(NX_PACKET *source_pkt_head, NX_PACKET *dest_pkt_head, UINT size);
UINT _nx_ipv6_multicast_join(NX_IP *, ULONG *, NX_INTERFACE *);
UINT _nx_ipv6_multicast_leave(NX_IP *, ULONG *, NX_INTERFACE *);
UINT _nx_ipv6_option_error(NX_IP *ip_ptr, NX_PACKET *packet_ptr, UCHAR option_type, UINT offset);
VOID _nx_ipv6_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
VOID _nx_ipv6_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, ULONG protocol, ULONG payload_size, ULONG hop_limit, ULONG *src_address, ULONG *dest_address);
UINT _nx_ipv6_prefix_list_add_entry(NX_IP *ip_ptr, ULONG *prefix, ULONG prefix_length, ULONG valid_lifetime);
VOID _nx_ipv6_prefix_list_delete(NX_IP *ip_ptr, ULONG *prefix, INT prefix_length);
VOID _nx_ipv6_prefix_list_delete_entry(NX_IP *ip_ptr, NX_IPV6_PREFIX_ENTRY *entry);
UINT _nx_ipv6_process_hop_by_hop_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
UINT _nx_ipv6_process_routing_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
UINT _nx_ipv6_process_fragment_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
UINT _nxd_ipv6_interface_find(NX_IP *ip_ptr, ULONG *dest_address,
NXD_IPV6_ADDRESS **ipv6_addr, NX_INTERFACE *if_ptr);
UINT _nxd_ipv6_router_lookup(NX_IP *ip_ptr, NX_INTERFACE *if_ptr, ULONG *router_address, void **nd_cache_entry);
VOID _nxd_ipv6_router_solicitation_check(NX_IP *ip_ptr);
UINT _nxd_ipv6_raw_packet_send_internal(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip, ULONG protocol);
VOID _nxd_ipv6_prefix_router_timer_tick(NX_IP *ip_ptr);
NX_IPV6_DEFAULT_ROUTER_ENTRY* _nxd_ipv6_find_default_router_from_address(NX_IP *ip_ptr, ULONG *ip_addr);
INT _nxd_ipv6_search_onlink(NX_IP *ip_ptr, ULONG *dest_addr);
/* ... */
#endif
/* ... */
#ifndef NX_IPV6_UTIL_INLINE
#ifdef NX_IPSEC_ENABLE
INT CHECK_IPV6_ADDRESS_RANGE(ULONG *ip_addr_start, ULONG *ip_addr_end, ULONG *ip_addr);
#endif
INT CHECK_IPV6_ADDRESSES_SAME(ULONG *ip_dest, ULONG *myip);
INT CHECK_UNSPECIFIED_ADDRESS(ULONG *ip_addr);
void SET_UNSPECIFIED_ADDRESS(ULONG *ip_addr);
void COPY_IPV6_ADDRESS(ULONG *copy_from, ULONG *copy_to);
void COPY_NXD_ADDRESS(NXD_ADDRESS *copy_from, NXD_ADDRESS *copy_to);
void SET_SOLICITED_NODE_MULTICAST_ADDRESS(ULONG *address, ULONG *unicast_address);
INT CHECK_ALL_ROUTER_MCAST_ADDRESS(ULONG *address);
VOID _nx_ipv6_address_change_endian(ULONG *address);
/* ... */
#endif
INT CHECK_IP_ADDRESSES_BY_PREFIX(ULONG *ip_addr1, ULONG *ip_addr2, ULONG prefix_len);
INT CHECK_IPV6_SOLICITED_NODE_MCAST_ADDRESS(ULONG *dest_ip, ULONG *myip);
ULONG IPv6_Address_Type(ULONG *ip_address);
UINT _nxd_ipv6_enable(NX_IP *ip_ptr);
UINT _nxd_ipv6_disable(NX_IP *ip_ptr);
UINT _nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index);
UINT _nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index);
UINT _nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index);
UINT _nxd_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address));
UINT _nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index);
UINT _nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address);
UINT _nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length);
UINT _nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method);
UINT _nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries);
UINT _nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
UINT _nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
UINT _nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index);
UINT _nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index);
UINT _nxde_ipv6_enable(NX_IP *ip_ptr);
UINT _nxde_ipv6_disable(NX_IP *ip_ptr);
UINT _nxde_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index);
UINT _nxde_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index);
UINT _nxde_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *prefix_length, UINT *interface_index);
UINT _nxde_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address, ULONG prefix_length, UINT *address_index);
UINT _nxde_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index);
UINT _nxde_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ipv6_address_change_notfiy)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address));
UINT _nxde_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr, ULONG router_lifetime, UINT interface_index);
UINT _nxde_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address);
UINT _nxde_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length);
UINT _nxde_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index, NXD_ADDRESS *router_addr, ULONG *router_lifetime, ULONG *prefix_length, ULONG *configuration_method);
UINT _nxde_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries);
UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr,
NXD_ADDRESS *destination_ip, ULONG protocol, UINT ttl, ULONG tos);
UINT _nxde_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
UINT _nxde_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
/* ... */
#endif ...