From 01b0975072c9d74d95afe68547d4bea0a9e96b19 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 19 Aug 2016 16:52:06 +0200 Subject: [PATCH] fixup! sock: Introduction of new application layer API --- sys/include/net/sock.h | 15 ++++++++++++++ sys/include/net/sock/addr.h | 13 ++++++++---- sys/include/net/sock/flags.h | 39 ------------------------------------ sys/include/net/sock/ip.h | 8 +++++--- sys/include/net/sock/tcp.h | 8 +++++--- sys/include/net/sock/udp.h | 8 +++++--- 6 files changed, 39 insertions(+), 52 deletions(-) delete mode 100644 sys/include/net/sock/flags.h diff --git a/sys/include/net/sock.h b/sys/include/net/sock.h index 1db809754f..ec64be366e 100644 --- a/sys/include/net/sock.h +++ b/sys/include/net/sock.h @@ -91,6 +91,21 @@ extern "C" { #endif +#if defined(DOXYGEN) +/** + * @brief compile flag to activate IPv6 support for sock. + */ +#define SOCK_HAS_IPV6 +#endif + +/** + * @brief Common flags for @ref net_conn + * @{ + */ +#define SOCK_FLAGS_REUSE_EP (0x00000001) /**< allow to reuse end point on bind */ +/** @} */ + + #ifdef __cplusplus } #endif diff --git a/sys/include/net/sock/addr.h b/sys/include/net/sock/addr.h index 977230bfac..ee90b8595d 100644 --- a/sys/include/net/sock/addr.h +++ b/sys/include/net/sock/addr.h @@ -29,8 +29,8 @@ extern "C" { #endif /** - * @brief Special @ref net_netif "netif" ID for "any interface" - * @todo Define in @ref net_netif + * @brief Special netif ID for "any interface" + * @todo Use an equivalent defintion from #5511 */ #define SOCK_ADDR_ANY_NETIF (0) @@ -57,8 +57,13 @@ typedef struct { * @brief Type to abstract both IPv4 and IPv6 addresses */ typedef union { -#ifdef SOCK_HAS_IPV6 - sock_addr_ipv6_t ipv6; /**< IPv6 address mode */ +#if defined(SOCK_HAS_IPV6) || defined(DOXYGEN) + /** + * @brief IPv6 address mode + * + * @note only available if @ref SOCK_HAS_IPV6 is defined. + */ + sock_addr_ipv6_t ipv6; #endif sock_addr_ipv4_t ipv4; /**< IPv4 address mode */ } sock_addr_ip_t; diff --git a/sys/include/net/sock/flags.h b/sys/include/net/sock/flags.h deleted file mode 100644 index 270fd6c1f6..0000000000 --- a/sys/include/net/sock/flags.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2016 Freie Univesität Berlin - * - * 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. - */ - -/** - * @defgroup net_sock_flags Common flags for @ref net_sock - * @ingroup net_sock - * @brief Common flags for usage with @ref net_sock - * @{ - * - * @file - * @brief Common flags definitions for usage with @ref net_sock - * - * @author Martine Lenders - */ -#ifndef NET_SOCK_FLAGS_H_ -#define NET_SOCK_FLAGS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Common flags for @ref net_conn - * @{ - */ -#define SOCK_FLAGS_REUSE_EP (0x00000001) /**< allow to reuse end point on bind */ -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* NET_SOCK_FLAGS_H_ */ -/** @} */ diff --git a/sys/include/net/sock/ip.h b/sys/include/net/sock/ip.h index 46eb6912aa..7abee1698e 100644 --- a/sys/include/net/sock/ip.h +++ b/sys/include/net/sock/ip.h @@ -43,11 +43,12 @@ extern "C" { * @brief An end point for a raw IPv4/IPv6 sock object */ typedef struct { - sock_addr_ip_t addr; /**< IP address */ - int family; /**< family of sock_ip_ep_t::addr */ + uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */ /** - * @brief network interface ID as defined in @ref net_netif + * @brief stack-specific network interface ID + * + * @todo port to common network interface identifiers in PR #5511. * * Use @ref SOCK_ADDR_ANY_NETIF for any interface. * For reception this is the local interface the message came over, @@ -55,6 +56,7 @@ typedef struct { * over */ uint16_t netif; + sock_addr_ip_t addr; /**< IP address */ } sock_ip_ep_t; /** diff --git a/sys/include/net/sock/tcp.h b/sys/include/net/sock/tcp.h index 3339ae1a4b..b9ef89690b 100644 --- a/sys/include/net/sock/tcp.h +++ b/sys/include/net/sock/tcp.h @@ -42,11 +42,12 @@ extern "C" { * @brief An end point for a TCP sock object */ typedef struct { - sock_addr_ip_t addr; /**< IP address */ - int family; /**< family of sock_tcp_ep_t::addr */ + uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */ /** - * @brief network interface ID as defined in @ref net_netif + * @brief stack-specific network interface ID + * + * @todo port to common network interface identifiers in PR #5511. * * Use @ref SOCK_ADDR_ANY_NETIF for any interface. * For reception this is the local interface the message came over, @@ -54,6 +55,7 @@ typedef struct { * over */ uint16_t netif; + sock_addr_ip_t addr; /**< IP address */ uint16_t port; /**< port for the TCP end point */ } sock_tcp_ep_t; diff --git a/sys/include/net/sock/udp.h b/sys/include/net/sock/udp.h index fe40c51724..fc48fc71bd 100644 --- a/sys/include/net/sock/udp.h +++ b/sys/include/net/sock/udp.h @@ -43,11 +43,12 @@ extern "C" { * @brief An end point for a UDP sock object */ typedef struct { - sock_addr_ip_t addr; /**< IP address */ - int family; /**< family of sock_udp_ep_t::addr */ + uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */ /** - * @brief network interface ID as defined in @ref net_netif + * @brief stack-specific network interface ID + * + * @todo port to common network interface identifiers in PR #5511. * * Use @ref SOCK_ADDR_ANY_NETIF for any interface. * For reception this is the local interface the message came over, @@ -55,6 +56,7 @@ typedef struct { * over */ uint16_t netif; + sock_addr_ip_t addr; /**< IP address */ uint16_t port; /**< port for the UDP end point */ } sock_udp_ep_t;