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_igmp.h" 29 30 #ifndef NX_DISABLE_IPV4 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _nx_igmp_queue_process PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Yuxin Zhou, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function processes the IGMP receive packet queue. */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* ip_ptr Pointer to IP control block */ 48 /* */ 49 /* OUTPUT */ 50 /* */ 51 /* None */ 52 /* */ 53 /* CALLS */ 54 /* */ 55 /* _nx_igmp_packet_process Process IGMP packet */ 56 /* */ 57 /* CALLED BY */ 58 /* */ 59 /* _nx_ip_thread_entry IP helper thread processing */ 60 /* */ 61 /* RELEASE HISTORY */ 62 /* */ 63 /* DATE NAME DESCRIPTION */ 64 /* */ 65 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 66 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 67 /* resulting in version 6.1 */ 68 /* */ 69 /**************************************************************************/ _nx_igmp_queue_process(NX_IP * ip_ptr)70VOID _nx_igmp_queue_process(NX_IP *ip_ptr) 71 { 72 73 TX_INTERRUPT_SAVE_AREA 74 75 NX_PACKET *queue_head; 76 NX_PACKET *packet_ptr; 77 78 79 /* Disable interrupts. */ 80 TX_DISABLE 81 82 /* Remove the IGMP message queue from the IP structure. */ 83 queue_head = ip_ptr -> nx_ip_igmp_queue_head; 84 ip_ptr -> nx_ip_igmp_queue_head = NX_NULL; 85 86 /* Restore interrupts. */ 87 TX_RESTORE 88 89 /* Walk through the entire IGMP message queue and process packets 90 one by one. */ 91 while (queue_head) 92 { 93 94 /* Pickup the first queue IGMP message and remove it from the 95 IGMP queue. */ 96 packet_ptr = queue_head; 97 queue_head = queue_head -> nx_packet_queue_next; 98 packet_ptr -> nx_packet_queue_next = NX_NULL; 99 100 /* Process the packet. */ 101 _nx_igmp_packet_process(ip_ptr, packet_ptr); 102 } 103 } 104 #endif /* !NX_DISABLE_IPV4 */ 105 106