1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   Transmission Control Protocol (TCP)                                 */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define NX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "nx_api.h"
28 #include "nx_tcp.h"
29 
30 #ifdef NX_ENABLE_LOW_WATERMARK
31 /* Bring in externs for caller checking code.  */
32 
33 NX_CALLER_CHECKING_EXTERNS
34 
35 #endif /* NX_ENABLE_LOW_WATERMARK */
36 
37 /**************************************************************************/
38 /*                                                                        */
39 /*  FUNCTION                                               RELEASE        */
40 /*                                                                        */
41 /*    _nxe_tcp_socket_receive_queue_max_set               PORTABLE C      */
42 /*                                                           6.1          */
43 /*  AUTHOR                                                                */
44 /*                                                                        */
45 /*    Yuxin Zhou, Microsoft Corporation                                   */
46 /*                                                                        */
47 /*  DESCRIPTION                                                           */
48 /*                                                                        */
49 /*    This function checks for errors in the maximum receive queue depth  */
50 /*    of a TCP socket set call.                                           */
51 /*                                                                        */
52 /*  INPUT                                                                 */
53 /*                                                                        */
54 /*    socket_ptr                            Pointer to socket             */
55 /*    receive_queue_maximum                 Maximum receive queue         */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _nx_tcp_socket_receive_queue_max_set  Actual set routine.           */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
74 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_nxe_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET * socket_ptr,UINT receive_queue_maximum)78 UINT  _nxe_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum)
79 {
80 #ifdef NX_ENABLE_LOW_WATERMARK
81 
82     /* Check for invalid input pointers.  */
83     if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID))
84     {
85         return(NX_PTR_ERROR);
86     }
87 
88     /* Check for appropriate caller.  */
89     NX_NOT_ISR_CALLER_CHECKING
90 
91     return(_nx_tcp_socket_receive_queue_max_set(socket_ptr, receive_queue_maximum));
92 
93 #else /* !NX_ENABLE_LOW_WATERMARK */
94     NX_PARAMETER_NOT_USED(socket_ptr);
95     NX_PARAMETER_NOT_USED(receive_queue_maximum);
96 
97     return(NX_NOT_SUPPORTED);
98 
99 #endif /* NX_ENABLE_LOW_WATERMARK */
100 }
101 
102