1
10
13
14
20
21
22
23
24
25
26
27
28
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
181
182
183
184
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
205
206
207
208
209
210
211
212
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "tx_thread.h"
#include "nx_packet.h"
#include "nx_ip.h"
#include "nx_icmp.h"
5 includes
#ifdef NX_IPSEC_ENABLE
#include "nx_ipsec.h"
#endif
#ifndef NX_DISABLE_IPV4...
...
VOID _nx_icmpv4_process_echo_reply(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
{
TX_INTERRUPT_SAVE_AREA
TX_THREAD *thread_ptr;
ULONG suspended;
USHORT sequence_num;
NX_ICMPV4_ECHO *echo_ptr;
NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr);
echo_ptr = (NX_ICMPV4_ECHO *)packet_ptr -> nx_packet_prepend_ptr;
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_ping_responses_received++;/* ... */
#endif
sequence_num = echo_ptr -> nx_icmpv4_echo_sequence_num;
NX_CHANGE_USHORT_ENDIAN(sequence_num);
TX_DISABLE
thread_ptr = ip_ptr -> nx_ip_icmp_ping_suspension_list;
suspended = ip_ptr -> nx_ip_icmp_ping_suspended_count;
_tx_thread_preempt_disable++;
TX_RESTORE
/* ... */
while (suspended--)
{
if ((USHORT)(thread_ptr -> tx_thread_suspend_info) == sequence_num)
{
TX_DISABLE
if (thread_ptr == thread_ptr -> tx_thread_suspended_next)
{
ip_ptr -> nx_ip_icmp_ping_suspension_list = NX_NULL;
}if (thread_ptr == thread_ptr -> tx_thread_suspended_next) { ... }
else
{
if (ip_ptr -> nx_ip_icmp_ping_suspension_list == thread_ptr)
{
ip_ptr -> nx_ip_icmp_ping_suspension_list = thread_ptr -> tx_thread_suspended_next;
}if (ip_ptr -> nx_ip_icmp_ping_suspension_list == thread_ptr) { ... }
(thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous =
thread_ptr -> tx_thread_suspended_previous;
(thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next =
thread_ptr -> tx_thread_suspended_next;
}else { ... }
ip_ptr -> nx_ip_icmp_ping_suspended_count--;
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
_tx_thread_preempt_disable++;
TX_RESTORE
/* ... */
packet_ptr -> nx_packet_length = packet_ptr -> nx_packet_length - (ULONG)sizeof(NX_ICMPV4_ECHO);
packet_ptr -> nx_packet_prepend_ptr = packet_ptr -> nx_packet_prepend_ptr + sizeof(NX_ICMPV4_ECHO);
/* ... */
*((NX_PACKET **)thread_ptr -> tx_thread_additional_suspend_info) = packet_ptr;
packet_ptr = NX_NULL;
thread_ptr -> tx_thread_suspend_status = NX_SUCCESS;
_tx_thread_system_resume(thread_ptr);
break;
}if ((USHORT)(thread_ptr -> tx_thread_suspend_info) == sequence_num) { ... }
else
{
thread_ptr = thread_ptr -> tx_thread_suspended_next;
}else { ... }
}while (suspended--) { ... }
if (packet_ptr)
{
#ifndef NX_DISABLE_ICMP_INFO
ip_ptr -> nx_ip_icmp_invalid_packets++;/* ... */
#endif
_nx_packet_release(packet_ptr);
}if (packet_ptr) { ... }
TX_DISABLE
_tx_thread_preempt_disable--;
TX_RESTORE
_tx_thread_system_preempt_check();
}{ ... }
#endif/* ... */