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 Protocol (IP) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "nx_api.h"
28 #include "nx_ipv6.h"
29 #if defined(NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY) && defined(FEATURE_NX_IPV6)
30 #include "nx_ip.h"
31
32 /* Bring in externs for caller checking code. */
33
34 NX_CALLER_CHECKING_EXTERNS
35 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY && FEATURE_NX_IPV6 */
36
37
38 /**************************************************************************/
39 /* */
40 /* FUNCTION RELEASE */
41 /* */
42 /* _nxde_ipv6_address_change_notify PORTABLE C */
43 /* 6.1 */
44 /* AUTHOR */
45 /* */
46 /* Yuxin Zhou, Microsoft Corporation */
47 /* */
48 /* DESCRIPTION */
49 /* */
50 /* This function checks for errors in the IPv6 address change notify */
51 /* function call. */
52 /* */
53 /* INPUT */
54 /* */
55 /* ip_ptr IP control block pointer */
56 /* ip_address_change_notify Application callback function */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* status Completion status */
61 /* */
62 /* CALLS */
63 /* */
64 /* _nxd_ip_address_change_notify Actual IP address change */
65 /* notify function */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Application Code */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
76 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* */
79 /**************************************************************************/
_nxde_ipv6_address_change_notify(NX_IP * ip_ptr,VOID (* ip_address_change_notify)(NX_IP * ip_ptr,UINT status,UINT interface_index,UINT address_index,ULONG * ip_address))80 UINT _nxde_ipv6_address_change_notify(NX_IP *ip_ptr, VOID (*ip_address_change_notify)(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT address_index, ULONG *ip_address))
81 {
82 #if defined(NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY) && defined(FEATURE_NX_IPV6)
83 UINT status;
84
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 appropriate caller. */
93 NX_THREADS_ONLY_CALLER_CHECKING
94
95 /* Call actual IP address change notify function. */
96 status = _nxd_ipv6_address_change_notify(ip_ptr, ip_address_change_notify);
97
98 /* Return completion status. */
99 return(status);
100 #else
101
102 NX_PARAMETER_NOT_USED(ip_ptr);
103 NX_PARAMETER_NOT_USED(ip_address_change_notify);
104
105 return(NX_NOT_ENABLED);
106 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY && FEATURE_NX_IPV6 */
107 }
108
109