1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

fixup! sock: Introduction of new application layer API

This commit is contained in:
Martine Lenders 2016-08-19 16:52:06 +02:00
parent 6f06deff40
commit 01b0975072
6 changed files with 39 additions and 52 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 <m.lenders@fu-berlin.de>
*/
#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_ */
/** @} */

View File

@ -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;
/**

View File

@ -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;

View File

@ -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;