2013-10-31 15:25:26 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Freie Universität Berlin
|
|
|
|
*
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup pnet
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#include "net_help.h"
|
|
|
|
#include "inet_ntop.h"
|
|
|
|
#include "inet_pton.h"
|
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-10-31 15:25:26 +01:00
|
|
|
typedef uint16_t in_port_t; ///< Internet port type
|
|
|
|
typedef uint32_t in_addr_t; ///< IPv4 address type
|
|
|
|
|
|
|
|
#define INET_ADDRSTRLEN 16 ///< Length of the string form for IPv4.
|
|
|
|
#define INET6_ADDRSTRLEN 46 ///< Length of the string form for IPv6.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IPv4 address structure type.
|
|
|
|
*/
|
|
|
|
struct in_addr {
|
|
|
|
in_addr_t s_addr; ///< an IPv4 address
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert values between host and network byte order.
|
|
|
|
*
|
|
|
|
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html">
|
|
|
|
* The Open Group Base Specification Issue 7, htonl
|
|
|
|
* </a>
|
|
|
|
*
|
|
|
|
* @param[in] hostlong A 32 bit number.
|
|
|
|
* @return The argument value converted from host to network byte
|
|
|
|
* order.
|
|
|
|
*/
|
|
|
|
#define htonl(hostlong) HTONL(hostlong)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert values between host and network byte order.
|
|
|
|
*
|
|
|
|
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html">
|
|
|
|
* The Open Group Base Specification Issue 7, htons
|
|
|
|
* </a>
|
|
|
|
*
|
2014-11-30 22:34:50 +01:00
|
|
|
* @param[in] hostshort A 16 bit number.
|
2013-10-31 15:25:26 +01:00
|
|
|
* @return The argument value converted from host to network byte
|
|
|
|
* order.
|
|
|
|
*/
|
|
|
|
#define htons(hostshort) HTONS(hostshort)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert values between host and network byte order.
|
|
|
|
*
|
|
|
|
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html">
|
|
|
|
* The Open Group Base Specification Issue 7, ntohl
|
|
|
|
* </a>
|
|
|
|
*
|
2014-11-30 22:34:50 +01:00
|
|
|
* @param[in] netlong A 32-bit integer number.
|
2013-10-31 15:25:26 +01:00
|
|
|
* @return The argument value converted from network to host byte
|
|
|
|
* order.
|
|
|
|
*/
|
|
|
|
#define ntohl(netlong) NTOHL(netlong)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Convert values between host and network byte order.
|
|
|
|
*
|
|
|
|
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html">
|
|
|
|
* The Open Group Base Specification Issue 7, ntohs
|
|
|
|
* </a>
|
|
|
|
*
|
2014-11-30 22:34:50 +01:00
|
|
|
* @param[in] netshort A 16-bit integer number.
|
2013-10-31 15:25:26 +01:00
|
|
|
* @return The argument value converted from network to host byte
|
|
|
|
* order.
|
|
|
|
*/
|
|
|
|
#define ntohs(netshort) NTOHS(netshort)
|
|
|
|
|
2014-10-10 11:51:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-10-31 15:25:26 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
#endif /* ARPA_INET_H */
|