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 #include "nx_api.h"
28 #include "nx_ipv6.h"
29 #ifdef FEATURE_NX_IPV6
30 #include "nx_ip.h"
31 
32 /* Bring in externs for caller checking code.  */
33 NX_CALLER_CHECKING_EXTERNS
34 
35 
36 #endif /* FEATURE_NX_IPV6 */
37 
38 /**************************************************************************/
39 /*                                                                        */
40 /*  FUNCTION                                               RELEASE        */
41 /*                                                                        */
42 /*    _nxd_ipv6_address_delete                            PORTABLE C      */
43 /*                                                           6.1          */
44 /*  AUTHOR                                                                */
45 /*                                                                        */
46 /*    Yuxin Zhou, Microsoft Corporation                                   */
47 /*                                                                        */
48 /*  DESCRIPTION                                                           */
49 /*                                                                        */
50 /*  This function performs error checking for the IPv6 address deletion   */
51 /*  service.                                                              */
52 /*                                                                        */
53 /*  INPUT                                                                 */
54 /*                                                                        */
55 /*    ip_ptr                            IP control block pointer          */
56 /*    address_index                     Index into interface address list */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    NX_NO_INTERFACE_ADDRESS           Invalid address supplied          */
61 /*    NX_PTR_ERROR                      Invalid pointer input             */
62 /*    NX_INVALID_INTERFACE              Invalid Interface Index           */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    None                                                                */
67 /*                                                                        */
68 /*  CALLED BY                                                             */
69 /*                                                                        */
70 /*    Application Code                                                    */
71 /*                                                                        */
72 /*  NOTE                                                                  */
73 /*    Application needs to fill in the ip_address.nxd_ip_version field.   */
74 /*                                                                        */
75 /*  RELEASE HISTORY                                                       */
76 /*                                                                        */
77 /*    DATE              NAME                      DESCRIPTION             */
78 /*                                                                        */
79 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
80 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
81 /*                                            resulting in version 6.1    */
82 /*                                                                        */
83 /**************************************************************************/
_nxde_ipv6_address_delete(NX_IP * ip_ptr,UINT address_index)84 UINT  _nxde_ipv6_address_delete(NX_IP *ip_ptr,
85                                 UINT address_index)
86 {
87 #ifdef FEATURE_NX_IPV6
88 
89 UINT status;
90 
91 
92     /* Check for invalid input pointers.  */
93     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
94     {
95         return(NX_PTR_ERROR);
96     }
97 
98     /* Validate the address index. */
99     if (address_index >= NX_MAX_IPV6_ADDRESSES)
100     {
101         return(NX_NO_INTERFACE_ADDRESS);
102     }
103 
104     /* Check for appropriate caller.  */
105     NX_INIT_AND_THREADS_CALLER_CHECKING
106 
107     /* Call actual IPv6 address delete function.  */
108     status = _nxd_ipv6_address_delete(ip_ptr, address_index);
109 
110     /* Return completion status.  */
111     return(status);
112 
113 #else /* !FEATURE_NX_IPV6 */
114     NX_PARAMETER_NOT_USED(ip_ptr);
115     NX_PARAMETER_NOT_USED(address_index);
116 
117     return(NX_NOT_SUPPORTED);
118 
119 #endif /* FEATURE_NX_IPV6 */
120 }
121 
122