Loading...
Searching...
No Matches
sock_types.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Martine Lenders <mlenders@inf.fu-berlin.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
21
22#include <stdbool.h>
23#include <stdint.h>
24
25#include "mbox.h"
26#include "net/af.h"
27#include "net/gnrc.h"
28#if IS_USED(MODULE_GNRC_TCP)
29#include "net/gnrc/tcp.h"
30#endif
31#include "net/gnrc/netreg.h"
32#ifdef SOCK_HAS_ASYNC
34#endif
35#include "net/sock/ip.h"
36#include "net/sock/udp.h"
37#include "net/sock/tcp.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
55#ifndef CONFIG_GNRC_SOCK_MBOX_SIZE_EXP
56#define CONFIG_GNRC_SOCK_MBOX_SIZE_EXP (3)
57#endif
59
63#ifndef GNRC_SOCK_MBOX_SIZE
64#define GNRC_SOCK_MBOX_SIZE (1 << CONFIG_GNRC_SOCK_MBOX_SIZE_EXP)
65#endif
66
72
73#ifdef SOCK_HAS_ASYNC
78typedef void (*gnrc_sock_reg_cb_t)(gnrc_sock_reg_t *sock,
80 void *arg);
81#endif /* SOCK_HAS_ASYNC */
82
88#ifdef MODULE_GNRC_SOCK_CHECK_REUSE
89 struct gnrc_sock_reg *next;
90#endif
94#ifdef SOCK_HAS_ASYNC
95 gnrc_netreg_entry_cbd_t netreg_cb;
102 union {
103 gnrc_sock_reg_cb_t generic;
104#ifdef MODULE_SOCK_IP
105 sock_ip_cb_t ip;
106#endif
107#ifdef MODULE_SOCK_UDP
108 sock_udp_cb_t udp;
109#endif
110 } async_cb;
111 void *async_cb_arg;
112#ifdef SOCK_HAS_ASYNC_CTX
113 sock_async_ctx_t async_ctx;
114#endif
115#endif /* SOCK_HAS_ASYNC */
116};
117
122struct sock_ip {
126 uint16_t flags;
127};
128
133struct sock_udp {
137 uint16_t flags;
138};
139
140#ifdef __cplusplus
141}
142#endif
143
Global UNIX address family definitions.
GNRC TCP API.
Includes all essential GNRC network stack base modules.
struct gnrc_netreg_entry gnrc_netreg_entry_t
Entry to the Network protocol registry.
struct gnrc_sock_reg gnrc_sock_reg_t
Forward declaration.
Definition sock_types.h:71
#define GNRC_SOCK_MBOX_SIZE
Size for gnrc_sock_reg_t::mbox_queue.
Definition sock_types.h:64
void(* sock_udp_cb_t)(sock_udp_t *sock, sock_async_flags_t flags, void *arg)
Event callback for sock_udp_t.
Definition types.h:154
sock_async_flags_t
Flag types to signify asynchronous sock events.
Definition types.h:34
void(* sock_ip_cb_t)(sock_ip_t *sock, sock_async_flags_t flags, void *arg)
Event callback for sock_ip_t.
Definition types.h:88
struct _sock_tl_ep sock_udp_ep_t
An end point for a UDP sock object.
Definition udp.h:292
Raw IPv4/IPv6 sock definitions.
Mailbox API.
Definitions to register network protocol PIDs to use with GNRC communication interface.
TCP sock definitions.
UDP sock definitions.
Callback + Context descriptor.
Definition netreg.h:155
sock Network protocol registry info
Definition sock_types.h:87
msg_t mbox_queue[GNRC_SOCK_MBOX_SIZE]
queue for gnrc_sock_reg_t::mbox
Definition sock_types.h:93
gnrc_netreg_entry_t entry
Network protocol registry entry for mbox
Definition sock_types.h:91
mbox_t mbox
Mailboxes target for the sock
Definition sock_types.h:92
Mailbox struct definition.
Definition mbox.h:38
Describes a message object which can be sent between threads.
Definition msg.h:193
Asynchronous context for Asynchronous sock with event API.
Abstract IP end point and end point for a raw IP sock object.
Definition sock.h:174
Raw IP sock type.
Definition sock_types.h:91
uint16_t flags
option flags
Definition sock_types.h:126
gnrc_sock_reg_t reg
netreg info
Definition sock_types.h:123
sock_ip_ep_t local
local end-point
Definition sock_types.h:124
sock_ip_ep_t remote
remote end-point
Definition sock_types.h:125
UDP sock type.
Definition sock_types.h:128
gnrc_sock_reg_t reg
netreg info
Definition sock_types.h:134
sock_udp_ep_t remote
remote end-point
Definition sock_types.h:136
sock_udp_ep_t local
local end-point
Definition sock_types.h:135
uint16_t flags
option flags
Definition sock_types.h:137
Definitions for sock extension for asynchronous access.