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 /**   Internet Protocol (IP)                                              */
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_ipv6.h"
30 #if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL)
31 #include "nx_ip.h"
32 
33 /* Bring in externs for caller checking code.  */
34 NX_CALLER_CHECKING_EXTERNS
35 
36 #endif /* FEATURE_NX_IPV6 && NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */
37 
38 /**************************************************************************/
39 /*                                                                        */
40 /*  FUNCTION                                               RELEASE        */
41 /*                                                                        */
42 /*    _nxde_ipv6_stateless_address_autoconfig_disable     PORTABLE C      */
43 /*                                                           6.1          */
44 /*  AUTHOR                                                                */
45 /*                                                                        */
46 /*    Yuxin Zhou, Microsoft Corporation                                   */
47 /*                                                                        */
48 /*  DESCRIPTION                                                           */
49 /*                                                                        */
50 /*    This function performs error checking on the IPv6 stateless address */
51 /*    auto configuratoin disable service                                  */
52 /*                                                                        */
53 /*  INPUT                                                                 */
54 /*                                                                        */
55 /*    ip_ptr                                IP instance pointer           */
56 /*    interface_index                       The interface to operate on   */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*   _nxd_ipv6_stateless_address_autoconfig_disable                       */
65 /*                                                                        */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
76 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_nxde_ipv6_stateless_address_autoconfig_disable(NX_IP * ip_ptr,UINT interface_index)80 UINT  _nxde_ipv6_stateless_address_autoconfig_disable(NX_IP *ip_ptr, UINT interface_index)
81 {
82 
83 #if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL)
84 UINT status;
85 
86     /* Check for invalid input pointers.  */
87     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
88     {
89         return(NX_PTR_ERROR);
90     }
91 
92     /* Validate the interface. */
93     if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
94     {
95         return(NX_INVALID_INTERFACE);
96     }
97 
98     /* Check for appropriate caller.  */
99     NX_INIT_AND_THREADS_CALLER_CHECKING
100 
101     /* Call actual IPv6 stateless address autoconfig disable function.  */
102     status =  _nxd_ipv6_stateless_address_autoconfig_disable(ip_ptr, interface_index);
103 
104     /* Return completion status.  */
105     return(status);
106 
107 #else
108     NX_PARAMETER_NOT_USED(ip_ptr);
109     NX_PARAMETER_NOT_USED(interface_index);
110 
111     return(NX_NOT_SUPPORTED);
112 
113 #endif /* FEATURE_NX_IPV6 && NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */
114 }
115 
116