/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Component */ /** */ /** Transmission Control Protocol (TCP) */ /** */ /**************************************************************************/ /**************************************************************************/ #define NX_SOURCE_CODE /* Include necessary system files. */ #include "nx_api.h" #include "nx_tcp.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _nx_tcp_socket_window_update_notify_set PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function sets the window update notify function pointer to the */ /* function specified by the application, which is called whenever */ /* the specified socket receives a packet indicating an increase in */ /* window size of the remote host. */ /* */ /* If a NULL pointer is supplied, the window update notify function is */ /* disabled. */ /* */ /* INPUT */ /* */ /* socket_ptr Pointer to TCP socket */ /* tcp_window_udpate_notify Routine to call when NetX */ /* receives a window update */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ /* 09-30-2020 Yuxin Zhou Modified comment(s), */ /* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _nx_tcp_socket_window_update_notify_set(NX_TCP_SOCKET *socket_ptr, VOID (*tcp_socket_window_update_notify)(NX_TCP_SOCKET *socket_ptr)) { TX_INTERRUPT_SAVE_AREA /* If trace is enabled, insert this event into the trace buffer. */ NX_TRACE_IN_LINE_INSERT(NX_TRACE_TCP_SOCKET_WINDOW_UPDATE_NOTIFY_SET, socket_ptr, 0, 0, 0, NX_TRACE_TCP_EVENTS, 0, 0); /* Get mutex protection. */ tx_mutex_get(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); /* Disable interrupts. */ TX_DISABLE /* Setup the receive notify function pointer. */ socket_ptr -> nx_tcp_socket_window_update_notify = tcp_socket_window_update_notify; /* Restore interrupts. */ TX_RESTORE /* Release protection. */ tx_mutex_put(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection)); /* Return successful completion. */ return(NX_SUCCESS); }