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