libcoap 4.3.5-develop-ea01661
Loading...
Searching...
No Matches
coap_io_internal.h
Go to the documentation of this file.
1/*
2 * coap_io.h -- Default network I/O functions for libcoap
3 *
4 * Copyright (C) 2012-2025 Olaf Bergmann <bergmann@tzi.org>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_IO_INTERNAL_H_
18#define COAP_IO_INTERNAL_H_
19
20#include "coap_internal.h"
22#include <sys/types.h>
23
24#include "coap_address.h"
25
26#ifdef WITH_CONTIKI
27struct uip_udp_conn;
28#endif /* WITH_CONTIKI */
29
30#ifdef RIOT_VERSION
31#include "net/gnrc.h"
32#include "net/sock/udp.h"
33#if ! COAP_DISABLE_TCP
34#include "net/sock/tcp.h"
35#endif /* ! COAP_DISABLE_TCP */
36#endif /* RIOT_VERSION */
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
43#if defined(WITH_LWIP)
44 struct pbuf *p;
45 struct udp_pcb *udp_pcb;
46#if ! COAP_DISABLE_TCP
47 struct tcp_pcb *tcp_pcb;
48#endif /* ! COAP_DISABLE_TCP */
49
50#elif defined(WITH_CONTIKI)
51 struct uip_udp_conn *udp_conn;
52 coap_context_t *context;
53
54#elif defined(RIOT_VERSION)
55 sock_udp_t udp;
56#if ! COAP_DISABLE_TCP
57 sock_tcp_t tcp;
58#endif /* ! COAP_DISABLE_TCP */
60#else
62#endif /* ! WITH_LWIP && !WITH_CONTIKI && ! RIOT_VERSION */
65#if COAP_SERVER_SUPPORT
68#endif /* COAP_SERVER_SUPPORT */
69#if COAP_CLIENT_SUPPORT
71#endif /* COAP_CLIENT_SUPPORT */
73};
74
78#define COAP_SOCKET_EMPTY 0x0000
79#define COAP_SOCKET_NOT_EMPTY 0x0001
80#define COAP_SOCKET_BOUND 0x0002
81#define COAP_SOCKET_CONNECTED 0x0004
82#define COAP_SOCKET_WANT_READ 0x0010
83#define COAP_SOCKET_WANT_WRITE 0x0020
84#define COAP_SOCKET_WANT_ACCEPT 0x0040
85#define COAP_SOCKET_WANT_CONNECT 0x0080
86#define COAP_SOCKET_CAN_READ 0x0100
87#define COAP_SOCKET_CAN_WRITE 0x0200
88#define COAP_SOCKET_CAN_ACCEPT 0x0400
89#define COAP_SOCKET_CAN_CONNECT 0x0800
90#define COAP_SOCKET_MULTICAST 0x1000
91#define COAP_SOCKET_SLAVE 0x2000
93#if COAP_SERVER_SUPPORT
96#endif /* COAP_SERVER_SUPPORT */
97
98const char *coap_socket_format_errno(int error);
99
109void coap_epoll_ctl_add(coap_socket_t *sock, uint32_t events, const char *func);
110
120void coap_epoll_ctl_mod(coap_socket_t *sock, uint32_t events, const char *func);
121
130
131#ifndef coap_mcast_interface
132# define coap_mcast_interface(Local) 0
133#endif
134
140 unsigned char **address,
141 size_t *length);
142
143#ifdef WITH_LWIP
144void coap_io_process_timeout(void *arg);
145void coap_io_lwip_init(void);
146void coap_io_lwip_cleanup(void);
147#endif
148
155
156#ifdef WITH_CONTIKI
157void coap_start_io_process(void);
158void coap_stop_io_process(void);
159#endif /* WITH_CONTIKI */
160
161#ifdef __cplusplus
162}
163#endif
164
165#endif /* COAP_IO_INTERNAL_H_ */
Representation of network addresses.
Pulls together all the internal only header files.
uint16_t coap_socket_flags_t
Definition coap_io.h:57
int coap_fd_t
Definition coap_io.h:51
void coap_epoll_ctl_add(coap_socket_t *sock, uint32_t events, const char *func)
Epoll specific function to add the state of events that epoll is to track for the appropriate file de...
const char * coap_socket_format_errno(int error)
Definition coap_io.c:2353
void coap_packet_get_memmapped(coap_packet_t *packet, unsigned char **address, size_t *length)
Given a packet, set msg and msg_len to an address and length of the packet's data in memory.
Definition coap_io.c:1057
void coap_update_io_timer(coap_context_t *context, coap_tick_t delay)
Update when to continue with I/O processing, unless packets come in in the meantime.
Definition coap_io.c:533
coap_endpoint_t * coap_malloc_endpoint(void)
void coap_epoll_ctl_mod(coap_socket_t *sock, uint32_t events, const char *func)
Epoll specific function to modify the state of events that epoll is tracking on the appropriate file ...
void coap_mfree_endpoint(coap_endpoint_t *ep)
Internal layer I/O functions.
@ COAP_LAYER_LAST
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition coap_time.h:152
Multi-purpose address abstraction.
The CoAP stack's global state is stored in a coap_context_t object.
Abstraction of virtual endpoint that can be attached to coap_context_t.
size_t length
length of payload
coap_addr_tuple_t addr_info
local and remote addresses
unsigned char * payload
payload
int ifindex
the interface index
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_layer_func_t lfunc[COAP_LAYER_LAST]
Layer functions to use.
coap_session_t * session
Used to determine session owner.
coap_endpoint_t * endpoint
Used by the epoll logic for a listening endpoint.
coap_address_t mcast_addr
remote address and port (multicast track)
coap_socket_flags_t flags
1 or more of COAP_SOCKET* flag values