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