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
23 #define NX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "nx_api.h"
29 #include "nx_ip.h"
30 #include "nx_igmp.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _nx_igmp_enable PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Yuxin Zhou, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function enables the IGMP management component for the */
46 /* specified IP instance. */
47 /* */
48 /* INPUT */
49 /* */
50 /* ip_ptr IP instance pointer */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* status Completion status */
55 /* */
56 /* CALLS */
57 /* */
58 /* tx_event_flags_set Set deferred IGMP enable */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* Application Code */
63 /* */
64 /* RELEASE HISTORY */
65 /* */
66 /* DATE NAME DESCRIPTION */
67 /* */
68 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
69 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
70 /* resulting in version 6.1 */
71 /* */
72 /**************************************************************************/
_nx_igmp_enable(NX_IP * ip_ptr)73 UINT _nx_igmp_enable(NX_IP *ip_ptr)
74 {
75
76 #ifndef NX_DISABLE_IPV4
77
78
79 /* If trace is enabled, insert this event into the trace buffer. */
80 NX_TRACE_IN_LINE_INSERT(NX_TRACE_IGMP_ENABLE, ip_ptr, 0, 0, 0, NX_TRACE_IGMP_EVENTS, 0, 0);
81
82
83 #ifndef NX_DISABLE_IGMPV2
84
85 /* Set the IGMP protocol to the default version supported by NetX, IGMPv2. */
86
87 ip_ptr -> nx_ip_igmp_router_version = NX_IGMP_HOST_VERSION_2;
88
89 #endif
90
91 /* Setup the IGMP packet receive routine, which enables the IGMP component. */
92 ip_ptr -> nx_ip_igmp_packet_receive = _nx_igmp_packet_receive;
93
94 /* Setup the IGMP periodic processing routine, which enables the IGMP component. */
95 ip_ptr -> nx_ip_igmp_periodic_processing = _nx_igmp_periodic_processing;
96
97 /* Setup the IGMP queue processing routine, which processes deferred IGMP
98 requests. */
99 ip_ptr -> nx_ip_igmp_queue_process = _nx_igmp_queue_process;
100
101 /* Wakeup IP helper thread to process the IGMP deferred enable. */
102 tx_event_flags_set(&(ip_ptr -> nx_ip_events), NX_IP_IGMP_ENABLE_EVENT, TX_OR);
103
104 /* Return a successful status! */
105 return(NX_SUCCESS);
106 #else /* NX_DISABLE_IPV4 */
107 NX_PARAMETER_NOT_USED(ip_ptr);
108
109 return(NX_NOT_SUPPORTED);
110 #endif /* !NX_DISABLE_IPV4 */
111 }
112
113