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
93
94
95
99
100
101
102
103
107
108
109
110
111
112
113
114
115
123
124
131
132
133
134
135
136
137
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_rarp.h"
#include "nx_packet.h"
#ifndef NX_DISABLE_IPV4...
...
VOID _nx_rarp_packet_send(NX_IP *ip_ptr)
{
NX_PACKET *request_ptr;
ULONG *message_ptr;
NX_IP_DRIVER driver_request;
ULONG i;
for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++)
{
if (ip_ptr -> nx_ip_interface[i].nx_interface_valid == 0)
{
continue;
}if (ip_ptr -> nx_ip_interface[i].nx_interface_valid == 0) { ... }
if (ip_ptr -> nx_ip_interface[i].nx_interface_ip_address != 0)
{
continue;
}if (ip_ptr -> nx_ip_interface[i].nx_interface_ip_address != 0) { ... }
if (ip_ptr -> nx_ip_interface[i].nx_interface_address_mapping_needed == 0)
{
continue;
}if (ip_ptr -> nx_ip_interface[i].nx_interface_address_mapping_needed == 0) { ... }
#ifdef NX_ENABLE_DUAL_PACKET_POOL
if (_nx_packet_allocate(ip_ptr -> nx_ip_auxiliary_packet_pool, &request_ptr, (NX_PHYSICAL_HEADER + NX_RARP_MESSAGE_SIZE), NX_NO_WAIT))
{
if (ip_ptr -> nx_ip_auxiliary_packet_pool != ip_ptr -> nx_ip_default_packet_pool)
#endif
{
if (_nx_packet_allocate(ip_ptr -> nx_ip_default_packet_pool, &request_ptr, (NX_PHYSICAL_HEADER + NX_RARP_MESSAGE_SIZE), NX_NO_WAIT))
{
return;
}if (_nx_packet_allocate(ip_ptr -> nx_ip_default_packet_pool, &request_ptr, (NX_PHYSICAL_HEADER + NX_RARP_MESSAGE_SIZE), NX_NO_WAIT)) { ... }
...}
#ifdef NX_ENABLE_DUAL_PACKET_POOL
else
{
return;
}else { ... }
}/* ... */
if (_nx_packet_allocate(ip_ptr -> nx_ip_auxiliary_packet_pool, &request_ptr, (NX_PHYSICAL_HEADER + NX_RARP_MESSAGE_SIZE), NX_NO_WAIT)) { ... }#endif
NX_PACKET_DEBUG(__FILE__, __LINE__, request_ptr);
#ifndef NX_DISABLE_RARP_INFO
ip_ptr -> nx_ip_rarp_requests_sent++;/* ... */
#endif
request_ptr -> nx_packet_address.nx_packet_interface_ptr = &(ip_ptr -> nx_ip_interface[i]);
request_ptr -> nx_packet_length = NX_RARP_MESSAGE_SIZE;
request_ptr -> nx_packet_prepend_ptr -= NX_RARP_MESSAGE_SIZE;
message_ptr = (ULONG *)request_ptr -> nx_packet_prepend_ptr;
*message_ptr = (ULONG)(NX_RARP_HARDWARE_TYPE << 16) | (NX_RARP_PROTOCOL_TYPE);
*(message_ptr + 1) = (ULONG)(NX_RARP_HARDWARE_SIZE << 24) | (NX_RARP_PROTOCOL_SIZE << 16) | NX_RARP_OPTION_REQUEST;
*(message_ptr + 2) = (ULONG)(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_physical_address_msw << 16) |
(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_physical_address_lsw >> 16);
*(message_ptr + 3) = (ULONG)(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_physical_address_lsw << 16);
*(message_ptr + 4) = (ULONG)(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_physical_address_msw & NX_LOWER_16_MASK);
*(message_ptr + 5) = (ULONG)(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_physical_address_lsw);
*(message_ptr + 6) = (ULONG)0;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_RARP_SEND, ip_ptr, 0, request_ptr, *(message_ptr + 1), NX_TRACE_INTERNAL_EVENTS, 0, 0);
/* ... */
NX_CHANGE_ULONG_ENDIAN(*(message_ptr));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 1));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 2));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 3));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 4));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 5));
NX_CHANGE_ULONG_ENDIAN(*(message_ptr + 6));
driver_request.nx_ip_driver_ptr = ip_ptr;
driver_request.nx_ip_driver_command = NX_LINK_RARP_SEND;
driver_request.nx_ip_driver_packet = request_ptr;
driver_request.nx_ip_driver_physical_address_msw = 0xFFFFUL;
driver_request.nx_ip_driver_physical_address_lsw = 0xFFFFFFFFUL;
driver_request.nx_ip_driver_interface = request_ptr -> nx_packet_address.nx_packet_interface_ptr;
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_IO_DRIVER_RARP_SEND, ip_ptr, request_ptr, request_ptr -> nx_packet_length, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0);
(request_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_link_driver_entry)(&driver_request);
}for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { ... }
return;
}{ ... }
#endif/* ... */