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 Protocol (IP) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define NX_SOURCE_CODE 24 25 26 /* Include necessary system files. */ 27 28 #include "nx_api.h" 29 #ifdef FEATURE_NX_IPV6 30 #include "nx_ip.h" 31 #include "nx_ipv6.h" 32 33 34 /**************************************************************************/ 35 /* */ 36 /* FUNCTION RELEASE */ 37 /* */ 38 /* _nx_ipv6_multicast_join PORTABLE C */ 39 /* 6.1 */ 40 /* AUTHOR */ 41 /* */ 42 /* Yuxin Zhou, Microsoft Corporation */ 43 /* */ 44 /* DESCRIPTION */ 45 /* */ 46 /* Joins IPv6 multicast group. This is an internal function. The */ 47 /* caller must hold the IP protection (mutex). */ 48 /* */ 49 /* INPUT */ 50 /* */ 51 /* ip_ptr IP instance pointer */ 52 /* multicast_address IPv6 multicast address */ 53 /* */ 54 /* OUTPUT */ 55 /* */ 56 /* status Completion status */ 57 /* */ 58 /* CALLS */ 59 /* */ 60 /* tx_mutex_get Obtain protection mutex */ 61 /* tx_mutex_put Release protection mutex */ 62 /* (ip_link_driver) Device driver entry point */ 63 /* */ 64 /* CALLED BY */ 65 /* */ 66 /* nx_icmpv6_process_ra */ 67 /* nxd_ipv6_enable */ 68 /* nxd_ipv6_address_set */ 69 /* */ 70 /* RELEASE HISTORY */ 71 /* */ 72 /* DATE NAME DESCRIPTION */ 73 /* */ 74 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 75 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 76 /* resulting in version 6.1 */ 77 /* */ 78 /**************************************************************************/ _nx_ipv6_multicast_join(NX_IP * ip_ptr,ULONG * multicast_addr,NX_INTERFACE * nx_interface)79UINT _nx_ipv6_multicast_join(NX_IP *ip_ptr, ULONG *multicast_addr, NX_INTERFACE *nx_interface) 80 { 81 82 NX_IP_DRIVER driver_request; 83 84 85 /* Construct a driver command. */ 86 driver_request.nx_ip_driver_ptr = ip_ptr; 87 driver_request.nx_ip_driver_command = NX_LINK_MULTICAST_JOIN; 88 driver_request.nx_ip_driver_physical_address_msw = 0x00003333; 89 driver_request.nx_ip_driver_physical_address_lsw = multicast_addr[3]; 90 driver_request.nx_ip_driver_interface = nx_interface; 91 92 /* Obtain the IP mutex so we can search the multicast join list. */ 93 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); 94 95 /* Call the device driver with the driver request. */ 96 (nx_interface -> nx_interface_link_driver_entry)(&driver_request); 97 98 /* Release the protection over the IP instance. */ 99 tx_mutex_put(&(ip_ptr -> nx_ip_protection)); 100 101 /*lint -e{644} suppress variable might not be initialized, since "nx_ip_driver_status" was initialized in nx_interface_link_driver_entry. */ 102 return(driver_request.nx_ip_driver_status); 103 } 104 #endif /* FEATURE_NX_IPV6 */ 105 106