Skip to content

Commit

Permalink
Add listen queue callback function
Browse files Browse the repository at this point in the history
  • Loading branch information
gresolio committed Nov 22, 2024
1 parent 6c8e9d1 commit 6ed72a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/inc/nx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions common/src/nx_tcp_packet_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 6ed72a9

Please sign in to comment.