1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** NetX Component */ 16 /** */ 17 /** Transmission Control Protocol (TCP) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* nx_tcp.h PORTABLE C */ 28 /* 6.4.0 */ 29 /* AUTHOR */ 30 /* */ 31 /* Yuxin Zhou, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file defines the NetX Transmission Control Protocol component, */ 36 /* including all data types and external references. It is assumed */ 37 /* that nx_api.h and nx_port.h have already been included. */ 38 /* */ 39 /* RELEASE HISTORY */ 40 /* */ 41 /* DATE NAME DESCRIPTION */ 42 /* */ 43 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 44 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 45 /* resulting in version 6.1 */ 46 /* 08-02-2021 Yuxin Zhou Modified comment(s), and */ 47 /* supported TCP/IP offload, */ 48 /* resulting in version 6.1.8 */ 49 /* 10-15-2021 Yuxin Zhou Modified comment(s), included */ 50 /* necessary header file, */ 51 /* resulting in version 6.1.9 */ 52 /* 12-31-2023 Yajun Xia Modified comment(s), */ 53 /* supported VLAN, */ 54 /* resulting in version 6.4.0 */ 55 /* */ 56 /**************************************************************************/ 57 58 #ifndef NX_TCP_H 59 #define NX_TCP_H 60 61 #include "nx_api.h" 62 63 64 /* Define TCP constants. */ 65 66 #define NX_TCP_ID ((ULONG)0x54435020) 67 68 69 /* Define the TCP header typical size. */ 70 71 #define NX_TCP_HEADER_SIZE ((ULONG)0x50000000) /* Typical 5 word TCP header */ 72 #define NX_TCP_SYN_HEADER ((ULONG)0x70000000) /* SYN header with MSS option */ 73 #define NX_TCP_HEADER_SHIFT 28 /* Shift down to pickup length */ 74 #define NX_TCP_SYN_OPTION_SIZE 8 /* 8 bytes of TCP SYN option */ 75 #define NX_TCP_SYN_SIZE (NX_TCP_SYN_OPTION_SIZE + sizeof(NX_TCP_HEADER)) 76 77 78 /* Define the TCP header control fields. */ 79 80 #define NX_TCP_CONTROL_MASK ((ULONG)0x00170000) /* ACK, RST, SYN, and FIN bits */ 81 #define NX_TCP_URG_BIT ((ULONG)0x00200000) /* Urgent data bit */ 82 #define NX_TCP_ACK_BIT ((ULONG)0x00100000) /* Acknowledgement bit */ 83 #define NX_TCP_PSH_BIT ((ULONG)0x00080000) /* Push bit */ 84 #define NX_TCP_RST_BIT ((ULONG)0x00040000) /* Reset bit */ 85 #define NX_TCP_SYN_BIT ((ULONG)0x00020000) /* Sequence bit */ 86 #define NX_TCP_FIN_BIT ((ULONG)0x00010000) /* Finish bit */ 87 88 89 /* Define the MSS option for the TCP header. */ 90 91 #define NX_TCP_MSS_OPTION ((ULONG)0x02040000) /* Maximum Segment Size option */ 92 #ifdef NX_ENABLE_TCP_WINDOW_SCALING 93 #define NX_TCP_RWIN_OPTION ((ULONG)0x03030000) /* 24 bits, so NOP, 0x3, 0x3, scale value */ 94 #endif /* NX_ENABLE_TCP_WINDOW_SCALING */ 95 #define NX_TCP_MSS_SIZE 1460 /* Maximum Segment Size */ 96 #define NX_TCP_OPTION_END ((ULONG)0x01010100) /* NOPs and end of TCP options */ 97 #define NX_TCP_EOL_KIND 0x00 /* EOL option kind */ 98 #define NX_TCP_NOP_KIND 0x01 /* NOP option kind */ 99 #define NX_TCP_MSS_KIND 0x02 /* MSS option kind */ 100 #ifdef NX_ENABLE_TCP_WINDOW_SCALING 101 #define NX_TCP_RWIN_KIND 0x03 /* RWIN option kind */ 102 #endif /* NX_ENABLE_TCP_WINDOW_SCALING */ 103 104 105 /* Define constants for the optional TCP keepalive Timer. To enable this 106 feature, the TCP source must be compiled with NX_ENABLE_TCP_KEEPALIVE 107 defined. */ 108 109 #ifndef NX_TCP_KEEPALIVE_INITIAL 110 #define NX_TCP_KEEPALIVE_INITIAL 7200 /* Number of seconds for initial */ 111 #endif /* keepalive expiration, the */ 112 /* default is 2 hours (120 min)*/ 113 #ifndef NX_TCP_KEEPALIVE_RETRY 114 #define NX_TCP_KEEPALIVE_RETRY 75 /* After initial expiration, */ 115 #endif /* retry every 75 seconds */ 116 117 #ifndef NX_TCP_KEEPALIVE_RETRIES 118 #define NX_TCP_KEEPALIVE_RETRIES 10 /* Retry a maximum of 10 times */ 119 #endif 120 121 #ifndef NX_TCP_MAXIMUM_TX_QUEUE 122 #define NX_TCP_MAXIMUM_TX_QUEUE 20 /* Maximum number of transmit */ 123 #endif /* packets queued */ 124 125 #ifndef NX_TCP_MAXIMUM_RETRIES 126 #define NX_TCP_MAXIMUM_RETRIES 10 /* Maximum number of transmit */ 127 #endif /* retries allowed */ 128 129 #ifndef NX_TCP_RETRY_SHIFT 130 #define NX_TCP_RETRY_SHIFT 0 /* Shift that is applied to */ 131 #endif /* last timeout for back off, */ 132 /* i.e. a value of zero means */ 133 /* constant timeouts, a value */ 134 /* of 1 causes each successive */ 135 /* be multiplied by two, etc. */ 136 137 #ifndef NX_TCP_MAXIMUM_SEGMENT_LIFETIME 138 #define NX_TCP_MAXIMUM_SEGMENT_LIFETIME 120 /* Number of seconds for maximum */ 139 #endif /* segment lifetime, the */ 140 /* default is 2 minutes (120s) */ 141 142 143 /* Define the maximum receive queue depth for TCP socket. */ 144 #ifdef NX_ENABLE_LOW_WATERMARK 145 #ifndef NX_TCP_MAXIMUM_RX_QUEUE 146 #define NX_TCP_MAXIMUM_RX_QUEUE 20 147 #endif /* NX_TCP_MAXIMUM_RX_QUEUE */ 148 #endif /* NX_ENABLE_LOW_WATERMARK */ 149 150 /* Define the rate for the TCP fast periodic timer. This timer is used to process 151 delayed ACKs and packet re-transmission. Hence, it must have greater resolution 152 than the 200ms delayed ACK requirement. By default, the fast periodic timer is 153 setup on a 100ms periodic. The number supplied is used to divide the 154 NX_IP_PERIODIC_RATE value to actually derive the ticks. Dividing 155 by 10 yields a 100ms base periodic. */ 156 157 #ifndef NX_TCP_FAST_TIMER_RATE 158 #define NX_TCP_FAST_TIMER_RATE 10 159 #endif 160 161 162 /* Define the rate for the TCP delayed ACK timer, which by default is 200ms. The 163 number supplied is used to divide the NX_IP_PERIODIC_RATE value to 164 actually derive the ticks. Dividing by 5 yields a 200ms periodic. */ 165 166 #ifndef NX_TCP_ACK_TIMER_RATE 167 #define NX_TCP_ACK_TIMER_RATE 5 168 #endif 169 170 /* Define the rate for the TCP retransmit timer, which by default is set to 171 one second. The number supplied is used to divide the NX_IP_PERIODIC_RATE 172 value to actually derive the ticks. Dividing by 1 yields a 1 second periodic. */ 173 174 #ifndef NX_TCP_TRANSMIT_TIMER_RATE 175 #define NX_TCP_TRANSMIT_TIMER_RATE 1 176 #endif 177 178 /* Define the value of the TCP minimum acceptable MSS for the host to accept the connection, 179 which by default is 128. */ 180 181 #ifndef NX_TCP_MSS_MINIMUM 182 #define NX_TCP_MSS_MINIMUM 128 183 #endif 184 185 186 /* Define Basic TCP packet header data type. This will be used to 187 build new TCP packets and to examine incoming packets into NetX. */ 188 189 typedef struct NX_TCP_HEADER_STRUCT 190 { 191 192 /* Define the first 32-bit word of the TCP header. This word contains 193 the following information: 194 195 bits 31-16 TCP 16-bit source port number 196 bits 15-0 TCP 16-bit destination port number 197 */ 198 ULONG nx_tcp_header_word_0; 199 200 /* Define the second word of the TCP header. This word contains 201 the following information: 202 203 bits 31-0 TCP 32-bit sequence number 204 */ 205 ULONG nx_tcp_sequence_number; 206 207 /* Define the third word of the TCP header. This word contains 208 the following information: 209 210 bits 31-0 TCP 32-bit acknowledgment number 211 */ 212 ULONG nx_tcp_acknowledgment_number; 213 214 /* Define the fourth 32-bit word of the TCP header. This word contains 215 the following information: 216 217 bits 31-28 TCP 4-bit header length 218 bits 27-22 TCP 6-bit reserved field 219 bit 21 TCP Urgent bit (URG) 220 bit 20 TCP Acknowledgement bit (ACK) 221 bit 19 TCP Push bit (PSH) 222 bit 18 TCP Reset connection bit (RST) 223 bit 17 TCP Synchronize sequence numbers bit (SYN) 224 bit 16 TCP Sender has reached the end of its byte stream (FIN) 225 bits 15-0 TCP 16-bit window size 226 */ 227 ULONG nx_tcp_header_word_3; 228 229 /* Define the fifth 32-bit word of the TCP header. This word contains 230 the following information: 231 232 bits 31-16 TCP 16-bit TCP checksum 233 bits 15-0 TCP 16-bit TCP urgent pointer 234 */ 235 ULONG nx_tcp_header_word_4; 236 } NX_TCP_HEADER; 237 238 239 /* Define TCP component API function prototypes. */ 240 241 UINT _nxd_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); 242 UINT _nxd_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); 243 UINT _nx_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); 244 UINT _nx_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); 245 UINT _nx_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); 246 UINT _nx_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); 247 UINT _nx_tcp_enable(NX_IP *ip_ptr); 248 UINT _nx_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); 249 UINT _nx_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, 250 ULONG *tcp_packets_received, ULONG *tcp_bytes_received, 251 ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, 252 ULONG *tcp_checksum_errors, ULONG *tcp_connections, 253 ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, 254 ULONG *tcp_retransmit_packets); 255 UINT _nx_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); 256 UINT _nx_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, 257 VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); 258 UINT _nx_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); 259 UINT _nx_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); 260 UINT _nx_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); 261 UINT _nx_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, 262 ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, 263 VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), 264 VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr)); 265 UINT _nx_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); 266 UINT _nx_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); 267 UINT _nx_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, 268 ULONG *tcp_packets_received, ULONG *tcp_bytes_received, 269 ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, 270 ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, 271 ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, 272 ULONG *tcp_receive_window); 273 UINT _nx_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); 274 UINT _nx_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); 275 UINT _nx_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); 276 UINT _nx_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); 277 UINT _nx_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, 278 VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); 279 UINT _nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, 280 VOID (*tcp_windows_update_notify)(NX_TCP_SOCKET *socket_ptr)); 281 UINT _nx_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); 282 UINT _nx_tcp_socket_send_internal(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr, ULONG wait_option); 283 UINT _nx_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); 284 UINT _nx_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, 285 ULONG max_retries, ULONG timeout_shift); 286 UINT _nx_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); 287 UINT _nx_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); 288 UINT _nx_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); 289 UINT _nx_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); 290 UINT _nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); 291 #ifdef NX_ENABLE_TCPIP_OFFLOAD 292 /* Define the direct TCP packet receive processing. This is used with TCP/IP offload feature. */ 293 VOID _nx_tcp_socket_driver_packet_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); 294 295 /* Define the direct TCP established processing. This is used with TCP/IP offload feature. */ 296 UINT _nx_tcp_socket_driver_establish(NX_TCP_SOCKET *socket_ptr, NX_INTERFACE *interface_ptr, UINT remote_port); 297 UINT _nx_tcp_server_socket_driver_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); 298 #endif /* NX_ENABLE_TCPIP_OFFLOAD */ 299 300 /* Define TCP component internal function prototypes. */ 301 VOID _nx_tcp_cleanup_deferred(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 302 VOID _nx_tcp_client_bind_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 303 VOID _nx_tcp_deferred_cleanup_check(NX_IP *ip_ptr); 304 VOID _nx_tcp_fast_periodic_processing(NX_IP *ip_ptr); 305 VOID _nx_tcp_socket_retransmit(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, UINT need_fast_retransmit); 306 VOID _nx_tcp_connect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 307 VOID _nx_tcp_disconnect_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 308 VOID _nx_tcp_initialize(VOID); 309 UINT _nx_tcp_mss_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *mss); 310 #ifdef NX_ENABLE_TCP_WINDOW_SCALING 311 UINT _nx_tcp_window_scaling_option_get(UCHAR *option_ptr, ULONG option_area_size, ULONG *window_scale); 312 #endif /* NX_ENABLE_TCP_WINDOW_SCALING */ 313 VOID _nx_tcp_no_connection_reset(NX_IP *ip_ptr, NX_PACKET *packet_ptr, NX_TCP_HEADER *tcp_header_ptr); 314 VOID _nx_tcp_packet_process(NX_IP *ip_ptr, NX_PACKET *packet_ptr); 315 VOID _nx_tcp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); 316 VOID _nx_tcp_packet_send_ack(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); 317 VOID _nx_tcp_packet_send_fin(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); 318 VOID _nx_tcp_packet_send_rst(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *header_ptr); 319 VOID _nx_tcp_packet_send_syn(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence); 320 VOID _nx_tcp_packet_send_probe(NX_TCP_SOCKET *socket_ptr, ULONG tx_sequence, UCHAR data); 321 VOID _nx_tcp_packet_send_control(NX_TCP_SOCKET *socket_ptr, ULONG control_bits, ULONG tx_sequence, 322 ULONG ack_number, ULONG option_word_1, ULONG option_word_2, UCHAR *data); 323 VOID _nx_tcp_periodic_processing(NX_IP *ip_ptr); 324 VOID _nx_tcp_queue_process(NX_IP *ip_ptr); 325 VOID _nx_tcp_receive_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 326 UINT _nx_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); 327 VOID _nx_tcp_socket_connection_reset(NX_TCP_SOCKET *socket_ptr); 328 VOID _nx_tcp_socket_packet_process(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); 329 UINT _nx_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); 330 331 VOID _nx_tcp_socket_receive_queue_flush(NX_TCP_SOCKET *socket_ptr); 332 UINT _nx_tcp_socket_state_ack_check(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); 333 VOID _nx_tcp_socket_state_closing(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); 334 UINT _nx_tcp_socket_state_data_check(NX_TCP_SOCKET *socket_ptr, NX_PACKET *packet_ptr); 335 VOID _nx_tcp_socket_state_data_trim_front(NX_PACKET *packet_ptr, ULONG amount); 336 VOID _nx_tcp_socket_state_data_trim(NX_PACKET *packet_ptr, ULONG amount); 337 VOID _nx_tcp_socket_state_established(NX_TCP_SOCKET *socket_ptr); 338 VOID _nx_tcp_socket_state_fin_wait1(NX_TCP_SOCKET *socket_ptr); 339 VOID _nx_tcp_socket_state_fin_wait2(NX_TCP_SOCKET *socket_ptr); 340 VOID _nx_tcp_socket_state_last_ack(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); 341 VOID _nx_tcp_socket_state_syn_sent(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr, NX_PACKET *packet_ptr); 342 VOID _nx_tcp_socket_state_syn_received(NX_TCP_SOCKET *socket_ptr, NX_TCP_HEADER *tcp_header_ptr); 343 VOID _nx_tcp_socket_state_transmit_check(NX_TCP_SOCKET *socket_ptr); 344 VOID _nx_tcp_socket_thread_resume(TX_THREAD **suspension_list_head, UINT status); 345 VOID _nx_tcp_socket_thread_suspend(TX_THREAD **suspension_list_head, VOID (*suspend_cleanup)(TX_THREAD * NX_CLEANUP_PARAMETER), NX_TCP_SOCKET *socket_ptr, TX_MUTEX *mutex_ptr, ULONG wait_option); 346 VOID _nx_tcp_socket_transmit_queue_flush(NX_TCP_SOCKET *socket_ptr); 347 VOID _nx_tcp_socket_block_cleanup(NX_TCP_SOCKET *socket_ptr); 348 VOID _nx_tcp_transmit_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER); 349 UINT _nx_tcp_socket_vlan_priority_set(NX_TCP_SOCKET *socket_ptr, UINT vlan_priority); 350 351 352 /* Define error checking shells for TCP API services. These are only referenced by the 353 application. */ 354 355 UINT _nxde_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *server_ip, UINT server_port, ULONG wait_option); 356 UINT _nxde_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS *peer_ip_address, ULONG *peer_port); 357 UINT _nxe_tcp_client_socket_bind(NX_TCP_SOCKET *socket_ptr, UINT port, ULONG wait_option); 358 UINT _nxe_tcp_client_socket_connect(NX_TCP_SOCKET *socket_ptr, ULONG server_ip, UINT server_port, ULONG wait_option); 359 UINT _nxe_tcp_client_socket_port_get(NX_TCP_SOCKET *socket_ptr, UINT *port_ptr); 360 UINT _nxe_tcp_client_socket_unbind(NX_TCP_SOCKET *socket_ptr); 361 UINT _nxe_tcp_enable(NX_IP *ip_ptr); 362 UINT _nxe_tcp_free_port_find(NX_IP *ip_ptr, UINT port, UINT *free_port_ptr); 363 UINT _nxe_tcp_info_get(NX_IP *ip_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, 364 ULONG *tcp_packets_received, ULONG *tcp_bytes_received, 365 ULONG *tcp_invalid_packets, ULONG *tcp_receive_packets_dropped, 366 ULONG *tcp_checksum_errors, ULONG *tcp_connections, 367 ULONG *tcp_disconnections, ULONG *tcp_connections_dropped, 368 ULONG *tcp_retransmit_packets); 369 UINT _nxe_tcp_server_socket_accept(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); 370 UINT _nxe_tcp_server_socket_listen(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr, UINT listen_queue_size, 371 VOID (*tcp_listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port)); 372 UINT _nxe_tcp_server_socket_relisten(NX_IP *ip_ptr, UINT port, NX_TCP_SOCKET *socket_ptr); 373 UINT _nxe_tcp_server_socket_unaccept(NX_TCP_SOCKET *socket_ptr); 374 UINT _nxe_tcp_server_socket_unlisten(NX_IP *ip_ptr, UINT port); 375 UINT _nxe_tcp_socket_bytes_available(NX_TCP_SOCKET *socket_ptr, ULONG *bytes_available); 376 UINT _nxe_tcp_socket_create(NX_IP *ip_ptr, NX_TCP_SOCKET *socket_ptr, CHAR *name, 377 ULONG type_of_service, ULONG fragment, UINT time_to_live, ULONG window_size, 378 VOID (*tcp_urgent_data_callback)(NX_TCP_SOCKET *socket_ptr), 379 VOID (*tcp_disconnect_callback)(NX_TCP_SOCKET *socket_ptr), 380 UINT tcp_socket_size); 381 UINT _nxe_tcp_socket_delete(NX_TCP_SOCKET *socket_ptr); 382 UINT _nxe_tcp_socket_disconnect(NX_TCP_SOCKET *socket_ptr, ULONG wait_option); 383 UINT _nxe_tcp_socket_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *tcp_packets_sent, ULONG *tcp_bytes_sent, 384 ULONG *tcp_packets_received, ULONG *tcp_bytes_received, 385 ULONG *tcp_retransmit_packets, ULONG *tcp_packets_queued, 386 ULONG *tcp_checksum_errors, ULONG *tcp_socket_state, 387 ULONG *tcp_transmit_queue_depth, ULONG *tcp_transmit_window, 388 ULONG *tcp_receive_window); 389 UINT _nxe_tcp_socket_mss_get(NX_TCP_SOCKET *socket_ptr, ULONG *mss); 390 UINT _nxe_tcp_socket_mss_peer_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_mss); 391 UINT _nxe_tcp_socket_mss_set(NX_TCP_SOCKET *socket_ptr, ULONG mss); 392 UINT _nxe_tcp_socket_peer_info_get(NX_TCP_SOCKET *socket_ptr, ULONG *peer_ip_address, ULONG *peer_port); 393 UINT _nxe_tcp_socket_receive(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr, ULONG wait_option); 394 UINT _nxe_tcp_socket_receive_notify(NX_TCP_SOCKET *socket_ptr, 395 VOID (*tcp_receive_notify)(NX_TCP_SOCKET *socket_ptr)); 396 UINT _nxe_tcp_socket_send(NX_TCP_SOCKET *socket_ptr, NX_PACKET **packet_ptr_ptr, ULONG wait_option); 397 UINT _nxe_tcp_socket_state_wait(NX_TCP_SOCKET *socket_ptr, UINT desired_state, ULONG wait_option); 398 UINT _nxe_tcp_socket_transmit_configure(NX_TCP_SOCKET *socket_ptr, ULONG max_queue_depth, ULONG timeout, 399 ULONG max_retries, ULONG timeout_shift); 400 UINT _nxe_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, 401 VOID (*tcp_socket_window_update_notify)(NX_TCP_SOCKET *socket_ptr)); 402 UINT _nxe_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum); 403 UINT _nxe_tcp_socket_establish_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_establish_notify)(NX_TCP_SOCKET *socket_ptr)); 404 UINT _nxe_tcp_socket_disconnect_complete_notify(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_disconnect_complete_notify)(NX_TCP_SOCKET *socket_ptr)); 405 UINT _nxe_tcp_socket_queue_depth_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_queue_depth_notify)(NX_TCP_SOCKET *socket_ptr)); 406 UINT _nxe_tcp_socket_timed_wait_callback(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_timed_wait_callback)(NX_TCP_SOCKET *socket_ptr)); 407 UINT _nxe_tcp_socket_vlan_priority_set(NX_TCP_SOCKET *socket_ptr, UINT vlan_priority); 408 409 /* TCP component data declarations follow. */ 410 411 /* Determine if the initialization function of this component is including 412 this file. If so, make the data definitions really happen. Otherwise, 413 make them extern so other functions in the component can access them. */ 414 415 /*lint -e767 suppress different definitions. */ 416 #ifdef NX_TCP_INIT 417 #define TCP_DECLARE 418 #else 419 #define TCP_DECLARE extern 420 #endif 421 /*lint +e767 enable checking for different definitions. */ 422 423 /* Define global data for the TCP component. */ 424 425 /* Define the actual number of ticks for the fast periodic timer. */ 426 427 TCP_DECLARE ULONG _nx_tcp_fast_timer_rate; 428 429 /* Define the actual number of ticks for the delayed ACK timer. */ 430 431 TCP_DECLARE ULONG _nx_tcp_ack_timer_rate; 432 433 /* Define the actual number of ticks for the retransmit timer. */ 434 435 TCP_DECLARE ULONG _nx_tcp_transmit_timer_rate; 436 437 /* Define the actual number of ticks for the 2MSL(Maximum Segment Lifetime) timer. */ 438 439 TCP_DECLARE ULONG _nx_tcp_2MSL_timer_rate; 440 441 442 #endif 443 444