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 Control Message Protocol (ICMP) v6                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define NX_SOURCE_CODE
24 
25 /* Include necessary system files.  */
26 
27 #include "nx_api.h"
28 #include "nx_nd_cache.h"
29 #ifdef FEATURE_NX_IPV6
30 #include "nx_ip.h"
31 #include "nx_icmpv6.h"
32 
33 /* Bring in externs for caller checking code.  */
34 NX_CALLER_CHECKING_EXTERNS
35 
36 #endif /* FEATURE_NX_IPV6 */
37 
38 
39 /**************************************************************************/
40 /*                                                                        */
41 /*  FUNCTION                                               RELEASE        */
42 /*                                                                        */
43 /*    _nxde_nd_cache_entry_delete                         PORTABLE C      */
44 /*                                                           6.1          */
45 /*  AUTHOR                                                                */
46 /*                                                                        */
47 /*    Yuxin Zhou, Microsoft Corporation                                   */
48 /*                                                                        */
49 /*  DESCRIPTION                                                           */
50 /*                                                                        */
51 /*    This function performs error checking for service to remove an      */
52 /*    entry from the neighbor discovery (ND) cache.                       */
53 /*                                                                        */
54 /*  INPUT                                                                 */
55 /*                                                                        */
56 /*    ip_ptr                                Pointer to IP instance        */
57 /*    dest_ip                               Pointer to IP address to      */
58 /*                                            delete                      */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _nx_nd_cache_entry_delete             Actual ND cache delete        */
67 /*                                            function                    */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
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_nd_cache_entry_delete(NX_IP * ip_ptr,ULONG * dest_ip)82 UINT _nxde_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip)
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))
88     {
89         return(NX_PTR_ERROR);
90     }
91 
92     /* Check for invalid address of cache entry to delete. */
93     if (dest_ip == NX_NULL)
94     {
95         return(NX_PTR_ERROR);
96     }
97 
98     /* Check for appropriate caller.  */
99     NX_INIT_AND_THREADS_CALLER_CHECKING
100 
101     /* Call the actual cache entry delete function and return completion status. */
102     return(_nxd_nd_cache_entry_delete(ip_ptr, dest_ip));
103 
104 #else /* !FEATURE_NX_IPV6 */
105     NX_PARAMETER_NOT_USED(ip_ptr);
106     NX_PARAMETER_NOT_USED(dest_ip);
107 
108     return(NX_NOT_SUPPORTED);
109 
110 #endif /* FEATURE_NX_IPV6 */
111 }
112 
113