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 /** NetX Component                                                        */
15 /**                                                                       */
16 /**   Internet Protocol version 6 Default Router Table (IPv6 router)      */
17 /**                                                                       */
18 /**************************************************************************/
19 /**************************************************************************/
20 #define NX_SOURCE_CODE
21 
22 
23 /* Include necessary system files.  */
24 
25 #include "nx_api.h"
26 #include "nx_ipv6.h"
27 #ifdef FEATURE_NX_IPV6
28 #include "nx_ip.h"
29 #include "nx_nd_cache.h"
30 
31 /* Bring in externs for caller checking code.  */
32 NX_CALLER_CHECKING_EXTERNS
33 
34 #endif /* FEATURE_NX_IPV6 */
35 
36 
37 
38 /**************************************************************************/
39 /*                                                                        */
40 /*  FUNCTION                                               RELEASE        */
41 /*                                                                        */
42 /*    _nxde_ipv6_default_router_delete                     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 routing table entry    */
51 /*    delete service.                                                     */
52 /*                                                                        */
53 /*  INPUT                                                                 */
54 /*                                                                        */
55 /*    ip_ptr                                Pointer to IP control block   */
56 /*    router_address                        router  IP address            */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    NX_PTR_ERROR                          Invalid pointer input         */
61 /*    NX_INVALID_PARAMETERS                 Invalid IP address version    */
62 /*    status                                Actual completion Status      */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _nxd_ipv6_default_router_delete       Actual router delete service  */
67 /*                                                                        */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
72 /*                                                                        */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
79 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
_nxde_ipv6_default_router_delete(NX_IP * ip_ptr,NXD_ADDRESS * router_address)83 UINT _nxde_ipv6_default_router_delete(NX_IP *ip_ptr, NXD_ADDRESS *router_address)
84 {
85 #ifdef FEATURE_NX_IPV6
86 
87     /* Check for invalid input pointers. */
88     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (router_address == NX_NULL))
89     {
90         return(NX_PTR_ERROR);
91     }
92 
93     /* Must be in IPv6 address type. */
94     if (router_address -> nxd_ip_version != NX_IP_VERSION_V6)
95     {
96         return(NX_INVALID_PARAMETERS);
97     }
98 
99     /* Check for appropriate caller.  */
100     NX_INIT_AND_THREADS_CALLER_CHECKING
101 
102     /* Call the actual router delete service and return completion status. */
103     return(_nxd_ipv6_default_router_delete(ip_ptr, router_address));
104 
105 #else /* !FEATURE_NX_IPV6 */
106     NX_PARAMETER_NOT_USED(ip_ptr);
107     NX_PARAMETER_NOT_USED(router_address);
108 
109     return(NX_NOT_SUPPORTED);
110 
111 #endif /* FEATURE_NX_IPV6 */
112 }
113 
114