2013-10-31 15:25:26 +01:00
|
|
|
/*
|
2015-08-11 20:06:13 +02:00
|
|
|
* Copyright (C) 2013-15 Freie Universität Berlin
|
2013-10-31 15:25:26 +01:00
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2013-10-31 15:25:26 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-09-25 21:03:46 +02:00
|
|
|
* @addtogroup posix_sockets
|
2013-10-31 15:25:26 +01:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-05-22 07:34:41 +02:00
|
|
|
* @file
|
2013-10-31 15:25:26 +01:00
|
|
|
* @brief Definitions for internet operations
|
|
|
|
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html">
|
|
|
|
* The Open Group Base Specifications Issue 7, <arpa/inet.h>
|
|
|
|
* </a>
|
|
|
|
*
|
2015-02-08 18:51:25 +01:00
|
|
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
2013-10-31 15:25:26 +01:00
|
|
|
*/
|
|
|
|
#ifndef ARPA_INET_H
|
|
|
|
#define ARPA_INET_H
|
|
|
|
|
2015-08-11 20:06:13 +02:00
|
|
|
#include "net/af.h"
|
2015-08-17 13:48:08 +02:00
|
|
|
#include "sys/bytes.h"
|
|
|
|
#include "netinet/in.h"
|
2013-10-31 15:25:26 +01:00
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-08-11 20:06:13 +02:00
|
|
|
/**
|
|
|
|
* @brief Size in byte of an IPv4 address
|
|
|
|
*/
|
|
|
|
#ifndef INADDRSZ
|
2017-09-20 22:11:04 +02:00
|
|
|
#define INADDRSZ (4)
|
2015-08-11 20:06:13 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Size in byte of an IPv6 address
|
|
|
|
*/
|
|
|
|
#ifndef IN6ADDRSZ
|
2017-09-20 22:11:04 +02:00
|
|
|
#define IN6ADDRSZ (16)
|
2015-08-11 20:06:13 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Converts an IP address to its string representation
|
|
|
|
*
|
|
|
|
* @pre (af == AF_INET) || (af == AF_INET6)
|
|
|
|
*
|
|
|
|
* @param[in] af Address family of @p src. Must be @ref AF_INET or @ref AF_INET6.
|
|
|
|
* @param[in] src An IP address.
|
|
|
|
* @param[out] dst The resulting string representation.
|
|
|
|
* @param[in] size Length of @p result.
|
|
|
|
*
|
|
|
|
* @return @p dst, on success
|
|
|
|
* @return NULL, if @p size was smaller than needed
|
|
|
|
* @return NULL, if @p src or @p dst was NULL
|
|
|
|
*/
|
2022-04-28 23:05:42 +02:00
|
|
|
const char *inet_ntop(int af, const void *__restrict src, char *__restrict dst,
|
2017-09-20 22:11:04 +02:00
|
|
|
socklen_t size);
|
2015-08-11 20:06:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Converts an IP address string representation to a byte-represented
|
|
|
|
* IP address
|
|
|
|
*
|
|
|
|
* @pre (af == AF_INET) || (af == AF_INET6)
|
|
|
|
*
|
|
|
|
* @param[in] af Address family of @p src. Must be @ref AF_INET or @ref AF_INET6.
|
|
|
|
* @param[in] src An IP address string representation
|
|
|
|
* @param[out] dst The resulting byte representation
|
|
|
|
*
|
|
|
|
* @return 1, on success.
|
|
|
|
* @return 0, if @p src was malformed or input pointers were NULL.
|
|
|
|
* @return -1, if @p af is not supported.
|
|
|
|
*/
|
2017-09-20 22:11:04 +02:00
|
|
|
int inet_pton(int af, const char *src, void *dst);
|
2015-08-11 20:06:13 +02:00
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-10-31 15:25:26 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
#endif /* ARPA_INET_H */
|