Go to the documentation of this file.
13 #include <sys/types.h>
17 #ifndef COAP_RXBUFFER_SIZE
18 #define COAP_RXBUFFER_SIZE 1472
26 #ifndef COAP_MAX_EPOLL_EVENTS
27 #define COAP_MAX_EPOLL_EVENTS 10
32 #define coap_closesocket closesocket
33 #define COAP_SOCKET_ERROR SOCKET_ERROR
34 #define COAP_INVALID_SOCKET INVALID_SOCKET
37 #define coap_closesocket close
38 #define COAP_SOCKET_ERROR (-1)
39 #define COAP_INVALID_SOCKET (-1)
55 #if defined(WITH_LWIP)
57 #elif defined(WITH_CONTIKI)
76 #define COAP_SOCKET_EMPTY 0x0000
77 #define COAP_SOCKET_NOT_EMPTY 0x0001
78 #define COAP_SOCKET_BOUND 0x0002
79 #define COAP_SOCKET_CONNECTED 0x0004
80 #define COAP_SOCKET_WANT_READ 0x0010
81 #define COAP_SOCKET_WANT_WRITE 0x0020
82 #define COAP_SOCKET_WANT_ACCEPT 0x0040
83 #define COAP_SOCKET_WANT_CONNECT 0x0080
84 #define COAP_SOCKET_CAN_READ 0x0100
85 #define COAP_SOCKET_CAN_WRITE 0x0200
86 #define COAP_SOCKET_CAN_ACCEPT 0x0400
87 #define COAP_SOCKET_CAN_CONNECT 0x0800
88 #define COAP_SOCKET_MULTICAST 0x1000
90 struct coap_endpoint_t *coap_malloc_endpoint( void );
134 const uint8_t *data,
size_t data_len );
180 #ifndef coap_mcast_interface
181 # define coap_mcast_interface(Local) 0
189 unsigned char **address,
197 struct pbuf *coap_packet_extract_pbuf(
struct coap_packet_t *packet);
200 #if defined(WITH_LWIP)
coap_address_t remote
remote address and port
coap_address_t local
local address and port
uint16_t coap_socket_flags_t
struct coap_session_t * session
#define COAP_RXBUFFER_SIZE
The CoAP stack's global state is stored in a coap_context_t object.
ssize_t coap_network_read(coap_socket_t *sock, struct coap_packet_t *packet)
Function interface for reading data.
@ COAP_NACK_NOT_DELIVERABLE
int coap_socket_connect_udp(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)
struct coap_endpoint_t * endpoint
int coap_socket_bind_udp(coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
coap_socket_t sock
socket object for the interface, if any
structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload mark...
multi-purpose address abstraction
ssize_t coap_socket_send(coap_socket_t *sock, struct coap_session_t *session, const uint8_t *data, size_t data_len)
struct coap_socket_t coap_socket_t
@ COAP_NACK_TOO_MANY_RETRIES
void coap_mfree_endpoint(struct coap_endpoint_t *ep)
void coap_epoll_ctl_mod(coap_socket_t *sock, uint32_t events, const char *func)
Representation of network addresses.
ssize_t coap_network_send(coap_socket_t *sock, const struct coap_session_t *session, const uint8_t *data, size_t datalen)
Function interface for data transmission.
struct coap_addr_tuple_t coap_addr_tuple_t
unsigned char payload[COAP_RXBUFFER_SIZE]
payload
int ifindex
the interface index
void coap_socket_close(coap_socket_t *sock)
int coap_socket_bind_tcp(coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
coap_addr_tuple_t addr_info
local and remote addresses
ssize_t coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len)
int coap_socket_accept_tcp(coap_socket_t *server, coap_socket_t *new_client, coap_address_t *local_addr, coap_address_t *remote_addr)
coap_socket_flags_t flags
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)
void coap_packet_get_memmapped(struct 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.
const char * coap_socket_strerror(void)
int coap_socket_connect_tcp2(coap_socket_t *sock, coap_address_t *local_addr, coap_address_t *remote_addr)
size_t length
length of payload
Abstraction of virtual endpoint that can be attached to coap_context_t.
ssize_t coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_len)