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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
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
174
175
176
177
178
179
180
181
182
183
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_igmp.h"
#ifndef NX_DISABLE_IPV4...
...
UINT _nx_igmp_multicast_interface_leave_internal(NX_IP *ip_ptr, ULONG group_address, UINT interface_index)
{
UINT i;
NX_IP_DRIVER driver_request;
NX_INTERFACE *nx_interface;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_IGMP_MULTICAST_LEAVE, ip_ptr, group_address, 0, 0, NX_TRACE_IGMP_EVENTS, 0, 0);
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
nx_interface = &ip_ptr -> nx_ip_interface[interface_index];
for (i = 0; i < NX_MAX_MULTICAST_GROUPS; i++)
{
if ((ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_list == group_address) &&
(ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_interface_list == nx_interface))
{
ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_count--;
if (ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_count == 0)
{
ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_list = 0;
driver_request.nx_ip_driver_ptr = ip_ptr;
driver_request.nx_ip_driver_command = NX_LINK_MULTICAST_LEAVE;
driver_request.nx_ip_driver_physical_address_msw = NX_IP_MULTICAST_UPPER;
driver_request.nx_ip_driver_physical_address_lsw = NX_IP_MULTICAST_LOWER | (group_address & NX_IP_MULTICAST_MASK);
driver_request.nx_ip_driver_interface = ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_interface_list;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_LEAVE, ip_ptr, 0, 0, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0);
(ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_interface_list -> nx_interface_link_driver_entry)(&driver_request);
ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_interface_list = NX_NULL;
#ifndef NX_DISABLE_IGMP_INFO
ip_ptr -> nx_ip_igmp_groups_joined--;/* ... */
#endif
#ifndef NX_DISABLE_IGMPV2
if (ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_update_time == NX_WAIT_FOREVER)
{
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_SUCCESS);
}if (ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_update_time == NX_WAIT_FOREVER) { ... }
if (ip_ptr -> nx_ip_igmp_router_version == NX_IGMP_HOST_VERSION_1)
{
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_SUCCESS);
}if (ip_ptr -> nx_ip_igmp_router_version == NX_IGMP_HOST_VERSION_1) { ... }
_nx_igmp_interface_report_send(ip_ptr, group_address, interface_index, NX_FALSE);
/* ... */
#endif
}if (ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_count == 0) { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_SUCCESS);
}if ((ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_list == group_address) && (ip_ptr -> nx_ipv4_multicast_entry[i].nx_ipv4_multicast_join_interface_list == nx_interface)) { ... }
}for (i = 0; i < NX_MAX_MULTICAST_GROUPS; i++) { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
return(NX_ENTRY_NOT_FOUND);
}{ ... }
#endif/* ... */