summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXander Gresolio <[email protected]>2024-11-22 16:53:57 +0100
committerXander Gresolio <[email protected]>2024-11-22 16:53:57 +0100
commit6ed72a9030fd33ff27f3e2c38895d22d308f3b19 (patch)
tree167e256da87fb78298b9afd48b4e916f6d057f94
parent6c8e9d1c95d71bd4b313e1cc37d8f8841543b248 (diff)
Add listen queue callback function
-rw-r--r--common/inc/nx_api.h6
-rw-r--r--common/src/nx_tcp_packet_process.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/common/inc/nx_api.h b/common/inc/nx_api.h
index 44fc1a45..259bc358 100644
--- a/common/inc/nx_api.h
+++ b/common/inc/nx_api.h
@@ -2226,6 +2226,12 @@ typedef struct NX_TCP_LISTEN_STRUCT
NX_PACKET *nx_tcp_listen_queue_head,
*nx_tcp_listen_queue_tail;
+#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
+ /* Define the callback function for notifying the host application of
+ a new connect request in the listen queue. */
+ VOID (*nx_tcp_listen_queue_notify)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
+#endif
+
/* Define the link between other TCP listen structures created by the application. */
struct NX_TCP_LISTEN_STRUCT
*nx_tcp_listen_next,
diff --git a/common/src/nx_tcp_packet_process.c b/common/src/nx_tcp_packet_process.c
index a9fa6c38..ef8b2e9f 100644
--- a/common/src/nx_tcp_packet_process.c
+++ b/common/src/nx_tcp_packet_process.c
@@ -108,6 +108,9 @@ NX_TCP_SOCKET *socket_ptr;
NX_TCP_HEADER *tcp_header_ptr;
struct NX_TCP_LISTEN_STRUCT *listen_ptr;
VOID (*listen_callback)(NX_TCP_SOCKET *socket_ptr, UINT port);
+#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
+VOID (*queue_callback)(struct NX_TCP_LISTEN_STRUCT *listen_ptr);
+#endif
ULONG option_words;
ULONG mss = 0;
ULONG checksum;
@@ -1011,6 +1014,17 @@ ULONG rwin_scale = 0xFF;
/* Release the packet. */
_nx_packet_release(packet_ptr);
}
+
+#ifndef NX_DISABLE_EXTENDED_NOTIFY_SUPPORT
+ /* If extended notify is enabled, call the listen_queue_notify function.
+ This user-supplied function notifies the host application of
+ a new connect request in the listen queue. */
+ queue_callback = listen_ptr -> nx_tcp_listen_queue_notify;
+ if (queue_callback)
+ {
+ (queue_callback)(listen_ptr);
+ }
+#endif
}
/* Finished processing, just return. */