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.
Dependencies: FXAS21002 FXOS8700Q
simple-mbed-cloud-client/mbed-cloud-client/nanostack-libservice/mbed-client-libservice/ip4string.h@0:977e87915078, 2019-08-28 (annotated)
- Committer:
- vithyat
- Date:
- Wed Aug 28 19:24:56 2019 +0000
- Revision:
- 0:977e87915078
init
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| vithyat | 0:977e87915078 | 1 | /* |
| vithyat | 0:977e87915078 | 2 | * Copyright (c) 2014-2018 ARM Limited. All rights reserved. |
| vithyat | 0:977e87915078 | 3 | * SPDX-License-Identifier: Apache-2.0 |
| vithyat | 0:977e87915078 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| vithyat | 0:977e87915078 | 5 | * not use this file except in compliance with the License. |
| vithyat | 0:977e87915078 | 6 | * You may obtain a copy of the License at |
| vithyat | 0:977e87915078 | 7 | * |
| vithyat | 0:977e87915078 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| vithyat | 0:977e87915078 | 9 | * |
| vithyat | 0:977e87915078 | 10 | * Unless required by applicable law or agreed to in writing, software |
| vithyat | 0:977e87915078 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| vithyat | 0:977e87915078 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| vithyat | 0:977e87915078 | 13 | * See the License for the specific language governing permissions and |
| vithyat | 0:977e87915078 | 14 | * limitations under the License. |
| vithyat | 0:977e87915078 | 15 | */ |
| vithyat | 0:977e87915078 | 16 | #ifndef IP4STRING_H |
| vithyat | 0:977e87915078 | 17 | #define IP4STRING_H |
| vithyat | 0:977e87915078 | 18 | #ifdef __cplusplus |
| vithyat | 0:977e87915078 | 19 | extern "C" { |
| vithyat | 0:977e87915078 | 20 | #endif |
| vithyat | 0:977e87915078 | 21 | |
| vithyat | 0:977e87915078 | 22 | #include "ns_types.h" |
| vithyat | 0:977e87915078 | 23 | |
| vithyat | 0:977e87915078 | 24 | /** |
| vithyat | 0:977e87915078 | 25 | * Print binary IPv4 address to a string. |
| vithyat | 0:977e87915078 | 26 | * |
| vithyat | 0:977e87915078 | 27 | * String must contain enough room for full address, 16 bytes exact. |
| vithyat | 0:977e87915078 | 28 | * |
| vithyat | 0:977e87915078 | 29 | * \param ip4addr IPv4 address. |
| vithyat | 0:977e87915078 | 30 | * \param p buffer to write string to. |
| vithyat | 0:977e87915078 | 31 | * \return length of generated string excluding the terminating null character |
| vithyat | 0:977e87915078 | 32 | */ |
| vithyat | 0:977e87915078 | 33 | uint_fast8_t ip4tos(const void *ip4addr, char *p); |
| vithyat | 0:977e87915078 | 34 | |
| vithyat | 0:977e87915078 | 35 | /** |
| vithyat | 0:977e87915078 | 36 | * Convert numeric IPv4 address string to a binary. |
| vithyat | 0:977e87915078 | 37 | * |
| vithyat | 0:977e87915078 | 38 | * \param ip4addr IPv4 address in string format. |
| vithyat | 0:977e87915078 | 39 | * \param len Length of IPv4 string, maximum of 16.. |
| vithyat | 0:977e87915078 | 40 | * \param dest buffer for address. MUST be 4 bytes. |
| vithyat | 0:977e87915078 | 41 | * \return boolean set to true if conversion succeed, false if it didn't |
| vithyat | 0:977e87915078 | 42 | */ |
| vithyat | 0:977e87915078 | 43 | bool stoip4(const char *ip4addr, size_t len, void *dest); |
| vithyat | 0:977e87915078 | 44 | |
| vithyat | 0:977e87915078 | 45 | #ifdef __cplusplus |
| vithyat | 0:977e87915078 | 46 | } |
| vithyat | 0:977e87915078 | 47 | #endif |
| vithyat | 0:977e87915078 | 48 | #endif |