mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
fixup! sock: Introduction of new application layer API
This commit is contained in:
parent
6f06deff40
commit
01b0975072
@ -91,6 +91,21 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -29,8 +29,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Special @ref net_netif "netif" ID for "any interface"
|
* @brief Special netif ID for "any interface"
|
||||||
* @todo Define in @ref net_netif
|
* @todo Use an equivalent defintion from #5511
|
||||||
*/
|
*/
|
||||||
#define SOCK_ADDR_ANY_NETIF (0)
|
#define SOCK_ADDR_ANY_NETIF (0)
|
||||||
|
|
||||||
@ -57,8 +57,13 @@ typedef struct {
|
|||||||
* @brief Type to abstract both IPv4 and IPv6 addresses
|
* @brief Type to abstract both IPv4 and IPv6 addresses
|
||||||
*/
|
*/
|
||||||
typedef union {
|
typedef union {
|
||||||
#ifdef SOCK_HAS_IPV6
|
#if defined(SOCK_HAS_IPV6) || defined(DOXYGEN)
|
||||||
sock_addr_ipv6_t ipv6; /**< IPv6 address mode */
|
/**
|
||||||
|
* @brief IPv6 address mode
|
||||||
|
*
|
||||||
|
* @note only available if @ref SOCK_HAS_IPV6 is defined.
|
||||||
|
*/
|
||||||
|
sock_addr_ipv6_t ipv6;
|
||||||
#endif
|
#endif
|
||||||
sock_addr_ipv4_t ipv4; /**< IPv4 address mode */
|
sock_addr_ipv4_t ipv4; /**< IPv4 address mode */
|
||||||
} sock_addr_ip_t;
|
} sock_addr_ip_t;
|
||||||
|
|||||||
@ -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_ */
|
|
||||||
/** @} */
|
|
||||||
@ -43,11 +43,12 @@ extern "C" {
|
|||||||
* @brief An end point for a raw IPv4/IPv6 sock object
|
* @brief An end point for a raw IPv4/IPv6 sock object
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sock_addr_ip_t addr; /**< IP address */
|
uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */
|
||||||
int family; /**< family of sock_ip_ep_t::addr */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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.
|
* Use @ref SOCK_ADDR_ANY_NETIF for any interface.
|
||||||
* For reception this is the local interface the message came over,
|
* For reception this is the local interface the message came over,
|
||||||
@ -55,6 +56,7 @@ typedef struct {
|
|||||||
* over
|
* over
|
||||||
*/
|
*/
|
||||||
uint16_t netif;
|
uint16_t netif;
|
||||||
|
sock_addr_ip_t addr; /**< IP address */
|
||||||
} sock_ip_ep_t;
|
} sock_ip_ep_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -42,11 +42,12 @@ extern "C" {
|
|||||||
* @brief An end point for a TCP sock object
|
* @brief An end point for a TCP sock object
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sock_addr_ip_t addr; /**< IP address */
|
uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */
|
||||||
int family; /**< family of sock_tcp_ep_t::addr */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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.
|
* Use @ref SOCK_ADDR_ANY_NETIF for any interface.
|
||||||
* For reception this is the local interface the message came over,
|
* For reception this is the local interface the message came over,
|
||||||
@ -54,6 +55,7 @@ typedef struct {
|
|||||||
* over
|
* over
|
||||||
*/
|
*/
|
||||||
uint16_t netif;
|
uint16_t netif;
|
||||||
|
sock_addr_ip_t addr; /**< IP address */
|
||||||
uint16_t port; /**< port for the TCP end point */
|
uint16_t port; /**< port for the TCP end point */
|
||||||
} sock_tcp_ep_t;
|
} sock_tcp_ep_t;
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,12 @@ extern "C" {
|
|||||||
* @brief An end point for a UDP sock object
|
* @brief An end point for a UDP sock object
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sock_addr_ip_t addr; /**< IP address */
|
uint16_t family; /**< family of sock_ip_ep_t::addr as defined in @ref net_af */
|
||||||
int family; /**< family of sock_udp_ep_t::addr */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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.
|
* Use @ref SOCK_ADDR_ANY_NETIF for any interface.
|
||||||
* For reception this is the local interface the message came over,
|
* For reception this is the local interface the message came over,
|
||||||
@ -55,6 +56,7 @@ typedef struct {
|
|||||||
* over
|
* over
|
||||||
*/
|
*/
|
||||||
uint16_t netif;
|
uint16_t netif;
|
||||||
|
sock_addr_ip_t addr; /**< IP address */
|
||||||
uint16_t port; /**< port for the UDP end point */
|
uint16_t port; /**< port for the UDP end point */
|
||||||
} sock_udp_ep_t;
|
} sock_udp_ep_t;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user