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