Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add listen queue callback function #291

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading