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 Group Management Protocol (IGMP) */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22 #define NX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "nx_api.h"
28 #include "nx_igmp.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _nx_igmp_loopback_enable PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function enables loopback for all subsequent IGMP groups */
44 /* joined by the host. */
45 /* */
46 /* INPUT */
47 /* */
48 /* ip_ptr IP instance pointer */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* status Completion status */
53 /* */
54 /* CALLS */
55 /* */
56 /* _tx_mutex_get Obtain the mutex */
57 /* _tx_mutex_put Release the mutex */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* Application Code */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
68 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_nx_igmp_loopback_enable(NX_IP * ip_ptr)72 UINT _nx_igmp_loopback_enable(NX_IP *ip_ptr)
73 {
74
75 #ifndef NX_DISABLE_IPV4
76
77
78 /* If trace is enabled, insert this event into the trace buffer. */
79 NX_TRACE_IN_LINE_INSERT(NX_TRACE_IGMP_LOOPBACK_ENABLE, ip_ptr, 0, 0, 0, NX_TRACE_IGMP_EVENTS, 0, 0);
80
81 /* Obtain the IP mutex so we can search the multicast join list. */
82 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
83
84 /* Set the global IGMP loopback flag. All subsequent IGMP group join
85 requests will have loopback enabled. */
86 ip_ptr -> nx_ip_igmp_global_loopback_enable = NX_TRUE;
87
88 /* Release the protection over the IP instance. */
89 tx_mutex_put(&(ip_ptr -> nx_ip_protection));
90
91 /* Return a successful status! */
92 return(NX_SUCCESS);
93 #else /* NX_DISABLE_IPV4 */
94 NX_PARAMETER_NOT_USED(ip_ptr);
95
96 return(NX_NOT_SUPPORTED);
97 #endif /* !NX_DISABLE_IPV4 */
98 }
99
100