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 #include "nx_api.h" 27 #include "nx_ipv6.h" 28 #ifdef FEATURE_NX_IPV6 29 #include "nx_ip.h" 30 31 /* Bring in externs for caller checking code. */ 32 NX_CALLER_CHECKING_EXTERNS 33 34 35 #endif /* FEATURE_NX_IPV6 */ 36 37 /**************************************************************************/ 38 /* */ 39 /* FUNCTION RELEASE */ 40 /* */ 41 /* _nxd_ipv6_address_delete PORTABLE C */ 42 /* 6.1 */ 43 /* AUTHOR */ 44 /* */ 45 /* Yuxin Zhou, Microsoft Corporation */ 46 /* */ 47 /* DESCRIPTION */ 48 /* */ 49 /* This function performs error checking for the IPv6 address deletion */ 50 /* service. */ 51 /* */ 52 /* INPUT */ 53 /* */ 54 /* ip_ptr IP control block pointer */ 55 /* address_index Index into interface address list */ 56 /* */ 57 /* OUTPUT */ 58 /* */ 59 /* NX_NO_INTERFACE_ADDRESS Invalid address supplied */ 60 /* NX_PTR_ERROR Invalid pointer input */ 61 /* NX_INVALID_INTERFACE Invalid Interface Index */ 62 /* */ 63 /* CALLS */ 64 /* */ 65 /* None */ 66 /* */ 67 /* CALLED BY */ 68 /* */ 69 /* Application Code */ 70 /* */ 71 /* NOTE */ 72 /* Application needs to fill in the ip_address.nxd_ip_version field. */ 73 /* */ 74 /* RELEASE HISTORY */ 75 /* */ 76 /* DATE NAME DESCRIPTION */ 77 /* */ 78 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 79 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 80 /* resulting in version 6.1 */ 81 /* */ 82 /**************************************************************************/ _nxde_ipv6_address_delete(NX_IP * ip_ptr,UINT address_index)83UINT _nxde_ipv6_address_delete(NX_IP *ip_ptr, 84 UINT address_index) 85 { 86 #ifdef FEATURE_NX_IPV6 87 88 UINT status; 89 90 91 /* Check for invalid input pointers. */ 92 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID)) 93 { 94 return(NX_PTR_ERROR); 95 } 96 97 /* Validate the address index. */ 98 if (address_index >= NX_MAX_IPV6_ADDRESSES) 99 { 100 return(NX_NO_INTERFACE_ADDRESS); 101 } 102 103 /* Check for appropriate caller. */ 104 NX_INIT_AND_THREADS_CALLER_CHECKING 105 106 /* Call actual IPv6 address delete function. */ 107 status = _nxd_ipv6_address_delete(ip_ptr, address_index); 108 109 /* Return completion status. */ 110 return(status); 111 112 #else /* !FEATURE_NX_IPV6 */ 113 NX_PARAMETER_NOT_USED(ip_ptr); 114 NX_PARAMETER_NOT_USED(address_index); 115 116 return(NX_NOT_SUPPORTED); 117 118 #endif /* FEATURE_NX_IPV6 */ 119 } 120 121