libcoap  4.3.0
coap_io.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-2013 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 
12 #ifndef COAP_IO_H_
13 #define COAP_IO_H_
14 
15 #include <sys/types.h>
16 
17 #include "address.h"
18 
19 #ifdef RIOT_VERSION
20 #include "net/gnrc.h"
21 #endif /* RIOT_VERSION */
22 
23 #ifndef COAP_RXBUFFER_SIZE
24 #define COAP_RXBUFFER_SIZE 1472
25 #endif /* COAP_RXBUFFER_SIZE */
26 
27 /*
28  * It may may make sense to define this larger on busy systems
29  * (lots of sessions, large number of which are active), by using
30  * -DCOAP_MAX_EPOLL_EVENTS=nn at compile time.
31  */
32 #ifndef COAP_MAX_EPOLL_EVENTS
33 #define COAP_MAX_EPOLL_EVENTS 10
34 #endif /* COAP_MAX_EPOLL_EVENTS */
35 
36 #ifdef _WIN32
37 typedef SOCKET coap_fd_t;
38 #define coap_closesocket closesocket
39 #define COAP_SOCKET_ERROR SOCKET_ERROR
40 #define COAP_INVALID_SOCKET INVALID_SOCKET
41 #else
42 typedef int coap_fd_t;
43 #define coap_closesocket close
44 #define COAP_SOCKET_ERROR (-1)
45 #define COAP_INVALID_SOCKET (-1)
46 #endif
47 
48 typedef uint16_t coap_socket_flags_t;
49 
50 typedef struct coap_addr_tuple_t {
54 
55 const char *coap_socket_strerror( void );
56 
62 int coap_tcp_is_supported(void);
63 
64 typedef enum {
71 
72 #endif /* COAP_IO_H_ */
Representation of network addresses.
uint16_t coap_socket_flags_t
Definition: coap_io.h:48
int coap_tcp_is_supported(void)
Check whether TCP is available.
Definition: coap_tcp.c:33
coap_nack_reason_t
Definition: coap_io.h:64
@ COAP_NACK_NOT_DELIVERABLE
Definition: coap_io.h:66
@ COAP_NACK_TOO_MANY_RETRIES
Definition: coap_io.h:65
@ COAP_NACK_TLS_FAILED
Definition: coap_io.h:68
@ COAP_NACK_ICMP_ISSUE
Definition: coap_io.h:69
@ COAP_NACK_RST
Definition: coap_io.h:67
struct coap_addr_tuple_t coap_addr_tuple_t
int coap_fd_t
Definition: coap_io.h:42
const char * coap_socket_strerror(void)
Definition: coap_io.c:1502
coap_address_t remote
remote address and port
Definition: coap_io.h:51
coap_address_t local
local address and port
Definition: coap_io.h:52
multi-purpose address abstraction
Definition: address.h:96