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 (IP) */ 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_ipv6.h" 29 #if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) 30 #include "nx_ip.h" 31 32 /* Bring in externs for caller checking code. */ 33 NX_CALLER_CHECKING_EXTERNS 34 35 36 #endif /* FEATURE_NX_IPV6 && NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */ 37 38 /**************************************************************************/ 39 /* */ 40 /* FUNCTION RELEASE */ 41 /* */ 42 /* _nxde_ipv6_stateless_address_autoconfig_enable PORTABLE C */ 43 /* 6.1 */ 44 /* AUTHOR */ 45 /* */ 46 /* Yuxin Zhou, Microsoft Corporation */ 47 /* */ 48 /* DESCRIPTION */ 49 /* */ 50 /* This function performs error checking on the IPv6 stateless address */ 51 /* auto configuration enable service. */ 52 /* */ 53 /* INPUT */ 54 /* */ 55 /* ip_ptr IP instance pointer */ 56 /* interface_index The interface to operate on */ 57 /* */ 58 /* OUTPUT */ 59 /* */ 60 /* status Completion status */ 61 /* */ 62 /* CALLS */ 63 /* */ 64 /* _nxd_ipv6_stateless_address_autoconfig_enable */ 65 /* */ 66 /* */ 67 /* CALLED BY */ 68 /* */ 69 /* Application Code */ 70 /* */ 71 /* RELEASE HISTORY */ 72 /* */ 73 /* DATE NAME DESCRIPTION */ 74 /* */ 75 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 76 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 77 /* resulting in version 6.1 */ 78 /* */ 79 /**************************************************************************/ _nxde_ipv6_stateless_address_autoconfig_enable(NX_IP * ip_ptr,UINT interface_index)80UINT _nxde_ipv6_stateless_address_autoconfig_enable(NX_IP *ip_ptr, UINT interface_index) 81 { 82 83 #if defined(FEATURE_NX_IPV6) && defined(NX_IPV6_STATELESS_AUTOCONFIG_CONTROL) 84 UINT status; 85 86 /* Check for invalid input pointers. */ 87 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) 88 { 89 return(NX_PTR_ERROR); 90 } 91 92 /* Validate the interface. */ 93 if (interface_index >= NX_MAX_PHYSICAL_INTERFACES) 94 { 95 return(NX_INVALID_INTERFACE); 96 } 97 98 /* Check for appropriate caller. */ 99 NX_INIT_AND_THREADS_CALLER_CHECKING 100 101 /* Call actual IPv6 stateless address autoconfig enable function. */ 102 status = _nxd_ipv6_stateless_address_autoconfig_enable(ip_ptr, interface_index); 103 104 /* Return completion status. */ 105 return(status); 106 107 #else 108 NX_PARAMETER_NOT_USED(ip_ptr); 109 NX_PARAMETER_NOT_USED(interface_index); 110 111 return(NX_NOT_SUPPORTED); 112 113 #endif /* FEATURE_NX_IPV6 && NX_IPV6_STATELESS_AUTOCONFIG_CONTROL */ 114 } 115 116