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