mbed os with nrf51 internal bandgap enabled to read battery level
Dependents: BLE_file_test BLE_Blink ExternalEncoder
features/FEATURE_COMMON_PAL/nanostack-libservice/mbed-client-libservice/ip6string.h@0:f269e3021894, 2016-10-23 (annotated)
- Committer:
- elessair
- Date:
- Sun Oct 23 15:10:02 2016 +0000
- Revision:
- 0:f269e3021894
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | /* |
elessair | 0:f269e3021894 | 2 | * Copyright (c) 2014-2015 ARM Limited. All rights reserved. |
elessair | 0:f269e3021894 | 3 | * SPDX-License-Identifier: Apache-2.0 |
elessair | 0:f269e3021894 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
elessair | 0:f269e3021894 | 5 | * not use this file except in compliance with the License. |
elessair | 0:f269e3021894 | 6 | * You may obtain a copy of the License at |
elessair | 0:f269e3021894 | 7 | * |
elessair | 0:f269e3021894 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
elessair | 0:f269e3021894 | 9 | * |
elessair | 0:f269e3021894 | 10 | * Unless required by applicable law or agreed to in writing, software |
elessair | 0:f269e3021894 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
elessair | 0:f269e3021894 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
elessair | 0:f269e3021894 | 13 | * See the License for the specific language governing permissions and |
elessair | 0:f269e3021894 | 14 | * limitations under the License. |
elessair | 0:f269e3021894 | 15 | */ |
elessair | 0:f269e3021894 | 16 | #ifndef IP6STRING_H |
elessair | 0:f269e3021894 | 17 | #define IP6STRING_H |
elessair | 0:f269e3021894 | 18 | #ifdef __cplusplus |
elessair | 0:f269e3021894 | 19 | extern "C" { |
elessair | 0:f269e3021894 | 20 | #endif |
elessair | 0:f269e3021894 | 21 | |
elessair | 0:f269e3021894 | 22 | #include "ns_types.h" |
elessair | 0:f269e3021894 | 23 | /** |
elessair | 0:f269e3021894 | 24 | * Print binary IPv6 address to a string. |
elessair | 0:f269e3021894 | 25 | * |
elessair | 0:f269e3021894 | 26 | * String must contain enough room for full address, 40 bytes exact. |
elessair | 0:f269e3021894 | 27 | * IPv4 tunneling addresses are not covered. |
elessair | 0:f269e3021894 | 28 | * |
elessair | 0:f269e3021894 | 29 | * \param ip6addr IPv6 address. |
elessair | 0:f269e3021894 | 30 | * \param p buffer to write string to. |
elessair | 0:f269e3021894 | 31 | * \return length of generated string excluding the terminating null character |
elessair | 0:f269e3021894 | 32 | */ |
elessair | 0:f269e3021894 | 33 | uint_fast8_t ip6tos(const void *ip6addr, char *p); |
elessair | 0:f269e3021894 | 34 | |
elessair | 0:f269e3021894 | 35 | /** |
elessair | 0:f269e3021894 | 36 | * Print binary IPv6 prefix to a string. |
elessair | 0:f269e3021894 | 37 | * |
elessair | 0:f269e3021894 | 38 | * String buffer `p` must contain enough room for a full address and prefix length, 44 bytes exact. |
elessair | 0:f269e3021894 | 39 | * Bits in the `prefix` buffer beyond `prefix_len` bits are not shown and only the bytes containing the |
elessair | 0:f269e3021894 | 40 | * prefix bits are read. I.e. for a 20 bit prefix 3 bytes are read, and for a 0 bit prefix 0 bytes are |
elessair | 0:f269e3021894 | 41 | * read (thus if `prefix_len` is zero, `prefix` can be NULL). |
elessair | 0:f269e3021894 | 42 | * `prefix_len` must be 0 to 128. |
elessair | 0:f269e3021894 | 43 | * |
elessair | 0:f269e3021894 | 44 | * \param prefix IPv6 prefix. |
elessair | 0:f269e3021894 | 45 | * \param prefix_len length of `prefix` in bits. |
elessair | 0:f269e3021894 | 46 | * \param p buffer to write string to. |
elessair | 0:f269e3021894 | 47 | * \return length of generated string excluding the terminating null character, or 0 for an error, such as 'prefix_len' > 128 |
elessair | 0:f269e3021894 | 48 | */ |
elessair | 0:f269e3021894 | 49 | uint_fast8_t ip6_prefix_tos(const void *prefix, uint_fast8_t prefix_len, char *p); |
elessair | 0:f269e3021894 | 50 | |
elessair | 0:f269e3021894 | 51 | /** |
elessair | 0:f269e3021894 | 52 | * Convert numeric IPv6 address string to a binary. |
elessair | 0:f269e3021894 | 53 | * |
elessair | 0:f269e3021894 | 54 | * IPv4 tunneling addresses are not covered. |
elessair | 0:f269e3021894 | 55 | * |
elessair | 0:f269e3021894 | 56 | * \param ip6addr IPv6 address in string format. |
elessair | 0:f269e3021894 | 57 | * \param len Lenght of ipv6 string, maximum of 41. |
elessair | 0:f269e3021894 | 58 | * \param dest buffer for address. MUST be 16 bytes. |
elessair | 0:f269e3021894 | 59 | */ |
elessair | 0:f269e3021894 | 60 | void stoip6(const char *ip6addr, size_t len, void *dest); |
elessair | 0:f269e3021894 | 61 | /** |
elessair | 0:f269e3021894 | 62 | * Find out numeric IPv6 address prefix length. |
elessair | 0:f269e3021894 | 63 | * |
elessair | 0:f269e3021894 | 64 | * \param ip6addr IPv6 address in string format |
elessair | 0:f269e3021894 | 65 | * \return prefix length or 0 if it not given |
elessair | 0:f269e3021894 | 66 | */ |
elessair | 0:f269e3021894 | 67 | unsigned char sipv6_prefixlength(const char *ip6addr); |
elessair | 0:f269e3021894 | 68 | |
elessair | 0:f269e3021894 | 69 | #ifdef __cplusplus |
elessair | 0:f269e3021894 | 70 | } |
elessair | 0:f269e3021894 | 71 | #endif |
elessair | 0:f269e3021894 | 72 | #endif |