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 Protocol (IPv6) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define NX_SOURCE_CODE 22 23 24 /* Include necessary system files. */ 25 26 #include "nx_api.h" 27 #include "nx_ipv6.h" 28 #if defined(NX_ENABLE_IPV6_MULTICAST) && defined(FEATURE_NX_IPV6) 29 #include "nx_ip.h" 30 31 /* Bring in externs for caller checking code. */ 32 33 NX_CALLER_CHECKING_EXTERNS 34 #endif /* NX_ENABLE_IPV6_MULTICAST && FEATURE_NX_IPV6 */ 35 36 /**************************************************************************/ 37 /* */ 38 /* FUNCTION RELEASE */ 39 /* */ 40 /* _nxde_ipv6_multicast_interface_join PORTABLE C */ 41 /* 6.1 */ 42 /* AUTHOR */ 43 /* */ 44 /* Yuxin Zhou, Microsoft Corporation */ 45 /* */ 46 /* DESCRIPTION */ 47 /* */ 48 /* This service checks for errors in the IPv6 multicast join call. */ 49 /* */ 50 /* INPUT */ 51 /* */ 52 /* ip_ptr IP instance pointer */ 53 /* group_address IPv6 multicast address */ 54 /* interface_index Index to the phyical interface*/ 55 /* */ 56 /* OUTPUT */ 57 /* */ 58 /* status Completion status */ 59 /* */ 60 /* CALLS */ 61 /* */ 62 /* IPv6_Address_Type Obtain IPv6 address type */ 63 /* _nxd_ipv6_multicast_interface_join Actual IPv6 multicast join */ 64 /* function */ 65 /* */ 66 /* CALLED BY */ 67 /* */ 68 /* Application */ 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 /**************************************************************************/ _nxde_ipv6_multicast_interface_join(NX_IP * ip_ptr,NXD_ADDRESS * group_address,UINT interface_index)79UINT _nxde_ipv6_multicast_interface_join(NX_IP *ip_ptr, NXD_ADDRESS *group_address, UINT interface_index) 80 { 81 82 #if defined(NX_ENABLE_IPV6_MULTICAST) && defined(FEATURE_NX_IPV6) 83 UINT status; 84 85 86 /* Check for invalid input pointers. */ 87 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (group_address == NX_NULL)) 88 { 89 return(NX_PTR_ERROR); 90 } 91 92 /* Check for invalid input parameter. */ 93 if ((IPv6_Address_Type(group_address -> nxd_ip_address.v6) & IPV6_ADDRESS_MULTICAST) != IPV6_ADDRESS_MULTICAST) 94 { 95 return(NX_IP_ADDRESS_ERROR); 96 } 97 98 /* Validate the interface. */ 99 if (interface_index >= NX_MAX_PHYSICAL_INTERFACES) 100 { 101 return(NX_INVALID_INTERFACE); 102 } 103 104 /* Validate the interface. */ 105 if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_valid != NX_TRUE) 106 { 107 return(NX_INVALID_INTERFACE); 108 } 109 110 /* Check for appropriate caller. */ 111 NX_THREADS_ONLY_CALLER_CHECKING 112 113 /* Call actual IPv6 enable function. */ 114 status = _nxd_ipv6_multicast_interface_join(ip_ptr, group_address, interface_index); 115 116 /* Return completion status. */ 117 return(status); 118 119 #else /* ! NX_ENABLE_IPV6_MULTICAST */ 120 NX_PARAMETER_NOT_USED(ip_ptr); 121 NX_PARAMETER_NOT_USED(group_address); 122 NX_PARAMETER_NOT_USED(interface_index); 123 124 return(NX_NOT_SUPPORTED); 125 126 #endif /* NX_ENABLE_IPV6_MULTICAST && FEATURE_NX_IPV6 */ 127 } 128 129