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