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