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 for IPv6 (ICMPv6) */
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_icmpv6.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _nxd_icmpv6_ra_flag_callback_set PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Yuxin Zhou, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function registers an application callback routine that NetX */
45 /* Duo calls whenever router advertisement is received. */
46 /* */
47 /* INPUT */
48 /* */
49 /* ip_ptr IP control block pointer */
50 /* icmpv6_ra_flag_callback Application callback function */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* status Completion status */
55 /* */
56 /* CALLS */
57 /* */
58 /* tx_mutex_get Get protection mutex */
59 /* tx_mutex_put Put protection mutex */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application Code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
70 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* */
73 /**************************************************************************/
_nxd_icmpv6_ra_flag_callback_set(NX_IP * ip_ptr,VOID (* icmpv6_ra_flag_callback)(NX_IP * ip_ptr,UINT ra_flag))74 UINT _nxd_icmpv6_ra_flag_callback_set(NX_IP *ip_ptr, VOID (*icmpv6_ra_flag_callback)(NX_IP *ip_ptr, UINT ra_flag))
75 {
76
77 #ifdef FEATURE_NX_IPV6
78 /* Get mutex protection. */
79 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
80
81 /* Setup the IP address change callback function and the additional information pointers. */
82 ip_ptr -> nx_icmpv6_ra_flag_callback = icmpv6_ra_flag_callback;
83
84 /* Release mutex protection. */
85 tx_mutex_put(&(ip_ptr -> nx_ip_protection));
86
87 /* Return completion status. */
88 return(NX_SUCCESS);
89
90 #else /* !FEATURE_NX_IPV6 */
91 NX_PARAMETER_NOT_USED(ip_ptr);
92 NX_PARAMETER_NOT_USED(icmpv6_ra_flag_callback);
93
94 return(NX_NOT_SUPPORTED);
95
96 #endif /* FEATURE_NX_IPV6 */
97 }
98
99