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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
113
114
115
116
117
118
119
120
121
122
123
125
126
127
128
129
132
133
134
135
136
137
138
139
140
141
142
143
145
146
147
148
149
150
151
152
153
154
155
156
157
158
160
161
162
163
164
165
166
167
171
172
173
179
180
181
182
189
190
191
192
193
194
195
196
197
198
199
200
201
203
204
205
206
207
208
209
210
215
216
217
218
219
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_rarp.h"
#include "nx_packet.h"
#ifndef NX_DISABLE_IPV4...
...
VOID _nx_rarp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
{
TX_INTERRUPT_SAVE_AREA
ULONG *message_ptr;
UINT i;
VOID (*address_change_notify)(NX_IP *, VOID *) = NX_NULL;
VOID *additional_info = NX_NULL;
#ifndef NX_DISABLE_RX_SIZE_CHECKING
if (packet_ptr -> nx_packet_length < NX_RARP_MESSAGE_SIZE)
{
#ifndef NX_DISABLE_RARP_INFO
/* ... */
ip_ptr -> nx_ip_rarp_invalid_messages++;/* ... */
#endif
_nx_packet_release(packet_ptr);
return;
}if (packet_ptr -> nx_packet_length < NX_RARP_MESSAGE_SIZE) { ... }
/* ... */#endif
message_ptr = (ULONG *)packet_ptr -> nx_packet_prepend_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));
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_RARP_RECEIVE, ip_ptr, *(message_ptr + 6), packet_ptr, *(message_ptr + 1), NX_TRACE_INTERNAL_EVENTS, 0, 0);
/* ... */
if ((*(message_ptr + 1) & 0xFFFF) == NX_RARP_OPTION_REQUEST)
{
#ifndef NX_DISABLE_RARP_INFO
/* ... */
ip_ptr -> nx_ip_rarp_invalid_messages++;/* ... */
#endif
_nx_packet_release(packet_ptr);
}if ((*(message_ptr + 1) & 0xFFFF) == NX_RARP_OPTION_REQUEST) { ... }
else if ((*(message_ptr + 1) & 0xFFFF) == NX_RARP_OPTION_RESPONSE)
{
#ifndef NX_DISABLE_ARP_INFO
ip_ptr -> nx_ip_rarp_responses_received++;/* ... */
#endif
TX_DISABLE
if (*(message_ptr + 6) && (packet_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_ip_address == 0))
{
address_change_notify = ip_ptr -> nx_ip_address_change_notify;
additional_info = ip_ptr -> nx_ip_address_change_notify_additional_info;
/* ... */
packet_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_ip_address = *(message_ptr + 6);
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) &&
(ip_ptr -> nx_ip_interface[i].nx_interface_address_mapping_needed == NX_TRUE))
{
break;
}if ((ip_ptr -> nx_ip_interface[i].nx_interface_ip_address == 0) && (ip_ptr -> nx_ip_interface[i].nx_interface_address_mapping_needed == NX_TRUE)) { ... }
}for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) { ... }
if (i >= NX_MAX_PHYSICAL_INTERFACES)
{
ip_ptr -> nx_ip_rarp_periodic_update = NX_NULL;
ip_ptr -> nx_ip_rarp_queue_process = NX_NULL;
}if (i >= NX_MAX_PHYSICAL_INTERFACES) { ... }
}if (*(message_ptr + 6) && (packet_ptr -> nx_packet_address.nx_packet_interface_ptr -> nx_interface_ip_address == 0)) { ... }
TX_RESTORE
_nx_packet_release(packet_ptr);
}else if ((*(message_ptr + 1) & 0xFFFF) == NX_RARP_OPTION_RESPONSE) { ... }
else
{
#ifndef NX_DISABLE_RARP_INFO
ip_ptr -> nx_ip_rarp_invalid_messages++;/* ... */
#endif
_nx_packet_release(packet_ptr);
}else { ... }
if (address_change_notify != NX_NULL)
{
(address_change_notify)(ip_ptr, additional_info);
}if (address_change_notify != NX_NULL) { ... }
return;
}{ ... }
#endif/* ... */