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 Group Management Protocol (IGMP) */
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_ip.h"
29 #include "nx_igmp.h"
30
31 /* Bring in externs for caller checking code. */
32 NX_CALLER_CHECKING_EXTERNS
33
34
35 /**************************************************************************/
36 /* */
37 /* FUNCTION RELEASE */
38 /* */
39 /* _nxe_igmp_info_get PORTABLE C */
40 /* 6.1 */
41 /* AUTHOR */
42 /* */
43 /* Yuxin Zhou, Microsoft Corporation */
44 /* */
45 /* DESCRIPTION */
46 /* */
47 /* This function checks for errors in the IGMP information get */
48 /* function call. */
49 /* */
50 /* INPUT */
51 /* */
52 /* ip_ptr IP instance pointer */
53 /* igmp_reports_sent Destination for the number */
54 /* of IGMP reports sent */
55 /* igmp_queries_received Destination for the number */
56 /* of IGMP queries received */
57 /* igmp_checksum_errors Destination for the number */
58 /* of IGMP checksum errors */
59 /* current_groups_joined Destination for the number */
60 /* of IGMP multicast groups */
61 /* currently joined */
62 /* */
63 /* OUTPUT */
64 /* */
65 /* status Completion status */
66 /* */
67 /* CALLS */
68 /* */
69 /* _nx_igmp_info_get Actual IGMP information get */
70 /* function */
71 /* */
72 /* CALLED BY */
73 /* */
74 /* Application Code */
75 /* */
76 /* RELEASE HISTORY */
77 /* */
78 /* DATE NAME DESCRIPTION */
79 /* */
80 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
81 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
82 /* resulting in version 6.1 */
83 /* */
84 /**************************************************************************/
_nxe_igmp_info_get(NX_IP * ip_ptr,ULONG * igmp_reports_sent,ULONG * igmp_queries_received,ULONG * igmp_checksum_errors,ULONG * current_groups_joined)85 UINT _nxe_igmp_info_get(NX_IP *ip_ptr, ULONG *igmp_reports_sent, ULONG *igmp_queries_received,
86 ULONG *igmp_checksum_errors, ULONG *current_groups_joined)
87 {
88
89 #ifndef NX_DISABLE_IPV4
90 UINT status;
91
92
93 /* Check for invalid input pointers. */
94 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
95 {
96 return(NX_PTR_ERROR);
97 }
98
99 /* Check to see if IGMP is enabled. */
100 if (!ip_ptr -> nx_ip_igmp_packet_receive)
101 {
102 return(NX_NOT_ENABLED);
103 }
104
105 /* Check for appropriate caller. */
106 NX_INIT_AND_THREADS_CALLER_CHECKING
107
108 /* Call actual IGMP information get function. */
109 status = _nx_igmp_info_get(ip_ptr, igmp_reports_sent, igmp_queries_received,
110 igmp_checksum_errors, current_groups_joined);
111
112 /* Return completion status. */
113 return(status);
114 #else /* NX_DISABLE_IPV4 */
115 NX_PARAMETER_NOT_USED(ip_ptr);
116 NX_PARAMETER_NOT_USED(igmp_reports_sent);
117 NX_PARAMETER_NOT_USED(igmp_queries_received);
118 NX_PARAMETER_NOT_USED(igmp_checksum_errors);
119 NX_PARAMETER_NOT_USED(current_groups_joined);
120
121 return(NX_NOT_SUPPORTED);
122 #endif /* !NX_DISABLE_IPV4 */
123 }
124
125