Mbed library for ENC28J60 Ethernet modules. Full support for TCP/IP and UDP Server, Client and HTTP server (webserver). DHCP and DNS is included.

Dependents:   mBuino_ENC28_MQTT Nucleo_Web_ENC28J60 Nucleo_Web_ENC28J60_ADC Serial_over_Ethernet ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip4string.h Source File

ip4string.h

00001 /*
00002  * Copyright (c) 2014-2018 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 IP4STRING_H
00017 #define IP4STRING_H
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 #include "ns_types.h"
00023 
00024 /**
00025  * Print binary IPv4 address to a string.
00026  *
00027  * String must contain enough room for full address, 16 bytes exact.
00028  *
00029  * \param ip4addr IPv4 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 ip4tos(const void *ip4addr, char *p);
00034 
00035 /**
00036  * Convert numeric IPv4 address string to a binary.
00037  *
00038  * \param ip4addr IPv4 address in string format.
00039  * \param len Length of IPv4 string, maximum of 16..
00040  * \param dest buffer for address. MUST be 4 bytes.
00041  * \return boolean set to true if conversion succeed, false if it didn't
00042  */
00043 bool stoip4(const char *ip4addr, size_t len, void *dest);
00044 
00045 #ifdef __cplusplus
00046 }
00047 #endif
00048 #endif