1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Component                                                        */
17 /**                                                                       */
18 /**   Application Interface (API)                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
27 /*                                                                        */
28 /*    nx_api.h                                            PORTABLE C      */
29 /*                                                           6.3.0        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Yuxin Zhou, Microsoft Corporation                                   */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the basic Application Interface (API) to the      */
37 /*    high-performance NetX TCP/IP implementation for the ThreadX         */
38 /*    real-time kernel.  All service prototypes and data structure        */
39 /*    definitions are defined in this file. Please note that basic data   */
40 /*    type definitions and other architecture-specific information is     */
41 /*    contained in the file nx_port.h.                                    */
42 /*                                                                        */
43 /*  RELEASE HISTORY                                                       */
44 /*                                                                        */
45 /*    DATE              NAME                      DESCRIPTION             */
46 /*                                                                        */
47 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
48 /*  09-30-2020     Yuxin Zhou               Modified comment(s), fixed    */
49 /*                                            ThreadX version check,      */
50 /*                                            updated product constants,  */
51 /*                                            resulting in version 6.1    */
52 /*  11-09-2020     Yuxin Zhou               Modified comment(s), and      */
53 /*                                            updated product constants,  */
54 /*                                            resulting in version 6.1.2  */
55 /*  12-31-2020     Yuxin Zhou               Modified comment(s), added    */
56 /*                                            PTP timestamp capability,   */
57 /*                                            added function to convert   */
58 /*                                            string to unsigned integer, */
59 /*                                            updated product constants,  */
60 /*                                            resulting in version 6.1.3  */
61 /*  02-02-2021     Yuxin Zhou               Modified comment(s), and      */
62 /*                                            updated product constants,  */
63 /*                                            resulting in version 6.1.4  */
64 /*  03-02-2021     Yuxin Zhou               Modified comment(s), and      */
65 /*                                            updated product constants,  */
66 /*                                            resulting in version 6.1.5  */
67 /*  04-02-2021     Yuxin Zhou               Modified comment(s), and      */
68 /*                                            added functions for base64, */
69 /*                                            resulting in version 6.1.6  */
70 /*  06-02-2021     Yuxin Zhou               Modified comment(s), and      */
71 /*                                            updated product constants,  */
72 /*                                            resulting in version 6.1.7  */
73 /*  08-02-2021     Yuxin Zhou               Modified comment(s), and      */
74 /*                                            supported TCP/IP offload,   */
75 /*                                            added new ip filter,        */
76 /*                                            added function to convert   */
77 /*                                            unsigned integer to string, */
78 /*                                            resulting in version 6.1.8  */
79 /*  10-15-2021     Yuxin Zhou               Modified comment(s), and      */
80 /*                                            added support for getting   */
81 /*                                            interface type,             */
82 /*                                            resulting in version 6.1.9  */
83 /*  01-31-2022     Yuxin Zhou               Modified comment(s), and      */
84 /*                                            updated product constants,  */
85 /*                                            resulting in version 6.1.10 */
86 /*  04-25-2022     Yuxin Zhou               Modified comment(s), and      */
87 /*                                            updated product constants,  */
88 /*                                            added internal ip address   */
89 /*                                            change notification,        */
90 /*                                            resulting in version 6.1.11 */
91 /*  07-29-2022     Yuxin Zhou               Modified comment(s), and      */
92 /*                                            updated product constants,  */
93 /*                                            fixed compiler errors when  */
94 /*                                            TX_SAFETY_CRITICAL is       */
95 /*                                            enabled,                    */
96 /*                                            resulting in version 6.1.12 */
97 /*  10-31-2022     Wenhui Xie               Modified comment(s), and      */
98 /*                                            supported HTTP Proxy,       */
99 /*                                            resulting in version 6.2.0  */
100 /*  03-08-2023     Tiejun Zhou              Modified comment(s), and      */
101 /*                                            updated product constants,  */
102 /*                                            resulting in version 6.2.1  */
103 /*  10-31-2023     Tiejun Zhou              Modified comment(s),          */
104 /*                                            supported random IP id,     */
105 /*                                            resulting in version 6.3.0  */
106 /*                                                                        */
107 /**************************************************************************/
108 
109 #ifndef NX_API_H
110 #define NX_API_H
111 
112 /* Determine if a C++ compiler is being used.  If so, ensure that standard
113    C is used to process the API information.  */
114 
115 #ifdef __cplusplus
116 
117 /* Yes, C++ compiler is present.  Use standard C.  */
118 extern   "C" {
119 
120 #endif
121 
122 
123 /* Disable warning of parameter not used. */
124 #ifndef NX_PARAMETER_NOT_USED
125 #define NX_PARAMETER_NOT_USED(p) ((void)(p))
126 #endif /* NX_PARAMETER_NOT_USED */
127 
128 
129 /* Bypass ThreadX API error checking for internal NetX calls.  */
130 #include "tx_port.h"
131 
132 #ifdef NX_SOURCE_CODE
133 #ifndef TX_SAFETY_CRITICAL
134 #ifndef TX_DISABLE_ERROR_CHECKING
135 #define TX_DISABLE_ERROR_CHECKING
136 #endif
137 #endif
138 #endif
139 
140 
141 
142 /* Include the ThreadX and port-specific data type file.  */
143 
144 #include "tx_api.h"
145 #include "nx_port.h"
146 
147 #ifdef NX_IPSEC_ENABLE
148 #include "nx_crypto_const.h"
149 #endif /* NX_IPSEC_ENABLE */
150 /* Include the ThreadX trace information.  */
151 
152 #include "tx_trace.h"
153 
154 #ifdef NX_ENABLE_TCPIP_OFFLOAD
155 #ifndef NX_ENABLE_INTERFACE_CAPABILITY
156 #error "NX_ENABLE_INTERFACE_CAPABILITY must be defined to enable TCP/IP offload"
157 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */
158 #endif /* NX_ENABLE_TCPIP_OFFLOAD */
159 
160 /* Define symbols for compatibility before and after ThreadX 5.8. */
161 #if (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508)
162 #define NX_CLEANUP_PARAMETER , ULONG suspension_sequence
163 #define NX_CLEANUP_ARGUMENT  , 0
164 #define NX_CLEANUP_EXTENSION NX_PARAMETER_NOT_USED(suspension_sequence);
165 #else
166 #define NX_CLEANUP_PARAMETER
167 #define NX_CLEANUP_ARGUMENT
168 #define NX_CLEANUP_EXTENSION
169 #endif /* (((THREADX_MAJOR_VERSION << 8) | THREADX_MINOR_VERSION) >= 0x0508) */
170 
171 /* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state.  */
172 #ifndef TX_THREAD_GET_SYSTEM_STATE
173 #define TX_THREAD_GET_SYSTEM_STATE()                        _tx_thread_system_state
174 #endif
175 
176 /* Define basic alignment type used in block and byte pool operations. This data type must
177    be at least 32-bits in size and also be large enough to hold a pointer type.  */
178 
179 #ifndef ALIGN_TYPE_DEFINED
180 #define ALIGN_TYPE      ULONG
181 #endif
182 
183 
184 /* Define the extension to hold the control block.  */
185 #ifndef NX_THREAD_EXTENSION_PTR_SET
186 #define NX_THREAD_EXTENSION_PTR_SET(a, b)
187 #endif /* NX_THREAD_EXTENSION_PTR_SET  */
188 
189 #ifndef NX_THREAD_EXTENSION_PTR_GET
190 #define NX_THREAD_EXTENSION_PTR_GET(a, b, c)                { \
191                                                                 (a) = (b *)(c); \
192                                                             }
193 #endif /* NX_THREAD_EXTENSION_PTR_GET  */
194 
195 #ifndef NX_TIMER_EXTENSION_PTR_SET
196 #define NX_TIMER_EXTENSION_PTR_SET(a, b)
197 #endif /* NX_TIMER_EXTENSION_PTR_SET  */
198 
199 #ifndef NX_TIMER_EXTENSION_PTR_GET
200 #define NX_TIMER_EXTENSION_PTR_GET(a, b, c)                 { \
201                                                                 (a) = (b *)(c); \
202                                                             }
203 #endif /* NX_TIMER_EXTENSION_PTR_GET  */
204 
205 
206 #ifdef TX_UCHAR_POINTER_ADD
207 #define NX_UCHAR_POINTER_ADD(a,b)                           TX_UCHAR_POINTER_ADD(a,b)
208 #else
209 #define NX_UCHAR_POINTER_ADD(a,b)                           (((UCHAR *) (a)) + ((UINT) (b)))
210 #endif
211 
212 
213 /* The symbol "NX_IP_PERIODIC_RATE" specifies the number of ThreadX timer ticks in one second.
214    The value should be derived from TX_TIMER_TICKS_PER_SECOND, which is defined in ThreadX port.
215    If TX_TIMER_TICKS_PER_SECOND is not defined, NX_IP_PERIODIC_RATE defaults to 100 ticks per second. */
216 
217 #ifndef NX_IP_PERIODIC_RATE
218 #ifdef TX_TIMER_TICKS_PER_SECOND
219 #define NX_IP_PERIODIC_RATE                                 TX_TIMER_TICKS_PER_SECOND
220 #else
221 #define NX_IP_PERIODIC_RATE                                 100
222 #endif
223 #endif
224 
225 
226 /* This defines the ASSET and process on ASSET fail. */
227 #ifndef NX_DISABLE_ASSERT
228 #ifndef NX_ASSERT_FAIL
229 #define NX_ASSERT_FAIL                                      for (;;) {tx_thread_sleep(NX_WAIT_FOREVER); }
230 #endif /* NX_ASSERT_FAIL */
231 #define NX_ASSERT(s)                                        if (!(s)) {NX_ASSERT_FAIL}
232 #else
233 #define NX_ASSERT(s)
234 #endif /* NX_DISABLE_ASSERT */
235 
236 
237 #ifndef NX_RAND
238 #ifdef NX_HIGH_SECURITY
239 #error "The symbol NX_RAND must be defined to use a qualified random number generator."
240 #else
241 #define NX_RAND                                             rand
242 #endif
243 #endif
244 
245 #ifndef NX_SRAND
246 #ifdef NX_HIGH_SECURITY
247 #error "The symbol NX_SRAND must be defined to use a qualified random number seed."
248 #else
249 #define NX_SRAND                                            srand
250 #endif
251 #endif
252 
253 
254 /* Define the max string length.  */
255 #ifndef NX_MAX_STRING_LENGTH
256 #define NX_MAX_STRING_LENGTH                                1024
257 #endif  /* NX_MAX_STRING_LENGTH */
258 
259 
260 /* Determine if tracing is enabled.  */
261 
262 #ifdef TX_ENABLE_EVENT_TRACE
263 
264 /* Define the object types in NetX, if not defined.  */
265 
266 #ifndef NX_TRACE_OBJECT_TYPE_IP
267 #define NX_TRACE_OBJECT_TYPE_IP                             11          /* P1 = stack start address, P2 = stack size    */
268 #define NX_TRACE_OBJECT_TYPE_PACKET_POOL                    12          /* P1 = packet size, P2 = number of packets     */
269 #define NX_TRACE_OBJECT_TYPE_TCP_SOCKET                     13          /* P1 = IP address, P2 = window size            */
270 #define NX_TRACE_OBJECT_TYPE_UDP_SOCKET                     14          /* P1 = IP address, P2 = receive queue maximum  */
271 #endif
272 
273 
274 /* Define event filters that can be used to selectively disable certain events or groups of events.  */
275 
276 #define NX_TRACE_ALL_EVENTS                                 0x00FF8000  /* All NetX events                           */
277 #define NX_TRACE_INTERNAL_EVENTS                            0x00008000  /* NetX internal events                      */
278 #define NX_TRACE_ARP_EVENTS                                 0x00010000  /* NetX ARP events                           */
279 #define NX_TRACE_ICMP_EVENTS                                0x00020000  /* NetX ICMP events                          */
280 #define NX_TRACE_IGMP_EVENTS                                0x00040000  /* NetX IGMP events                          */
281 #define NX_TRACE_IP_EVENTS                                  0x00080000  /* NetX IP events                            */
282 #define NX_TRACE_PACKET_EVENTS                              0x00100000  /* NetX Packet events                        */
283 #define NX_TRACE_RARP_EVENTS                                0x00200000  /* NetX RARP events                          */
284 #define NX_TRACE_TCP_EVENTS                                 0x00400000  /* NetX TCP events                           */
285 #define NX_TRACE_UDP_EVENTS                                 0x00800000  /* NetX UDP events                           */
286 
287 
288 /* Define the trace events in NetX, if not defined.  */
289 
290 /* Define NetX Trace Events, along with a brief description of the additional information fields,
291    where I1 -> Information Field 1, I2 -> Information Field 2, etc.  */
292 
293 /* Define the NetX internal events first.  */
294 
295 #ifndef NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE
296 #define NX_TRACE_INTERNAL_ARP_REQUEST_RECEIVE               300         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr                     */
297 #define NX_TRACE_INTERNAL_ARP_REQUEST_SEND                  301         /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr                */
298 #define NX_TRACE_INTERNAL_ARP_RESPONSE_RECEIVE              302         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr                     */
299 #define NX_TRACE_INTERNAL_ARP_RESPONSE_SEND                 303         /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr                */
300 #define NX_TRACE_INTERNAL_ICMP_RECEIVE                      304         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */
301 #define NX_TRACE_INTERNAL_ICMP_SEND                         305         /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = header 0 */
302 #define NX_TRACE_INTERNAL_IGMP_RECEIVE                      306         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = header word 0 */
303 
304 #define NX_TRACE_INTERNAL_IP_RECEIVE                        308         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = packet length */
305 #define NX_TRACE_INTERNAL_IP_SEND                           309         /* I1 = ip ptr, I2 = destination IP address, I3 = packet ptr, I4 = length   */
306 #define NX_TRACE_INTERNAL_TCP_DATA_RECEIVE                  310         /* I1 = ip ptr, I2 = source IP address, I3 = packet ptr, I4 = sequence      */
307 #define NX_TRACE_INTERNAL_TCP_DATA_SEND                     311         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
308 #define NX_TRACE_INTERNAL_TCP_FIN_RECEIVE                   312         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
309 #define NX_TRACE_INTERNAL_TCP_FIN_SEND                      313         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
310 #define NX_TRACE_INTERNAL_TCP_RESET_RECEIVE                 314         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
311 #define NX_TRACE_INTERNAL_TCP_RESET_SEND                    315         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
312 #define NX_TRACE_INTERNAL_TCP_SYN_RECEIVE                   316         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
313 #define NX_TRACE_INTERNAL_TCP_SYN_SEND                      317         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = sequence             */
314 #define NX_TRACE_INTERNAL_UDP_RECEIVE                       318         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = header word 0        */
315 #define NX_TRACE_INTERNAL_UDP_SEND                          319         /* I1 = ip ptr, I2 = socket_ptr, I3 = packet ptr, I4 = header 0             */
316 #define NX_TRACE_INTERNAL_RARP_RECEIVE                      320         /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */
317 #define NX_TRACE_INTERNAL_RARP_SEND                         321         /* I1 = ip ptr, I2 = target IP address, I3 = packet ptr, I4 = header word 1 */
318 #define NX_TRACE_INTERNAL_TCP_RETRY                         322         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = number of retries    */
319 #define NX_TRACE_INTERNAL_TCP_STATE_CHANGE                  323         /* I1 = ip ptr, I2 = socket ptr, I3 = previous state, I4 = new state        */
320 #define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_SEND             324         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
321 #define NX_TRACE_INTERNAL_IO_DRIVER_INITIALIZE              325         /* I1 = ip ptr                                                              */
322 #define NX_TRACE_INTERNAL_IO_DRIVER_LINK_ENABLE             326         /* I1 = ip ptr                                                              */
323 #define NX_TRACE_INTERNAL_IO_DRIVER_LINK_DISABLE            327         /* I1 = ip ptr                                                              */
324 #define NX_TRACE_INTERNAL_IO_DRIVER_PACKET_BROADCAST        328         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
325 #define NX_TRACE_INTERNAL_IO_DRIVER_ARP_SEND                329         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
326 #define NX_TRACE_INTERNAL_IO_DRIVER_ARP_RESPONSE_SEND       330         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
327 #define NX_TRACE_INTERNAL_IO_DRIVER_RARP_SEND               331         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
328 #define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_JOIN          332         /* I1 = ip ptr                                                              */
329 #define NX_TRACE_INTERNAL_IO_DRIVER_MULTICAST_LEAVE         333         /* I1 = ip ptr                                                              */
330 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_STATUS              334         /* I1 = ip ptr                                                              */
331 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_SPEED               335         /* I1 = ip ptr                                                              */
332 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_DUPLEX_TYPE         336         /* I1 = ip ptr                                                              */
333 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_ERROR_COUNT         337         /* I1 = ip ptr                                                              */
334 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_RX_COUNT            338         /* I1 = ip ptr                                                              */
335 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_TX_COUNT            339         /* I1 = ip ptr                                                              */
336 #define NX_TRACE_INTERNAL_IO_DRIVER_GET_ALLOC_ERRORS        340         /* I1 = ip ptr                                                              */
337 #define NX_TRACE_INTERNAL_IO_DRIVER_UNINITIALIZE            341         /* I1 = ip ptr                                                              */
338 #define NX_TRACE_INTERNAL_IO_DRIVER_DEFERRED_PROCESSING     342         /* I1 = ip ptr, I2 = packet ptr, I3 = packet size                           */
339 
340 #define NX_TRACE_ARP_DYNAMIC_ENTRIES_INVALIDATE             350         /* I1 = ip ptr, I2 = entries invalidated                                    */
341 #define NX_TRACE_ARP_DYNAMIC_ENTRY_SET                      351         /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw       */
342 #define NX_TRACE_ARP_ENABLE                                 352         /* I1 = ip ptr, I2 = arp cache memory, I3 = arp cache size                  */
343 #define NX_TRACE_ARP_GRATUITOUS_SEND                        353         /* I1 = ip ptr                                                              */
344 #define NX_TRACE_ARP_HARDWARE_ADDRESS_FIND                  354         /* I1 = ip ptr, I2 = ip_address, I3 = physical msw, I4 = physical lsw       */
345 #define NX_TRACE_ARP_INFO_GET                               355         /* I1 = ip ptr, I2 = arps sent, I3 = arp responses, I3 = arps received      */
346 #define NX_TRACE_ARP_IP_ADDRESS_FIND                        356         /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical lsw       */
347 #define NX_TRACE_ARP_STATIC_ENTRIES_DELETE                  357         /* I1 = ip ptr, I2 = entries deleted                                        */
348 #define NX_TRACE_ARP_STATIC_ENTRY_CREATE                    358         /* I1 = ip ptr, I2 = ip address, I3 = physical msw, I4 = physical_lsw       */
349 #define NX_TRACE_ARP_STATIC_ENTRY_DELETE                    359         /* I1 = ip ptr, I2 = ip address, I3 = physical_msw, I4 = physical_lsw       */
350 #define NX_TRACE_ICMP_ENABLE                                360         /* I1 = ip ptr                                                              */
351 #define NX_TRACE_ICMP_INFO_GET                              361         /* I1 = ip ptr, I2 = pings sent, I3 = ping responses, I4 = pings received   */
352 #define NX_TRACE_ICMP_PING                                  362         /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size              */
353 #define NX_TRACE_IGMP_ENABLE                                363         /* I1 = ip ptr                                                              */
354 #define NX_TRACE_IGMP_INFO_GET                              364         /* I1 = ip ptr, I2 = reports sent, I3 = queries received, I4 = groups joined*/
355 #define NX_TRACE_IGMP_LOOPBACK_DISABLE                      365         /* I1 = ip ptr                                                              */
356 #define NX_TRACE_IGMP_LOOPBACK_ENABLE                       366         /* I1 = ip ptr                                                              */
357 #define NX_TRACE_IGMP_MULTICAST_JOIN                        367         /* I1 = ip ptr, I2 = group address                                          */
358 #define NX_TRACE_IGMP_MULTICAST_LEAVE                       368         /* I1 = ip ptr, I2 = group_address                                          */
359 #define NX_TRACE_IP_ADDRESS_CHANGE_NOTIFY                   369         /* I1 = ip ptr, I2 = ip address change notify, I3 = additional info         */
360 #define NX_TRACE_IP_ADDRESS_GET                             370         /* I1 = ip ptr, I2 = ip address, I3 = network_mask                          */
361 #define NX_TRACE_IP_ADDRESS_SET                             371         /* I1 = ip ptr, I2 = ip address, I3 = network_mask                          */
362 #define NX_TRACE_IP_CREATE                                  372         /* I1 = ip ptr, I2 = ip address, I3 = network mask, I4 = default_pool       */
363 #define NX_TRACE_IP_DELETE                                  373         /* I1 = ip ptr                                                              */
364 #define NX_TRACE_IP_DRIVER_DIRECT_COMMAND                   374         /* I1 = ip ptr, I2 = command, I3 = return value                             */
365 #define NX_TRACE_IP_FORWARDING_DISABLE                      375         /* I1 = ip ptr                                                              */
366 #define NX_TRACE_IP_FORWARDING_ENABLE                       376         /* I1 = ip ptr                                                              */
367 #define NX_TRACE_IP_FRAGMENT_DISABLE                        377         /* I1 = ip ptr                                                              */
368 #define NX_TRACE_IP_FRAGMENT_ENABLE                         378         /* I1 = ip ptr                                                              */
369 #define NX_TRACE_IP_GATEWAY_ADDRESS_SET                     379         /* I1 = ip ptr, I2 = gateway address                                        */
370 #define NX_TRACE_IP_INFO_GET                                380         /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = packets dropped  */
371 #define NX_TRACE_IP_RAW_PACKET_DISABLE                      381         /* I1 = ip ptr                                                              */
372 #define NX_TRACE_IP_RAW_PACKET_ENABLE                       382         /* I1 = ip ptr                                                              */
373 #define NX_TRACE_IP_RAW_PACKET_RECEIVE                      383         /* I1 = ip ptr, I2 = packet ptr, I3 = wait option                           */
374 #define NX_TRACE_IP_RAW_PACKET_SEND                         384         /* I1 = ip ptr, I2 = packet ptr, I3 = destination ip, I4 = type of service  */
375 #define NX_TRACE_IP_STATUS_CHECK                            385         /* I1 = ip ptr, I2 = needed status, I3 = actual status, I4 = wait option    */
376 #define NX_TRACE_PACKET_ALLOCATE                            386         /* I1 = pool ptr, I2 = packet ptr, I3 = packet type, I4 = available packets */
377 #define NX_TRACE_PACKET_COPY                                387         /* I1 = packet ptr, I2 = new packet ptr, I3 = pool ptr, I4 = wait option    */
378 #define NX_TRACE_PACKET_DATA_APPEND                         388         /* I1 = packet ptr, I2 = data start, I3 = data size, I4 = pool ptr          */
379 #define NX_TRACE_PACKET_DATA_RETRIEVE                       389         /* I1 = packet ptr, I2 = buffer start, I3 = bytes copied                    */
380 #define NX_TRACE_PACKET_LENGTH_GET                          390         /* I1 = packet ptr, I2 = length                                             */
381 #define NX_TRACE_PACKET_POOL_CREATE                         391         /* I1 = pool ptr, I2 = payload size, I3 = memory ptr, I4 = memory_size      */
382 #define NX_TRACE_PACKET_POOL_DELETE                         392         /* I1 = pool ptr                                                            */
383 #define NX_TRACE_PACKET_POOL_INFO_GET                       393         /* I1 = pool ptr, I2 = total_packets, I3 = free packets, I4 = empty requests*/
384 #define NX_TRACE_PACKET_RELEASE                             394         /* I1 = packet ptr, I2 = packet status, I3 = available packets              */
385 #define NX_TRACE_PACKET_TRANSMIT_RELEASE                    395         /* I1 = packet ptr, I2 = packet status, I3 = available packets              */
386 #define NX_TRACE_RARP_DISABLE                               396         /* I1 = ip ptr                                                              */
387 #define NX_TRACE_RARP_ENABLE                                397         /* I1 = ip ptr                                                              */
388 #define NX_TRACE_RARP_INFO_GET                              398         /* I1 = ip ptr, I2 = requests sent, I3 = responses received, I4 = invalids  */
389 #define NX_TRACE_SYSTEM_INITIALIZE                          399         /* none                                                                     */
390 #define NX_TRACE_TCP_CLIENT_SOCKET_BIND                     400         /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option                */
391 #define NX_TRACE_TCP_CLIENT_SOCKET_CONNECT                  401         /* I1 = ip ptr, I2 = socket ptr, I3 = server ip, I4 = server port           */
392 #define NX_TRACE_TCP_CLIENT_SOCKET_PORT_GET                 402         /* I1 = ip ptr, I2 = socket ptr, I3 = port                                  */
393 #define NX_TRACE_TCP_CLIENT_SOCKET_UNBIND                   403         /* I1 = ip ptr, I2 = socket ptr                                             */
394 #define NX_TRACE_TCP_ENABLE                                 404         /* I1 = ip ptr                                                              */
395 #define NX_TRACE_TCP_FREE_PORT_FIND                         405         /* I1 = ip ptr, I2 = port, I3 = free port                                   */
396 #define NX_TRACE_TCP_INFO_GET                               406         /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets  */
397 #define NX_TRACE_TCP_SERVER_SOCKET_ACCEPT                   407         /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state        */
398 #define NX_TRACE_TCP_SERVER_SOCKET_LISTEN                   408         /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = listen queue size          */
399 #define NX_TRACE_TCP_SERVER_SOCKET_RELISTEN                 409         /* I1 = ip ptr, I2 = port, I3 = socket ptr, I4 = socket state               */
400 #define NX_TRACE_TCP_SERVER_SOCKET_UNACCEPT                 410         /* I1 = ip ptr, I2 = socket ptr, I3 = socket state                          */
401 #define NX_TRACE_TCP_SERVER_SOCKET_UNLISTEN                 411         /* I1 = ip ptr, I2 = port                                                   */
402 #define NX_TRACE_TCP_SOCKET_CREATE                          412         /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = window size     */
403 #define NX_TRACE_TCP_SOCKET_DELETE                          413         /* I1 = ip ptr, I2 = socket ptr, I3 = socket state                          */
404 #define NX_TRACE_TCP_SOCKET_DISCONNECT                      414         /* I1 = ip ptr, I2 = socket ptr, I3 = wait option, I4 = socket state        */
405 #define NX_TRACE_TCP_SOCKET_INFO_GET                        415         /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received       */
406 #define NX_TRACE_TCP_SOCKET_MSS_GET                         416         /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 = socket state                */
407 #define NX_TRACE_TCP_SOCKET_MSS_PEER_GET                    417         /* I1 = ip ptr, I2 = socket ptr, I3 = peer_mss, I4 = socket state           */
408 #define NX_TRACE_TCP_SOCKET_MSS_SET                         418         /* I1 = ip ptr, I2 = socket ptr, I3 = mss, I4 socket state                  */
409 #define NX_TRACE_TCP_SOCKET_RECEIVE                         419         /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = rx sequence          */
410 #define NX_TRACE_TCP_SOCKET_RECEIVE_NOTIFY                  420         /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify                        */
411 #define NX_TRACE_TCP_SOCKET_SEND                            421         /* I1 = socket ptr, I2 = packet ptr, I3 = length, I4 = tx sequence          */
412 #define NX_TRACE_TCP_SOCKET_STATE_WAIT                      422         /* I1 = ip ptr, I2 = socket ptr, I3 = desired state, I4 = previous state    */
413 #define NX_TRACE_TCP_SOCKET_TRANSMIT_CONFIGURE              423         /* I1 = ip ptr, I2 = socket ptr, I3 = queue depth, I4 = timeout             */
414 #define NX_TRACE_UDP_ENABLE                                 424         /* I1 = ip ptr                                                              */
415 #define NX_TRACE_UDP_FREE_PORT_FIND                         425         /* I1 = ip ptr, I2 = port, I3 = free port                                   */
416 #define NX_TRACE_UDP_INFO_GET                               426         /* I1 = ip ptr, I2 = bytes sent, I3 = bytes received, I4 = invalid packets  */
417 #define NX_TRACE_UDP_SOCKET_BIND                            427         /* I1 = ip ptr, I2 = socket ptr, I3 = port, I4 = wait option                */
418 #define NX_TRACE_UDP_SOCKET_CHECKSUM_DISABLE                428         /* I1 = ip ptr, I2 = socket ptr                                             */
419 #define NX_TRACE_UDP_SOCKET_CHECKSUM_ENABLE                 429         /* I1 = ip ptr, I2 = socket ptr                                             */
420 #define NX_TRACE_UDP_SOCKET_CREATE                          430         /* I1 = ip ptr, I2 = socket ptr, I3 = type of service, I4 = queue maximum   */
421 #define NX_TRACE_UDP_SOCKET_DELETE                          431         /* I1 = ip ptr, I2 = socket ptr                                             */
422 #define NX_TRACE_UDP_SOCKET_INFO_GET                        432         /* I1 = ip ptr, I2 = socket ptr, I3 = bytes sent, I4 = bytes received       */
423 #define NX_TRACE_UDP_SOCKET_PORT_GET                        433         /* I1 = ip ptr, I2 = socket ptr, I3 = port                                  */
424 #define NX_TRACE_UDP_SOCKET_RECEIVE                         434         /* I1 = ip ptr, I2 = socket ptr, I3 = packet ptr, I4 = packet size          */
425 #define NX_TRACE_UDP_SOCKET_RECEIVE_NOTIFY                  435         /* I1 = ip ptr, I2 = socket ptr, I3 = receive notify                        */
426 #define NX_TRACE_UDP_SOCKET_SEND                            436         /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address      */
427 #define NX_TRACE_UDP_SOCKET_UNBIND                          437         /* I1 = ip ptr, I2 = socket ptr, I3 = port                                  */
428 #define NX_TRACE_UDP_SOURCE_EXTRACT                         438         /* I1 = packet ptr, I2 = ip address, I3 = port                              */
429 #define NX_TRACE_IP_INTERFACE_ATTACH                        439         /* I1 = ip ptr, I2 = ip address, I3 = interface index                       */
430 #define NX_TRACE_UDP_SOCKET_BYTES_AVAILABLE                 440         /* I1 = ip ptr, I2 = socket ptr, I3 = bytes available                       */
431 #define NX_TRACE_IP_STATIC_ROUTE_ENABLE                     441         /* I1 = ip_ptr,                                                             */
432 #define NX_TRACE_IP_STATIC_ROUTE_DISABLE                    442         /* I1 = ip_ptr,                                                             */
433 #define NX_TRACE_IP_STATIC_ROUTE_ADD                        443         /* I1 = ip_ptr, I2 = network_address, I3 = net_mask, I4 = next_hop          */
434 #define NX_TRACE_IP_STATIC_ROUTE_DELETE                     444         /* I1 = ip_ptr, I2 = network_address, I3 = net_mask                         */
435 #define NX_TRACE_TCP_SOCKET_PEER_INFO_GET                   445         /* I1 = socket ptr, I2 = network_address, I3 = port                         */
436 #define NX_TRACE_TCP_SOCKET_WINDOW_UPDATE_NOTIFY_SET        446         /* I1 = socket ptr,                                                         */
437 #define NX_TRACE_UDP_SOCKET_INTERFACE_SET                   447         /* I1 = socket_ptr, I2 = interface_index,                                   */
438 #define NX_TRACE_UDP_SOCKET_INTERFACE_CLEAR                 448         /* I1 = socket_ptr,                                                         */
439 #define NX_TRACE_IP_INTERFACE_INFO_GET                      449         /* I1 = ip_ptr, I2 = ip_address, I3 = mtu_size, I4 = interface_index        */
440 #define NX_TRACE_PACKET_DATA_EXTRACT_OFFSET                 450         /* I1 = packet_ptr, I2 = buffer_length, I3 = bytes_copied,                  */
441 
442 
443 #endif
444 
445 
446 #ifndef NXD_TRACE_ICMP_ENABLE
447 #define NXD_TRACE_ICMP_ENABLE                               470         /* I1 = ip ptr                                                              */
448 #define NX_TRACE_ICMP_PING6                                 471         /* I1 = ip ptr, I2 = ip_address, I3 = data ptr, I4 = data size              */
449 #define NXD_TRACE_UDP_SOURCE_EXTRACT                        472         /* I1 = packet ptr, I2 = IP Version (4 or 6), I3 = ip address, I4 = port    */
450 #define NXD_TRACE_UDP_SOCKET_SET_INTERFACE                  473         /* I1 = udp_socket_ptr, I2 = interface_id                                   */
451 #define NXD_TRACE_TCP_SOCKET_SET_INTERFACE                  474         /* I1 = tcp_socket_ptr, I2 = interface_id                                   */
452 #define NXD_TRACE_UDP_SOCKET_SEND                           475         /* I1 = socket ptr, I2 = packet ptr, I3 = packet size, I4 = ip address      */
453 #define NXD_TRACE_ND_CACHE_DELETE                           476         /* I1 = dest_ip                                                             */
454 #define NXD_TRACE_ND_CACHE_ENTRY_SET                        477         /* I1 = IP address, I2 = physical msw, I3 = physical lsw                    */
455 #define NX_TRACE_ND_CACHE_IP_ADDRESS_FIND                   478         /* I1 = ip_ptr, I2 = IP address, I3 = physical msw, I4 = physical lsw       */
456 #define NXD_TRACE_ND_CACHE_INVALIDATE                       479         /* I1 = ip_ptr                                                              */
457 #define NXD_TRACE_IPV6_GLOBAL_ADDRESS_GET                   480         /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length          */
458 #define NXD_TRACE_IPV6_GLOBAL_ADDRESS_SET                   481         /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length          */
459 #define NX_TRACE_IPSTATIC_ROUTE_ADD                         482         /* I1 = ip_ptr, I2 = network address, I3 = net_mask, I4 = next hop address  */
460 #define NX_TRACE_IP_STATIC_ROUTING_ENABLE                   483         /* I1 = ip_ptr                                                              */
461 #define NX_TRACE_IP_STATIC_ROUTING_DISABLE                  484         /* I1 = ip_ptr                                                              */
462 #define NX_TRACE_IPV6_ENABLE                                485         /* I1 = ip_ptr                                                              */
463 #define NXD_TRACE_IPV6_RAW_PACKET_SEND                      486         /* I1 = ip_ptr, I2 = ip address lsw, I3 = protocol, I4 = packet_ptr         */
464 #define NXD_TRACE_IP_RAW_PACKET_SEND                        487         /* I1 = ip_ptr, I2 = ip address lsw, I3 = type of serveice, I4 = packet_ptr */
465 #define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_GET                488         /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw                              */
466 #define NXD_TRACE_IPV6_LINKLOCAL_ADDRESS_SET                489         /* (Obsolete) I1 = ip_ptr, I2 = IP address lsw, I3 = prefix length          */
467 #define NXD_TRACE_IPV6_INITIATE_DAD_PROCESS                 490         /* I1 = ip_ptr                                                              */
468 #define NXD_TRACE_IPV6_DEFAULT_ROUTER_ADD                   491         /* I1 = ip_ptr, I2 = router addr lsw, I3 = router lifetime                  */
469 #define NXD_TRACE_IPV6_DEFAULT_ROUTER_DELETE                492         /* I1 = ip_ptr, I2 = router addr lsw,                                       */
470 #define NXD_TRACE_IPV6_INTERFACE_ADDRESS_GET                493         /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */
471 #define NXD_TRACE_IPV6_INTERFACE_ADDRESS_SET                494         /* I1 = ip_ptr, I2 = IP address lsw,I3 = prefix length,I4 = interface_index */
472 #define NXD_TRACE_TCP_SOCKET_PEER_INFO_GET                  495         /* I1 = socket_ptr, I2 = Peer IP address, I3 = peer_port                    */
473 #define NXD_TRACE_IP_MAX_PAYLOAD_SIZE_FIND                  496         /* I1 = src address, I2 = dst address,I3 = payload length,I4 = start offset */
474 #define NX_TRACE_IPV6_DISABLE                               497         /* I1 = ip_ptr                                                              */
475 #define NXD_TRACE_IPV6_ADDRESS_CHANGE_NOTIFY                498         /* I1 = ip_ptr, I2 = notify_callback                                        */
476 #define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_ENABLE  499         /* I1 = ip_ptr, I2 = interface_index                                        */
477 #define NXD_TRACE_IPV6_STATELESS_ADDRESS_AUTOCONFIG_DISABLE 500         /* I1 = ip_ptr, I2 = interface_index                                        */
478 #define NXD_TRACE_IP_RAW_PACKET_FILTER_SET                  501         /* I1 = ip_ptr, I2 = raw_pcket_filter                                       */
479 #endif
480 
481 /* Map the trace macros to internal NetX versions so we can get interrupt protection.  */
482 
483 #ifdef NX_SOURCE_CODE
484 
485 #define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b)             _nx_trace_object_register(t, (VOID *)p, (CHAR *)n, (ULONG)a, (ULONG)b)
486 #define NX_TRACE_OBJECT_UNREGISTER(o)                       _nx_trace_object_unregister((VOID *)o)
487 #define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h)     _nx_trace_event_insert((ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d, (ULONG)f, g, h)
488 #define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d)          _nx_trace_event_update((TX_TRACE_BUFFER_ENTRY *)e, (ULONG)t, (ULONG)i, (ULONG)a, (ULONG)b, (ULONG)c, (ULONG)d)
489 #endif
490 /* Define NetX trace prototypes.  */
491 
492 VOID _nx_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
493 VOID _nx_trace_object_unregister(VOID *object_ptr);
494 VOID _nx_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp);
495 VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4);
496 
497 #else
498 #define NX_TRACE_OBJECT_REGISTER(t, p, n, a, b)
499 #define NX_TRACE_OBJECT_UNREGISTER(o)
500 #define NX_TRACE_IN_LINE_INSERT(i, a, b, c, d, f, g, h)
501 #define NX_TRACE_EVENT_UPDATE(e, t, i, a, b, c, d)
502 #endif
503 
504 /* If NX_PACKET_HEADER_PAD is defined, make sure NX_PACKET_HEADER_PAD_SIZE is also defined.  The default is 1, for backward compatibility. */
505 #ifdef NX_PACKET_HEADER_PAD
506 #ifndef NX_PACKET_HEADER_PAD_SIZE
507 #define NX_PACKET_HEADER_PAD_SIZE                1
508 #endif /* NX_PACKET_HEADER_PAD_SIZE */
509 #endif /* NX_PACKET_HEADER_PAD */
510 
511 /* If NX_PACKET_ALIGNMENT is defined, packet header and payload are aligned automatically to the value specified
512    in the symbol. The default is to align packet payload area to ULONG. */
513 #ifndef NX_PACKET_ALIGNMENT
514 #define NX_PACKET_ALIGNMENT                      sizeof(ULONG)
515 #endif /* NX_PACKET_ALIGNMENT */
516 
517 
518 /* Define basic constants for the NetX TCP/IP Stack.  */
519 #define AZURE_RTOS_NETXDUO
520 #define NETXDUO_MAJOR_VERSION                    6
521 #define NETXDUO_MINOR_VERSION                    3
522 #define NETXDUO_PATCH_VERSION                    0
523 
524 /* Define the following symbols for backward compatibility */
525 #define EL_PRODUCT_NETXDUO
526 #define __PRODUCT_NETXDUO__
527 #define __NETXDUO_MAJOR_VERSION__                NETXDUO_MAJOR_VERSION
528 #define __NETXDUO_MINOR_VERSION__                NETXDUO_MINOR_VERSION
529 
530 /* API input parameters and general constants.  */
531 #define NX_NO_WAIT                               0
532 #define NX_WAIT_FOREVER                          ((ULONG)0xFFFFFFFF)
533 #define NX_TRUE                                  1
534 #define NX_FALSE                                 0
535 #define NX_NULL                                  0
536 #define NX_FOREVER                               1
537 #define NX_INIT_PACKET_ID                        1
538 #ifndef NX_MAX_PORT
539 #define NX_MAX_PORT                              0xFFFF
540 #endif /* NX_MAX_PORT */
541 #define NX_LOWER_16_MASK                         ((ULONG)0x0000FFFF)
542 #define NX_CARRY_BIT                             ((ULONG)0x10000)
543 #define NX_SHIFT_BY_16                           16
544 #define NX_TCP_CLIENT                            1
545 #define NX_TCP_SERVER                            2
546 #define NX_ANY_PORT                              0
547 #ifndef NX_SEARCH_PORT_START
548 #define NX_SEARCH_PORT_START                     0xC000 /* Free port search start UDP/TCP */
549 #endif /* NX_SEARCH_PORT_START */
550 
551 #ifndef NX_PHYSICAL_HEADER
552 #define NX_PHYSICAL_HEADER                       16    /* Maximum physical header        */
553 #endif
554 
555 #ifndef NX_PHYSICAL_TRAILER
556 #define NX_PHYSICAL_TRAILER                      4     /* Maximum physical trailer       */
557 #endif
558 
559 /* Specify th wait interval, in seconds. */
560 #ifndef NX_PATH_MTU_INCREASE_WAIT_INTERVAL
561 #define NX_PATH_MTU_INCREASE_WAIT_INTERVAL       600
562 #endif
563 
564 #define NX_PATH_MTU_INCREASE_WAIT_INTERVAL_TICKS (NX_PATH_MTU_INCREASE_WAIT_INTERVAL * NX_IP_PERIODIC_RATE)
565 
566 /* By default IPv6 is enabled. */
567 #ifndef NX_DISABLE_IPV6
568 #ifndef FEATURE_NX_IPV6
569 #define FEATURE_NX_IPV6
570 #endif /* FEATURE_NX_IPV6 */
571 #endif /* NX_DISABLE_IPV6 */
572 
573 /* Remove the IPv6 component if NX_DISABLE_IPV6 is defined. */
574 #ifdef NX_DISABLE_IPV6
575 #ifdef FEATURE_NX_IPV6
576 #undef FEATURE_NX_IPV6
577 #endif /* FEATURE_NX_IPV6 */
578 #endif /* NX_DISABLE_IPV6 */
579 
580 #ifdef NX_IPSEC_ENABLE
581 
582 /* Define the IPsec header size.  The space reserved here is good for ESP/AH header and possiblly IPv4/v6 header in tunnel mode. */
583 #ifdef FEATURE_NX_IPV6
584 #define NX_IPSEC_MAX_HEADER_SIZE    (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 16 + 40)
585 #else /* !FEATURE_NX_IPV6 */
586 #define NX_IPSEC_MAX_HEADER_SIZE    (((NX_CRYPTO_MAX_IV_SIZE_IN_BITS + NX_CRYPTO_AUTHENTICATION_ICV_TRUNC_BITS + 7) / 8) + 12 + 20)
587 #endif /* FEATURE_NX_IPV6 */
588 
589 #else /* !NX_IPSEC_ENABLE */
590 #define NX_IPSEC_MAX_HEADER_SIZE    0
591 #endif /* NX_IPSEC_ENABLE */
592 
593 #ifndef NX_IPV6_HOST_ID_LENGTH
594 #define NX_IPV6_HOST_ID_LENGTH      64
595 #endif /* NX_IPV6_HOST_ID_LENGTH */
596 
597 #define NX_IPv4_PACKET              (NX_PHYSICAL_HEADER + 20)   /* 20 bytes of IP header          */
598 #define NX_IPv4_TCP_PACKET          (NX_IPv4_PACKET + 20)       /* IP header plus 20 bytes        */
599 #define NX_IPv4_UDP_PACKET          (NX_IPv4_PACKET + 8)        /* IP header plus 8 bytes         */
600 #define NX_IPv4_ICMP_PACKET         (NX_IPv4_PACKET)
601 #define NX_IPv4_IGMP_PACKET         (NX_IPv4_PACKET)
602 
603 #define NX_IPv6_PACKET              (NX_PHYSICAL_HEADER + 40)   /* 40 bytes of basic IPv6 Header  */
604 #define NX_IPv6_UDP_PACKET          (NX_IPv6_PACKET + 8)        /* IPv6 header plus 8 bytes       */
605 #define NX_IPv6_TCP_PACKET          (NX_IPv6_PACKET + 20)       /* IPv6 header plus 20 bytes      */
606 #define NX_IPv6_ICMP_PACKET         (NX_IPv6_PACKET)
607 #define NX_RECEIVE_PACKET           0                           /* This is for driver receive     */
608 
609 
610 #ifdef FEATURE_NX_IPV6
611 /* For systems with IPv6 enabled, the payload offset defaults to IPv6 header size. */
612 #define NX_IP_PACKET                NX_IPv6_PACKET
613 #define NX_TCP_PACKET               (NX_IPv6_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
614 #define NX_UDP_PACKET               (NX_IPv6_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
615 #define NX_ICMP_PACKET              (NX_IPv6_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
616 #else
617 /* Define payload offset to IPv4 header size if IPv6 is not defined.  */
618 #define NX_IP_PACKET                NX_IPv4_PACKET
619 #define NX_TCP_PACKET               (NX_IPv4_TCP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
620 #define NX_UDP_PACKET               (NX_IPv4_UDP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
621 #define NX_ICMP_PACKET              (NX_IPv4_ICMP_PACKET + NX_IPSEC_MAX_HEADER_SIZE)
622 #endif /* FEATURE_NX_IPV6 */
623 #define NX_IGMP_PACKET              NX_IPv4_IGMP_PACKET
624 
625 
626 /* Define the ARP update rate, in terms of IP periodic intervals.  This can be defined on the
627    command line as well.  */
628 
629 #ifndef NX_ARP_UPDATE_RATE
630 #define NX_ARP_UPDATE_RATE          10
631 #endif
632 
633 
634 /* Define the ARP entry expiration rate, in terms of IP periodic intervals.  This can be defined on the
635    command line as well.   A value of 0 disables ARP entry expiration, and is the default.  */
636 
637 #ifndef NX_ARP_EXPIRATION_RATE
638 #define NX_ARP_EXPIRATION_RATE      0
639 #endif
640 
641 
642 /* Define the ARP maximum retry constant that specifies the maximum number of ARP requests that will be sent
643    without receiving an ARP response.  Once this limit is reached, the ARP attempt is abandoned and
644    any queued packet is released.  */
645 
646 #ifndef NX_ARP_MAXIMUM_RETRIES
647 #define NX_ARP_MAXIMUM_RETRIES      18
648 #endif
649 
650 
651 /* Define the maximum number of packets that can be queued while waiting for ARP resolution of an
652    IP address.  */
653 
654 #ifndef NX_ARP_MAX_QUEUE_DEPTH
655 #define NX_ARP_MAX_QUEUE_DEPTH      4
656 #endif
657 
658 
659 /* Define the maximum time of IP reassembly.  */
660 #ifndef NX_IP_MAX_REASSEMBLY_TIME
661 
662 /* Define the maximum time of IPv4 reassembly. RFC791, Section3.2, page27.  */
663 #ifndef NX_IPV4_MAX_REASSEMBLY_TIME
664 #define NX_IPV4_MAX_REASSEMBLY_TIME 15
665 #endif
666 
667 /* Define the maximum time of IPv6 reassembly. RFC2460, Section4.5, page22.  */
668 #ifndef NX_IPV6_MAX_REASSEMBLY_TIME
669 #define NX_IPV6_MAX_REASSEMBLY_TIME 60
670 #endif
671 
672 #else /* NX_IP_MAX_REASSEMBLY_TIME */
673 
674 /* Define the maximum time of IP reassembly.  */
675 #define NX_IPV4_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME
676 #define NX_IPV6_MAX_REASSEMBLY_TIME NX_IP_MAX_REASSEMBLY_TIME
677 
678 #endif /* NX_IP_MAX_REASSEMBLY_TIME */
679 
680 
681 /* Define the maximum number of the packets that can be queued for raw receive. */
682 #ifndef NX_IP_RAW_MAX_QUEUE_DEPTH
683 #define NX_IP_RAW_MAX_QUEUE_DEPTH   20
684 #endif
685 
686 #ifndef NX_IP_ROUTING_TABLE_SIZE
687 #define NX_IP_ROUTING_TABLE_SIZE    8
688 #endif /* NX_IP_ROUTING_TABLE_SIZE */
689 
690 /* For backward compatibility, map the smbol NX_RAW_PACKET_FILTER_ENABLE to
691    NX_ENABLE_IP_RAW_PACKET_FILTER. */
692 #ifdef NX_RAW_PACKET_FILTER_ENABLE
693 #ifndef NX_ENABLE_IP_RAW_PACKET_FILTER
694 #define NX_ENABLE_IP_RAW_PACKET_FILTER
695 #endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */
696 #endif /* NX_RAW_PACKET_FILTER_ENABLE */
697 
698 /* For backward compatibility, map the symbol NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS
699    to NX_DISABLE_ICMPV6_REDIRECT_PROCESS.   */
700 #ifdef NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS
701 #ifndef NX_DISABLE_ICMPV6_REDIRECT_PROCESS
702 #define NX_DISABLE_ICMPV6_REDIRECT_PROCESS
703 #endif /* NX_DISABLE_ICMPV6_REDIRECT_PROCESS */
704 #endif /* NXDUO_DISABLE_ICMPV6_REDIRECT_PROCESS */
705 
706 /* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS to NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */
707 #ifdef NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS
708 #ifndef NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS
709 #define NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS
710 #endif /* NX_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */
711 #endif /* NXDUO_DISABLE_ICMPV6_ROUTER_ADVERTISEMENT_PROCESS */
712 
713 /* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION to NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */
714 #ifdef NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION
715 #ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION
716 #define NX_DISABLE_ICMPV6_ROUTER_SOLICITATION
717 #endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */
718 #endif /* NXDUO_DISABLE_ICMPV6_ROUTER_SOLICITATION */
719 
720 /* For backward compatibility, convert map NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE to NX_DISABLE_ICMPV6_ERROR_MESSAGE */
721 #ifdef NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE
722 #ifndef NX_DISABLE_ICMPV6_ERROR_MESSAGE
723 #define NX_DISABLE_ICMPV6_ERROR_MESSAGE
724 #endif /* NX_DISABLE_ICMPV6_ERROR_MESSAGE */
725 #endif /* NXDUO_DISABLE_ICMPV6_ERROR_MESSAGE */
726 
727 /* For backward compatibility, convert map NXDUO_DISABLE_DAD to NX_DISABLE_IPV6_DAD */
728 #ifdef NXDUO_DISABLE_DAD
729 #ifndef NX_DISABLE_IPV6_DAD
730 #define NX_DISABLE_IPV6_DAD
731 #endif /* NX_DISABLE_IPV6_DAD */
732 #endif /* NXDUO_DISABLE_DAD */
733 
734 /* For backward compatibility, convert map NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE to NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */
735 #ifdef NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE
736 #ifndef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
737 #define NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
738 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */
739 #endif /* NX_IPV6_ADDRESS_CHANGE_NOTIFY_ENABLE */
740 
741 /* For backward compatibility, convert map NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES to NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */
742 #ifdef NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES
743 #ifndef NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES
744 #define NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES
745 #endif /* NX_DISABLE_IPV6_PURGE_UNUSED_CACHE_ENTRIES */
746 #endif /* NX_IPV6_DISABLE_PURGE_UNUSED_CACHE_ENTRIES */
747 
748 /* For backward compatibility, convert map NX_IPV6_MULTICAST_ENABLE to NX_ENABLE_IPV6_MULTICAST */
749 #ifdef NX_IPV6_MULTICAST_ENABLE
750 #ifndef NX_ENABLE_IPV6_MULTICAST
751 #define NX_ENABLE_IPV6_MULTICAST
752 #endif /* NX_ENABLE_IPV6_MULTICAST */
753 #endif /* NX_IPV6_MULTICAST_ENABLE */
754 
755 /* Define the size of the IPv6 destination table. */
756 /* For backward compatibility, convert map NX_DESTINATION_TABLE_SIZE and NXDUO_DESTINATION_TABLE_SIZE to NX_IPV6_DESTINATION_TABLE_SIZE */
757 #ifdef NX_DESTINATION_TABLE_SIZE
758 #define NX_IPV6_DESTINATION_TABLE_SIZE  NX_DESTINATION_TABLE_SIZE
759 #endif /* NX_DESTINATION_TABLE_SIZE */
760 
761 #ifdef NXDUO_DESTINATION_TABLE_SIZE
762 #define NX_IPV6_DESTINATION_TABLE_SIZE  NXDUO_DESTINATION_TABLE_SIZE
763 #endif /* NXDUO_DESTINATION_TABLE_SIZE */
764 
765 #ifndef NX_IPV6_DESTINATION_TABLE_SIZE
766 #define NX_IPV6_DESTINATION_TABLE_SIZE  8
767 #ifndef NX_DESTINATION_TABLE_SIZE
768 #define NX_DESTINATION_TABLE_SIZE       NX_IPV6_DESTINATION_TABLE_SIZE
769 #endif /* NX_DESTINATION_TABLE_SIZE */
770 #ifndef NXDUO_DESTINATION_TABLE_SIZE
771 #define NXDUO_DESTINATION_TABLE_SIZE    NX_IPV6_DESTINATION_TABLE_SIZE
772 #endif /* NXDUO_DESTINATION_TABLE_SIZE */
773 #endif /* NX_IPV6_DESTINATION_TABLE_SIZE */
774 
775 /* Define the size of the IPv6 ND cache table. */
776 #ifndef NX_IPV6_NEIGHBOR_CACHE_SIZE
777 #define NX_IPV6_NEIGHBOR_CACHE_SIZE     16
778 #endif /* NX_IPV6_NEIGHBOR_CACHE_SIZE */
779 
780 /* Define the maximum ICMPv6 Duplicate Address Detect Transmit .  */
781 /* For backward compatibility, convert map NX_DUP_ADDR_DETECT_TRANSMITS and NXDUO_DUP_ADDR_DETECT_TRANSMITS to NX_IPV6_DAD_TRANSMITS */
782 #ifdef NX_DUP_ADDR_DETECT_TRANSMITS
783 #define NX_IPV6_DAD_TRANSMITS           NX_DUP_ADDR_DETECT_TRANSMITS
784 #endif /* NX_DUP_ADDR_DETECT_TRANSMITS */
785 
786 #ifdef NXDUO_DUP_ADDR_DETECT_TRANSMITS
787 #define NX_IPV6_DAD_TRANSMITS           NXDUO_DUP_ADDR_DETECT_TRANSMITS
788 #endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */
789 
790 #ifndef NX_IPV6_DAD_TRANSMITS
791 #define NX_IPV6_DAD_TRANSMITS           3
792 #ifndef NX_DUP_ADDR_DETECT_TRANSMITS
793 #define NX_DUP_ADDR_DETECT_TRANSMITS    NX_IPV6_DAD_TRANSMITS
794 #endif /* NX_DUP_ADDR_DETECT_TRANSMITS */
795 #ifndef NXDUO_DUP_ADDR_DETECT_TRANSMITS
796 #define NXDUO_DUP_ADDR_DETECT_TRANSMITS NX_IPV6_DAD_TRANSMITS
797 #endif /* NXDUO_DUP_ADDR_DETECT_TRANSMITS */
798 #endif /* NX_IPV6_DAD_TRANSMITS */
799 
800 /* For backward compatibility, convert map NX_ARP_DISABLE_AUTO_ARP_ENTRY to NX_DISABLE_ARP_AUTO_ENTRY. */
801 #ifdef NX_ARP_DISABLE_AUTO_ARP_ENTRY
802 #ifndef NX_DISABLE_ARP_AUTO_ENTRY
803 #define NX_DISABLE_ARP_AUTO_ENTRY
804 #endif /* NX_DISABLE_ARP_AUTO_ENTRY */
805 #endif /* NX_ARP_DISABLE_AUTO_ARP_ENTRY */
806 
807 /* For backward compatibility, convert map NX_TCP_ENABLE_KEEPALIVE to NX_ENABLE_TCP_KEEPALIVE. */
808 #ifdef NX_TCP_ENABLE_KEEPALIVE
809 #ifndef NX_ENABLE_TCP_KEEPALIVE
810 #define NX_ENABLE_TCP_KEEPALIVE
811 #endif /* NX_ENABLE_TCP_KEEPALIVE */
812 #endif /* NX_TCP_ENABLE_KEEPALIVE */
813 
814 /* For backward compatibility, convert map NX_TCP_ENABLE_WINDOW_SCALING to NX_ENABLE_TCP_WINDOW_SCALING. */
815 #ifdef NX_TCP_ENABLE_WINDOW_SCALING
816 #ifndef NX_ENABLE_TCP_WINDOW_SCALING
817 #define NX_ENABLE_TCP_WINDOW_SCALING
818 #endif /* NX_ENABLE_TCP_WINDOW_SCALING */
819 #endif /* NX_TCP_ENABLE_WINDOW_SCALING */
820 
821 /* For backward compatibility, convert map NX_TCP_ENABLE_MSS_CHECK to NX_ENABLE_TCP_MSS_CHECK. */
822 #ifdef NX_TCP_ENABLE_MSS_CHECK
823 #ifndef NX_ENABLE_TCP_MSS_CHECK
824 #define NX_ENABLE_TCP_MSS_CHECK
825 #endif /* NX_ENABLE_TCP_MSS_CHECK */
826 #endif /* NX_TCP_ENABLE_MSS_CHECK */
827 
828 /* For backward compatibility, convert map NX_DUAL_PACKET_POOL_ENABLE to NX_ENABLE_DUAL_PACKET_POOL. */
829 #ifdef NX_DUAL_PACKET_POOL_ENABLE
830 #ifndef NX_ENABLE_DUAL_PACKET_POOL
831 #define NX_ENABLE_DUAL_PACKET_POOL
832 #endif /* NX_ENABLE_DUAL_PACKET_POOL. */
833 #endif /* NX_DUAL_PACKET_POOL_ENABLE */
834 
835 /* For backward compatibility, convert map NX_ENABLE_FEATURE_LOW_WATERMARK to NX_ENABLE_LOW_WATERMARK. */
836 #ifdef NX_ENABLE_FEATURE_LOW_WATERMARK
837 #ifndef NX_ENABLE_LOW_WATERMARK
838 #define NX_ENABLE_LOW_WATERMARK
839 #endif /* NX_ENABLE_LOW_WATERMARK */
840 #endif /* NX_ENABLE_FEATURE_LOW_WATERMARK */
841 
842 #ifdef NX_DISABLE_ICMP_RX_CHECKSUM
843 #ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM
844 #define NX_DISABLE_ICMPV4_RX_CHECKSUM
845 #endif
846 #ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM
847 #define NX_DISABLE_ICMPV6_RX_CHECKSUM
848 #endif
849 #endif /* NX_DISABLE_ICMP_RX_CHECKSUM */
850 
851 #ifdef NX_DISABLE_ICMP_TX_CHECKSUM
852 #ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM
853 #define NX_DISABLE_ICMPV4_TX_CHECKSUM
854 #endif
855 #ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM
856 #define NX_DISABLE_ICMPV6_TX_CHECKSUM
857 #endif
858 #endif /* NX_DISABLE_ICMP_TX_CHECKSUM */
859 
860 /* For backward compatibility, convert map NX_DISABLE_ICMPv4_RX_CHECKSUM to NX_DISABLE_ICMPV4_RX_CHECKSUM. */
861 #ifdef NX_DISABLE_ICMPv4_RX_CHECKSUM
862 #ifndef NX_DISABLE_ICMPV4_RX_CHECKSUM
863 #define NX_DISABLE_ICMPV4_RX_CHECKSUM
864 #endif /* NX_DISABLE_ICMPV4_RX_CHECKSUM */
865 #endif /* NX_DISABLE_ICMPv4_RX_CHECKSUM */
866 
867 /* For backward compatibility, convert map NX_DISABLE_ICMPv4_TX_CHECKSUM to NX_DISABLE_ICMPV4_TX_CHECKSUM. */
868 #ifdef NX_DISABLE_ICMPv4_TX_CHECKSUM
869 #ifndef NX_DISABLE_ICMPV4_TX_CHECKSUM
870 #define NX_DISABLE_ICMPV4_TX_CHECKSUM
871 #endif /* NX_DISABLE_ICMPV4_TX_CHECKSUM */
872 #endif /* NX_DISABLE_ICMPv4_TX_CHECKSUM */
873 
874 /* For backward compatibility, convert map NX_DISABLE_ICMPv6_RX_CHECKSUM to NX_DISABLE_ICMPV6_RX_CHECKSUM. */
875 #ifdef NX_DISABLE_ICMPv6_RX_CHECKSUM
876 #ifndef NX_DISABLE_ICMPV6_RX_CHECKSUM
877 #define NX_DISABLE_ICMPV6_RX_CHECKSUM
878 #endif /* NX_DISABLE_ICMPV6_RX_CHECKSUM */
879 #endif /* NX_DISABLE_ICMPv6_RX_CHECKSUM */
880 
881 /* For backward compatibility, convert map NX_DISABLE_ICMPv6_TX_CHECKSUM to NX_DISABLE_ICMPV6_TX_CHECKSUM. */
882 #ifdef NX_DISABLE_ICMPv6_TX_CHECKSUM
883 #ifndef NX_DISABLE_ICMPV6_TX_CHECKSUM
884 #define NX_DISABLE_ICMPV6_TX_CHECKSUM
885 #endif /* NX_DISABLE_ICMPV6_TX_CHECKSUM */
886 #endif /* NX_DISABLE_ICMPv6_TX_CHECKSUM */
887 
888 
889 
890 #ifdef NX_ENABLE_EXTENDED_NOTIFY_SUPPORT
891 #ifdef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
892 #undef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
893 #endif /* NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */
894 #else
895 #define NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
896 #endif /* !NX_ENABLE_EXTENDED_NOTIFY_SUPPORT */
897 
898 /* Define the IPv4 fragment options.  */
899 
900 #define NX_FRAGMENT_OKAY                       ((ULONG)0x00000000)
901 #define NX_DONT_FRAGMENT                       ((ULONG)0x00004000)
902 #define NX_MORE_FRAGMENTS                      ((ULONG)0x00002000)
903 #define NX_FRAG_OFFSET_MASK                    ((ULONG)0x00001FFF)
904 
905 
906 /* Define the IPv4 Type Of Service constants.  These will be supplied to the
907    IPv4 output packet routine.  */
908 
909 #define NX_IP_NORMAL                           ((ULONG)0x00000000) /* Normal IP delivery                     */
910 #define NX_IP_MIN_DELAY                        ((ULONG)0x00100000) /* Minimum Delay delivery                 */
911 #define NX_IP_MAX_DATA                         ((ULONG)0x00080000) /* Maximum Throughput delivery            */
912 #define NX_IP_MAX_RELIABLE                     ((ULONG)0x00040000) /* Maximum Reliable delivery              */
913 #define NX_IP_MIN_COST                         ((ULONG)0x00020000) /* Minimum Cost deliver                   */
914 #define NX_IP_TOS_MASK                         ((ULONG)0x00FF0000) /* Type of Service Mask                   */
915 
916 
917 /* Define the IPv4 length mask.   */
918 
919 #define NX_IP_PACKET_SIZE_MASK                 ((ULONG)0x0000FFFF) /* Mask for isolating the IP packet length */
920 
921 
922 /* Define the IPv4 default time to live.  */
923 
924 #define NX_IP_TIME_TO_LIVE                     ((ULONG)0x00000080) /* Default packet time to live            */
925 #define NX_IP_TIME_TO_LIVE_MASK                ((ULONG)0xFF000000) /* Mask for isolating the time to live    */
926 #define NX_IP_TIME_TO_LIVE_SHIFT               24                  /* Number of bits to shift left           */
927 
928 
929 
930 
931 /* Define IPv6 protocol types.  These types are used in the
932    "next header" field in IPv6 header and optional headers. */
933 #define NX_PROTOCOL_NEXT_HEADER_HOP_BY_HOP     0
934 #define NX_PROTOCOL_ICMP                       1
935 #define NX_PROTOCOL_IGMP                       2
936 #define NX_PROTOCOL_IPV4                       4   /* IP-in-IP encapsulation */
937 #define NX_PROTOCOL_TCP                        6
938 #define NX_PROTOCOL_UDP                        17
939 #define NX_PROTOCOL_IPV6                       41  /* IP-in-IP encapsulation */
940 #define NX_PROTOCOL_NEXT_HEADER_ROUTING        43
941 #define NX_PROTOCOL_NEXT_HEADER_FRAGMENT       44
942 #define NX_PROTOCOL_NEXT_HEADER_ENCAP_SECURITY 50
943 #define NX_PROTOCOL_NEXT_HEADER_AUTHENTICATION 51
944 #define NX_PROTOCOL_ICMPV6                     58
945 #define NX_PROTOCOL_NO_NEXT_HEADER             59
946 #define NX_PROTOCOL_NEXT_HEADER_DESTINATION    60
947 #define NX_PROTOCOL_NEXT_HEADER_MOBILE         135
948 
949 /* Define the type of Protocol in this IPv6 packet.  */
950 /* Note that these values can be directly mapped to the protocol field in an IPv4 header. */
951 #define NX_IP_ICMP                             ((ULONG)0x00010000) /* ICMP Protocol Type                     */
952 #define NX_IP_IGMP                             ((ULONG)0x00020000) /* IGMP Protocol Type                     */
953 #define NX_IP_TCP                              ((ULONG)0x00060000) /* TCP Protocol Type                      */
954 #define NX_IP_UDP                              ((ULONG)0x00110000) /* UDP Protocol Type                      */
955 #define NX_IP_ESP                              ((ULONG)0x00320000) /* ESP Protocol Type                      */
956 #define NX_IP_AH                               ((ULONG)0x00330000) /* UDP Protocol Type                      */
957 #define NX_IP_PROTOCOL_MASK                    ((ULONG)0x00FF0000) /* Protocol Type mask                     */
958 
959 
960 /* Define IPv4 address type masks and values.  These will determine the net id and
961    host id fields of the supplied IPv4 address.  */
962 
963 #define NX_IP_CLASS_A_MASK                     ((ULONG)0x80000000) /* Define mask for class A IP addresses   */
964 #define NX_IP_CLASS_A_TYPE                     ((ULONG)0x00000000) /* Define class A address type            */
965 #define NX_IP_CLASS_A_NETID                    ((ULONG)0x7F000000) /* Define class A network ID mask         */
966 #define NX_IP_CLASS_A_HOSTID                   ((ULONG)0x00FFFFFF) /* Define class A host ID mask            */
967 
968 #define NX_IP_CLASS_B_MASK                     ((ULONG)0xC0000000) /* Define mask for class B IP addresses   */
969 #define NX_IP_CLASS_B_TYPE                     ((ULONG)0x80000000) /* Define class B address type            */
970 #define NX_IP_CLASS_B_NETID                    ((ULONG)0x3FFF0000) /* Define class B network ID mask         */
971 #define NX_IP_CLASS_B_HOSTID                   ((ULONG)0x0000FFFF) /* Define class B host ID mask            */
972 
973 #define NX_IP_CLASS_C_MASK                     ((ULONG)0xE0000000) /* Define mask for class C IP addresses   */
974 #define NX_IP_CLASS_C_TYPE                     ((ULONG)0xC0000000) /* Define class C address type            */
975 #define NX_IP_CLASS_C_NETID                    ((ULONG)0x1FFFFF00) /* Define class C network ID mask         */
976 #define NX_IP_CLASS_C_HOSTID                   ((ULONG)0x000000FF) /* Define class C host ID mask            */
977 
978 #define NX_IP_CLASS_D_MASK                     ((ULONG)0xF0000000) /* Define mask for class D IP addresses   */
979 #define NX_IP_CLASS_D_TYPE                     ((ULONG)0xE0000000) /* Define class D address type            */
980 #define NX_IP_CLASS_D_GROUP                    ((ULONG)0x0FFFFFFF) /* Define class D group ID mask           */
981 #define NX_IP_CLASS_D_HOSTID                   ((ULONG)0x00000000) /* Define class D host ID mask N/A        */
982 
983 #define NX_IP_LIMITED_BROADCAST                ((ULONG)0xFFFFFFFF) /* Limited broadcast address (local net)  */
984 #define NX_IP_LOOPBACK_FIRST                   ((ULONG)0x7F000000) /* First loopback address 127.0.0.0       */
985 #define NX_IP_LOOPBACK_LAST                    ((ULONG)0x7FFFFFFF) /* Last loopback address  127.255.255.255 */
986 
987 #define NX_IP_MULTICAST_UPPER                  ((ULONG)0x00000100) /* Upper two bytes of multicast Ethernet  */
988 #define NX_IP_MULTICAST_LOWER                  ((ULONG)0x5E000000) /* Lower 23 bits of address are from IP   */
989 #define NX_IP_MULTICAST_MASK                   ((ULONG)0x007FFFFF) /* Mask to pickup the lower 23 bits of IP */
990 
991 
992 /* Define the constants that determine how big the hash table is for destination IP
993    addresses.  The value must be a power of two, so subtracting one gives us
994    the mask.  */
995 
996 #define NX_ROUTE_TABLE_SIZE                    32
997 #define NX_ROUTE_TABLE_MASK                    (NX_ROUTE_TABLE_SIZE - 1)
998 
999 /* By default use 0xFF when sending raw packet.  */
1000 #ifndef NX_IP_RAW
1001 #define NX_IP_RAW                              0x00FF0000
1002 #endif /* NX_IP_RAW */
1003 
1004 /*
1005  * NX_ROUTE_TABLE_SIZE|MASK are used for ARP table. So we define NX_ARP_TABLE_SIZE|MASK so the
1006  *    macro names are more descriptive.
1007  *
1008  * NX_ROUTE_TABLE_SIZE and NX_ROUTE_TABLE_MASK will be deprecated in future releases.
1009  */
1010 #define NX_ARP_TABLE_SIZE                      NX_ROUTE_TABLE_SIZE
1011 #define NX_ARP_TABLE_MASK                      (NX_ARP_TABLE_SIZE - 1)
1012 
1013 
1014 
1015 #ifdef FEATURE_NX_IPV6
1016 /* Define IPv6 address state.  These states are defined in RFC 2462. */
1017 
1018 #define NX_IPV6_ADDR_STATE_UNKNOWN             0x00
1019 #define NX_IPV6_ADDR_STATE_TENTATIVE           0x01
1020 #define NX_IPV6_ADDR_STATE_PREFERRED           0x02
1021 #define NX_IPV6_ADDR_STATE_DEPRECATED          0x03
1022 #define NX_IPV6_ADDR_STATE_VALID               0x04
1023 
1024 
1025 
1026 /* Define the size of the IPv6 Default Router Table. */
1027 #ifndef NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE
1028 #define NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE      8
1029 #endif /* NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE */
1030 
1031 /* Define the size of the IPv6 prefix table. */
1032 #ifndef NX_IPV6_PREFIX_LIST_TABLE_SIZE
1033 #define NX_IPV6_PREFIX_LIST_TABLE_SIZE         8
1034 #endif /* NX_IPV6_PREFIX_LIST_TABLE_SIZE */
1035 
1036 /* Flags for the IPv6 default router table status field. */
1037 #define NX_IPV6_ROUTE_TYPE_NOT_ROUTER          0x00
1038 #define NX_IPV6_ROUTE_TYPE_SOLICITATED         0x01
1039 #define NX_IPV6_ROUTE_TYPE_UNSOLICITATED       0x02
1040 #define NX_IPV6_ROUTE_TYPE_STATIC              0x04
1041 #define NX_IPV6_ROUTE_TYPE_DEFAULT             0x40
1042 #define NX_IPV6_ROUTE_TYPE_VALID               0x80
1043 
1044 #define NX_IPV6_ADDRESS_NOT_CONFIGURED         0
1045 #define NX_IPV6_ADDRESS_MANUAL_CONFIG          1
1046 #ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
1047 #define NX_IPV6_ADDRESS_STATELESS_AUTO_CONFIG  2
1048 #define NX_IPV6_ADDRESS_STATEFUL_AUTO_CONFIG   3
1049 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */
1050 #define NX_IPV6_ADDRESS_BASED_ON_INTERFACE     4
1051 #define NX_IPV6_ADDRESS_MANUAL_DELETE          5
1052 #ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
1053 #define NX_IPV6_ADDRESS_LIFETIME_EXPIRED       6
1054 #define NX_IPV6_ADDRESS_DAD_SUCCESSFUL         7
1055 #define NX_IPV6_ADDRESS_DAD_FAILURE            8
1056 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */
1057 
1058 
1059 
1060 /* Define the maximum number of packets that can be queued while waiting for Neighbor Discovery
1061    to resolution of an IPv6 address.  */
1062 #ifndef NX_ND_MAX_QUEUE_DEPTH
1063 #define NX_ND_MAX_QUEUE_DEPTH                  4
1064 #endif
1065 
1066 /* Define the ND cache entry structure. */
1067 typedef struct ND_CACHE_ENTRY_STRUCT
1068 {
1069 
1070     /* Neighbor IP address. */
1071     ULONG nx_nd_cache_dest_ip[4];
1072 
1073     /* Corresponding LLA.   */
1074     UCHAR nx_nd_cache_mac_addr[6];
1075 
1076     /* Padding.  Reserved for future use. */
1077     /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved1) suppress member not referenced. It is reserved for future use. */
1078     UCHAR nx_nd_cache_reserved1;
1079 
1080     /* Padding.  Reserved for future use. */
1081     /*lint -esym(768,ND_CACHE_ENTRY_STRUCT::nx_nd_cache_reserved2) suppress member not referenced. It is reserved for future use. */
1082     UCHAR nx_nd_cache_reserved2;
1083 
1084     /* Number of Solicitation it needs to send before timing out. */
1085     UCHAR nx_nd_cache_num_solicit;
1086 
1087     /* Entry Status, such as INCOMPLETE, REACHABLE, and so on. */
1088     UCHAR nx_nd_cache_nd_status;
1089 
1090     /* Number of out going packets waiting for this entry to be resolved. */
1091     UCHAR nx_nd_cache_packet_waiting_queue_length;
1092 
1093     /* Whether or not this entry is statically configured. */
1094     UCHAR nx_nd_cache_is_static;
1095 
1096     /* Timeout value. */
1097     ULONG nx_nd_cache_timer_tick;
1098 
1099     /* Interface through which the destination can be reached. */
1100     struct NX_INTERFACE_STRUCT *nx_nd_cache_interface_ptr;
1101 
1102     /* Link to the default router table, if this neighbor is a router. */
1103     struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT *nx_nd_cache_is_router;
1104 
1105     /*
1106      * Queue head and queue tail of the out going packets.
1107      * This queue is used for keeping outgoing packets while the stack is
1108      * resolving the target link layer address.
1109      */
1110     struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_head;
1111     struct NX_PACKET_STRUCT *nx_nd_cache_packet_waiting_tail;
1112 
1113     /*
1114      * Local interface associated with this neighbor entry. If outoing_address is known
1115      * outgoing packets shall be sent using this address.
1116      */
1117     struct NXD_IPV6_ADDRESS_STRUCT *nx_nd_cache_outgoing_address;
1118 } ND_CACHE_ENTRY;
1119 
1120 /* Define the destination table entry type. */
1121 typedef struct NX_IPV6_DESTINATION_ENTRY_STRUCT
1122 {
1123     /* Flag indicates whether or not the entry is valid. */
1124     ULONG nx_ipv6_destination_entry_valid;
1125 
1126     /* Destination IP address. */
1127     ULONG nx_ipv6_destination_entry_destination_address[4];
1128 
1129     /* Next hop address.  Next hop could be the host, if it
1130        is on the local network, or a router. */
1131     ULONG nx_ipv6_destination_entry_next_hop[4];
1132 
1133     /* Cross link to the next hop entry in the ND cache. */
1134     ND_CACHE_ENTRY *nx_ipv6_destination_entry_nd_entry;
1135 
1136 #ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY
1137 
1138     /* Maximum transmission size for this destination. */
1139     ULONG nx_ipv6_destination_entry_path_mtu;
1140 
1141     /* MTU Timeout value. */
1142     ULONG nx_ipv6_destination_entry_MTU_timer_tick;
1143 #endif
1144 } NX_IPV6_DESTINATION_ENTRY;
1145 
1146 /* Define data structure for IPv6 prefix table. */
1147 typedef struct NX_IPV6_PREFIX_ENTRY_STRUCT
1148 {
1149     /* Network IPv6 prefix address, in host byte order. */
1150     ULONG nx_ipv6_prefix_entry_network_address[4];
1151 
1152     /* Number of valid bits in the prefix. */
1153     ULONG nx_ipv6_prefix_entry_prefix_length;
1154 
1155     /* Valid life time, in seconds. */
1156     ULONG nx_ipv6_prefix_entry_valid_lifetime;
1157 
1158     /* Pointer to the previous entry. */
1159     struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_prev;
1160 
1161     /* Pointer to the next entry. */
1162     struct NX_IPV6_PREFIX_ENTRY_STRUCT *nx_ipv6_prefix_entry_next;
1163 } NX_IPV6_PREFIX_ENTRY;
1164 
1165 
1166 /* Define data structure for IPv6 default router table. */
1167 typedef struct NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT
1168 {
1169     /* route type */
1170     UCHAR nx_ipv6_default_router_entry_flag;
1171 
1172     /* Reserved for future expansion. */
1173     /*lint -esym(768,NX_IPV6_DEFAULT_ROUTER_ENTRY_STRUCT::nx_ipv6_default_router_entry_reserved) suppress member not referenced. It is reserved for future use. */
1174     UCHAR nx_ipv6_default_router_entry_reserved;
1175 
1176     /* Router Life Time, in seconds, host-byte order. */
1177     USHORT nx_ipv6_default_router_entry_life_time;
1178 
1179     /* Router interface address. */
1180     ULONG nx_ipv6_default_router_entry_router_address[4];
1181 
1182     /* Router interface index.  */
1183     struct NX_INTERFACE_STRUCT *nx_ipv6_default_router_entry_interface_ptr;
1184 
1185     /* Point to the corresonding neighbor cache entry. */
1186     ND_CACHE_ENTRY *nx_ipv6_default_router_entry_neighbor_cache_ptr;
1187 } NX_IPV6_DEFAULT_ROUTER_ENTRY;
1188 
1189 #endif /* FEATURE_NX_IPV6 */
1190 /* Define the constants that determine how big the hash table is for UDP ports.  The
1191    value must be a power of two, so subtracting one gives us the mask.  */
1192 
1193 #define NX_UDP_PORT_TABLE_SIZE                     32
1194 #define NX_UDP_PORT_TABLE_MASK                     (NX_UDP_PORT_TABLE_SIZE - 1)
1195 
1196 
1197 /* Define the constants that determine how big the hash table is for TCP ports.  The
1198    value must be a power of two, so subtracting one gives us the mask.  */
1199 
1200 #define NX_TCP_PORT_TABLE_SIZE                     32
1201 #define NX_TCP_PORT_TABLE_MASK                     (NX_TCP_PORT_TABLE_SIZE - 1)
1202 
1203 
1204 /* Define the maximum number of multicast groups the system can support.  This might
1205    be further limited by the underlying physical hardware.  */
1206 
1207 #ifndef NX_MAX_MULTICAST_GROUPS
1208 #define NX_MAX_MULTICAST_GROUPS                    7
1209 #endif
1210 
1211 /* The following symbol defines the number of IPv6 addresses in the system.
1212    A typical system shall have 2 IPv6 addresses: one linklocal address and one global address.  */
1213 
1214 
1215 /* Define the maximum number of internal server resources for TCP connections.  Server
1216    connections require a listen control structure.  */
1217 
1218 #ifndef NX_MAX_LISTEN_REQUESTS
1219 #define NX_MAX_LISTEN_REQUESTS                     10
1220 #endif
1221 
1222 /* Define the max length of username and password for HTTP Proxy authentication.  */
1223 
1224 /* Define the max length of username.  */
1225 #ifndef NX_HTTP_PROXY_MAX_USERNAME
1226 #define NX_HTTP_PROXY_MAX_USERNAME                 20
1227 #endif
1228 
1229 /* Define the max length of password.  */
1230 #ifndef NX_HTTP_PROXY_MAX_PASSWORD
1231 #define NX_HTTP_PROXY_MAX_PASSWORD                 20
1232 #endif
1233 
1234 /* NX_HTTP_PROXY_MAX_AUTHENTICATION is the max length of base64 of "name:password",
1235    1 bytes for an extra conversion if needed, 2 bytes for pad if needed, 1 byte for null terminator and four byte alignment. */
1236 #define NX_HTTP_PROXY_MAX_AUTHENTICATION           (((((NX_HTTP_PROXY_MAX_USERNAME + NX_HTTP_PROXY_MAX_PASSWORD  + 1 ) * 4 / 3) + 1 + 2 + 1) / 4 + 1) * 4)
1237 
1238 
1239 /* Define the IP status checking/return bits.  */
1240 
1241 #define NX_IP_INITIALIZE_DONE                      ((ULONG)0x0001)
1242 #define NX_IP_ADDRESS_RESOLVED                     ((ULONG)0x0002)
1243 #define NX_IP_LINK_ENABLED                         ((ULONG)0x0004)
1244 #define NX_IP_ARP_ENABLED                          ((ULONG)0x0008)
1245 #define NX_IP_UDP_ENABLED                          ((ULONG)0x0010)
1246 #define NX_IP_TCP_ENABLED                          ((ULONG)0x0020)
1247 #define NX_IP_IGMP_ENABLED                         ((ULONG)0x0040)
1248 #define NX_IP_RARP_COMPLETE                        ((ULONG)0x0080)
1249 #define NX_IP_INTERFACE_LINK_ENABLED               ((ULONG)0x0100)
1250 
1251 /* Define various states in the TCP connection state machine.  */
1252 
1253 #define NX_TCP_CLOSED                              1  /* Connection is closed state   */
1254 #define NX_TCP_LISTEN_STATE                        2  /* Server listen state          */
1255 #define NX_TCP_SYN_SENT                            3  /* SYN sent state               */
1256 #define NX_TCP_SYN_RECEIVED                        4  /* SYN received state           */
1257 #define NX_TCP_ESTABLISHED                         5  /* Connection established state */
1258 #define NX_TCP_CLOSE_WAIT                          6  /* Close Wait state             */
1259 #define NX_TCP_FIN_WAIT_1                          7  /* Finished Wait 1 state        */
1260 #define NX_TCP_FIN_WAIT_2                          8  /* Finished Wait 2 state        */
1261 #define NX_TCP_CLOSING                             9  /* Closing state                */
1262 #define NX_TCP_TIMED_WAIT                          10 /* Timed wait state             */
1263 #define NX_TCP_LAST_ACK                            11 /* Last ACK state               */
1264 
1265 
1266 /* API return values.  */
1267 
1268 #define NX_SUCCESS                                 0x00
1269 #define NX_NO_PACKET                               0x01
1270 #define NX_UNDERFLOW                               0x02
1271 #define NX_OVERFLOW                                0x03
1272 #define NX_NO_MAPPING                              0x04
1273 #define NX_DELETED                                 0x05
1274 #define NX_POOL_ERROR                              0x06
1275 #define NX_PTR_ERROR                               0x07
1276 #define NX_WAIT_ERROR                              0x08
1277 #define NX_SIZE_ERROR                              0x09
1278 #define NX_OPTION_ERROR                            0x0a
1279 #define NX_DELETE_ERROR                            0x10
1280 #define NX_CALLER_ERROR                            0x11
1281 #define NX_INVALID_PACKET                          0x12
1282 #define NX_INVALID_SOCKET                          0x13
1283 #define NX_NOT_ENABLED                             0x14
1284 #define NX_ALREADY_ENABLED                         0x15
1285 #define NX_ENTRY_NOT_FOUND                         0x16
1286 #define NX_NO_MORE_ENTRIES                         0x17
1287 #define NX_ARP_TIMER_ERROR                         0x18
1288 #define NX_RESERVED_CODE0                          0x19
1289 #define NX_WAIT_ABORTED                            0x1A
1290 #define NX_IP_INTERNAL_ERROR                       0x20
1291 #define NX_IP_ADDRESS_ERROR                        0x21
1292 #define NX_ALREADY_BOUND                           0x22
1293 #define NX_PORT_UNAVAILABLE                        0x23
1294 #define NX_NOT_BOUND                               0x24
1295 #define NX_RESERVED_CODE1                          0x25
1296 #define NX_SOCKET_UNBOUND                          0x26
1297 #define NX_NOT_CREATED                             0x27
1298 #define NX_SOCKETS_BOUND                           0x28
1299 #define NX_NO_RESPONSE                             0x29
1300 #define NX_POOL_DELETED                            0x30
1301 #define NX_ALREADY_RELEASED                        0x31
1302 #define NX_RESERVED_CODE2                          0x32
1303 #define NX_MAX_LISTEN                              0x33
1304 #define NX_DUPLICATE_LISTEN                        0x34
1305 #define NX_NOT_CLOSED                              0x35
1306 #define NX_NOT_LISTEN_STATE                        0x36
1307 #define NX_IN_PROGRESS                             0x37
1308 #define NX_NOT_CONNECTED                           0x38
1309 #define NX_WINDOW_OVERFLOW                         0x39
1310 #define NX_ALREADY_SUSPENDED                       0x40
1311 #define NX_DISCONNECT_FAILED                       0x41
1312 #define NX_STILL_BOUND                             0x42
1313 #define NX_NOT_SUCCESSFUL                          0x43
1314 #define NX_UNHANDLED_COMMAND                       0x44
1315 #define NX_NO_FREE_PORTS                           0x45
1316 #define NX_INVALID_PORT                            0x46
1317 #define NX_INVALID_RELISTEN                        0x47
1318 #define NX_CONNECTION_PENDING                      0x48
1319 #define NX_TX_QUEUE_DEPTH                          0x49
1320 #define NX_NOT_IMPLEMENTED                         0x4A
1321 #define NX_NOT_SUPPORTED                           0x4B
1322 #define NX_INVALID_INTERFACE                       0x4C
1323 #define NX_INVALID_PARAMETERS                      0x4D
1324 #define NX_NOT_FOUND                               0x4E
1325 #define NX_CANNOT_START                            0x4F
1326 #define NX_NO_INTERFACE_ADDRESS                    0x50
1327 #define NX_INVALID_MTU_DATA                        0x51
1328 #define NX_DUPLICATED_ENTRY                        0x52
1329 #define NX_PACKET_OFFSET_ERROR                     0x53
1330 #define NX_OPTION_HEADER_ERROR                     0x54
1331 #define NX_CONTINUE                                0x55
1332 #define NX_TCPIP_OFFLOAD_ERROR                     0x56
1333 
1334 /* Define Link Driver constants.  */
1335 
1336 #define NX_LINK_PACKET_SEND                        0
1337 #define NX_LINK_INITIALIZE                         1
1338 #define NX_LINK_ENABLE                             2
1339 #define NX_LINK_DISABLE                            3
1340 #define NX_LINK_PACKET_BROADCAST                   4
1341 #define NX_LINK_ARP_SEND                           5
1342 #define NX_LINK_ARP_RESPONSE_SEND                  6
1343 #define NX_LINK_RARP_SEND                          7
1344 #define NX_LINK_MULTICAST_JOIN                     8
1345 #define NX_LINK_MULTICAST_LEAVE                    9
1346 #define NX_LINK_GET_STATUS                         10
1347 #define NX_LINK_GET_SPEED                          11
1348 #define NX_LINK_GET_DUPLEX_TYPE                    12
1349 #define NX_LINK_GET_ERROR_COUNT                    13
1350 #define NX_LINK_GET_RX_COUNT                       14
1351 #define NX_LINK_GET_TX_COUNT                       15
1352 #define NX_LINK_GET_ALLOC_ERRORS                   16
1353 #define NX_LINK_UNINITIALIZE                       17
1354 #define NX_LINK_DEFERRED_PROCESSING                18
1355 #define NX_LINK_INTERFACE_ATTACH                   19
1356 #define NX_LINK_SET_PHYSICAL_ADDRESS               20
1357 #define NX_INTERFACE_CAPABILITY_GET                21
1358 #define NX_INTERFACE_CAPABILITY_SET                22
1359 #define NX_LINK_INTERFACE_DETACH                   23
1360 #define NX_LINK_FACTORY_ADDRESS_GET                24
1361 #define NX_LINK_RX_ENABLE                          25
1362 #define NX_LINK_RX_DISABLE                         26
1363 #define NX_LINK_6LOWPAN_COMMAND                    27 /* 6LowPAN driver command, the sub command see nx_6lowpan.h.  */
1364 #define NX_LINK_GET_INTERFACE_TYPE                 28
1365 
1366 #define NX_LINK_USER_COMMAND                       50 /* Values after this value are reserved for application.  */
1367 
1368 
1369 /* Define operations for TCP/IP offload callback functions.  */
1370 #define NX_TCPIP_OFFLOAD_TCP_CLIENT_SOCKET_CONNECT  0
1371 #define NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_LISTEN   1
1372 #define NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_ACCEPT   2
1373 #define NX_TCPIP_OFFLOAD_TCP_SERVER_SOCKET_UNLISTEN 3
1374 #define NX_TCPIP_OFFLOAD_TCP_SOCKET_DISCONNECT      4
1375 #define NX_TCPIP_OFFLOAD_TCP_SOCKET_SEND            5
1376 #define NX_TCPIP_OFFLOAD_UDP_SOCKET_BIND            6
1377 #define NX_TCPIP_OFFLOAD_UDP_SOCKET_UNBIND          7
1378 #define NX_TCPIP_OFFLOAD_UDP_SOCKET_SEND            8
1379 
1380 
1381 /* Define Link Driver Capability Flags.  */
1382 #ifdef NX_ENABLE_INTERFACE_CAPABILITY
1383 #define NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM   0x00000001
1384 #define NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM   0x00000002
1385 #define NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM    0x00000004
1386 #define NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM    0x00000008
1387 #define NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM    0x00000010
1388 #define NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM    0x00000020
1389 #define NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM 0x00000040
1390 #define NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM 0x00000080
1391 #define NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM 0x00000100
1392 #define NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM 0x00000200
1393 #define NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM   0x00000400
1394 #define NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM   0x00000800
1395 #define NX_INTERFACE_CAPABILITY_PTP_TIMESTAMP      0x00001000
1396 #define NX_INTERFACE_CAPABILITY_TCPIP_OFFLOAD      0x00002000
1397 #define NX_INTERFACE_CAPABILITY_CHECKSUM_ALL       (NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM | \
1398                                                     NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM | \
1399                                                     NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM | \
1400                                                     NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM | \
1401                                                     NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM | \
1402                                                     NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM | \
1403                                                     NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM | \
1404                                                     NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM | \
1405                                                     NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM | \
1406                                                     NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM | \
1407                                                     NX_INTERFACE_CAPABILITY_IGMP_TX_CHECKSUM | \
1408                                                     NX_INTERFACE_CAPABILITY_IGMP_RX_CHECKSUM)
1409 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */
1410 
1411 #define NX_IP_VERSION_V4                           0x4
1412 #define NX_IP_VERSION_V6                           0x6
1413 
1414 #if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL)
1415 #define NX_STATELESS_ADDRESS_AUTOCONFIG_ENABLED    0
1416 #define NX_STATELESS_ADDRESS_AUTOCONFIG_DISABLED   1
1417 #endif /* defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) */
1418 
1419 /* Define the macro for building IPv4 addresses.  */
1420 #define IP_ADDRESS(a, b, c, d)                     ((((ULONG)a) << 24) | (((ULONG)b) << 16) | (((ULONG)c) << 8) | ((ULONG)d))
1421 
1422 /* Define the direction of IP packet. */
1423 #ifdef NX_ENABLE_IP_PACKET_FILTER
1424 #define NX_IP_PACKET_IN                            0
1425 #define NX_IP_PACKET_OUT                           1
1426 #endif /* NX_ENABLE_IP_PACKET_FILTER */
1427 
1428 /* Define the interface type.  */
1429 #define NX_INTERFACE_TYPE_UNKNOWN                  0
1430 #define NX_INTERFACE_TYPE_OTHER                    1
1431 #define NX_INTERFACE_TYPE_ETHERNET                 2
1432 #define NX_INTERFACE_TYPE_WIFI                     3
1433 #define NX_INTERFACE_TYPE_CELLULAR                 4
1434 #define NX_INTERFACE_TYPE_BLUETOOTH                5
1435 #define NX_INTERFACE_TYPE_LORAWAN                  6
1436 #define NX_INTERFACE_TYPE_MAX                      7
1437 
1438 #ifdef NX_ENABLE_THREAD
1439 /* Define the packet type for Thread MLE.  */
1440 #define NX_PACKET_TYPE_THREAD_MLE                  0x01
1441 #endif /* NX_ENABLE_THREAD  */
1442 
1443 /* Define IPv4/v6 Address structure */
1444 typedef struct NXD_ADDRESS_STRUCT
1445 {
1446     /* Flag indicating IP address format.  Valid values are:
1447        NX_IP_VERSION_V4 and NX_IP_VERSION_V6.
1448      */
1449     ULONG nxd_ip_version;
1450 
1451     /* Union that holds either IPv4 or IPv6 address. */
1452     union
1453     {
1454 
1455 #ifndef NX_DISABLE_IPV4
1456         ULONG v4;
1457 #endif /* NX_DISABLE_IPV4 */
1458 #ifdef FEATURE_NX_IPV6
1459         ULONG v6[4];
1460 #endif /* FEATURE_NX_IPV6 */
1461     } nxd_ip_address;
1462 } NXD_ADDRESS;
1463 
1464 
1465 #ifdef NX_IPSEC_ENABLE
1466 /* Define the selector for IPSEC or TUNNEL. */
1467 typedef struct NX_ADDRESS_SELECTOR_STRUCT
1468 {
1469     /* Define selector source, destination address. */
1470     NXD_ADDRESS nx_selector_src_address_start;
1471     NXD_ADDRESS nx_selector_src_address_end;
1472     NXD_ADDRESS nx_selector_dst_address_start;
1473     NXD_ADDRESS nx_selector_dst_address_end;
1474 } NX_ADDRESS_SELECTOR;
1475 
1476 #endif /* NX_IPSEC_ENABLE */
1477 
1478 
1479 /* Define the control block definitions for all system objects.  */
1480 
1481 
1482 /* Define the basic memory management packet structure.  This structure is
1483    used to hold application data as well as internal control data.  */
1484 struct NX_PACKET_POOL_STRUCT;
1485 
1486 #ifdef NX_ENABLE_PACKET_DEBUG_INFO
1487 /* Define macro to record packet debug information.  */
1488 #define NX_PACKET_DEBUG(f,l,p)  {\
1489         (p) -> nx_packet_debug_file=f;\
1490         (p) -> nx_packet_debug_line=l;\
1491         if (tx_thread_identify())                            \
1492             (p) -> nx_packet_debug_thread = tx_thread_identify() -> tx_thread_name;                            \
1493         else                            \
1494             (p) -> nx_packet_debug_thread = "ISR";                            \
1495                                 }
1496 #else
1497 #define NX_PACKET_DEBUG(f, l, p)
1498 #endif /* NX_ENABLE_PACKET_DEBUG_INFO */
1499 
1500 typedef  struct NX_PACKET_STRUCT
1501 {
1502 
1503     /* Define the pool this packet is associated with.  */
1504     struct NX_PACKET_POOL_STRUCT
1505                 *nx_packet_pool_owner;
1506 
1507 #ifndef NX_DISABLE_PACKET_CHAIN
1508     /* Define the link to the chain (one or more) of packet extensions.  If this is NULL, there
1509        are no packet extensions for this packet.  */
1510     struct NX_PACKET_STRUCT
1511                 *nx_packet_next;
1512 #endif /* NX_DISABLE_PACKET_CHAIN */
1513 
1514     /* Define the pointer to the first byte written closest to the beginning of the
1515        buffer.  This is used to prepend information in front of the packet.  */
1516     UCHAR       *nx_packet_prepend_ptr;
1517 
1518     /* Define the pointer to the byte after the last character written in the buffer.  */
1519     UCHAR       *nx_packet_append_ptr;
1520 
1521     /* Define the packet data area start and end pointer.  These will be used to
1522        mark the physical boundaries of the packet.  */
1523     UCHAR       *nx_packet_data_start;
1524     UCHAR       *nx_packet_data_end;
1525 
1526     /* The above data are required by all packets. */
1527     /* The following data are required by header packet when optimized packet is not disabled. */
1528 
1529 #ifndef NX_DISABLE_PACKET_CHAIN
1530     /* Define the link to the last packet (if any) in the chain.  This is used to append
1531        information to the end without having to traverse the entire chain.  */
1532     struct NX_PACKET_STRUCT
1533                 *nx_packet_last;
1534 #endif /* NX_DISABLE_PACKET_CHAIN */
1535 
1536     /* Define the link that will be used to queue the packet.  */
1537     struct NX_PACKET_STRUCT
1538                 *nx_packet_queue_next;
1539 
1540     /* Union that holds either tcp_queue_next or fragment_next. */
1541     union
1542     {
1543 
1544         /* Define the link that will be used to keep outgoing TCP packets queued
1545            so they can be ACKed or re-sent.  */
1546         struct NX_PACKET_STRUCT
1547                 *nx_packet_tcp_queue_next;
1548 
1549 #ifndef NX_DISABLE_FRAGMENTATION
1550         /* Define the link to the next fragment.  This is only used in IP fragmentation
1551            re-assembly.  */
1552         struct NX_PACKET_STRUCT
1553                 *nx_packet_fragment_next;
1554 #endif /* NX_DISABLE_FRAGMENTATION */
1555     } nx_packet_union_next;
1556 
1557     /* Define the total packet length.  */
1558     ULONG       nx_packet_length;
1559 
1560 #ifndef NX_DISABLE_FRAGMENTATION
1561     ULONG       nx_packet_reassembly_time;  /* Time stamp for measuring the number of seconds a
1562                                                packet is in the reassebmly logic.  Once a time
1563                                                out value is reached packets of the same FRAG ID
1564                                                are released. */
1565 #endif /* NX_DISABLE_FRAGMENTATION */
1566 
1567 #ifdef FEATURE_NX_IPV6
1568     UCHAR       nx_packet_option_state;  /* Used by IPv6, indicating the current option
1569                                             being processed. */
1570     UCHAR       nx_packet_destination_header;
1571     USHORT      nx_packet_option_offset;
1572 #endif /* FEATURE_NX_IPV6 */
1573 
1574 
1575     /*
1576        Tag the packet type. Valid values are either
1577        NX_IP_VERSION_V4 or NX_IP_VERSION_V6.
1578      */
1579     UCHAR       nx_packet_ip_version;
1580 
1581     /* RFC1122, Section3.2.1.5, Page32-33. RFC1122, Section4.2.2.15, Page90-91.  */
1582     /* nx_packet_identical_copy is to track the IP ID field in the IP header
1583        for the retransmitted TCP packet. The IP ID value should not change
1584        if the TCP header for a retransmitted packet is not changed.
1585 
1586        On retransmission, if the flag nx_packet_identical_copy is set, the same IP ID value is used for the retransmitted packet.
1587        Otherwise the value in the IP ID field is updated with the latest ID value in the IP instance.
1588      */
1589     UCHAR       nx_packet_identical_copy;
1590 
1591     /* Length of IP header including options. It is set for outgoing packet only. */
1592     UCHAR       nx_packet_ip_header_length;
1593 
1594     /*lint -esym(768,NX_PACKET_STRUCT::nx_packet_reserved) suppress member not referenced. It is reserved for future use. */
1595     UCHAR       nx_packet_reserved;
1596 
1597     /* Union that holds either IPv4 interface or IPv6 address. */
1598     union
1599     {
1600 
1601         /* Define the interface from which the packet was received, or the interface to transmit to. */
1602         struct NX_INTERFACE_STRUCT
1603                 *nx_packet_interface_ptr;
1604 
1605         /* Point to the interface IPv6 address structure.  On transmit or receive path. */
1606         struct NXD_IPV6_ADDRESS_STRUCT
1607                 *nx_packet_ipv6_address_ptr;
1608     } nx_packet_address;
1609 
1610 #define nx_packet_ip_interface nx_packet_address.nx_packet_interface_ptr
1611 
1612     /* Points to the beginning of IPv4/6 header.  This field is used for */
1613     /* quick refernece to the IP header, in case there are optional headers. */
1614     UCHAR       *nx_packet_ip_header;
1615 
1616 #ifdef NX_ENABLE_THREAD
1617     /* Define the packet type for MLE.  */
1618     UCHAR       nx_packet_type;
1619 
1620     /* Define the received signal strength.  */
1621     UCHAR       nx_packet_signal_strength;
1622 
1623     /* It is reserved for future use.  */
1624     UCHAR       nx_packet_thread_reserved[2];
1625 #endif /* NX_ENABLE_THREAD  */
1626 
1627 #ifdef NX_ENABLE_INTERFACE_CAPABILITY
1628     /* Define the capability flag of hardware to be used by the packet. */
1629     ULONG       nx_packet_interface_capability_flag;
1630 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */
1631 
1632 #ifdef NX_IPSEC_ENABLE
1633     VOID        *nx_packet_ipsec_sa_ptr;
1634 
1635     /* Used in HW engine non-block mode. */
1636     USHORT      nx_packet_ipsec_op;
1637 
1638     /* Indicate the current protocol being processed. */
1639     USHORT      nx_packet_ipsec_state;
1640 #endif /* NX_IPSEC_ENABLE */
1641 
1642 #ifdef NX_ENABLE_PACKET_DEBUG_INFO
1643     /* Indicate the current thread that owns the packet. */
1644     CHAR       *nx_packet_debug_thread;
1645 
1646     /* Indicate the current file that is processing the packet. */
1647     CHAR       *nx_packet_debug_file;
1648 
1649     /* Indicate the current function that is processing the packet. */
1650     ULONG       nx_packet_debug_line;
1651 #endif /* NX_ENABLE_PACKET_DEBUG_INFO */
1652 
1653 #ifdef NX_PACKET_HEADER_PAD
1654 
1655     /* Define a pad word for 16-byte alignment, if necessary.  */
1656     ULONG       nx_packet_packet_pad[NX_PACKET_HEADER_PAD_SIZE];
1657 #endif
1658 } NX_PACKET;
1659 
1660 
1661 /* Define the Packet Pool control block that will be used to manage each individual
1662    packet pool.  */
1663 
1664 typedef struct NX_PACKET_POOL_STRUCT
1665 {
1666 
1667     /* Define the block pool ID used for error checking.  */
1668     ULONG       nx_packet_pool_id;
1669 
1670     /* Define the packet pool's name.  */
1671     CHAR       *nx_packet_pool_name;
1672 
1673     /* Define the number of available memory packets in the pool.  */
1674     ULONG       nx_packet_pool_available;
1675 
1676     /* Save the initial number of blocks.  */
1677     ULONG       nx_packet_pool_total;
1678 
1679     /* Define statistics and error counters for this packet pool.  */
1680     ULONG       nx_packet_pool_empty_requests;
1681     ULONG       nx_packet_pool_empty_suspensions;
1682     ULONG       nx_packet_pool_invalid_releases;
1683 
1684     /* Define the head pointer of the available packet pool.  */
1685     struct NX_PACKET_STRUCT    *nx_packet_pool_available_list;
1686 
1687     /* Save the start address of the packet pool's memory area.  */
1688     CHAR       *nx_packet_pool_start;
1689 
1690     /* Save the packet pool's size in bytes.  */
1691     ULONG       nx_packet_pool_size;
1692 
1693     /* Save the individual packet payload size - rounded for alignment.  */
1694     ULONG       nx_packet_pool_payload_size;
1695 
1696     /* Define the packet pool suspension list head along with a count of
1697        how many threads are suspended.  */
1698     TX_THREAD  *nx_packet_pool_suspension_list;
1699     ULONG       nx_packet_pool_suspended_count;
1700 
1701     /* Define the created list next and previous pointers.  */
1702     struct NX_PACKET_POOL_STRUCT
1703                *nx_packet_pool_created_next,
1704                *nx_packet_pool_created_previous;
1705 
1706 #ifdef NX_ENABLE_LOW_WATERMARK
1707     /* Low watermark. */
1708     UINT        nx_packet_pool_low_watermark;
1709 #endif /* NX_ENABLE_LOW_WATERMARK */
1710 } NX_PACKET_POOL;
1711 
1712 
1713 #ifndef NX_DISABLE_IPV4
1714 /* Define the Address Resolution Protocol (ARP) structure that makes up the
1715    route table in each IP instance.  This is how IP addresses are translated
1716    to physical addresses in the system.  */
1717 
1718 typedef struct NX_ARP_STRUCT
1719 {
1720 
1721     /* Define a flag that indicates whether or not the mapping in this ARP
1722        entry is static.  */
1723     UINT nx_arp_route_static;
1724 
1725     /* Define the counter that indicates when the next ARP update request is
1726        sent.  This is always zero for static entries and initialized to the maximum
1727        value for new entries.  */
1728     UINT nx_arp_entry_next_update;
1729 
1730     /* Define the ARP retry counter that is incremented each time the ARP request
1731        is sent.  */
1732     UINT nx_arp_retries;
1733 
1734     /* Define the links for the IP ARP dynamic structures in the system.  This list
1735        is maintained in a most recently used fashion.  */
1736     struct NX_ARP_STRUCT
1737         *nx_arp_pool_next,
1738         *nx_arp_pool_previous;
1739 
1740     /* Define the links for the active ARP entry that is part of route
1741        information inside of an IP instance.  */
1742     struct NX_ARP_STRUCT
1743          *nx_arp_active_next,
1744          *nx_arp_active_previous,
1745         **nx_arp_active_list_head;
1746 
1747     /* Define the IP address that this entry is setup for.  */
1748     ULONG nx_arp_ip_address;
1749 
1750     /* Define the physical address that maps to this IP address.  */
1751     ULONG nx_arp_physical_address_msw;
1752     ULONG nx_arp_physical_address_lsw;
1753 
1754     /* Define the physical interface attached to this IP address. */
1755     struct NX_INTERFACE_STRUCT *nx_arp_ip_interface;
1756 
1757     /* Define a pointer to the queue holding one or more packets while address
1758        resolution is pending. The maximum number of packets that can be queued
1759        is defined by NX_APR_MAX_QUEUE_DEPTH. If ARP packet queue is exceeded,
1760        the oldest packet is discarded in favor of keeping the newer packet.  */
1761     struct NX_PACKET_STRUCT
1762         *nx_arp_packets_waiting;
1763 } NX_ARP;
1764 #endif /* NX_DISABLE_IPV4 */
1765 
1766 
1767 /* Determine if the UDP control block has an extension defined. If not,
1768    define the extension to whitespace.  */
1769 
1770 #ifndef NX_UDP_SOCKET_MODULE_EXTENSION
1771 #define NX_UDP_SOCKET_MODULE_EXTENSION
1772 #endif
1773 
1774 
1775 /* Define the basic UDP socket structure.  This structure is used to manage all information
1776    necessary to manage UDP transmission and reception.  */
1777 
1778 typedef struct NX_UDP_SOCKET_STRUCT
1779 {
1780 
1781     /* Define the UDP identification that is used to determine if the UDP socket has
1782        been created.  */
1783     ULONG       nx_udp_socket_id;
1784 
1785     /* Define the Application defined name for this UDP socket instance.  */
1786     CHAR        *nx_udp_socket_name;
1787 
1788     /* Define the UDP port that was bound to.  */
1789     UINT        nx_udp_socket_port;
1790 
1791     /* Define the entry that this UDP socket belongs to.  */
1792     struct NX_IP_STRUCT
1793                 *nx_udp_socket_ip_ptr;
1794 
1795     /* Define the statistic and error counters for this UDP socket.  */
1796     ULONG       nx_udp_socket_packets_sent;
1797     ULONG       nx_udp_socket_bytes_sent;
1798     ULONG       nx_udp_socket_packets_received;
1799     ULONG       nx_udp_socket_bytes_received;
1800     ULONG       nx_udp_socket_invalid_packets;
1801     ULONG       nx_udp_socket_packets_dropped;
1802     ULONG       nx_udp_socket_checksum_errors;
1803 
1804     /* Define the type of service for this UDP instance.  */
1805     ULONG       nx_udp_socket_type_of_service;
1806 
1807     /* Define the time-to-live for this UDP instance.  */
1808     UINT        nx_udp_socket_time_to_live;
1809 
1810     /* Define the fragment enable bit for this UDP instance.  */
1811     ULONG       nx_udp_socket_fragment_enable;
1812 
1813     /* Define the UDP checksum disable flag for this UDP socket.  */
1814     UINT        nx_udp_socket_disable_checksum;
1815 
1816     /* Define the UDP receive packet queue pointers, queue counter, and
1817        the maximum queue depth.  */
1818     ULONG       nx_udp_socket_receive_count;
1819     ULONG       nx_udp_socket_queue_maximum;
1820     NX_PACKET   *nx_udp_socket_receive_head,
1821                 *nx_udp_socket_receive_tail;
1822 
1823     /* Define the UDP socket bound list.  These pointers are used to manage the list
1824        of UDP sockets on a particular hashed port index.  */
1825     struct NX_UDP_SOCKET_STRUCT
1826                 *nx_udp_socket_bound_next,
1827                 *nx_udp_socket_bound_previous;
1828 
1829     /* Define the UDP socket bind suspension thread pointer.  This pointer points
1830        to the thread that that is suspended attempting to bind to a port that is
1831        already bound to another socket.  */
1832     TX_THREAD   *nx_udp_socket_bind_in_progress;
1833 
1834     /* Define the UDP receive suspension list head associated with a count of
1835        how many threads are suspended attempting to receive from the same UDP port.  */
1836     TX_THREAD   *nx_udp_socket_receive_suspension_list;
1837     ULONG       nx_udp_socket_receive_suspended_count;
1838 
1839     /* Define the UDP bind suspension list head associated with a count of
1840        how many threads are suspended attempting to bind to the same UDP port.  The
1841        currently bound socket will maintain the head pointer.  When a socket unbinds,
1842        the head of the suspension list is given the port and the remaining entries
1843        of the suspension list are transferred to its suspension list head pointer.  */
1844     TX_THREAD   *nx_udp_socket_bind_suspension_list;
1845     ULONG       nx_udp_socket_bind_suspended_count;
1846 
1847     /* Define the link between other UDP structures created by the application.  This
1848        is linked to the IP instance the socket was created on.  */
1849     struct NX_UDP_SOCKET_STRUCT
1850                 *nx_udp_socket_created_next,
1851                 *nx_udp_socket_created_previous;
1852 
1853     /* Define the callback function for receive packet notification. If specified
1854        by the application, this function is called whenever a receive packet is
1855        available on for the socket.  */
1856     VOID (*nx_udp_receive_callback)(struct NX_UDP_SOCKET_STRUCT *socket_ptr);
1857 
1858     /* This pointer is reserved for application specific use.  */
1859     /*lint -esym(768,NX_UDP_SOCKET_STRUCT::nx_udp_socket_reserved_ptr) suppress member not referenced. It is reserved for future use. */
1860     void        *nx_udp_socket_reserved_ptr;
1861 
1862 #ifdef NX_ENABLE_TCPIP_OFFLOAD
1863     /* Store a pointer to TCP/IP offload context.  */
1864     VOID        *nx_udp_socket_tcpip_offload_context;
1865 #endif /* NX_ENABLE_TCPIP_OFFLOAD */
1866 
1867     /* Define the port extension in the UDP socket control block. This
1868        is typically defined to whitespace in nx_port.h.  */
1869     NX_UDP_SOCKET_MODULE_EXTENSION
1870 
1871 } NX_UDP_SOCKET;
1872 
1873 
1874 /* Determine if the TCP control block has an extension defined. If not,
1875    define the extension to whitespace.  */
1876 
1877 #ifndef NX_TCP_SOCKET_MODULE_EXTENSION
1878 #define NX_TCP_SOCKET_MODULE_EXTENSION
1879 #endif
1880 
1881 
1882 /* Define the basic TCP socket structure.  This structure is used to manage all information
1883    necessary to manage TCP transmission and reception.  */
1884 
1885 typedef struct NX_TCP_SOCKET_STRUCT
1886 {
1887 
1888     /* Define the TCP identification that is used to determine if the TCP socket has
1889        been created.  */
1890     ULONG       nx_tcp_socket_id;
1891 
1892     /* Define the Application defined name for this TCP socket instance.  */
1893     CHAR        *nx_tcp_socket_name;
1894 
1895     /* Define the socket type flag.  If true, this socket is a client socket.  */
1896     UINT        nx_tcp_socket_client_type;
1897 
1898     /* Define the TCP port that was bound to.  */
1899     UINT        nx_tcp_socket_port;
1900 
1901     /* Define the TCP socket's maximum segment size (mss). By default, this is setup to the
1902        IP's MTU less the size of the IP and TCP headers.  */
1903     ULONG       nx_tcp_socket_mss;
1904 
1905     /* Define the connected IP and port information.  */
1906     NXD_ADDRESS nx_tcp_socket_connect_ip;
1907     UINT        nx_tcp_socket_connect_port;
1908     ULONG       nx_tcp_socket_connect_mss;
1909     ULONG       nx_tcp_socket_peer_mss;
1910     struct NX_INTERFACE_STRUCT
1911                 *nx_tcp_socket_connect_interface;
1912     ULONG       nx_tcp_socket_next_hop_address;
1913 
1914     /* mss2 is the holding place for the smss * smss value.
1915        It is computed and stored here once for later use. */
1916     ULONG       nx_tcp_socket_connect_mss2;
1917 
1918     ULONG       nx_tcp_socket_tx_slow_start_threshold;
1919 
1920     /* Define the state of the TCP connection.  */
1921     UINT        nx_tcp_socket_state;
1922 
1923     /* Define the receive and transmit sequence numbers.   */
1924     ULONG       nx_tcp_socket_tx_sequence;
1925     ULONG       nx_tcp_socket_rx_sequence;
1926     ULONG       nx_tcp_socket_rx_sequence_acked;
1927     ULONG       nx_tcp_socket_delayed_ack_timeout;
1928     ULONG       nx_tcp_socket_fin_sequence;
1929     USHORT      nx_tcp_socket_fin_received;
1930     USHORT      nx_tcp_socket_fin_acked;
1931 
1932     /* Track the advertised window size */
1933     ULONG       nx_tcp_socket_tx_window_advertised;
1934     ULONG       nx_tcp_socket_tx_window_congestion;
1935     ULONG       nx_tcp_socket_tx_outstanding_bytes; /* Data transmitted but not acked. */
1936 
1937     /* Define the transmit sequence that enters fast transmit. */
1938     ULONG       nx_tcp_socket_tx_sequence_recover;
1939 
1940     /* Define the previous cumulative acknowledgment.  */
1941     ULONG       nx_tcp_socket_previous_highest_ack;
1942 
1943     /* Counter for "ack-N-packet" */
1944     ULONG       nx_tcp_socket_ack_n_packet_counter;
1945 
1946     /* Counter for duplicated ACK  */
1947     UINT        nx_tcp_socket_duplicated_ack_received;
1948 
1949     /* Define the window size fields of the TCP socket structure.  */
1950     ULONG       nx_tcp_socket_rx_window_default;
1951     ULONG       nx_tcp_socket_rx_window_current;
1952     ULONG       nx_tcp_socket_rx_window_last_sent;
1953 
1954     /* Define the statistic and error counters for this TCP socket.  */
1955     ULONG       nx_tcp_socket_packets_sent;
1956     ULONG       nx_tcp_socket_bytes_sent;
1957     ULONG       nx_tcp_socket_packets_received;
1958     ULONG       nx_tcp_socket_bytes_received;
1959     ULONG       nx_tcp_socket_retransmit_packets;
1960     ULONG       nx_tcp_socket_checksum_errors;
1961 
1962     /* Define data for zero window probe. */
1963     ULONG       nx_tcp_socket_zero_window_probe_failure;
1964     ULONG       nx_tcp_socket_zero_window_probe_sequence;
1965     UCHAR       nx_tcp_socket_zero_window_probe_has_data;
1966     UCHAR       nx_tcp_socket_zero_window_probe_data;
1967 
1968     /* Define whether or not TCP socket is in fast recovery procedure. */
1969     UCHAR       nx_tcp_socket_fast_recovery;
1970 
1971 #ifdef NX_ENABLE_HTTP_PROXY
1972 
1973     /* Define the state of HTTP Proxy connection.  */
1974     UCHAR       nx_tcp_socket_http_proxy_state;
1975 
1976     /* Define the packet to store HTTP response header.  */
1977     NX_PACKET   *nx_tcp_socket_http_proxy_header_packet;
1978 
1979     /* Define the IP and port for original server.  */
1980     NXD_ADDRESS nx_tcp_socket_original_server_ip;
1981     UINT        nx_tcp_socket_original_server_port;
1982 #else
1983     /* Reserved to four bytes alignment. */
1984     /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved) suppress member not referenced. It is reserved for future use. */
1985     UCHAR       nx_tcp_socket_reserved;
1986 #endif /* NX_ENABLE_HTTP_PROXY  */
1987 
1988     /* Define the entry that this TCP socket belongs to.  */
1989     struct NX_IP_STRUCT
1990                 *nx_tcp_socket_ip_ptr;
1991 
1992     /* Define the type of service for this TCP instance.  */
1993     ULONG       nx_tcp_socket_type_of_service;
1994 
1995     /* Define the time-to-live for this TCP instance.  */
1996     UINT        nx_tcp_socket_time_to_live;
1997 
1998     /* Define the fragment enable bit for this TCP instance.  */
1999     ULONG       nx_tcp_socket_fragment_enable;
2000 
2001     /* Define the TCP receive packet queue pointers, queue counter, and
2002        the maximum queue depth.  */
2003     ULONG       nx_tcp_socket_receive_queue_count;
2004     NX_PACKET   *nx_tcp_socket_receive_queue_head,
2005                 *nx_tcp_socket_receive_queue_tail;
2006 
2007     /* Define the TCP packet sent queue. This queue is used to keep track of the
2008        transmit packets already send.  Before they can be released we need to receive
2009        an ACK back from the other end of the connection.  If no ACK is received, the
2010        packet(s) need to be re-transmitted.  */
2011     ULONG       nx_tcp_socket_transmit_queue_maximum;
2012     ULONG       nx_tcp_socket_transmit_sent_count;
2013     NX_PACKET   *nx_tcp_socket_transmit_sent_head,
2014                 *nx_tcp_socket_transmit_sent_tail;
2015 
2016     /* Define the maximum TCP packet receive queue. */
2017 #ifdef NX_ENABLE_LOW_WATERMARK
2018     ULONG   nx_tcp_socket_receive_queue_maximum;
2019 #endif /* NX_ENABLE_LOW_WATERMARK */
2020 
2021     /* Define the TCP transmit timeout parameters.  If the socket timeout is non-zero,
2022        there is an active timeout on the TCP socket.  Subsequent timeouts are derived
2023        from the timeout rate, which is adjusted higher as timeouts occur.  */
2024     ULONG       nx_tcp_socket_timeout;
2025     ULONG       nx_tcp_socket_timeout_rate;
2026     ULONG       nx_tcp_socket_timeout_retries;
2027     ULONG       nx_tcp_socket_timeout_max_retries;
2028     ULONG       nx_tcp_socket_timeout_shift;
2029 
2030 #ifdef NX_ENABLE_TCP_WINDOW_SCALING
2031     /* Local receive window size, when user creates the TCP socket. */
2032     ULONG       nx_tcp_socket_rx_window_maximum;
2033 
2034     /* Window scale this side needs to offer to the peer. */
2035     ULONG       nx_tcp_rcv_win_scale_value;
2036 
2037     /* Window scale offered by the peer.  0xFF indicates the peer does not support window scaling. */
2038     ULONG       nx_tcp_snd_win_scale_value;
2039 #endif /* NX_ENABLE_TCP_WINDOW_SCALING */
2040 
2041     /* Define the TCP keepalive timer parameters.  If enabled with NX_ENABLE_TCP_KEEPALIVE,
2042        these parameters are used to implement the keepalive timer.  */
2043 #ifdef NX_ENABLE_TCP_KEEPALIVE
2044     ULONG       nx_tcp_socket_keepalive_timeout;
2045     ULONG       nx_tcp_socket_keepalive_retries;
2046 #endif /* NX_ENABLE_TCP_KEEPALIVE */
2047 
2048     /* Define the TCP socket bound list.  These pointers are used to manage the list
2049        of TCP sockets on a particular hashed port index.  */
2050     struct NX_TCP_SOCKET_STRUCT
2051                 *nx_tcp_socket_bound_next,
2052                 *nx_tcp_socket_bound_previous;
2053 
2054     /* Define the TCP socket bind suspension thread pointer.  This pointer points
2055        to the thread that that is suspended attempting to bind to a port that is
2056        already bound to another socket.  */
2057     TX_THREAD   *nx_tcp_socket_bind_in_progress;
2058 
2059     /* Define the TCP receive suspension list head associated with a count of
2060        how many threads are suspended attempting to receive from the same TCP port.  */
2061     TX_THREAD   *nx_tcp_socket_receive_suspension_list;
2062     ULONG       nx_tcp_socket_receive_suspended_count;
2063 
2064     /* Define the TCP transmit suspension list head associated with a count of
2065        how many threads are suspended attempting to transmit from the same TCP port.  */
2066     TX_THREAD   *nx_tcp_socket_transmit_suspension_list;
2067     ULONG       nx_tcp_socket_transmit_suspended_count;
2068 
2069     /* Define the TCP connect suspension pointer that contains the pointer to the
2070        thread suspended attempting to establish a TCP connection.  */
2071     TX_THREAD   *nx_tcp_socket_connect_suspended_thread;
2072 
2073     /* Define the TCP disconnect suspension pointer that contains the pointer to the
2074        thread suspended attempting to break a TCP connection.  */
2075     TX_THREAD   *nx_tcp_socket_disconnect_suspended_thread;
2076 
2077     /* Define the TCP bind suspension list head associated with a count of
2078        how many threads are suspended attempting to bind to the same TCP port.  The
2079        currently bound socket will maintain the head pointer.  When a socket unbinds,
2080        the head of the suspension list is given the port and the remaining entries
2081        of the suspension list are transferred to its suspension list head pointer.  */
2082     TX_THREAD   *nx_tcp_socket_bind_suspension_list;
2083     ULONG       nx_tcp_socket_bind_suspended_count;
2084 
2085     /* Define the link between other TCP structures created by the application.  This
2086        is linked to the IP instance the socket was created on.  */
2087     struct NX_TCP_SOCKET_STRUCT
2088             *nx_tcp_socket_created_next,
2089             *nx_tcp_socket_created_previous;
2090 
2091     /* Define the callback function for urgent data reception.  This is for future use.  */
2092     VOID (*nx_tcp_urgent_data_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2093 
2094 #ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
2095     /* Define the callback function for notifying an incoming SYN request. */
2096     UINT (*nx_tcp_socket_syn_received_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr, NX_PACKET *packet_ptr);
2097 
2098     /* Define the callback function for notifying the host application of a connection handshake completion
2099        with a remote host.  */
2100     VOID (*nx_tcp_establish_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2101 
2102     /* Define the callback function for notifying the host application of disconnection completion
2103        with a remote host.  */
2104     VOID (*nx_tcp_disconnect_complete_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2105 
2106     /* Define the callback function for notifying the host application to set the socket
2107        state in the timed wait state.  */
2108     VOID (*nx_tcp_timed_wait_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2109 #endif
2110 
2111     /* Define the callback function for disconnect detection from the other side of
2112        the connection.  */
2113     VOID (*nx_tcp_disconnect_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2114 
2115     /* Define the callback function for receive packet notification. If specified
2116        by the application, this function is called whenever a receive packet is
2117        available on for the socket.  */
2118     VOID (*nx_tcp_receive_callback)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2119 
2120     /* Define the callback function for receive packet notification. If specified
2121        by the application, this function is called whenever a receive packet is
2122        available on for the socket.  */
2123     VOID (*nx_tcp_socket_window_update_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2124 
2125 #ifdef   NX_ENABLE_TCP_QUEUE_DEPTH_UPDATE_NOTIFY
2126     VOID (*nx_tcp_socket_queue_depth_notify)(struct NX_TCP_SOCKET_STRUCT *socket_ptr);
2127 #endif
2128 
2129     /* This pointer is reserved for application specific use.  */
2130     /*lint -esym(768,NX_TCP_SOCKET_STRUCT::nx_tcp_socket_reserved_ptr) suppress member not referenced. It is reserved for application specific use. */
2131     void    *nx_tcp_socket_reserved_ptr;
2132 
2133     /* Define the default maximum queue size. This is necessary to dynamically
2134        change the maximum queue size dynamically.  */
2135     ULONG   nx_tcp_socket_transmit_queue_maximum_default;
2136 
2137     /* Define a flag for enabling the keepalive feature per TCP socket. */
2138 #ifdef NX_ENABLE_TCP_KEEPALIVE
2139     UINT    nx_tcp_socket_keepalive_enabled;
2140 #endif /* NX_ENABLE_TCP_KEEPALIVE */
2141 
2142 #ifdef FEATURE_NX_IPV6
2143     struct NXD_IPV6_ADDRESS_STRUCT *nx_tcp_socket_ipv6_addr;
2144 #endif /* FEATURE_NX_IPV6 */
2145 
2146 #ifdef NX_IPSEC_ENABLE
2147     /* Stores a pointer to the SA, if the traffic needs to be protected. */
2148     VOID *nx_tcp_socket_egress_sa;
2149 
2150     /* Number of bytes to offset from IP header.  This offset is needed to accommondate security header. */
2151     UINT  nx_tcp_socket_egress_sa_data_offset;
2152 
2153 #endif /* NX_IPSEC_ENABLE */
2154 
2155 #ifdef NX_ENABLE_TCPIP_OFFLOAD
2156     /* Store a pointer to TCP/IP offload context.  */
2157     VOID *nx_tcp_socket_tcpip_offload_context;
2158 #endif /* NX_ENABLE_TCPIP_OFFLOAD */
2159 
2160     /* Define the port extension in the TCP socket control block. This
2161        is typically defined to whitespace in nx_port.h.  */
2162     NX_TCP_SOCKET_MODULE_EXTENSION
2163 
2164 } NX_TCP_SOCKET;
2165 
2166 
2167 /* Define the basic TCP listen request structure.  This structure is used to indicate
2168    which, if any, TCP ports are allowing a client connection.  */
2169 
2170 typedef struct NX_TCP_LISTEN_STRUCT
2171 {
2172 
2173     /* Define the port number that we are allowing a connection on.  */
2174     UINT        nx_tcp_listen_port;
2175 
2176     /* Define the listen callback routine that will be called when a connection
2177        request is received.  */
2178     VOID        (*nx_tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port);
2179 
2180     /* Define the previously created socket for this listen request.  */
2181     NX_TCP_SOCKET
2182                 *nx_tcp_listen_socket_ptr;
2183 
2184     /* Define the listen queue for connect requests that come in when the previous socket
2185        given for a listen or relisten has been used.  */
2186     ULONG       nx_tcp_listen_queue_maximum;
2187     ULONG       nx_tcp_listen_queue_current;
2188     NX_PACKET   *nx_tcp_listen_queue_head,
2189                 *nx_tcp_listen_queue_tail;
2190 
2191     /* Define the link between other TCP listen structures created by the application.  */
2192     struct NX_TCP_LISTEN_STRUCT
2193                 *nx_tcp_listen_next,
2194                 *nx_tcp_listen_previous;
2195 } NX_TCP_LISTEN;
2196 
2197 /* There should be at least one physical interface. */
2198 #ifndef NX_MAX_PHYSICAL_INTERFACES
2199 #define NX_MAX_PHYSICAL_INTERFACES    1
2200 #endif /* NX_MAX_PHYSICAL_INTERFACES */
2201 
2202 #ifndef NX_MAX_IPV6_ADDRESSES
2203 #define NX_MAX_IPV6_ADDRESSES         (NX_MAX_PHYSICAL_INTERFACES * 3)
2204 #endif /* NX_MAX_IPV6_ADDRESSES */
2205 
2206 #if (NX_MAX_IPV6_ADDRESSES < 2)
2207 #error "NetX Duo needs at least 2 IPv6 interface addresses. "
2208 #endif
2209 
2210 #ifndef NX_DISABLE_LOOPBACK_INTERFACE
2211 /* Inside interface array, entries 0 up to NX_MAX_PHYSICAL_INTERFACES are assigned to the
2212    physical interfaces.  Entry NX_MAX_PHYSICAL_INTERFACES is assigned to the loopback interface. */
2213 #define NX_LOOPBACK_INTERFACE         NX_MAX_PHYSICAL_INTERFACES
2214 #define NX_LOOPBACK_IPV6_SOURCE_INDEX NX_MAX_IPV6_ADDRESSES
2215 #define NX_LOOPBACK_IPV6_ENABLED      1
2216 #else
2217 #define NX_LOOPBACK_INTERFACE         0
2218 #define NX_LOOPBACK_IPV6_ENABLED      0
2219 #endif /* NX_DISALBE_LOOPBACK_INTERFACE */
2220 
2221 #if (defined(NX_DISABLE_LOOPBACK_INTERFACE) && (NX_MAX_PHYSICAL_INTERFACES == 0))
2222 #error "NetX is built without either physical interfaces or loopback interfaces."
2223 #endif
2224 
2225 #if defined(NX_DISABLE_LOOPBACK_INTERFACE)
2226 #define NX_MAX_IP_INTERFACES          NX_MAX_PHYSICAL_INTERFACES
2227 #else
2228 #define NX_MAX_IP_INTERFACES          (NX_MAX_PHYSICAL_INTERFACES + 1)
2229 #endif /* NX_DISABLE_LOOPBACK_INTERFACE */
2230 
2231 #ifdef NX_DISABLE_PACKET_CHAIN
2232 #ifndef NX_DISABLE_FRAGMENTATION
2233 #error "IP fragmentation is not supported if packet chain is disabled."
2234 #endif /* NX_DISABLE_FRAGMENTATION */
2235 #endif /* NX_DISABLE_PACKET_CHAIN */
2236 
2237 struct NX_IP_DRIVER_STRUCT;
2238 
2239 typedef struct NXD_IPV6_ADDRESS_STRUCT
2240 {
2241     UCHAR nxd_ipv6_address_valid;
2242 
2243     UCHAR nxd_ipv6_address_type;  /* IPv6 = 6 */
2244 
2245     /* Current state:Invalid,Tentative...*/
2246     UCHAR nxd_ipv6_address_state;
2247 
2248     /* Prefix length */
2249     UCHAR nxd_ipv6_address_prefix_length;
2250 
2251     /* Pointer to the physical interface where this address is attached to.*/
2252     struct NX_INTERFACE_STRUCT *nxd_ipv6_address_attached;
2253 
2254     /* Interface address,in host byte order */
2255     ULONG nxd_ipv6_address[4];
2256 
2257     /* Pointer to the next address, or NX_NULL */
2258     struct NXD_IPV6_ADDRESS_STRUCT *nxd_ipv6_address_next;
2259 
2260     /* Number of DAD packets to be transmitted. */
2261     /* This entry is used only if DAD is enabled. */
2262     UCHAR nxd_ipv6_address_DupAddrDetectTransmit;
2263 
2264     /* Describe how the interface is configured. */
2265     UCHAR nxd_ipv6_address_ConfigurationMethod;
2266 
2267     /* Define the index in array. */
2268     UCHAR nxd_ipv6_address_index;
2269 
2270     /* Reserved. */
2271     /*lint -esym(768,NXD_IPV6_ADDRESS_STRUCT::reserved) suppress member not referenced. It is reserved for future use. */
2272     UCHAR reserved;
2273 } NXD_IPV6_ADDRESS;
2274 
2275 /* Define the address interface structure. */
2276 typedef struct NX_INTERFACE_STRUCT
2277 {
2278 
2279     /* Flag indicating whether or not the interface entry is valid. */
2280     CHAR *nx_interface_name;
2281     UCHAR nx_interface_valid;
2282     UCHAR nx_interface_address_mapping_needed;
2283 
2284     /* Define the Link Up field that is manipulated by the associated link driver.  */
2285     UCHAR nx_interface_link_up;
2286 
2287     /* Define the index in array. */
2288     UCHAR nx_interface_index;
2289 
2290     /* Define a flag to check if link status change. */
2291     UCHAR nx_interface_link_status_change;
2292 
2293     /*lint -esym(768,NX_INTERFACE_STRUCT::nx_interface_reserved) suppress member not referenced. It is reserved for future use. */
2294     UCHAR nx_interface_reserved[3];
2295 
2296     /* Define the physical address of this IP instance.  These field are
2297        setup by the link driver during initialization.  */
2298     ULONG nx_interface_physical_address_msw;
2299     ULONG nx_interface_physical_address_lsw;
2300 
2301 #ifndef NX_DISABLE_IPV4
2302     /* Define the IP address of this IP instance.  Loopback can be done by
2303        either using the same address or by using 127.*.*.*.  */
2304     ULONG nx_interface_ip_address;
2305 
2306     /* Define the network portion of the IP address.  */
2307     ULONG nx_interface_ip_network_mask;
2308 
2309     /* Define the network only bits of the IP address.  */
2310     ULONG nx_interface_ip_network;
2311 #endif /* !NX_DISABLE_IPV4  */
2312 
2313     /* Define the head of the interface IPv6 address list.
2314        Typically the 1st entry on the list is the link local address,
2315        followed by one or more global IPv6 addresses.
2316      */
2317     struct NXD_IPV6_ADDRESS_STRUCT *nxd_interface_ipv6_address_list_head;
2318 
2319     /* Define information setup by the Link Driver.  */
2320     ULONG nx_interface_ip_mtu_size;
2321 
2322 #ifndef NX_DISABLE_ICMPV6_ROUTER_SOLICITATION
2323 
2324     /* Maximum number of router solicitation messages to send. */
2325     ULONG nx_ipv6_rtr_solicitation_max;
2326 
2327     /* Number of router solicitation messages to be sent. */
2328     ULONG nx_ipv6_rtr_solicitation_count;
2329 
2330     /* Time (in seconds) before sending out another Router Solicitation message. */
2331     ULONG nx_ipv6_rtr_solicitation_interval;
2332 
2333     /* Count down timer for sending out  router solicitation message. */
2334     ULONG nx_ipv6_rtr_solicitation_timer;
2335 #endif /* NX_DISABLE_ICMPV6_ROUTER_SOLICITATION */
2336 
2337 #ifdef NX_IPV6_STATELESS_AUTOCONFIG_CONTROL
2338     ULONG nx_ipv6_stateless_address_autoconfig_status;
2339 #endif /* NX_IPV6_STATELESS_AUTOCONFIG_CONTROL    */
2340     /* Define a pointer for use by the applicaiton.  Typically this is going to be
2341        used by the link drvier. */
2342     VOID *nx_interface_additional_link_info;
2343 
2344     /* Define the Link Driver entry point.  */
2345     VOID        (*nx_interface_link_driver_entry)(struct NX_IP_DRIVER_STRUCT *);
2346 
2347 #ifdef NX_ENABLE_INTERFACE_CAPABILITY
2348     /* Define the capability flag of hardware for the interface. */
2349     ULONG nx_interface_capability_flag;
2350 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */
2351 
2352 #ifndef NX_DISABLE_IPV4
2353     /* Define the ARP defend timeout.  */
2354     ULONG nx_interface_arp_defend_timeout;
2355 
2356     /* Define the IP probe address.  */
2357     ULONG nx_interface_ip_probe_address;
2358 
2359     /* Define the IP conflict notify handler. A non-null value for this function
2360        pointer results in NetX calling it when an IP address is found in an incoming
2361        ARP packet that matches that of nx_interface_ip_probe_address.  */
2362     VOID        (*nx_interface_ip_conflict_notify_handler)(struct NX_IP_STRUCT *, UINT, ULONG, ULONG, ULONG);
2363 #endif /* !NX_DISABLE_IPV4  */
2364 
2365 #ifdef NX_ENABLE_TCPIP_OFFLOAD
2366     /* Define the TCP/IP offload handler. */
2367     UINT        (*nx_interface_tcpip_offload_handler)(struct NX_IP_STRUCT *ip_ptr,
2368                                                       struct NX_INTERFACE_STRUCT *interface_ptr,
2369                                                       VOID *socket_ptr, UINT operation, NX_PACKET *packet_ptr,
2370                                                       NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip,
2371                                                       UINT local_port, UINT *remote_port, UINT wait_option);
2372 #endif /* NX_ENABLE_TCPIP_OFFLOAD */
2373 } NX_INTERFACE;
2374 
2375 /* Define the static IPv4 routing table entry structure. */
2376 #if defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4)
2377 typedef struct NX_IP_ROUTING_ENTRY_STRUCT
2378 {
2379     /* Destination IP address, in host byte order */
2380     ULONG nx_ip_routing_dest_ip;
2381 
2382     /* Net mask, in host byte order */
2383     ULONG nx_ip_routing_net_mask;
2384 
2385     /* Next hop address, in host byte order.  */
2386     ULONG nx_ip_routing_next_hop_address;
2387 
2388     struct NX_INTERFACE_STRUCT
2389         *nx_ip_routing_entry_ip_interface;
2390 } NX_IP_ROUTING_ENTRY;
2391 #endif /* defined(NX_ENABLE_IP_STATIC_ROUTING) && !defined(NX_DISABLE_IPV4) */
2392 
2393 #ifndef NX_DISABLE_IPV4
2394 typedef struct NX_IPV4_MULTICAST_STRUCT
2395 {
2396 
2397     /* Define the multicast registered group list.  */
2398     ULONG nx_ipv4_multicast_join_list;
2399 
2400     /* Define the multicast regstiered group interface list. */
2401     NX_INTERFACE *nx_ipv4_multicast_join_interface_list;
2402 
2403     /* Define the multicast registration count.  */
2404     ULONG nx_ipv4_multicast_join_count;
2405 
2406     /* Define the multicast random time list.  */
2407     ULONG nx_ipv4_multicast_update_time;
2408 
2409     /* Define the multicast loopback flag list. This flag is set based on the global
2410        loopback enable at the time the group was joined. */
2411     UINT nx_ipv4_multicast_loopback_enable;
2412 } NX_IPV4_MULTICAST_ENTRY;
2413 #endif /* NX_DISABLE_IPV4 */
2414 
2415 #ifdef NX_ENABLE_IPV6_MULTICAST
2416 typedef struct NX_IPV6_MULTICAST_STRUCT
2417 {
2418 
2419     /* Define the MLD registered group list.  */
2420     ULONG nx_ip_mld_join_list[4];
2421 
2422     /* Define the MLD regstiered group interface list. */
2423     NX_INTERFACE *nx_ip_mld_join_interface_list;
2424 
2425     /* Define the MLD registration count.  */
2426     ULONG nx_ip_mld_join_count;
2427 } NX_IPV6_MULTICAST_ENTRY;
2428 
2429 #endif /* NX_ENABLE_IPV6_MULTICAST  */
2430 
2431 
2432 /* Determine if the IP control block has an extension defined. If not,
2433    define the extension to whitespace.  */
2434 
2435 #ifndef NX_IP_MODULE_EXTENSION
2436 #define NX_IP_MODULE_EXTENSION
2437 #endif
2438 
2439 
2440 /* Define the Internet Protocol (IP) structure.  Any number of IP instances
2441    may be used by the application.  */
2442 
2443 typedef struct NX_IP_STRUCT
2444 {
2445 
2446     /* Define the IP identification that is used to determine if the IP has
2447        been created.  */
2448     ULONG       nx_ip_id;
2449 
2450     /* Define the Application defined name for this IP instance.  */
2451     CHAR        *nx_ip_name;
2452 
2453     /* Define the IP address of this IP instance.  Loopback can be done by
2454        either using the same address or by using 127.*.*.*.  */
2455 #if 1
2456 #define nx_ip_address                  nx_ip_interface[0].nx_interface_ip_address
2457 #define nx_ip_driver_mtu               nx_ip_interface[0].nx_interface_ip_mtu_size
2458 #define nx_ip_driver_mapping_needed    nx_ip_interface[0].nx_interface_address_mapping_needed
2459 #define nx_ip_network_mask             nx_ip_interface[0].nx_interface_ip_network_mask
2460 #define nx_ip_network                  nx_ip_interface[0].nx_interface_ip_network
2461 #define nx_ip_arp_physical_address_msw nx_ip_interface[0].nx_interface_physical_address_msw
2462 #define nx_ip_arp_physical_address_lsw nx_ip_interface[0].nx_interface_physical_address_lsw
2463 #define nx_ip_driver_link_up           nx_ip_interface[0].nx_interface_link_up
2464 #define nx_ip_link_driver_entry        nx_ip_interface[0].nx_interface_link_driver_entry
2465 #define nx_ip_additional_link_info     nx_ip_interface[0].nx_interface_additional_link_info
2466 #endif
2467 
2468 #ifndef NX_DISABLE_IPV4
2469     /* Define the gateway IP address.  */
2470     ULONG       nx_ip_gateway_address;   /* In host byte order */
2471 
2472     struct NX_INTERFACE_STRUCT
2473                *nx_ip_gateway_interface;
2474 #endif /* !NX_DISABLE_IPV4  */
2475 
2476 #ifdef FEATURE_NX_IPV6
2477     /* Define IPv6 addresses.  NetX6 allows user to specify Global address
2478        in addition to the link-local address generated automatically. */
2479     /* IPv6 address takes 16 bytes.  These addresses are 4-byte aligned */
2480     struct NXD_IPV6_ADDRESS_STRUCT nx_ipv6_address[NX_MAX_IPV6_ADDRESSES + NX_LOOPBACK_IPV6_ENABLED];
2481 
2482     /* Define the destination table. */
2483     NX_IPV6_DESTINATION_ENTRY
2484                 nx_ipv6_destination_table[NX_IPV6_DESTINATION_TABLE_SIZE];
2485 
2486     /* Define the ND cache table. */
2487     ND_CACHE_ENTRY
2488                 nx_ipv6_nd_cache[NX_IPV6_NEIGHBOR_CACHE_SIZE];
2489 
2490     /* Define the destination table size. */
2491     UINT        nx_ipv6_destination_table_size;
2492 #endif /* FEATURE_NX_IPV6 */
2493 
2494     /* Define the statistic and error counters for this IP instance.   */
2495     ULONG       nx_ip_total_packet_send_requests;
2496     ULONG       nx_ip_total_packets_sent;
2497     ULONG       nx_ip_total_bytes_sent;
2498     ULONG       nx_ip_total_packets_received;
2499     ULONG       nx_ip_total_packets_delivered;
2500     ULONG       nx_ip_total_bytes_received;
2501     ULONG       nx_ip_packets_forwarded;
2502     ULONG       nx_ip_packets_reassembled;
2503     ULONG       nx_ip_reassembly_failures;
2504     ULONG       nx_ip_invalid_packets;
2505     ULONG       nx_ip_invalid_transmit_packets;
2506     ULONG       nx_ip_invalid_receive_address;
2507     ULONG       nx_ip_unknown_protocols_received;
2508 
2509     /*lint -esym(768,NX_IP_STRUCT::nx_ip_transmit_no_route_errors) suppress member not referenced. It is reserved for application specific use. */
2510     ULONG       nx_ip_transmit_resource_errors;
2511     ULONG       nx_ip_transmit_no_route_errors;
2512     ULONG       nx_ip_receive_packets_dropped;
2513     ULONG       nx_ip_receive_checksum_errors;
2514     ULONG       nx_ip_send_packets_dropped;
2515     ULONG       nx_ip_total_fragment_requests;
2516     ULONG       nx_ip_successful_fragment_requests;
2517     ULONG       nx_ip_fragment_failures;
2518     ULONG       nx_ip_total_fragments_sent;
2519     ULONG       nx_ip_total_fragments_received;
2520     ULONG       nx_ip_arp_requests_sent;
2521     ULONG       nx_ip_arp_requests_received;
2522     ULONG       nx_ip_arp_responses_sent;
2523     ULONG       nx_ip_arp_responses_received;
2524     ULONG       nx_ip_arp_aged_entries;
2525     ULONG       nx_ip_arp_invalid_messages;
2526     ULONG       nx_ip_arp_static_entries;
2527     ULONG       nx_ip_udp_packets_sent;
2528     ULONG       nx_ip_udp_bytes_sent;
2529     ULONG       nx_ip_udp_packets_received;
2530     ULONG       nx_ip_udp_bytes_received;
2531     ULONG       nx_ip_udp_invalid_packets;
2532     ULONG       nx_ip_udp_no_port_for_delivery;
2533     ULONG       nx_ip_udp_receive_packets_dropped;
2534     ULONG       nx_ip_udp_checksum_errors;
2535     ULONG       nx_ip_tcp_packets_sent;
2536     ULONG       nx_ip_tcp_bytes_sent;
2537     ULONG       nx_ip_tcp_packets_received;
2538     ULONG       nx_ip_tcp_bytes_received;
2539     ULONG       nx_ip_tcp_invalid_packets;
2540     ULONG       nx_ip_tcp_receive_packets_dropped;
2541     ULONG       nx_ip_tcp_checksum_errors;
2542     ULONG       nx_ip_tcp_connections;
2543     ULONG       nx_ip_tcp_passive_connections;
2544     ULONG       nx_ip_tcp_active_connections;
2545     ULONG       nx_ip_tcp_disconnections;
2546     ULONG       nx_ip_tcp_connections_dropped;
2547     ULONG       nx_ip_tcp_retransmit_packets;
2548     ULONG       nx_ip_tcp_resets_received;
2549     ULONG       nx_ip_tcp_resets_sent;
2550     ULONG       nx_ip_icmp_total_messages_received;
2551     ULONG       nx_ip_icmp_checksum_errors;
2552     ULONG       nx_ip_icmp_invalid_packets;
2553     ULONG       nx_ip_icmp_unhandled_messages;
2554     ULONG       nx_ip_pings_sent;
2555     ULONG       nx_ip_ping_timeouts;
2556     ULONG       nx_ip_ping_threads_suspended;
2557     ULONG       nx_ip_ping_responses_received;
2558     ULONG       nx_ip_pings_received;
2559     ULONG       nx_ip_pings_responded_to;
2560     ULONG       nx_ip_igmp_invalid_packets;
2561     ULONG       nx_ip_igmp_reports_sent;
2562     ULONG       nx_ip_igmp_queries_received;
2563     ULONG       nx_ip_igmp_checksum_errors;
2564     ULONG       nx_ip_igmp_groups_joined;
2565 #ifndef NX_DISABLE_IGMPV2
2566     ULONG       nx_ip_igmp_router_version;
2567 #endif
2568     ULONG       nx_ip_rarp_requests_sent;
2569     ULONG       nx_ip_rarp_responses_received;
2570     ULONG       nx_ip_rarp_invalid_messages;
2571 
2572 
2573     /* Define the IP forwarding flag.  This is by default set to NX_NULL.
2574        If forwarding is desired, the nx_ip_forward_packet_process service
2575        pointed to by this member should be called.  */
2576 #ifndef NX_DISABLE_IPV4
2577     VOID        (*nx_ip_forward_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *);
2578 
2579 #ifdef NX_NAT_ENABLE
2580     /*  Define the NAT forwarded packet handler. This is by default set to NX_NULL.  */
2581     UINT        (*nx_ip_nat_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *, UINT packet_process);
2582 
2583     /*  Define the NAT port verify handler. This is by default set to NX_NULL.  */
2584     UINT        (*nx_ip_nat_port_verify)(struct NX_IP_STRUCT *, UINT protocol, UINT port);
2585 #endif
2586 #endif /* !NX_DISABLE_IPV4  */
2587 
2588 #ifndef NX_ENABLE_IP_ID_RANDOMIZATION
2589     /* Define the packet ID.  */
2590     ULONG       nx_ip_packet_id;
2591 #endif /* NX_ENABLE_IP_ID_RANDOMIZATION */
2592 
2593     /* Define the default packet pool.  */
2594     struct NX_PACKET_POOL_STRUCT
2595                 *nx_ip_default_packet_pool;
2596 
2597 #ifdef NX_ENABLE_DUAL_PACKET_POOL
2598     /* Define the auxiliary packet pool for internal usage. */
2599     struct NX_PACKET_POOL_STRUCT
2600                 *nx_ip_auxiliary_packet_pool;
2601 #endif /* NX_ENABLE_DUAL_PACKET_POOL */
2602 
2603     /* Define the internal mutex used for protection inside the NetX
2604        data structures.  */
2605     TX_MUTEX    nx_ip_protection;
2606 
2607     /* Define the initialize done flag.  */
2608     UINT        nx_ip_initialize_done;
2609 
2610 #ifdef NX_DRIVER_DEFERRED_PROCESSING
2611     /* Define the Link Driver hardware deferred packet queue.  */
2612     NX_PACKET   *nx_ip_driver_deferred_packet_head,
2613                 *nx_ip_driver_deferred_packet_tail;
2614 
2615     /* Define the Link Driver hardware deferred packet processing routine.  If the driver
2616        deferred processing is enabled, this routine is called from the IP helper thread.  */
2617     VOID        (*nx_ip_driver_deferred_packet_handler)(struct NX_IP_STRUCT *, NX_PACKET *);
2618 #endif /* NX_DRIVER_DEFERRED_PROCESSING */
2619 
2620     /* Define the deferred packet processing queue.  This is used to
2621        process packets not initially processed in the receive ISR.  */
2622     NX_PACKET   *nx_ip_deferred_received_packet_head,
2623                 *nx_ip_deferred_received_packet_tail;
2624 
2625     /* Define the raw IP function pointer that also indicates whether or
2626        not raw IP packet sending and receiving is enabled.  */
2627     UINT        (*nx_ip_raw_ip_processing)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *);
2628 
2629 #ifdef NX_ENABLE_IP_RAW_PACKET_FILTER
2630     /* Define the raw packet filter function pointer. */
2631     UINT        (*nx_ip_raw_packet_filter)(struct NX_IP_STRUCT *, ULONG, NX_PACKET *);
2632 #endif /* NX_ENABLE_IP_RAW_PACKET_FILTER */
2633 
2634     /* Define the pointer to the raw IP packet queue.  */
2635     NX_PACKET   *nx_ip_raw_received_packet_head,
2636                 *nx_ip_raw_received_packet_tail;
2637 
2638     /* Define the count of raw IP packets on the queue.  */
2639     ULONG       nx_ip_raw_received_packet_count;
2640 
2641     /* Define the maximum number of packets queued for receive. */
2642     ULONG       nx_ip_raw_received_packet_max;
2643 
2644     /* Define the raw packet suspension list head along with a count of
2645        how many threads are suspended.  */
2646     TX_THREAD   *nx_ip_raw_packet_suspension_list;
2647     ULONG       nx_ip_raw_packet_suspended_count;
2648 
2649     /* Define the IP helper thread that processes periodic ARP requests,
2650        reassembles IP messages, and helps handle TCP/IP packets.  */
2651     TX_THREAD   nx_ip_thread;
2652 
2653     /* Define the IP event flags that are used to stimulate the IP helper
2654        thread.  */
2655     TX_EVENT_FLAGS_GROUP
2656                 nx_ip_events;
2657 
2658     /* Define the IP periodic timer for this IP instance.  */
2659     TX_TIMER    nx_ip_periodic_timer;
2660 
2661     /* Define the IP fragment function pointer that also indicates whether or
2662        IP fragmenting is enabled.  */
2663     VOID        (*nx_ip_fragment_processing)(struct NX_IP_DRIVER_STRUCT *);
2664 
2665     /* Define the IP unfragment function pointer.  */
2666     VOID        (*nx_ip_fragment_assembly)(struct NX_IP_STRUCT *);
2667 
2668     /* Define the IP unfragment timeout checking function pointer.  */
2669     VOID        (*nx_ip_fragment_timeout_check)(struct NX_IP_STRUCT *);
2670 
2671     /* Define the fragment pointer to the oldest fragment re-assembly.  If this is
2672        the same between any periodic the fragment re-assembly is too old and
2673        will be deleted.  */
2674     NX_PACKET   *nx_ip_timeout_fragment;
2675 
2676     /* Define the pointer to the fragmented IP packet queue.  This queue is
2677        appended when a fragmented packet is received and is drained inside
2678        the IP.  */
2679     NX_PACKET   *nx_ip_received_fragment_head,
2680                 *nx_ip_received_fragment_tail;
2681 
2682     /* Define the pointer to the fragment re-assembly queue.  */
2683     NX_PACKET   *nx_ip_fragment_assembly_head,
2684                 *nx_ip_fragment_assembly_tail;
2685 
2686 #ifdef NX_ENABLE_6LOWPAN
2687     /* Define the created 6LoWPAN list. */
2688     VOID        *nx_ip_6lowpan_created_ptr;
2689 
2690 #ifdef NX_ENABLE_THREAD
2691     /* Define the created Thread list. */
2692     VOID        *nx_ip_thread_created_ptr;
2693 #endif /* NX_ENABLE_THREAD  */
2694 #endif /* NX_ENABLE_6LOWPAN  */
2695 
2696 #ifndef NX_DISABLE_IPV4
2697     /* Define the IP address change notification callback routine pointer.  */
2698     VOID        (*nx_ip_address_change_notify)(struct NX_IP_STRUCT *, VOID *);
2699     VOID        *nx_ip_address_change_notify_additional_info;
2700 
2701     /* Define the internal IP address change notification callback routine pointer, used in mDNS.  */
2702     VOID        (*nx_ip_address_change_notify_internal)(struct NX_IP_STRUCT *, VOID *);
2703 #endif /* !NX_DISABLE_IPV4  */
2704 
2705 #ifdef FEATURE_NX_IPV6
2706 #ifdef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
2707     VOID        (*nx_ipv6_address_change_notify)(struct NX_IP_STRUCT *ip_ptr, UINT status, UINT interface_index, UINT addres_index, ULONG *ip_address);
2708 
2709     /* Define the internal IPv6 address change notification callback routine pointer, used in mDNS.  */
2710     VOID        (*nx_ipv6_address_change_notify_internal)(struct NX_IP_STRUCT *ip_ptr, UINT status, UINT interface_index, UINT addres_index, ULONG *ip_address);
2711 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY */
2712 #endif /* FEATURE_NX_IPV6 */
2713 
2714 #ifndef NX_DISABLE_IPV4
2715     /* Define the multicast entry. */
2716     NX_IPV4_MULTICAST_ENTRY nx_ipv4_multicast_entry[NX_MAX_MULTICAST_GROUPS];
2717 
2718     /* Define global IGMP loopback enable/disable flag. By default, IGMP loopback is
2719        disabled.  */
2720     UINT        nx_ip_igmp_global_loopback_enable;
2721 
2722     /* Define the IGMP receive packet processing routine.  This is setup when IGMP
2723        is enabled.  */
2724     void        (*nx_ip_igmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *);
2725 
2726     /* Define the IGMP periodic processing routine.  This is also setup when IGMP
2727        is enabled.  */
2728     void        (*nx_ip_igmp_periodic_processing)(struct NX_IP_STRUCT *);
2729 
2730     /* Define the IGMP packet queue processing routine.  This is setup when IGMP is
2731        enabled.  */
2732     void        (*nx_ip_igmp_queue_process)(struct NX_IP_STRUCT *);
2733 
2734     /* Define the IGMP message queue.  */
2735     NX_PACKET   *nx_ip_igmp_queue_head;
2736 #endif /* !NX_DISABLE_IPV4  */
2737 
2738     /* Define the ICMP sequence number.  This is used in ICMP messages that
2739        require a sequence number.  */
2740     ULONG       nx_ip_icmp_sequence;
2741 
2742 #ifdef NX_ENABLE_IPV6_MULTICAST
2743 
2744     /* Define the IPv6 Multicast Group structure.  */
2745     NX_IPV6_MULTICAST_ENTRY nx_ipv6_multicast_entry[NX_MAX_MULTICAST_GROUPS];
2746 
2747     /* Define the MLD join count.  */
2748     ULONG       nx_ipv6_multicast_groups_joined;
2749 
2750 #endif /* NX_ENABLE_IPV6_MULTICAST  */
2751 
2752     /* Define the ICMP packet receive routine.  This also doubles as a
2753        mechanism to make sure ICMP is enabled.  If this function is NULL, ICMP
2754        is not enabled.  */
2755     void        (*nx_ip_icmp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *);
2756 
2757 #ifndef NX_DISABLE_IPV4
2758     /* Define the ICMP packet queue processing routine.  This is setup when ICMP is
2759        enabled.  */
2760     void        (*nx_ip_icmp_queue_process)(struct NX_IP_STRUCT *);
2761 
2762     /* Define the ICMP packet process routine */
2763     void        (*nx_ip_icmpv4_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *);
2764 #endif /* !NX_DISABLE_IPV4  */
2765 
2766 #ifdef FEATURE_NX_IPV6
2767     /* Define the ICMPv6 packet process routine. */
2768     void        (*nx_ip_icmpv6_packet_process)(struct NX_IP_STRUCT *, NX_PACKET *);
2769 
2770     /* Define the Neighbor Discovery cache fast (10ms) periodic update routine. */
2771     void        (*nx_nd_cache_fast_periodic_update)(struct NX_IP_STRUCT *);
2772 
2773     /* Define the Neighbor Discovery cache slow (1000 ms) periodic update routine. */
2774     void        (*nx_nd_cache_slow_periodic_update)(struct NX_IP_STRUCT *);
2775 
2776     /* Define the ICMPv6 router advertisement flag callback. */
2777     void        (*nx_icmpv6_ra_flag_callback)(struct NX_IP_STRUCT *, UINT);
2778 
2779 #ifdef NX_ENABLE_IPV6_PATH_MTU_DISCOVERY
2780     /* Define the MTU path discovery periodic update. */
2781     void        (*nx_destination_table_periodic_update)(struct NX_IP_STRUCT *);
2782 #endif
2783 
2784 #endif /* FEATURE_NX_IPV6 */
2785 
2786 
2787     /* Define the ICMP message queue.  */
2788     NX_PACKET   *nx_ip_icmp_queue_head;
2789 
2790     /* Define the ICMP ping suspension list head associated with a count of
2791        how many threads are suspended attempting to ping.  */
2792     TX_THREAD   *nx_ip_icmp_ping_suspension_list;
2793     ULONG        nx_ip_icmp_ping_suspended_count;
2794 
2795     /* Define the UDP port information structure associated with this IP instance.  */
2796     struct NX_UDP_SOCKET_STRUCT
2797                 *nx_ip_udp_port_table[NX_UDP_PORT_TABLE_SIZE];
2798 
2799     /* Define the head pointer of the created UDP socket list.  */
2800     struct NX_UDP_SOCKET_STRUCT
2801                 *nx_ip_udp_created_sockets_ptr;
2802 
2803     /* Define the number of created UDP socket instances.  */
2804     ULONG       nx_ip_udp_created_sockets_count;
2805 
2806     /* Define the UDP packet receive routine.  This also doubles as a
2807        mechanism to make sure UDP is enabled.  If this function is NULL, UDP
2808        is not enabled.  */
2809     void        (*nx_ip_udp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *);
2810 
2811     /* Define the TCP port information structure associated with this IP instance.  */
2812     struct NX_TCP_SOCKET_STRUCT
2813                 *nx_ip_tcp_port_table[NX_TCP_PORT_TABLE_SIZE];
2814 
2815     /* Define the head pointer of the created TCP socket list.  */
2816     struct NX_TCP_SOCKET_STRUCT
2817                 *nx_ip_tcp_created_sockets_ptr;
2818 
2819     /* Define the number of created TCP socket instances.  */
2820     ULONG       nx_ip_tcp_created_sockets_count;
2821 
2822     /* Define the TCP packet receive routine.  This also doubles as a
2823        mechanism to make sure TCP is enabled.  If this function is NULL, TCP
2824        is not enabled.  */
2825     void        (*nx_ip_tcp_packet_receive)(struct NX_IP_STRUCT *, struct NX_PACKET_STRUCT *);
2826 
2827     /* Define the TCP periodic processing routine for transmit timeout logic.  */
2828     void        (*nx_ip_tcp_periodic_processing)(struct NX_IP_STRUCT *);
2829 
2830     /* Define the TCP fast periodic processing routine for transmit timeout logic.  */
2831     void        (*nx_ip_tcp_fast_periodic_processing)(struct NX_IP_STRUCT *);
2832 
2833     /* Define the TCP packet queue processing routine.  This is setup when TCP is
2834        enabled.  */
2835     void        (*nx_ip_tcp_queue_process)(struct NX_IP_STRUCT *);
2836 
2837     /* Define the pointer to the incoming TCP packet queue.  */
2838     NX_PACKET   *nx_ip_tcp_queue_head,
2839                 *nx_ip_tcp_queue_tail;
2840 
2841     /* Define the count of incoming TCP packets on the queue.  */
2842     ULONG       nx_ip_tcp_received_packet_count;
2843 
2844     /* Define the TCP listen request structure that contains the maximum number of
2845        listen requests allowed for this IP instance.  */
2846     NX_TCP_LISTEN
2847                 nx_ip_tcp_server_listen_reqs[NX_MAX_LISTEN_REQUESTS];
2848 
2849     /* Define the head pointer of the available listen request structures.  */
2850     NX_TCP_LISTEN
2851                 *nx_ip_tcp_available_listen_requests;
2852 
2853     /* Define the head pointer of the active listen requests.  These are made
2854        by issuing the nx_tcp_server_socket_listen service.  */
2855     NX_TCP_LISTEN
2856                 *nx_ip_tcp_active_listen_requests;
2857 
2858 #ifdef NX_ENABLE_HTTP_PROXY
2859     /* Define the IP address of HTTP proxy server.  */
2860     NXD_ADDRESS nx_ip_http_proxy_ip_address;
2861 
2862     /* Define the port of HTTP proxy server.  */
2863     USHORT      nx_ip_http_proxy_port;
2864 
2865     /* Define the flag indicating the HTTP proxy is enabled.  */
2866     USHORT      nx_ip_http_proxy_enable;
2867 
2868     /* Define the buffer for HTTP proxy authentication.  */
2869     UCHAR       nx_ip_http_proxy_authentication[NX_HTTP_PROXY_MAX_AUTHENTICATION];
2870     UINT        nx_ip_http_proxy_authentication_length;
2871 #endif /* NX_ENABLE_HTTP_PROXY */
2872 
2873     /* Define a flag indicating the IP fast timer has been created */
2874     UINT        nx_ip_fast_periodic_timer_created;
2875 
2876     /* Define the fast IP periodic timer used for high resolution events for
2877        this IP instance.  */
2878     TX_TIMER    nx_ip_fast_periodic_timer;
2879 
2880 #ifndef NX_DISABLE_IPV4
2881     /* Define the destination routing information associated with this IP
2882        instance.  */
2883     struct NX_ARP_STRUCT
2884                 *nx_ip_arp_table[NX_ARP_TABLE_SIZE];
2885 
2886     /* Define the head pointer of the static ARP list.  */
2887     struct NX_ARP_STRUCT
2888                 *nx_ip_arp_static_list;
2889 
2890     /* Define the head pointer of the dynamic ARP list.  */
2891     struct NX_ARP_STRUCT
2892                 *nx_ip_arp_dynamic_list;
2893 
2894     /* Define the number of dynamic entries that are active.  */
2895     ULONG       nx_ip_arp_dynamic_active_count;
2896 
2897     /* Define the ARP deferred packet processing queue.  This is used to
2898        process ARP packets not initially processed in the receive ISR.  */
2899     NX_PACKET   *nx_ip_arp_deferred_received_packet_head,
2900                 *nx_ip_arp_deferred_received_packet_tail;
2901 
2902     /* Define the ARP entry allocate routine.  This also doubles as a
2903        mechanism to make sure ARP is enabled.  If this function is NULL, ARP
2904        is not enabled.  */
2905     UINT        (*nx_ip_arp_allocate)(struct NX_IP_STRUCT *, struct NX_ARP_STRUCT **, UINT);
2906 
2907     /* Define the ARP periodic processing routine.  This is setup when ARP is
2908        enabled.  */
2909     void        (*nx_ip_arp_periodic_update)(struct NX_IP_STRUCT *);
2910 
2911     /* Define the ARP receive queue processing routine.  This is setup when ARP is
2912        enabled.  */
2913     void        (*nx_ip_arp_queue_process)(struct NX_IP_STRUCT *);
2914 
2915     /* Define the ARP send packet routine.  This is setup when ARP is
2916        enabled.  */
2917     void        (*nx_ip_arp_packet_send)(struct NX_IP_STRUCT *, ULONG destination_ip, NX_INTERFACE *nx_interface);
2918 
2919     /* Define the ARP gratuitous response handler. This routine is setup in the
2920        nx_arp_gratuitous_send function.  */
2921     void        (*nx_ip_arp_gratuitous_response_handler)(struct NX_IP_STRUCT *, NX_PACKET *);
2922 
2923 #ifdef NX_ENABLE_ARP_MAC_CHANGE_NOTIFICATION
2924     /* Define the ARP collision notify handler. A non-null value for this function
2925        pointer results in NetX calling it whenever an IP address is found in an incoming
2926        ARP packet that matches that of the IP address in our ARP table.  */
2927     void        (*nx_ip_arp_collision_notify_response_handler)(void *);
2928 #endif
2929 
2930     /* Define the ARP cache memory area.  This memory is supplied
2931        by the ARP enable function and is carved up by that function into as
2932        many ARP entries that will fit.  */
2933     struct NX_ARP_STRUCT
2934                 *nx_ip_arp_cache_memory;
2935 
2936     /* Define the number of ARP entries that will fit in the ARP cache.  */
2937     ULONG       nx_ip_arp_total_entries;
2938 
2939     /* Define the RARP periodic processing routine.  This is setup when RARP is
2940        enabled.  It is also used to indicate RARP is enabled.  */
2941     void        (*nx_ip_rarp_periodic_update)(struct NX_IP_STRUCT *);
2942 
2943     /* Define the RARP receive queue processing routine.  This is setup when RARP is
2944        enabled.  */
2945     void        (*nx_ip_rarp_queue_process)(struct NX_IP_STRUCT *);
2946 
2947     /* Define the RARP deferred packet processing queue.  This is used to
2948        process RARP packets not initially processed in the receive ISR.  */
2949     NX_PACKET   *nx_ip_rarp_deferred_received_packet_head,
2950                 *nx_ip_rarp_deferred_received_packet_tail;
2951 #endif /* !NX_DISABLE_IPV4  */
2952 
2953     /* Define the link between other IP structures created by the application.  */
2954     struct NX_IP_STRUCT
2955                 *nx_ip_created_next,
2956                 *nx_ip_created_previous;
2957 
2958     /* This pointer is reserved for application specific use.  */
2959     /*lint -esym(768,NX_IP_STRUCT::nx_ip_reserved_ptr) suppress member not referenced. */
2960     void        *nx_ip_reserved_ptr;
2961 
2962     /* Define the TCP devered cleanup processing routine.  */
2963     void        (*nx_tcp_deferred_cleanup_check)(struct NX_IP_STRUCT *);
2964 
2965     /* Define the interfaces attached to this IP instance. */
2966     NX_INTERFACE nx_ip_interface[NX_MAX_IP_INTERFACES];
2967 
2968 #ifndef NX_DISABLE_IPV4
2969     /* Define the IPv4 packet receive processing routine */
2970     void        (*nx_ipv4_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *);
2971 
2972     /* Define the static routing table, if the feature is enabled. */
2973 #ifdef NX_ENABLE_IP_STATIC_ROUTING
2974 
2975     /* IPv4 static routing table. */
2976     NX_IP_ROUTING_ENTRY
2977                 nx_ip_routing_table[NX_IP_ROUTING_TABLE_SIZE];
2978 
2979     /* Number of entries in the IPv4 static routing table. */
2980     ULONG       nx_ip_routing_table_entry_count;
2981 
2982 #endif /* NX_ENABLE_IP_STATIC_ROUTING */
2983 #endif /* !NX_DISABLE_IPV4  */
2984 
2985 #ifdef FEATURE_NX_IPV6
2986 
2987     /* Number of valid entries in the IPv6 default router table. */
2988     USHORT  nx_ipv6_default_router_table_size;
2989 
2990     /* IPv6 default router table. */
2991     NX_IPV6_DEFAULT_ROUTER_ENTRY nx_ipv6_default_router_table[NX_IPV6_DEFAULT_ROUTER_TABLE_SIZE];
2992 
2993     /* Create an index for round robin router selection. */
2994     UINT  nx_ipv6_default_router_table_round_robin_index;
2995 
2996     /*
2997      * IPv6 prefix table. Entries in the prefix table are put into two lists:
2998      *   the prefix list, and the free list. The prefix list keeps track of a list
2999      *   of valid prefix entries.  The free list points to the unused entries.
3000      */
3001     NX_IPV6_PREFIX_ENTRY nx_ipv6_prefix_list_table[NX_IPV6_PREFIX_LIST_TABLE_SIZE];
3002 
3003     /* Point to the 1st element of the prefix list. */
3004     NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_list_ptr;
3005 
3006     /* Pointer to the 1st element of the prefix free list entry. */
3007     NX_IPV6_PREFIX_ENTRY *nx_ipv6_prefix_entry_free_list;
3008 
3009     /* Define the IPv6 packet receive processing routine */
3010     void        (*nx_ipv6_packet_receive)(struct NX_IP_STRUCT *, NX_PACKET *);
3011 
3012     /* Variable tracks the Neighbor Solicitation retransmission timer. */
3013     ULONG       nx_ipv6_retrans_timer_ticks;
3014 
3015     /* Variable tracks the Neighbor reachable timer. */
3016     ULONG       nx_ipv6_reachable_timer;
3017 
3018     /* Variable tracks the current hop_limit.  Hop limit is assigned by
3019        routers through the router advertisement message. */
3020     ULONG       nx_ipv6_hop_limit;
3021 
3022 #endif /* FEATURE_NX_IPV6 */
3023 
3024 #ifdef NX_IPSEC_ENABLE
3025     /* Define the IPsec Authentication Header process function, for the received packet. */
3026     UINT        (*nx_ip_ipsec_authentication_header_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **);
3027 
3028     /* Define the IPsec Authentication Header process function, for the transmit packet. */
3029     UINT        (*nx_ip_ipsec_authentication_header_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT, UINT);
3030 
3031     /* Define the IPsec Encapsulating Security Payload header process function, for the received packet. */
3032     UINT        (*nx_ip_ipsec_encapsulating_security_payload_receive)(struct NX_IP_STRUCT *, NX_PACKET *, ULONG *, NX_PACKET **);
3033 
3034     /* Define the IPsec Encapsulating Security Payload header insert function, for the transmit packet. */
3035     UINT        (*nx_ip_ipsec_encapsulating_security_payload_transmit)(struct NX_IP_STRUCT *, NX_PACKET **, UINT);
3036 
3037     /* Define the IPsec egress SA lookup routine. This is called by TCP/UDP/ICMP/RAW packet send. */
3038     UINT        (*nx_ip_packet_egress_sa_lookup)(struct NX_IP_STRUCT *ip_ptr,  NXD_ADDRESS *src_address,
3039                                               NXD_ADDRESS *dst_address, UCHAR protocol, ULONG src_port, ULONG dest_port,
3040                                               ULONG *data_offset, VOID **sa_ptr, UINT option);
3041 
3042     /* Define the head pointer of the ingress SA list. */
3043     VOID        *nx_ip_ipsec_ingress_sa_ptr;
3044 
3045     /* Define the head pointer of the egress SA list. */
3046     VOID        *nx_ip_ipsec_egress_sa_ptr;
3047 
3048     /* Define the reference to IKEv2. */
3049     VOID        *nx_ip_ipsec_ikev2_ptr;
3050 
3051     /* Define the packet queue header in which packet is processed by hardware engine. */
3052     NX_PACKET   *nx_ip_hw_done_packet_header_ptr;
3053 
3054     /* Define the packet queue tail in which packet is processed by hardware engine. */
3055     NX_PACKET   *nx_ip_hw_done_packet_tail_ptr;
3056 
3057 #endif /* NX_IPSEC_ENABLE */
3058 
3059     /* Define the link status change notify routine. */
3060     VOID        (*nx_ip_link_status_change_callback)(struct NX_IP_STRUCT *, UINT, UINT);
3061 
3062 #ifdef NX_ENABLE_IP_PACKET_FILTER
3063     /* Define the IP packet filter routine.  */
3064     UINT        (*nx_ip_packet_filter)(VOID *, UINT);
3065 
3066     /* Define the IP packet filter extended routine.  */
3067     /* Note: Developers are encouraged to use nx_ip_packet_filter_extended since nx_ip_packet_filter will be deprecated.*/
3068     UINT        (*nx_ip_packet_filter_extended)(struct NX_IP_STRUCT *ip_ptr, NX_PACKET *packet_ptr, UINT direction);
3069 #endif /* NX_ENABLE_IP_PACKET_FILTER */
3070 
3071     /* Define the port extension in the IP control block. This
3072        is typically defined to whitespace in nx_port.h.  */
3073     NX_IP_MODULE_EXTENSION
3074 
3075 } NX_IP;
3076 
3077 
3078 /* Define the Driver interface structure that is typically allocated off of the
3079    local stack and passed to the IP Link Driver.  */
3080 
3081 typedef struct NX_IP_DRIVER_STRUCT
3082 {
3083 
3084     /* Define the driver command.  */
3085     UINT        nx_ip_driver_command;
3086 
3087     /* Define the driver return status.  */
3088     UINT        nx_ip_driver_status;
3089 
3090     /* Define the physical address that maps to the destination IP address.  */
3091     ULONG       nx_ip_driver_physical_address_msw;
3092     ULONG       nx_ip_driver_physical_address_lsw;
3093 
3094 #ifdef NX_ENABLE_6LOWPAN
3095     /* Define the length of physical address. Used by 6LoWPAN driver.  */
3096     USHORT      nx_ip_driver_physical_address_length;
3097 
3098     /* Define the 6LoWPAN sub driver command, see nx_6lowpan.h. Used by 6LoWPAN driver.  */
3099     USHORT      nx_ip_driver_sub_command;
3100 #endif /* NX_ENABLE_6LOWPAN */
3101 
3102     /* Define the datagram packet (if any) for the driver to send.  */
3103     NX_PACKET   *nx_ip_driver_packet;
3104 
3105     /* Define the return pointer for raw driver command requests.  */
3106     ULONG       *nx_ip_driver_return_ptr;
3107 
3108     /* Define the IP pointer associated with the request.  */
3109     struct NX_IP_STRUCT
3110                 *nx_ip_driver_ptr;
3111 
3112     NX_INTERFACE *nx_ip_driver_interface;
3113 } NX_IP_DRIVER;
3114 
3115 
3116 /* Define the system API mappings based on the error checking
3117    selected by the user.  Note: this section is only applicable to
3118    application source code, hence the conditional that turns off this
3119    stuff when the include file is processed by the ThreadX source. */
3120 
3121 #ifndef NX_SOURCE_CODE
3122 
3123 /* Map old APIs to new APIs. */
3124 #define nx_ip_raw_packet_interface_send                 nx_ip_raw_packet_source_send
3125 #define nx_udp_socket_interface_send                    nx_udp_socket_source_send
3126 #define nxd_icmp_interface_ping                         nxd_icmp_source_ping
3127 #define nxd_ip_raw_packet_interface_send                nxd_ip_raw_packet_source_send
3128 #define nxd_ipv6_global_address_set(i, a, p)            nxd_ipv6_address_set(i, 0, a, p, NX_NULL)
3129 #define nxd_ipv6_linklocal_address_set(i, a)            nxd_ipv6_address_set(i, 0, a, 10, NX_NULL)
3130 #define nxd_udp_socket_interface_send                   nxd_udp_socket_source_send
3131 
3132 
3133 /* Determine if error checking is desired.  If so, map API functions
3134    to the appropriate error checking front-ends.  Otherwise, map API
3135    functions to the core functions that actually perform the work.
3136    Note: error checking is enabled by default.  */
3137 
3138 #ifdef NX_DISABLE_ERROR_CHECKING
3139 /* Services without error checking.  */
3140 /* APIs for ARP. */
3141 #define nx_arp_dynamic_entries_invalidate               _nx_arp_dynamic_entries_invalidate
3142 #define nx_arp_dynamic_entry_set                        _nx_arp_dynamic_entry_set
3143 #define nx_arp_enable                                   _nx_arp_enable
3144 #define nx_arp_entry_delete                             _nx_arp_entry_delete
3145 #define nx_arp_gratuitous_send                          _nx_arp_gratuitous_send
3146 #define nx_arp_hardware_address_find                    _nx_arp_hardware_address_find
3147 #define nx_arp_info_get                                 _nx_arp_info_get
3148 #define nx_arp_ip_address_find                          _nx_arp_ip_address_find
3149 #define nx_arp_static_entries_delete                    _nx_arp_static_entries_delete
3150 #define nx_arp_static_entry_create                      _nx_arp_static_entry_create
3151 #define nx_arp_static_entry_delete                      _nx_arp_static_entry_delete
3152 
3153 /* APIs for ICMP. */
3154 #define nx_icmp_enable                                  _nx_icmp_enable
3155 #define nx_icmp_info_get                                _nx_icmp_info_get
3156 #define nx_icmp_ping                                    _nx_icmp_ping
3157 #define nxd_icmp_enable                                 _nxd_icmp_enable
3158 #define nxd_icmp_ping                                   _nxd_icmp_ping
3159 #define nxd_icmp_source_ping                            _nxd_icmp_source_ping
3160 #define nxd_icmpv6_ra_flag_callback_set                 _nxd_icmpv6_ra_flag_callback_set
3161 
3162 /* APIs for IGMP. */
3163 #define nx_igmp_enable                                  _nx_igmp_enable
3164 #define nx_igmp_info_get                                _nx_igmp_info_get
3165 #define nx_igmp_loopback_disable                        _nx_igmp_loopback_disable
3166 #define nx_igmp_multicast_leave                         _nx_igmp_multicast_leave
3167 #define nx_igmp_multicast_interface_join                _nx_igmp_multicast_interface_join
3168 #define nx_igmp_multicast_interface_leave               _nx_igmp_multicast_interface_leave
3169 #define nx_igmp_loopback_enable                         _nx_igmp_loopback_enable
3170 #define nx_igmp_multicast_join                          _nx_igmp_multicast_join
3171 
3172 /* APIs for IP. */
3173 #define nx_ip_address_change_notify                     _nx_ip_address_change_notify
3174 #define nx_ip_address_get                               _nx_ip_address_get
3175 #define nx_ip_address_set                               _nx_ip_address_set
3176 #define nx_ip_auxiliary_packet_pool_set                 _nx_ip_auxiliary_packet_pool_set
3177 #define nx_ip_create                                    _nx_ip_create
3178 #define nx_ip_delete                                    _nx_ip_delete
3179 #define nx_ip_driver_direct_command                     _nx_ip_driver_direct_command
3180 #define nx_ip_driver_interface_direct_command           _nx_ip_driver_interface_direct_command
3181 #define nx_ip_forwarding_disable                        _nx_ip_forwarding_disable
3182 #define nx_ip_forwarding_enable                         _nx_ip_forwarding_enable
3183 #define nx_ip_fragment_disable                          _nx_ip_fragment_disable
3184 #define nx_ip_fragment_enable                           _nx_ip_fragment_enable
3185 #define nx_ip_gateway_address_clear                     _nx_ip_gateway_address_clear
3186 #define nx_ip_gateway_address_get                       _nx_ip_gateway_address_get
3187 #define nx_ip_gateway_address_set                       _nx_ip_gateway_address_set
3188 #define nx_ip_info_get                                  _nx_ip_info_get
3189 #define nx_ip_interface_address_get                     _nx_ip_interface_address_get
3190 #define nx_ip_interface_address_mapping_configure       _nx_ip_interface_address_mapping_configure
3191 #define nx_ip_interface_address_set                     _nx_ip_interface_address_set
3192 #define nx_ip_interface_attach                          _nx_ip_interface_attach
3193 #define nx_ip_interface_capability_get                  _nx_ip_interface_capability_get
3194 #define nx_ip_interface_capability_set                  _nx_ip_interface_capability_set
3195 #define nx_ip_interface_detach                          _nx_ip_interface_detach
3196 #define nx_ip_interface_info_get                        _nx_ip_interface_info_get
3197 #define nx_ip_interface_mtu_set                         _nx_ip_interface_mtu_set
3198 #define nx_ip_interface_physical_address_get            _nx_ip_interface_physical_address_get
3199 #define nx_ip_interface_physical_address_set            _nx_ip_interface_physical_address_set
3200 #define nx_ip_interface_status_check                    _nx_ip_interface_status_check
3201 #define nx_ip_link_status_change_notify_set             _nx_ip_link_status_change_notify_set
3202 #define nx_ip_max_payload_size_find                     _nx_ip_max_payload_size_find
3203 #define nx_ip_status_check                              _nx_ip_status_check
3204 #define nx_ip_static_route_add                          _nx_ip_static_route_add
3205 #define nx_ip_static_route_delete                       _nx_ip_static_route_delete
3206 #define nx_ipv4_multicast_interface_join                _nx_ipv4_multicast_interface_join
3207 #define nx_ipv4_multicast_interface_leave               _nx_ipv4_multicast_interface_leave
3208 #define nxd_ipv6_address_change_notify                  _nxd_ipv6_address_change_notify
3209 #define nxd_ipv6_address_delete                         _nxd_ipv6_address_delete
3210 #define nxd_ipv6_address_get                            _nxd_ipv6_address_get
3211 #define nxd_ipv6_address_set                            _nxd_ipv6_address_set
3212 #define nxd_ipv6_default_router_add                     _nxd_ipv6_default_router_add
3213 #define nxd_ipv6_default_router_delete                  _nxd_ipv6_default_router_delete
3214 #define nxd_ipv6_default_router_entry_get               _nxd_ipv6_default_router_entry_get
3215 #define nxd_ipv6_default_router_get                     _nxd_ipv6_default_router_get
3216 #define nxd_ipv6_default_router_number_of_entries_get   _nxd_ipv6_default_router_number_of_entries_get
3217 #define nxd_ipv6_disable                                _nxd_ipv6_disable
3218 #define nxd_ipv6_enable                                 _nxd_ipv6_enable
3219 #define nxd_ipv6_multicast_interface_join               _nxd_ipv6_multicast_interface_join
3220 #define nxd_ipv6_multicast_interface_leave              _nxd_ipv6_multicast_interface_leave
3221 #define nxd_ipv6_stateless_address_autoconfig_disable   _nxd_ipv6_stateless_address_autoconfig_disable
3222 #define nxd_ipv6_stateless_address_autoconfig_enable    _nxd_ipv6_stateless_address_autoconfig_enable
3223 
3224 /* APIs for RAW service. */
3225 #define nx_ip_raw_packet_disable                        _nx_ip_raw_packet_disable
3226 #define nx_ip_raw_packet_enable                         _nx_ip_raw_packet_enable
3227 #define nx_ip_raw_packet_filter_set                     _nx_ip_raw_packet_filter_set
3228 #define nx_ip_raw_packet_receive                        _nx_ip_raw_packet_receive
3229 #define nx_ip_raw_packet_send                           _nx_ip_raw_packet_send
3230 #define nx_ip_raw_packet_source_send                    _nx_ip_raw_packet_source_send
3231 #define nx_ip_raw_receive_queue_max_set                 _nx_ip_raw_receive_queue_max_set
3232 #define nxd_ip_raw_packet_send                          _nxd_ip_raw_packet_send
3233 #define nxd_ip_raw_packet_source_send                   _nxd_ip_raw_packet_source_send
3234 
3235 /* APIs for ND cache. */
3236 #define nxd_nd_cache_entry_set                          _nxd_nd_cache_entry_set
3237 #define nxd_nd_cache_entry_delete                       _nxd_nd_cache_entry_delete
3238 #define nxd_nd_cache_hardware_address_find              _nxd_nd_cache_hardware_address_find
3239 #define nxd_nd_cache_invalidate                         _nxd_nd_cache_invalidate
3240 #define nxd_nd_cache_ip_address_find                    _nxd_nd_cache_ip_address_find
3241 
3242 /* APIs for packet pool. */
3243 #define nx_packet_allocate                              _nx_packet_allocate
3244 #define nx_packet_copy                                  _nx_packet_copy
3245 #define nx_packet_data_append                           _nx_packet_data_append
3246 #define nx_packet_data_extract_offset                   _nx_packet_data_extract_offset
3247 #define nx_packet_data_retrieve                         _nx_packet_data_retrieve
3248 #define nx_packet_length_get                            _nx_packet_length_get
3249 #define nx_packet_pool_create                           _nx_packet_pool_create
3250 #define nx_packet_pool_delete                           _nx_packet_pool_delete
3251 #define nx_packet_pool_info_get                         _nx_packet_pool_info_get
3252 #define nx_packet_pool_low_watermark_set                _nx_packet_pool_low_watermark_set
3253 #define nx_packet_release                               _nx_packet_release
3254 #define nx_packet_transmit_release                      _nx_packet_transmit_release
3255 
3256 /* APIs for RARP. */
3257 #define nx_rarp_disable                                 _nx_rarp_disable
3258 #define nx_rarp_enable                                  _nx_rarp_enable
3259 #define nx_rarp_info_get                                _nx_rarp_info_get
3260 
3261 /* APIs for TCP. */
3262 #define nx_tcp_client_socket_bind                       _nx_tcp_client_socket_bind
3263 #define nx_tcp_client_socket_connect                    _nx_tcp_client_socket_connect
3264 #define nx_tcp_client_socket_port_get                   _nx_tcp_client_socket_port_get
3265 #define nx_tcp_client_socket_unbind                     _nx_tcp_client_socket_unbind
3266 #define nx_tcp_enable                                   _nx_tcp_enable
3267 #define nx_tcp_free_port_find                           _nx_tcp_free_port_find
3268 #define nx_tcp_info_get                                 _nx_tcp_info_get
3269 #define nx_tcp_server_socket_accept                     _nx_tcp_server_socket_accept
3270 #define nx_tcp_server_socket_listen                     _nx_tcp_server_socket_listen
3271 #define nx_tcp_server_socket_relisten                   _nx_tcp_server_socket_relisten
3272 #define nx_tcp_server_socket_unaccept                   _nx_tcp_server_socket_unaccept
3273 #define nx_tcp_server_socket_unlisten                   _nx_tcp_server_socket_unlisten
3274 #define nx_tcp_socket_bytes_available                   _nx_tcp_socket_bytes_available
3275 #define nx_tcp_socket_create                            _nx_tcp_socket_create
3276 #define nx_tcp_socket_delete                            _nx_tcp_socket_delete
3277 #define nx_tcp_socket_disconnect                        _nx_tcp_socket_disconnect
3278 #define nx_tcp_socket_disconnect_complete_notify        _nx_tcp_socket_disconnect_complete_notify
3279 #define nx_tcp_socket_establish_notify                  _nx_tcp_socket_establish_notify
3280 #define nx_tcp_socket_info_get                          _nx_tcp_socket_info_get
3281 #define nx_tcp_socket_mss_get                           _nx_tcp_socket_mss_get
3282 #define nx_tcp_socket_mss_peer_get                      _nx_tcp_socket_mss_peer_get
3283 #define nx_tcp_socket_mss_set                           _nx_tcp_socket_mss_set
3284 #define nx_tcp_socket_peer_info_get                     _nx_tcp_socket_peer_info_get
3285 #define nx_tcp_socket_queue_depth_notify_set            _nx_tcp_socket_queue_depth_notify_set
3286 #define nx_tcp_socket_receive                           _nx_tcp_socket_receive
3287 #define nx_tcp_socket_receive_notify                    _nx_tcp_socket_receive_notify
3288 #define nx_tcp_socket_receive_queue_max_set             _nx_tcp_socket_receive_queue_max_set
3289 #define nx_tcp_socket_send                              _nx_tcp_socket_send
3290 #define nx_tcp_socket_state_wait                        _nx_tcp_socket_state_wait
3291 #define nx_tcp_socket_timed_wait_callback               _nx_tcp_socket_timed_wait_callback
3292 #define nx_tcp_socket_transmit_configure                _nx_tcp_socket_transmit_configure
3293 #define nx_tcp_socket_window_update_notify_set          _nx_tcp_socket_window_update_notify_set
3294 #define nxd_tcp_client_socket_connect                   _nxd_tcp_client_socket_connect
3295 #define nxd_tcp_socket_peer_info_get                    _nxd_tcp_socket_peer_info_get
3296 
3297 /* APIs for UDP. */
3298 
3299 #define nx_udp_enable                                   _nx_udp_enable
3300 #define nx_udp_free_port_find                           _nx_udp_free_port_find
3301 #define nx_udp_info_get                                 _nx_udp_info_get
3302 #define nx_udp_packet_info_extract                      _nx_udp_packet_info_extract
3303 #define nx_udp_socket_bind                              _nx_udp_socket_bind
3304 #define nx_udp_socket_bytes_available                   _nx_udp_socket_bytes_available
3305 #define nx_udp_socket_checksum_disable                  _nx_udp_socket_checksum_disable
3306 #define nx_udp_socket_checksum_enable                   _nx_udp_socket_checksum_enable
3307 #define nx_udp_socket_create                            _nx_udp_socket_create
3308 #define nx_udp_socket_delete                            _nx_udp_socket_delete
3309 #define nx_udp_socket_info_get                          _nx_udp_socket_info_get
3310 #define nx_udp_socket_port_get                          _nx_udp_socket_port_get
3311 #define nx_udp_socket_receive                           _nx_udp_socket_receive
3312 #define nx_udp_socket_receive_notify                    _nx_udp_socket_receive_notify
3313 #define nx_udp_socket_send                              _nx_udp_socket_send
3314 #define nx_udp_socket_source_send                       _nx_udp_socket_source_send
3315 #define nx_udp_socket_unbind                            _nx_udp_socket_unbind
3316 #define nx_udp_source_extract                           _nx_udp_source_extract
3317 #define nxd_udp_packet_info_extract                     _nxd_udp_packet_info_extract
3318 #define nxd_udp_socket_send                             _nxd_udp_socket_send
3319 #define nxd_udp_socket_source_send                      _nxd_udp_socket_source_send
3320 #define nxd_udp_source_extract                          _nxd_udp_source_extract
3321 
3322 /* APIs for others. */
3323 #define nx_system_initialize                            _nx_system_initialize
3324 #define nx_http_proxy_client_enable                     _nx_http_proxy_client_enable
3325 
3326 #else
3327 
3328 /* Services with error checking.  */
3329 /* APIs for ARP. */
3330 #define nx_arp_dynamic_entries_invalidate               _nxe_arp_dynamic_entries_invalidate
3331 #define nx_arp_dynamic_entry_set                        _nxe_arp_dynamic_entry_set
3332 #define nx_arp_enable                                   _nxe_arp_enable
3333 #define nx_arp_entry_delete                             _nxe_arp_entry_delete
3334 #define nx_arp_gratuitous_send                          _nxe_arp_gratuitous_send
3335 #define nx_arp_hardware_address_find                    _nxe_arp_hardware_address_find
3336 #define nx_arp_info_get                                 _nxe_arp_info_get
3337 #define nx_arp_ip_address_find                          _nxe_arp_ip_address_find
3338 #define nx_arp_static_entries_delete                    _nxe_arp_static_entries_delete
3339 #define nx_arp_static_entry_create                      _nxe_arp_static_entry_create
3340 #define nx_arp_static_entry_delete                      _nxe_arp_static_entry_delete
3341 
3342 /* APIs for ICMP. */
3343 #define nx_icmp_enable                                  _nxe_icmp_enable
3344 #define nx_icmp_info_get                                _nxe_icmp_info_get
3345 #define nx_icmp_ping                                    _nxe_icmp_ping
3346 #define nxd_icmp_enable                                 _nxde_icmp_enable
3347 #define nxd_icmp_ping                                   _nxde_icmp_ping
3348 #define nxd_icmp_source_ping                            _nxde_icmp_source_ping
3349 #define nxd_icmpv6_ra_flag_callback_set                 _nxde_icmpv6_ra_flag_callback_set
3350 
3351 /* APIs for IGMP. */
3352 #define nx_igmp_enable                                  _nxe_igmp_enable
3353 #define nx_igmp_info_get                                _nxe_igmp_info_get
3354 #define nx_igmp_loopback_disable                        _nxe_igmp_loopback_disable
3355 #define nx_igmp_loopback_enable                         _nxe_igmp_loopback_enable
3356 #define nx_igmp_multicast_interface_join                _nxe_igmp_multicast_interface_join
3357 #define nx_igmp_multicast_interface_leave               _nxe_igmp_multicast_interface_leave
3358 #define nx_igmp_multicast_join                          _nxe_igmp_multicast_join
3359 #define nx_igmp_multicast_leave                         _nxe_igmp_multicast_leave
3360 
3361 /* APIs for IP. */
3362 #define nx_ip_address_change_notify                     _nxe_ip_address_change_notify
3363 #define nx_ip_address_get                               _nxe_ip_address_get
3364 #define nx_ip_address_set                               _nxe_ip_address_set
3365 #define nx_ip_auxiliary_packet_pool_set                 _nxe_ip_auxiliary_packet_pool_set
3366 #define nx_ip_create(i, n, a, m, d, l, p, s, y)         _nxe_ip_create(i, n, a, m, d, l, p, s, y, sizeof(NX_IP))
3367 #define nx_ip_delete                                    _nxe_ip_delete
3368 #define nx_ip_driver_direct_command                     _nxe_ip_driver_direct_command
3369 #define nx_ip_driver_interface_direct_command           _nxe_ip_driver_interface_direct_command
3370 #define nx_ip_forwarding_disable                        _nxe_ip_forwarding_disable
3371 #define nx_ip_forwarding_enable                         _nxe_ip_forwarding_enable
3372 #define nx_ip_fragment_disable                          _nxe_ip_fragment_disable
3373 #define nx_ip_fragment_enable                           _nxe_ip_fragment_enable
3374 #define nx_ip_gateway_address_clear                     _nxe_ip_gateway_address_clear
3375 #define nx_ip_gateway_address_get                       _nxe_ip_gateway_address_get
3376 #define nx_ip_gateway_address_set                       _nxe_ip_gateway_address_set
3377 #define nx_ip_info_get                                  _nxe_ip_info_get
3378 #define nx_ip_interface_address_get                     _nxe_ip_interface_address_get
3379 #define nx_ip_interface_address_mapping_configure       _nxe_ip_interface_address_mapping_configure
3380 #define nx_ip_interface_address_set                     _nxe_ip_interface_address_set
3381 #define nx_ip_interface_attach                          _nxe_ip_interface_attach
3382 #define nx_ip_interface_capability_get                  _nxe_ip_interface_capability_get
3383 #define nx_ip_interface_capability_set                  _nxe_ip_interface_capability_set
3384 #define nx_ip_interface_detach                          _nxe_ip_interface_detach
3385 #define nx_ip_interface_info_get                        _nxe_ip_interface_info_get
3386 #define nx_ip_interface_mtu_set                         _nxe_ip_interface_mtu_set
3387 #define nx_ip_interface_physical_address_get            _nxe_ip_interface_physical_address_get
3388 #define nx_ip_interface_physical_address_set            _nxe_ip_interface_physical_address_set
3389 #define nx_ip_interface_status_check                    _nxe_ip_interface_status_check
3390 #define nx_ip_link_status_change_notify_set             _nxe_ip_link_status_change_notify_set
3391 #define nx_ip_max_payload_size_find                     _nxe_ip_max_payload_size_find
3392 #define nx_ip_status_check                              _nxe_ip_status_check
3393 #define nx_ip_static_route_add                          _nxe_ip_static_route_add
3394 #define nx_ip_static_route_delete                       _nxe_ip_static_route_delete
3395 #define nx_ipv4_multicast_interface_join                _nxe_ipv4_multicast_interface_join
3396 #define nx_ipv4_multicast_interface_leave               _nxe_ipv4_multicast_interface_leave
3397 #define nxd_ipv6_address_change_notify                  _nxde_ipv6_address_change_notify
3398 #define nxd_ipv6_address_delete                         _nxde_ipv6_address_delete
3399 #define nxd_ipv6_address_get                            _nxde_ipv6_address_get
3400 #define nxd_ipv6_address_set                            _nxde_ipv6_address_set
3401 #define nxd_ipv6_default_router_add                     _nxde_ipv6_default_router_add
3402 #define nxd_ipv6_default_router_delete                  _nxde_ipv6_default_router_delete
3403 #define nxd_ipv6_default_router_entry_get               _nxde_ipv6_default_router_entry_get
3404 #define nxd_ipv6_default_router_get                     _nxde_ipv6_default_router_get
3405 #define nxd_ipv6_default_router_number_of_entries_get   _nxde_ipv6_default_router_number_of_entries_get
3406 #define nxd_ipv6_disable                                _nxde_ipv6_disable
3407 #define nxd_ipv6_enable                                 _nxde_ipv6_enable
3408 #define nxd_ipv6_multicast_interface_join               _nxde_ipv6_multicast_interface_join
3409 #define nxd_ipv6_multicast_interface_leave              _nxde_ipv6_multicast_interface_leave
3410 #define nxd_ipv6_stateless_address_autoconfig_disable   _nxde_ipv6_stateless_address_autoconfig_disable
3411 #define nxd_ipv6_stateless_address_autoconfig_enable    _nxde_ipv6_stateless_address_autoconfig_enable
3412 
3413 /* APIs for RAW service. */
3414 #define nx_ip_raw_packet_disable                        _nxe_ip_raw_packet_disable
3415 #define nx_ip_raw_packet_enable                         _nxe_ip_raw_packet_enable
3416 #define nx_ip_raw_packet_filter_set                     _nxe_ip_raw_packet_filter_set
3417 #define nx_ip_raw_packet_receive                        _nxe_ip_raw_packet_receive
3418 #define nx_ip_raw_packet_send(i, p, d, t)               _nxe_ip_raw_packet_send(i, &p, d, t)
3419 #define nx_ip_raw_packet_source_send(i, p, d, a, t)     _nxe_ip_raw_packet_source_send(i, &p, d, a, t)
3420 #define nx_ip_raw_receive_queue_max_set                 _nxe_ip_raw_receive_queue_max_set
3421 #define nxd_ip_raw_packet_send(i, p, d, t, l, s)        _nxde_ip_raw_packet_send(i, &p, d, t, l, s)
3422 #define nxd_ip_raw_packet_source_send                   _nxde_ip_raw_packet_source_send
3423 
3424 /* APIs for ND cache. */
3425 #define nxd_nd_cache_entry_set                          _nxde_nd_cache_entry_set
3426 #define nxd_nd_cache_entry_delete                       _nxde_nd_cache_entry_delete
3427 #define nxd_nd_cache_hardware_address_find              _nxde_nd_cache_hardware_address_find
3428 #define nxd_nd_cache_invalidate                         _nxde_nd_cache_invalidate
3429 #define nxd_nd_cache_ip_address_find                    _nxde_nd_cache_ip_address_find
3430 
3431 /* APIs for packet pool. */
3432 #define nx_packet_allocate                              _nxe_packet_allocate
3433 #define nx_packet_copy                                  _nxe_packet_copy
3434 #define nx_packet_data_append                           _nxe_packet_data_append
3435 #define nx_packet_data_extract_offset                   _nxe_packet_data_extract_offset
3436 #define nx_packet_data_retrieve                         _nxe_packet_data_retrieve
3437 #define nx_packet_length_get                            _nxe_packet_length_get
3438 #define nx_packet_pool_create(p, n, l, m, s)            _nxe_packet_pool_create(p, n, l, m, s, sizeof(NX_PACKET_POOL))
3439 #define nx_packet_pool_delete                           _nxe_packet_pool_delete
3440 #define nx_packet_pool_info_get                         _nxe_packet_pool_info_get
3441 #define nx_packet_pool_low_watermark_set                _nxe_packet_pool_low_watermark_set
3442 #define nx_packet_release(p)                            _nxe_packet_release(&p)
3443 #define nx_packet_transmit_release(p)                   _nxe_packet_transmit_release(&p)
3444 
3445 /* APIs for RARP. */
3446 #define nx_rarp_disable                                 _nxe_rarp_disable
3447 #define nx_rarp_enable                                  _nxe_rarp_enable
3448 #define nx_rarp_info_get                                _nxe_rarp_info_get
3449 
3450 /* APIs for TCP. */
3451 #define nx_tcp_client_socket_bind                       _nxe_tcp_client_socket_bind
3452 #define nx_tcp_client_socket_connect                    _nxe_tcp_client_socket_connect
3453 #define nx_tcp_client_socket_port_get                   _nxe_tcp_client_socket_port_get
3454 #define nx_tcp_client_socket_unbind                     _nxe_tcp_client_socket_unbind
3455 #define nx_tcp_enable                                   _nxe_tcp_enable
3456 #define nx_tcp_free_port_find                           _nxe_tcp_free_port_find
3457 #define nx_tcp_info_get                                 _nxe_tcp_info_get
3458 #define nx_tcp_server_socket_accept                     _nxe_tcp_server_socket_accept
3459 #define nx_tcp_server_socket_listen                     _nxe_tcp_server_socket_listen
3460 #define nx_tcp_server_socket_relisten                   _nxe_tcp_server_socket_relisten
3461 #define nx_tcp_server_socket_unaccept                   _nxe_tcp_server_socket_unaccept
3462 #define nx_tcp_server_socket_unlisten                   _nxe_tcp_server_socket_unlisten
3463 #define nx_tcp_socket_bytes_available                   _nxe_tcp_socket_bytes_available
3464 #define nx_tcp_socket_create(i, s, n, t, f, l, w, u, d) _nxe_tcp_socket_create(i, s, n, t, f, l, w, u, d, sizeof(NX_TCP_SOCKET))
3465 #define nx_tcp_socket_delete                            _nxe_tcp_socket_delete
3466 #define nx_tcp_socket_disconnect                        _nxe_tcp_socket_disconnect
3467 #define nx_tcp_socket_disconnect_complete_notify        _nxe_tcp_socket_disconnect_complete_notify
3468 #define nx_tcp_socket_establish_notify                  _nxe_tcp_socket_establish_notify
3469 #define nx_tcp_socket_info_get                          _nxe_tcp_socket_info_get
3470 #define nx_tcp_socket_mss_get                           _nxe_tcp_socket_mss_get
3471 #define nx_tcp_socket_mss_peer_get                      _nxe_tcp_socket_mss_peer_get
3472 #define nx_tcp_socket_mss_set                           _nxe_tcp_socket_mss_set
3473 #define nx_tcp_socket_peer_info_get                     _nxe_tcp_socket_peer_info_get
3474 #define nx_tcp_socket_queue_depth_notify_set            _nxe_tcp_socket_queue_depth_notify_set
3475 #define nx_tcp_socket_receive                           _nxe_tcp_socket_receive
3476 #define nx_tcp_socket_receive_notify                    _nxe_tcp_socket_receive_notify
3477 #define nx_tcp_socket_receive_queue_max_set             _nxe_tcp_socket_receive_queue_max_set
3478 #define nx_tcp_socket_send(s, p, t)                     _nxe_tcp_socket_send(s, &p, t)
3479 #define nx_tcp_socket_state_wait                        _nxe_tcp_socket_state_wait
3480 #define nx_tcp_socket_timed_wait_callback               _nxe_tcp_socket_timed_wait_callback
3481 #define nx_tcp_socket_transmit_configure                _nxe_tcp_socket_transmit_configure
3482 #define nx_tcp_socket_window_update_notify_set          _nxe_tcp_socket_window_update_notify_set
3483 #define nxd_tcp_client_socket_connect                   _nxde_tcp_client_socket_connect
3484 #define nxd_tcp_socket_peer_info_get                    _nxde_tcp_socket_peer_info_get
3485 
3486 /* APIs for UDP. */
3487 #define nx_udp_enable                                   _nxe_udp_enable
3488 #define nx_udp_free_port_find                           _nxe_udp_free_port_find
3489 #define nx_udp_info_get                                 _nxe_udp_info_get
3490 #define nx_udp_packet_info_extract                      _nxe_udp_packet_info_extract
3491 #define nx_udp_socket_bind                              _nxe_udp_socket_bind
3492 #define nx_udp_socket_bytes_available                   _nxe_udp_socket_bytes_available
3493 #define nx_udp_socket_checksum_disable                  _nxe_udp_socket_checksum_disable
3494 #define nx_udp_socket_checksum_enable                   _nxe_udp_socket_checksum_enable
3495 #define nx_udp_socket_create(i, s, n, t, f, l, q)       _nxe_udp_socket_create(i, s, n, t, f, l, q, sizeof(NX_UDP_SOCKET))
3496 #define nx_udp_socket_delete                            _nxe_udp_socket_delete
3497 #define nx_udp_socket_info_get                          _nxe_udp_socket_info_get
3498 #define nx_udp_socket_port_get                          _nxe_udp_socket_port_get
3499 #define nx_udp_socket_receive                           _nxe_udp_socket_receive
3500 #define nx_udp_socket_receive_notify                    _nxe_udp_socket_receive_notify
3501 #define nx_udp_socket_send(s, p, i, t)                  _nxe_udp_socket_send(s, &p, i, t)
3502 #define nx_udp_socket_source_send(s, p, i, t, a)        _nxe_udp_socket_source_send(s, &p, i, t, a)
3503 #define nx_udp_socket_unbind                            _nxe_udp_socket_unbind
3504 #define nx_udp_source_extract                           _nxe_udp_source_extract
3505 #define nxd_udp_packet_info_extract                     _nxde_udp_packet_info_extract
3506 #define nxd_udp_socket_send(s, p, i, t)                 _nxde_udp_socket_send(s, &p, i, t)
3507 #define nxd_udp_socket_source_send                      _nxde_udp_socket_source_send
3508 #define nxd_udp_source_extract                          _nxde_udp_source_extract
3509 
3510 /* APIs for others. */
3511 #define nx_system_initialize                            _nx_system_initialize
3512 #define nx_http_proxy_client_enable                     _nxe_http_proxy_client_enable
3513 #endif
3514 
3515 
3516 /* Define the function prototypes of the NetX Duo API.  */
3517 
3518 /* APIs for ARP. */
3519 UINT nx_arp_dynamic_entries_invalidate(NX_IP *ip_ptr);
3520 UINT nx_arp_dynamic_entry_set(NX_IP *ip_ptr, ULONG ip_address,  ULONG physical_msw, ULONG physical_lsw);
3521 UINT nx_arp_enable(NX_IP *ip_ptr, VOID *arp_cache_memory, ULONG arp_cache_size);
3522 UINT nx_arp_entry_delete(NX_IP *ip_ptr, ULONG ip_address);
3523 UINT nx_arp_gratuitous_send(NX_IP *ip_ptr, VOID (*response_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr));
3524 UINT nx_arp_hardware_address_find(NX_IP *ip_ptr, ULONG ip_address, ULONG *physical_msw, ULONG *physical_lsw);
3525 UINT nx_arp_info_get(NX_IP *ip_ptr, ULONG *arp_requests_sent, ULONG *arp_requests_received,
3526                      ULONG *arp_responses_sent, ULONG *arp_responses_received,
3527                      ULONG *arp_dynamic_entries, ULONG *arp_static_entries,
3528                      ULONG *arp_aged_entries, ULONG *arp_invalid_messages);
3529 UINT nx_arp_ip_address_find(NX_IP *ip_ptr, ULONG *ip_address,  ULONG physical_msw, ULONG physical_lsw);
3530 UINT nx_arp_static_entries_delete(NX_IP *ip_ptr);
3531 UINT nx_arp_static_entry_create(NX_IP *ip_ptr, ULONG ip_address, ULONG physical_msw, ULONG physical_lsw);
3532 UINT nx_arp_static_entry_delete(NX_IP *ip_ptr, ULONG ip_address,  ULONG physical_msw, ULONG physical_lsw);
3533 
3534 /* APIs for ICMP. */
3535 UINT nx_icmp_enable(NX_IP *ip_ptr);
3536 UINT nx_icmp_info_get(NX_IP *ip_ptr, ULONG *pings_sent, ULONG *ping_timeouts,
3537                       ULONG *ping_threads_suspended, ULONG *ping_responses_received,
3538                       ULONG *icmp_checksum_errors, ULONG *icmp_unhandled_messages);
3539 UINT nx_icmp_ping(NX_IP *ip_ptr, ULONG ip_address, CHAR *data, ULONG data_size,
3540                   NX_PACKET **response_ptr, ULONG wait_option);
3541 UINT nxd_icmp_enable(NX_IP *ip_ptr);
3542 UINT nxd_icmp_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, CHAR *data_ptr, ULONG data_size,
3543                    NX_PACKET **response_ptr, ULONG wait_option);
3544 UINT nxd_icmp_source_ping(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, UINT address_index, CHAR *data_ptr,
3545                           ULONG data_size, NX_PACKET **response_ptr, ULONG wait_option);
3546 UINT nxd_icmpv6_ra_flag_callback_set(NX_IP *ip_ptr,
3547                                      VOID (*icmpv6_ra_flag_callback)(NX_IP *ip_ptr, UINT ra_flag));
3548 
3549 /* APIs for IGMP. */
3550 UINT nx_igmp_enable(NX_IP *ip_ptr);
3551 UINT nx_igmp_info_get(NX_IP *ip_ptr, ULONG *igmp_reports_sent, ULONG *igmp_queries_received,
3552                       ULONG *igmp_checksum_errors, ULONG *current_groups_joined);
3553 UINT nx_igmp_loopback_disable(NX_IP *ip_ptr);
3554 UINT nx_igmp_loopback_enable(NX_IP *ip_ptr);
3555 UINT nx_igmp_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index);
3556 UINT nx_igmp_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index);
3557 UINT nx_igmp_multicast_join(NX_IP *ip_ptr, ULONG group_address);
3558 UINT nx_igmp_multicast_leave(NX_IP *ip_ptr, ULONG group_address);
3559 
3560 /* APIs for IP. */
3561 UINT nx_ip_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *, VOID *), VOID *additional_info);
3562 UINT nx_ip_address_get(NX_IP *ip_ptr, ULONG *ip_address, ULONG *network_mask);
3563 UINT nx_ip_address_set(NX_IP *ip_ptr, ULONG ip_address, ULONG network_mask);
3564 UINT nx_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool);
3565 #ifndef NX_DISABLE_ERROR_CHECKING
3566 UINT _nxe_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask,
3567                     NX_PACKET_POOL *default_pool,
3568                     VOID (*ip_link_driver)(NX_IP_DRIVER *),
3569                     VOID *memory_ptr, ULONG memory_size, UINT priority, UINT ip_control_block_size);
3570 #else
3571 UINT _nx_ip_create(NX_IP *ip_ptr, CHAR *name, ULONG ip_address, ULONG network_mask,
3572                    NX_PACKET_POOL *default_pool,
3573                    VOID (*ip_link_driver)(NX_IP_DRIVER *),
3574                    VOID *memory_ptr, ULONG memory_size, UINT priority);
3575 #endif
3576 UINT nx_ip_delete(NX_IP *ip_ptr);
3577 UINT nx_ip_driver_direct_command(NX_IP *ip_ptr, UINT command, ULONG *return_value_ptr);
3578 UINT nx_ip_driver_interface_direct_command(NX_IP *ip_ptr, UINT command, UINT interface_index, ULONG *return_value_ptr);
3579 UINT nx_ip_forwarding_disable(NX_IP *ip_ptr);
3580 UINT nx_ip_forwarding_enable(NX_IP *ip_ptr);
3581 UINT nx_ip_fragment_disable(NX_IP *ip_ptr);
3582 UINT nx_ip_fragment_enable(NX_IP *ip_ptr);
3583 UINT nx_ip_gateway_address_clear(NX_IP *ip_ptr);
3584 UINT nx_ip_gateway_address_get(NX_IP *ip_ptr, ULONG *ip_address);
3585 UINT nx_ip_gateway_address_set(NX_IP *ip_ptr, ULONG ip_address);
3586 UINT nx_ip_info_get(NX_IP *ip_ptr, ULONG *ip_total_packets_sent, ULONG *ip_total_bytes_sent,
3587                     ULONG *ip_total_packets_received, ULONG *ip_total_bytes_received,
3588                     ULONG *ip_invalid_packets, ULONG *ip_receive_packets_dropped,
3589                     ULONG *ip_receive_checksum_errors, ULONG *ip_send_packets_dropped,
3590                     ULONG *ip_total_fragments_sent, ULONG *ip_total_fragments_received);
3591 UINT nx_ip_interface_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *ip_address, ULONG *network_mask);
3592 UINT nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed);
3593 UINT nx_ip_interface_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG ip_address, ULONG network_mask);
3594 UINT nx_ip_interface_attach(NX_IP *ip_ptr, CHAR *interface_name, ULONG ip_address, ULONG network_mask,
3595                             VOID (*ip_link_driver)(struct NX_IP_DRIVER_STRUCT *));
3596 UINT nx_ip_interface_capability_get(NX_IP *ip_ptr, UINT interface_index, ULONG *interface_capability_flag);
3597 UINT nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag);
3598 UINT nx_ip_interface_detach(NX_IP *ip_ptr, UINT index);
3599 UINT nx_ip_interface_info_get(NX_IP *ip_ptr, UINT interface_index, CHAR **interface_name, ULONG *ip_address,
3600                               ULONG *network_mask, ULONG *mtu_size, ULONG *physical_address_msw,
3601                               ULONG *physical_address_lsw);
3602 UINT nx_ip_interface_mtu_set(NX_IP *ip_ptr, UINT interface_index, ULONG mtu_size);
3603 UINT nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, ULONG *physical_msw,
3604                                           ULONG *physical_lsw);
3605 UINT nx_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index, ULONG physical_msw,
3606                                           ULONG physical_lsw, UINT update_driver);
3607 UINT nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status,
3608                                   ULONG *actual_status, ULONG wait_option);
3609 UINT nx_ip_link_status_change_notify_set(NX_IP *ip_ptr,
3610                                          VOID (*link_status_change_notify)(NX_IP *ip_ptr,
3611                                                                            UINT interface_index,
3612                                                                            UINT link_up));
3613 UINT nx_ip_max_payload_size_find(NX_IP *ip_ptr, NXD_ADDRESS *dest_address, UINT if_index,
3614                                  UINT src_port, UINT dest_port, ULONG protocol, ULONG *start_offset_ptr,
3615                                  ULONG *payload_length_ptr);
3616 UINT nx_ip_status_check(NX_IP *ip_ptr, ULONG needed_status, ULONG *actual_status, ULONG wait_option);
3617 UINT nx_ip_static_route_add(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask, ULONG next_hop);
3618 UINT nx_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask);
3619 UINT nx_ipv4_multicast_interface_join(NX_IP *ip_ptr, ULONG group_address, UINT interface_index);
3620 UINT nx_ipv4_multicast_interface_leave(NX_IP *ip_ptr, ULONG group_address, UINT interface_index);
3621 UINT nxd_ipv6_address_change_notify(NX_IP *ip_ptr,
3622                                     VOID (*ip_address_change_notify)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address));
3623 UINT nxd_ipv6_address_delete(NX_IP *ip_ptr, UINT address_index);
3624 UINT nxd_ipv6_address_get(NX_IP *ip_ptr, UINT address_index, NXD_ADDRESS *ip_address,
3625                           ULONG *prefix_length, UINT *interface_index);
3626 UINT nxd_ipv6_address_set(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *ip_address,
3627                           ULONG prefix_length, UINT *address_index);
3628 UINT nxd_ipv6_default_router_add(NX_IP *ip_ptr, NXD_ADDRESS *router_addr,
3629                                  ULONG router_lifetime, UINT interface_index);
3630 UINT nxd_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_addr);
3631 UINT nxd_ipv6_default_router_entry_get(NX_IP *ip_ptr, UINT interface_index, UINT entry_index,
3632                                        NXD_ADDRESS *router_addr, ULONG *router_lifetime,
3633                                        ULONG *prefix_length, ULONG *configuration_method);
3634 UINT nxd_ipv6_default_router_get(NX_IP *ip_ptr, UINT interface_index, NXD_ADDRESS *router_addr,
3635                                  ULONG *router_lifetime, ULONG *prefix_length);
3636 UINT nxd_ipv6_default_router_number_of_entries_get(NX_IP *ip_ptr, UINT interface_index, UINT *num_entries);
3637 UINT nxd_ipv6_disable(NX_IP *ip_ptr);
3638 UINT nxd_ipv6_enable(NX_IP *ip_ptr);
3639 UINT nxd_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
3640 UINT nxd_ipv6_multicast_interface_leave(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index);
3641 UINT nxd_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index);
3642 UINT nxd_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index);
3643 
3644 /* APIs for RAW service. */
3645 UINT nx_ip_raw_packet_disable(NX_IP *ip_ptr);
3646 UINT nx_ip_raw_packet_enable(NX_IP *ip_ptr);
3647 UINT nx_ip_raw_packet_filter_set(NX_IP *ip_ptr, UINT (*raw_packet_filter)(NX_IP *, ULONG, NX_PACKET *));
3648 UINT nx_ip_raw_packet_receive(NX_IP *ip_ptr, NX_PACKET **packet_ptr, ULONG wait_option);
3649 #ifndef NX_DISABLE_ERROR_CHECKING
3650 UINT _nxe_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr,
3651                              ULONG destination_ip, ULONG type_of_service);
3652 UINT _nxe_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr,
3653                                     ULONG destination_ip, UINT address_index, ULONG type_of_service);
3654 #else
3655 UINT _nx_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr,
3656                             ULONG destination_ip, ULONG type_of_service);
3657 UINT _nx_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr,
3658                                    ULONG destination_ip, UINT address_index, ULONG type_of_service);
3659 #endif /* NX_DISABLE_ERROR_CHECKING */
3660 UINT nx_ip_raw_receive_queue_max_set(NX_IP *ip_ptr, ULONG queue_max);
3661 #ifndef NX_DISABLE_ERROR_CHECKING
3662 UINT _nxde_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET **packet_ptr_ptr, NXD_ADDRESS *destination_ip,
3663                               ULONG protocol, UINT ttl, ULONG tos);
3664 #else /* NX_DISABLE_ERROR_CHECKING */
3665 UINT _nxd_ip_raw_packet_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr,  NXD_ADDRESS *destination_ip,
3666                              ULONG protocol, UINT ttl, ULONG tos);
3667 #endif /* NX_DISABLE_ERROR_CHECKING */
3668 UINT nxd_ip_raw_packet_source_send(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NXD_ADDRESS *destination_ip,
3669                                    UINT address_index, ULONG protocol, UINT ttl, ULONG tos);
3670 
3671 /* APIs for ND cache. */
3672 UINT nxd_nd_cache_entry_set(NX_IP *ip_ptr, ULONG *dest_ip, UINT interface_index, CHAR *mac);
3673 UINT nxd_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip);
3674 UINT nxd_nd_cache_hardware_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address,
3675                                         ULONG *physical_msw, ULONG *physical_lsw, UINT *interface_index);
3676 UINT nxd_nd_cache_invalidate(NX_IP *ip_ptr);
3677 UINT nxd_nd_cache_ip_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address,
3678                                   ULONG physical_msw, ULONG physical_lsw, UINT *interface_index);
3679 
3680 /* APIs for packet pool. */
3681 UINT nx_packet_allocate(NX_PACKET_POOL *pool_ptr,  NX_PACKET **packet_ptr,
3682                         ULONG packet_type, ULONG wait_option);
3683 UINT nx_packet_copy(NX_PACKET *packet_ptr, NX_PACKET **new_packet_ptr,
3684                     NX_PACKET_POOL *pool_ptr, ULONG wait_option);
3685 UINT nx_packet_data_append(NX_PACKET *packet_ptr, VOID *data_start, ULONG data_size,
3686                            NX_PACKET_POOL *pool_ptr, ULONG wait_option);
3687 UINT nx_packet_data_extract_offset(NX_PACKET *packet_ptr, ULONG offset, VOID *buffer_start,
3688                                    ULONG buffer_length, ULONG *bytes_copied);
3689 UINT nx_packet_data_retrieve(NX_PACKET *packet_ptr, VOID *buffer_start, ULONG *bytes_copied);
3690 UINT nx_packet_length_get(NX_PACKET *packet_ptr, ULONG *length);
3691 #ifndef NX_DISABLE_ERROR_CHECKING
3692 UINT _nxe_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size,
3693                              VOID *memory_ptr, ULONG memory_size, UINT pool_control_block_size);
3694 #else
3695 UINT _nx_packet_pool_create(NX_PACKET_POOL *pool_ptr, CHAR *name, ULONG payload_size,
3696                             VOID *memory_ptr, ULONG memory_size);
3697 #endif
3698 UINT nx_packet_pool_delete(NX_PACKET_POOL *pool_ptr);
3699 UINT nx_packet_pool_info_get(NX_PACKET_POOL *pool_ptr, ULONG *total_packets, ULONG *free_packets,
3700                              ULONG *empty_pool_requests, ULONG *empty_pool_suspensions,
3701                              ULONG *invalid_packet_releases);
3702 UINT nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_water_mark);
3703 #ifndef NX_DISABLE_ERROR_CHECKING
3704 UINT _nxe_packet_release(NX_PACKET **packet_ptr_ptr);
3705 UINT _nxe_packet_transmit_release(NX_PACKET **packet_ptr_ptr);
3706 #else
3707 UINT _nx_packet_release(NX_PACKET *packet_ptr);
3708 UINT _nx_packet_transmit_release(NX_PACKET *packet_ptr);
3709 #endif
3710 
3711 /* APIs for RARP. */
3712 UINT nx_rarp_disable(NX_IP *ip_ptr);
3713 UINT nx_rarp_enable(NX_IP *ip_ptr);
3714 UINT nx_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received,
3715                       ULONG *rarp_invalid_messages);
3716 
3717 /* APIs for TCP. */
3718 UINT nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option);
3719 UINT nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip,
3720                                   UINT server_port, ULONG wait_option);
3721 UINT nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr);
3722 UINT nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr);
3723 UINT nx_tcp_enable(NX_IP *ip_ptr);
3724 UINT nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr);
3725 UINT nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent,
3726                      ULONG *tcp_packets_received, ULONG *tcp_bytes_received,
3727                      ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped,
3728                      ULONG *tcp_checksum_errors, ULONG *tcp_connections,
3729                      ULONG *tcp_disconnections, ULONG *tcp_connections_dropped,
3730                      ULONG *tcp_retransmit_packets);
3731 UINT nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option);
3732 UINT nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size,
3733                                  VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port));
3734 UINT nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr);
3735 UINT nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr);
3736 UINT nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port);
3737 UINT nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available);
3738 #ifndef NX_DISABLE_ERROR_CHECKING
3739 UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name,
3740                             ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size,
3741                             VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr),
3742                             VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr),
3743                             UINT tcp_socket_size);
3744 #else
3745 UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name,
3746                            ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size,
3747                            VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr),
3748                            VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr));
3749 #endif
3750 UINT nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr);
3751 UINT nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option);
3752 UINT nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr,
3753                                               VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *));
3754 UINT nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr,
3755                                     VOID (*tcp_establish_notify)(NX_TCP_SOCKET *));
3756 UINT nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent,
3757                             ULONG *tcp_packets_received, ULONG *tcp_bytes_received,
3758                             ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued,
3759                             ULONG *tcp_checksum_errors, ULONG *tcp_socket_state,
3760                             ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window,
3761                             ULONG *tcp_receive_window);
3762 UINT nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss);
3763 UINT nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss);
3764 UINT nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss);
3765 UINT nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port);
3766 UINT nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr,
3767                                           VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *));
3768 UINT nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option);
3769 UINT nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr,
3770                                   VOID (*tcp_receive_notify)(NX_TCP_SOCKET *));
3771 UINT nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum);
3772 #ifndef NX_DISABLE_ERROR_CHECKING
3773 UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option);
3774 #else
3775 UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option);
3776 #endif
3777 UINT nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option);
3778 UINT nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr,
3779                                        VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *));
3780 UINT nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout,
3781                                       ULONG max_retries, ULONG timeout_shift);
3782 UINT nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr,
3783                                             VOID (*tcp_window_update_notify)(NX_TCP_SOCKET *));
3784 UINT nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip,
3785                                    UINT server_port, ULONG wait_option);
3786 UINT nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port);
3787 
3788 /* APIs for UDP. */
3789 UINT nx_udp_enable(NX_IP *ip_ptr);
3790 UINT nx_udp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr);
3791 UINT nx_udp_info_get(NX_IP *ip_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent,
3792                      ULONG *udp_packets_received, ULONG *udp_bytes_received,
3793                      ULONG *udp_invalid_packets, ULONG *udp_receive_packets_dropped,
3794                      ULONG *udp_checksum_errors);
3795 UINT nx_udp_packet_info_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *protocol, UINT *port, UINT *interface_index);
3796 UINT nx_udp_socket_bind(NX_UDP_SOCKET *socket_ptr, UINT  port, ULONG wait_option);
3797 UINT nx_udp_socket_bytes_available(NX_UDP_SOCKET *socket_ptr, ULONG *bytes_available);
3798 UINT nx_udp_socket_checksum_disable(NX_UDP_SOCKET *socket_ptr);
3799 UINT nx_udp_socket_checksum_enable(NX_UDP_SOCKET *socket_ptr);
3800 #ifndef NX_DISABLE_ERROR_CHECKING
3801 UINT _nxe_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name,
3802                             ULONG type_of_service, ULONG fragment, UINT time_to_live,
3803                             ULONG queue_maximum, UINT udp_socket_size);
3804 #else
3805 
3806 UINT _nx_udp_socket_create(NX_IP *ip_ptr, NX_UDP_SOCKET *socket_ptr, CHAR *name,
3807                            ULONG type_of_service, ULONG fragment, UINT time_to_live,
3808                            ULONG queue_maximum);
3809 #endif
3810 UINT nx_udp_socket_delete(NX_UDP_SOCKET *socket_ptr);
3811 UINT nx_udp_socket_info_get(NX_UDP_SOCKET *socket_ptr, ULONG *udp_packets_sent, ULONG *udp_bytes_sent,
3812                             ULONG *udp_packets_received, ULONG *udp_bytes_received, ULONG *udp_packets_queued,
3813                             ULONG *udp_receive_packets_dropped, ULONG *udp_checksum_errors);
3814 UINT nx_udp_socket_port_get(NX_UDP_SOCKET *socket_ptr, UINT *port_ptr);
3815 UINT nx_udp_socket_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option);
3816 UINT nx_udp_socket_receive_notify(NX_UDP_SOCKET *socket_ptr,
3817                                   VOID (*udp_receive_notify)(NX_UDP_SOCKET *));
3818 #ifndef NX_DISABLE_ERROR_CHECKING
3819 UINT _nxde_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr,
3820                            NXD_ADDRESS *ip_address, UINT port);
3821 UINT _nxde_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3822                                   NXD_ADDRESS *ip_address, UINT port, UINT address_index);
3823 
3824 #else /* NX_DISABLE_ERROR_CHECKING */
3825 UINT _nxd_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3826                           NXD_ADDRESS *ip_address, UINT port);
3827 UINT _nxd_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3828                                  NXD_ADDRESS *ip_address, UINT port, UINT address_index);
3829 #endif /* NX_DISABLE_ERROR_CHECKING */
3830 UINT nx_udp_socket_unbind(NX_UDP_SOCKET *socket_ptr);
3831 UINT nx_udp_source_extract(NX_PACKET *packet_ptr, ULONG *ip_address, UINT *port);
3832 UINT nxd_udp_source_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address, UINT *port);
3833 #ifndef NX_DISABLE_ERROR_CHECKING
3834 UINT _nxe_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr,
3835                           ULONG ip_address, UINT port);
3836 UINT _nxe_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET **packet_ptr,
3837                                  ULONG ip_address, UINT port, UINT address_index);
3838 #else
3839 UINT _nx_udp_socket_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3840                          ULONG ip_address, UINT port);
3841 UINT _nx_udp_socket_source_send(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3842                                 ULONG ip_address, UINT port, UINT address_index);
3843 
3844 #endif
3845 UINT nxd_udp_packet_info_extract(NX_PACKET *packet_ptr, NXD_ADDRESS *ip_address,
3846                                  UINT *protocol, UINT *port, UINT *interface_index);
3847 
3848 /* APIs for others. */
3849 VOID nx_system_initialize(VOID);
3850 UINT nx_http_proxy_client_enable(NX_IP *ip_ptr, NXD_ADDRESS *proxy_server_ip, UINT proxy_server_port,
3851                                  UCHAR *username, UINT username_length, UCHAR *password, UINT password_length);
3852 
3853 /* Define several function prototypes for exclusive use by NetX I/O drivers.  These routines
3854    are used by NetX drivers to report received packets to NetX.  */
3855 
3856 /* Define the driver deferred packet routines.  Using these routines results in the lowest
3857    possible ISR processing time.  However, it does require slightly more overhead than the
3858    other NetX receive processing routines.  The _nx_ip_driver_deferred_enable routine
3859    should be called from the driver's initialization routine, with the driver's deferred
3860    packet processing routine provided.  Each packet the driver receives should be
3861    delivered to NetX via the _nx_ip_driver_deferred_receive function.  This function
3862    queues the packet for the NetX IP thread.  The NetX IP thread will then call the driver's
3863    deferred packet processing routine, which can then process the packet at a thread level
3864    of execution.  The deferred packet processing routine should use the _nx_ip_packet_receive,
3865    _nx_arp_packet_deferred_receive, and _nx_rarp_packet_deferred_receive to dispatch the
3866    appropriate packets to NetX.  In order to use the deferred packet processing, NetX
3867    must be built with NX_DRIVER_DEFERRED_PROCESSING defined.  */
3868 
3869 VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr));
3870 VOID _nx_ip_driver_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
3871 
3872 
3873 /* Define the driver deferred processing notification routine. Calling this routine from
3874    the driver will cause the driver to be called with the NX_LINK_DEFERRED_PROCESSING
3875    value specified in the nx_ip_driver_command field of the NX_IP_DRIVER request
3876    structure. This is useful in situations where the driver wishes to process activities
3877    like transmit complete interrupts at the thread level rather than in the ISR. Note
3878    that the driver must set its own internal variables in order to know what processing
3879    needs to be done when subsequently called from the IP helper thread. */
3880 
3881 VOID _nx_ip_driver_deferred_processing(NX_IP *ip_ptr);
3882 
3883 
3884 /* Define the deferred NetX receive processing routines.  These routines depend on the
3885    NetX I/O drive to perform enough processing in the ISR to strip the link protocol
3886    header and dispatch to the appropriate NetX receive processing.  These routines
3887    can also be called from the previously mentioned driver deferred processing.  */
3888 
3889 VOID _nx_ip_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
3890 VOID _nx_arp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
3891 VOID _nx_rarp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
3892 
3893 
3894 /* Define the direct IP packet receive processing.  This is the lowest overhead way
3895    to notify NetX of a received IP packet, however, it results in the most amount of
3896    processing in the driver's receive ISR.  If the driver deferred packet processing
3897    is used, this routine should be used to notify NetX of the newly received IP packet.  */
3898 
3899 VOID _nx_ip_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
3900 
3901 /* Define the direct link status event.  This is the lowest overhead way
3902    to notify NetX of link status event, however, it results in the most amount of
3903    processing in the driver's receive ISR.  */
3904 VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index);
3905 
3906 #ifdef NX_ENABLE_TCPIP_OFFLOAD
3907 /* Define the direct TCP packet receive processing.  This is used with TCP/IP offload feature.  */
3908 VOID _nx_tcp_socket_driver_packet_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr);
3909 
3910 /* Define the direct TCP established processing.  This is used with TCP/IP offload feature.  */
3911 UINT _nx_tcp_socket_driver_establish(NX_TCP_SOCKET *socket_ptr, NX_INTERFACE *interface_ptr, UINT remote_port);
3912 
3913 /* Define the direct UDP packet receive processing.  This is used with TCP/IP offload feature.  */
3914 VOID _nx_udp_socket_driver_packet_receive(NX_UDP_SOCKET *socket_ptr, NX_PACKET *packet_ptr,
3915                                           NXD_ADDRESS *local_ip, NXD_ADDRESS *remote_ip, UINT remote_port);
3916 #endif /* NX_ENABLE_TCPIP_OFFLOAD */
3917 
3918 #endif
3919 
3920 #ifdef FEATURE_NX_IPV6
3921 
3922 #ifdef NX_LITTLE_ENDIAN
3923 #define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr) _nx_ipv6_address_change_endian(addr)
3924 #else /* BIG ENDIAN */
3925 #define NX_IPV6_ADDRESS_CHANGE_ENDIAN(addr)
3926 #endif /* NX_LITTLE_ENDIAN */
3927 
3928 #endif /* FEATURE_NX_IPV6 */
3929 
3930 
3931 #ifdef NX_IPV6_UTIL_INLINE
3932 /* Return 1 if IPv6 address is unspecified (::)  */
3933 #define CHECK_UNSPECIFIED_ADDRESS(ip_addr) \
3934     (!((ip_addr)[0] || (ip_addr)[1] || (ip_addr)[2] || (ip_addr)[3]))
3935 
3936 
3937 /* Set IPv6 address to unspecified (::) */
3938 #define SET_UNSPECIFIED_ADDRESS(ip_addr) \
3939     do {                                 \
3940         (ip_addr)[0] = 0;                \
3941         (ip_addr)[1] = 0;                \
3942         (ip_addr)[2] = 0;                \
3943         (ip_addr)[3] = 0;                \
3944     } while (0)
3945 
3946 
3947 /* Copy IPv6 address. */
3948 #define COPY_IPV6_ADDRESS(copy_from, copy_to) \
3949     do {                                      \
3950         (copy_to)[0] = (copy_from)[0];        \
3951         (copy_to)[1] = (copy_from)[1];        \
3952         (copy_to)[2] = (copy_from)[2];        \
3953         (copy_to)[3] = (copy_from)[3];        \
3954     } while (0)
3955 
3956 /* Copy NXD IP address structure  */
3957 #define COPY_NXD_ADDRESS(copy_from, copy_to)                                     \
3958     do {                                                                         \
3959         (copy_to) -> nxd_ip_version       = (copy_from) -> nxd_ip_version;       \
3960         (copy_to) -> nxd_ip_address.v6[0] = (copy_from) -> nxd_ip_address.v6[0]; \
3961         (copy_to) -> nxd_ip_address.v6[1] = (copy_from) -> nxd_ip_address.v6[1]; \
3962         (copy_to) -> nxd_ip_address.v6[2] = (copy_from) -> nxd_ip_address.v6[2]; \
3963         (copy_to) -> nxd_ip_address.v6[3] = (copy_from) -> nxd_ip_address.v6[3]; \
3964     } while (0)
3965 
3966 
3967 #define SET_SOLICITED_NODE_MULTICAST_ADDRESS(address, unicast) \
3968     do {                                                       \
3969         (address)[0] = 0xFF020000;                             \
3970         (address)[1] = 0;                                      \
3971         (address)[2] = 1;                                      \
3972         (address)[3] = 0xFF000000 | (unicast)[3];              \
3973     } while (0)
3974 
3975 
3976 #define CHECK_ALL_ROUTER_MCAST_ADDRESS(addr) \
3977     (((addr)[0] == 0xFF020000) &&            \
3978      ((addr)[1] == 0)          &&            \
3979      ((addr)[2] == 0)          &&            \
3980      ((addr)[3] == 2))
3981 
3982 /* Check whether or not two IPv6 addresses are the same. */
3983 #define CHECK_IPV6_ADDRESSES_SAME(addr1, addr2) \
3984     (((addr1)[0] == (addr2)[0]) &&              \
3985      ((addr1)[1] == (addr2)[1]) &&              \
3986      ((addr1)[2] == (addr2)[2]) &&              \
3987      ((addr1)[3] == (addr2)[3]))
3988 
3989 
3990 #endif /* NX_IPV6_UTIL_INLINE */
3991 
3992 /* Utility functions.  */
3993 UINT _nx_utility_string_length_check(CHAR *input_string, UINT *string_length, UINT max_string_length);
3994 UINT _nx_utility_string_to_uint(CHAR *input_string, UINT string_length, UINT *number);
3995 UINT _nx_utility_uint_to_string(UINT number, UINT base, CHAR *string_buffer, UINT string_buffer_size);
3996 UINT _nx_utility_base64_encode(UCHAR *name, UINT name_size, UCHAR *base64name, UINT base64name_size, UINT *bytes_copied);
3997 UINT _nx_utility_base64_decode(UCHAR *base64name, UINT base64name_size, UCHAR *name, UINT name_size, UINT *bytes_copied);
3998 
3999 /* Determine if a C++ compiler is being used.  If so, complete the standard
4000    C conditional started above.  */
4001 #ifdef __cplusplus
4002 }
4003 #endif
4004 
4005 #endif
4006 
4007