Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: blinky_max32630fthr
ip6string.h
00001 /* 00002 * Copyright (c) 2014-2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef IP6STRING_H 00017 #define IP6STRING_H 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 #include "ns_types.h" 00023 /** 00024 * Print binary IPv6 address to a string. 00025 * 00026 * String must contain enough room for full address, 40 bytes exact. 00027 * IPv4 tunneling addresses are not covered. 00028 * 00029 * \param ip6addr IPv6 address. 00030 * \param p buffer to write string to. 00031 * \return length of generated string excluding the terminating null character 00032 */ 00033 uint_fast8_t ip6tos(const void *ip6addr, char *p); 00034 00035 /** 00036 * Print binary IPv6 prefix to a string. 00037 * 00038 * String buffer `p` must contain enough room for a full address and prefix length, 44 bytes exact. 00039 * Bits in the `prefix` buffer beyond `prefix_len` bits are not shown and only the bytes containing the 00040 * prefix bits are read. I.e. for a 20 bit prefix 3 bytes are read, and for a 0 bit prefix 0 bytes are 00041 * read (thus if `prefix_len` is zero, `prefix` can be NULL). 00042 * `prefix_len` must be 0 to 128. 00043 * 00044 * \param prefix IPv6 prefix. 00045 * \param prefix_len length of `prefix` in bits. 00046 * \param p buffer to write string to. 00047 * \return length of generated string excluding the terminating null character, or 0 for an error, such as 'prefix_len' > 128 00048 */ 00049 uint_fast8_t ip6_prefix_tos(const void *prefix, uint_fast8_t prefix_len, char *p); 00050 00051 /** 00052 * Convert numeric IPv6 address string to a binary. 00053 * 00054 * IPv4 tunneling addresses are not covered. 00055 * 00056 * \param ip6addr IPv6 address in string format. 00057 * \param len Lenght of ipv6 string, maximum of 41. 00058 * \param dest buffer for address. MUST be 16 bytes. 00059 */ 00060 void stoip6(const char *ip6addr, size_t len, void *dest); 00061 /** 00062 * Find out numeric IPv6 address prefix length. 00063 * 00064 * \param ip6addr IPv6 address in string format 00065 * \return prefix length or 0 if it not given 00066 */ 00067 unsigned char sipv6_prefixlength(const char *ip6addr); 00068 00069 #ifdef __cplusplus 00070 } 00071 #endif 00072 #endif
Generated on Tue Jul 12 2022 14:21:07 by
1.7.2
