Skip to content

Commit 6ed72a9

Browse files
committed
Add listen queue callback function
1 parent 6c8e9d1 commit 6ed72a9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

common/inc/nx_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,12 @@ typedef struct NX_TCP_LISTEN_STRUCT
22262226
NX_PACKET *nx_tcp_listen_queue_head,
22272227
*nx_tcp_listen_queue_tail;
22282228

2229+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
2230+
/* Define the callback function for notifying the host application of
2231+
a new connect request in the listen queue. */
2232+
VOID (*nx_tcp_listen_queue_notify)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
2233+
#endif
2234+
22292235
/* Define the link between other TCP listen structures created by the application. */
22302236
struct NX_TCP_LISTEN_STRUCT
22312237
*nx_tcp_listen_next,

common/src/nx_tcp_packet_process.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ NX_TCP_SOCKET *socket_ptr;
108108
NX_TCP_HEADER *tcp_header_ptr;
109109
struct NX_TCP_LISTEN_STRUCT *listen_ptr;
110110
VOID (*listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port);
111+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
112+
VOID (*queue_callback)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
113+
#endif
111114
ULONG option_words;
112115
ULONG mss = 0;
113116
ULONG checksum;
@@ -1011,6 +1014,17 @@ ULONG rwin_scale = 0xFF;
10111014
/* Release the packet. */
10121015
_nx_packet_release(packet_ptr);
10131016
}
1017+
1018+
#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
1019+
/* If extended notify is enabled, call the listen_queue_notify function.
1020+
This user-supplied function notifies the host application of
1021+
a new connect request in the listen queue. */
1022+
queue_callback = listen_ptr -> nx_tcp_listen_queue_notify;
1023+
if (queue_callback)
1024+
{
1025+
(queue_callback)(listen_ptr);
1026+
}
1027+
#endif
10141028
}
10151029

10161030
/* Finished processing, just return. */

0 commit comments

Comments
 (0)