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 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _nxe_tcp_socket_vlan_priority_set                   PORTABLE C      */
35 /*                                                           6.4.0        */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Yajun Xia, Microsoft Corporation                                    */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This function checks for errors in tcp socket vlan priority set     */
43 /*    function call.                                                      */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    socket_ptr                            Pointer to tcp socket         */
48 /*    vlan_priority                         Vlan priority                 */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Actual completion status      */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _nx_tcp_socket_vlan_priority_set      Actual tcp socket vlan        */
57 /*                                            priority set function       */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Application Code                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  12-31-2023     Yajun Xia                Initial Version 6.4.0         */
68 /*                                                                        */
69 /**************************************************************************/
_nxe_tcp_socket_vlan_priority_set(NX_TCP_SOCKET * socket_ptr,UINT vlan_priority)70 UINT _nxe_tcp_socket_vlan_priority_set(NX_TCP_SOCKET *socket_ptr, UINT vlan_priority)
71 {
72 #ifdef NX_ENABLE_VLAN
73 UINT status;
74 
75     /* Check for invalid input pointers.  */
76     if ((socket_ptr == NX_NULL) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID))
77     {
78 
79         return(NX_PTR_ERROR);
80     }
81 
82     if (vlan_priority > NX_VLAN_PRIORITY_MAX)
83     {
84 
85         return(NX_INVALID_PARAMETERS);
86     }
87 
88     /* Call actual tcp vlan priority set function.  */
89     status =  _nx_tcp_socket_vlan_priority_set(socket_ptr, vlan_priority);
90 
91     return(status);
92 #else
93     NX_PARAMETER_NOT_USED(socket_ptr);
94     NX_PARAMETER_NOT_USED(vlan_priority);
95 
96     return(NX_NOT_SUPPORTED);
97 #endif /* NX_ENABLE_VLAN */
98 }
99 
100