1
10
13
14
20
21
22
23
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
114
115
116
117
123
124
125
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
175
176
177
178
179
180
185
186
187
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ip.h"
#include "nx_ipv6.h"
...
...
UINT _nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index)
{
#ifdef FEATURE_NX_IPV6
UINT result;
NXD_IPV6_ADDRESS *ipv6_address, *address_list;
#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
VOID (*address_change_notify)(NX_IP *, UINT, UINT, UINT, ULONG *);
UINT if_index;
ULONG obsoleted_address[4];
address_change_notify = NX_NULL;/* ... */
#endif
result = NX_NO_INTERFACE_ADDRESS;
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
ipv6_address = &ip_ptr -> nx_ipv6_address[address_index];
if (ipv6_address -> nxd_ipv6_address_valid)
{
address_list = ipv6_address -> nxd_ipv6_address_attached -> nxd_interface_ipv6_address_list_head;
if (ipv6_address == address_list)
{
ipv6_address -> nxd_ipv6_address_attached -> nxd_interface_ipv6_address_list_head = ipv6_address -> nxd_ipv6_address_next;
result = NX_SUCCESS;
}if (ipv6_address == address_list) { ... }
else
{
while (address_list && (address_list -> nxd_ipv6_address_next != ipv6_address))
{
address_list = address_list -> nxd_ipv6_address_next;
}while (address_list && (address_list -> nxd_ipv6_address_next != ipv6_address)) { ... }
if (address_list)
{
address_list -> nxd_ipv6_address_next = ipv6_address -> nxd_ipv6_address_next;
result = NX_SUCCESS;
}if (address_list) { ... }
}else { ... }
if (result == NX_SUCCESS)
{
ULONG multicast_address[4];
SET_SOLICITED_NODE_MULTICAST_ADDRESS(multicast_address, ipv6_address -> nxd_ipv6_address);
_nx_ipv6_multicast_leave(ip_ptr, &multicast_address[0], ipv6_address -> nxd_ipv6_address_attached);
#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
address_change_notify = ip_ptr -> nx_ipv6_address_change_notify;
obsoleted_address[0] = ipv6_address -> nxd_ipv6_address[0];
obsoleted_address[1] = ipv6_address -> nxd_ipv6_address[1];
obsoleted_address[2] = ipv6_address -> nxd_ipv6_address[2];
obsoleted_address[3] = ipv6_address -> nxd_ipv6_address[3];
if_index = ipv6_address -> nxd_ipv6_address_attached -> nx_interface_index;/* ... */
#endif
memset(ipv6_address, 0, sizeof(NXD_IPV6_ADDRESS));
ipv6_address -> nxd_ipv6_address_index = (UCHAR)address_index;
}if (result == NX_SUCCESS) { ... }
}if (ipv6_address -> nxd_ipv6_address_valid) { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
#ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
/* ... */
if (address_change_notify && (result == NX_SUCCESS))
{
(address_change_notify)(ip_ptr, NX_IPV6_ADDRESS_MANUAL_DELETE, if_index, address_index, &obsoleted_address[0]);
}if (address_change_notify && (result == NX_SUCCESS)) { ... }
/* ... */#endif
return(result);
/* ... */
#else
NX_PARAMETER_NOT_USED(ip_ptr);
NX_PARAMETER_NOT_USED(address_index);
return(NX_NOT_SUPPORTED);
/* ... */
#endif
}{ ... }