libcoap 4.3.5-develop-490e4e0
Loading...
Searching...
No Matches
coap_strm_contiki.c
Go to the documentation of this file.
1/* coap_strm_contiki.c -- TCP Network I/O functions for libcoap on Contiki-NG
2 *
3 * Copyright (C) 2012,2014,2024-2025 Olaf Bergmann <bergmann@tzi.org>
4 * 2014 chrysn <chrysn@fsfe.org>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see
9 * README for terms of use.
10 */
11
18
19#if defined(WITH_CONTIKI)
20
21#include "contiki-net.h"
22
23int
25 return 0;
26}
27
28#if ! COAP_DISABLE_TCP
29
30#if COAP_CLIENT_SUPPORT
31int
33 const coap_address_t *local_if,
34 const coap_address_t *server,
35 int default_port,
36 coap_address_t *local_addr,
37 coap_address_t *remote_addr) {
38 (void)sock;
39 (void)local_if;
40 (void)server;
41 (void)default_port;
42 (void)local_addr;
43 (void)remote_addr;
44
45 return -1;
46}
47
48int
50 coap_address_t *local_addr,
51 coap_address_t *remote_addr) {
52 (void)sock;
53 (void)local_addr;
54 (void)remote_addr;
55
56 return -1;
57}
58#endif /* COAP_CLIENT_SUPPORT */
59
60#if COAP_SERVER_SUPPORT
61
62int
64 const coap_address_t *listen_addr,
65 coap_address_t *bound_addr) {
66 (void)sock;
67 (void)listen_addr;
68 (void)bound_addr;
69
70 return -1;
71}
72
73int
75 coap_socket_t *new_client,
76 coap_address_t *local_addr,
77 coap_address_t *remote_addr,
78 void *extra) {
79 (void)server;
80 (void)new_client;
81 (void)local_addr;
82 (void)remote_addr;
83 (void)extra;
84
85 return -1;
86}
87#endif /* COAP_SERVER_SUPPORT */
88
89ssize_t
90coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_len) {
91 (void)sock;
92 (void)data;
93 (void)data_len;
94 return -1;
95}
96
97ssize_t
98coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len) {
99 (void)sock;
100 (void)data;
101 (void)data_len;
102 return -1;
103}
104
105void
107 (void)sock;
108}
109
110#endif /* ! COAP_DISABLE_TCP */
111
112#else /* ! WITH_CONTIKI */
113
114#ifdef __clang__
115/* Make compilers happy that do not like empty modules. As this function is
116 * never used, we ignore -Wunused-function at the end of compiling this file
117 */
118#pragma GCC diagnostic ignored "-Wunused-function"
119#endif
120static inline void
121dummy(void) {
122}
123
124#endif /* ! WITH_CONTIKI */
Library specific build wrapper for coap_internal.h.
static void dummy(void)
int coap_socket_bind_tcp(coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
Create a new TCP socket and then listen for new incoming TCP sessions.
ssize_t coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len)
Function interface for data stream receiving off a socket.
ssize_t coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_len)
Function interface for data stream sending off a socket.
int coap_socket_connect_tcp1(coap_socket_t *sock, const coap_address_t *local_if, const coap_address_t *server, int default_port, coap_address_t *local_addr, coap_address_t *remote_addr)
Create a new TCP socket and initiate the connection.
int coap_socket_accept_tcp(coap_socket_t *server, coap_socket_t *new_client, coap_address_t *local_addr, coap_address_t *remote_addr, void *extra)
Accept a new incoming TCP session.
void coap_socket_strm_close(coap_socket_t *sock)
Function interface to close off a stream socket.
int coap_socket_connect_tcp2(coap_socket_t *sock, coap_address_t *local_addr, coap_address_t *remote_addr)
Complete the TCP Connection.
int coap_tcp_is_supported(void)
Check whether TCP is available.
Multi-purpose address abstraction.