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