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_ip.h"
30 
31 #if !defined(NX_DISABLE_IPV4) && defined(NX_ENABLE_IP_STATIC_ROUTING)
32 /* Bring in externs for caller checking code.  */
33 NX_CALLER_CHECKING_EXTERNS
34 #endif /* !NX_DISABLE_IPV4 && NX_ENABLE_IP_STATIC_ROUTING  */
35 
36 /**************************************************************************/
37 /*                                                                        */
38 /*  FUNCTION                                               RELEASE        */
39 /*                                                                        */
40 /*    _nxe_ip_static_route_delete                         PORTABLE C      */
41 /*                                                           6.1          */
42 /*  AUTHOR                                                                */
43 /*                                                                        */
44 /*    Yuxin Zhou, Microsoft Corporation                                   */
45 /*                                                                        */
46 /*  DESCRIPTION                                                           */
47 /*                                                                        */
48 /*    This function deltes static routing entry from the routing table.   */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    ip_ptr                                Pointer to IP instance        */
53 /*    network_address                       network address, in host      */
54 /*                                            byte order.                 */
55 /*    net_mask                              Network Mask, in host byte    */
56 /*                                            order.                      */
57 /*                                                                        */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    status                                Completion status             */
62 /*                                                                        */
63 /*  CALLS                                                                 */
64 /*                                                                        */
65 /*    _nx_ip_staic_route_delete             Acutal IP static routing      */
66 /*                                            table delete function.      */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application                                                         */
70 /*                                                                        */
71 /*  NOTE:                                                                 */
72 /*                                                                        */
73 /*    None                                                                */
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 /**************************************************************************/
_nxe_ip_static_route_delete(NX_IP * ip_ptr,ULONG network_address,ULONG net_mask)84 UINT  _nxe_ip_static_route_delete(NX_IP *ip_ptr, ULONG network_address, ULONG net_mask)
85 {
86 #if !defined(NX_DISABLE_IPV4) && defined(NX_ENABLE_IP_STATIC_ROUTING)
87 
88 UINT status;
89 
90     /* Check for invalid input pointers.  */
91     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
92     {
93         return(NX_PTR_ERROR);
94     }
95 
96     /* Check for appropriate caller.  */
97     NX_INIT_AND_THREADS_CALLER_CHECKING
98 
99     /* Call actual IP forwarding disable function.  */
100     status =  _nx_ip_static_route_delete(ip_ptr, network_address, net_mask);
101 
102     /* Return completion status.  */
103     return(status);
104 
105 
106 #else /* !NX_DISABLE_IPV4 && NX_ENABLE_IP_STATIC_ROUTING  */
107     NX_PARAMETER_NOT_USED(ip_ptr);
108     NX_PARAMETER_NOT_USED(network_address);
109     NX_PARAMETER_NOT_USED(net_mask);
110 
111     return(NX_NOT_SUPPORTED);
112 
113 #endif /* !NX_DISABLE_IPV4 && NX_ENABLE_IP_STATIC_ROUTING  */
114 }
115 
116