Ram Gandikota / Mbed OS ABCD
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip6string.h Source File

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  * Print binary IPv6 address to a string.
00023  * String must contain enough room for full address, 40 bytes exact.
00024  * IPv4 tunneling addresses are not covered.
00025  * \param ip6addr IPv6 address.
00026  * \p buffer to write string to.
00027  */
00028 uint_fast8_t ip6tos(const void *ip6addr, char *p);
00029 
00030 /**
00031  * Convert numeric IPv6 address string to a binary.
00032  * IPv4 tunneling addresses are not covered.
00033  * \param ip6addr IPv6 address in string format.
00034  * \param len Lenght of ipv6 string, maximum of 41.
00035  * \param dest buffer for address. MUST be 16 bytes.
00036  */
00037 void stoip6(const char *ip6addr, size_t len, void *dest);
00038 /**
00039  * Find out numeric IPv6 address prefix length
00040  * \param ip6addr  IPv6 address in string format
00041  * \return prefix length or 0 if it not given
00042  */
00043 unsigned char sipv6_prefixlength(const char *ip6addr);
00044 
00045 #ifdef __cplusplus
00046 }
00047 #endif
00048 #endif