14 #include <sys/types.h> 18 #ifndef COAP_RXBUFFER_SIZE 19 #define COAP_RXBUFFER_SIZE 1472 24 #define coap_closesocket closesocket 25 #define COAP_SOCKET_ERROR SOCKET_ERROR 26 #define COAP_INVALID_SOCKET INVALID_SOCKET 29 #define coap_closesocket close 30 #define COAP_SOCKET_ERROR (-1) 31 #define COAP_INVALID_SOCKET (-1) 41 #if defined(WITH_LWIP) 43 #elif defined(WITH_CONTIKI) 54 #define COAP_SOCKET_EMPTY 0x0000 55 #define COAP_SOCKET_NOT_EMPTY 0x0001 56 #define COAP_SOCKET_BOUND 0x0002 57 #define COAP_SOCKET_CONNECTED 0x0004 58 #define COAP_SOCKET_WANT_READ 0x0010 59 #define COAP_SOCKET_WANT_WRITE 0x0020 60 #define COAP_SOCKET_WANT_ACCEPT 0x0040 61 #define COAP_SOCKET_WANT_CONNECT 0x0080 62 #define COAP_SOCKET_CAN_READ 0x0100 63 #define COAP_SOCKET_CAN_WRITE 0x0200 64 #define COAP_SOCKET_CAN_ACCEPT 0x0400 65 #define COAP_SOCKET_CAN_CONNECT 0x0800 66 #define COAP_SOCKET_MULTICAST 0x1000 68 struct coap_endpoint_t *coap_malloc_endpoint( void ); 112 const uint8_t *data,
size_t data_len );
155 #ifndef coap_mcast_interface 156 # define coap_mcast_interface(Local) 0 164 unsigned char **address,
175 struct pbuf *coap_packet_extract_pbuf(
struct coap_packet_t *packet);
178 #if defined(WITH_LWIP) #define COAP_RXBUFFER_SIZE
struct coap_socket_t coap_socket_t
void coap_socket_close(coap_socket_t *sock)
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)
int coap_socket_bind_udp(coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
multi-purpose address abstraction
int ifindex
the interface index
Abstraction of virtual endpoint that can be attached to coap_context_t.
int coap_socket_bind_tcp(coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
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)
coap_address_t src
the packet's source address
structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload mark...
int coap_socket_connect_tcp2(coap_socket_t *sock, coap_address_t *local_addr, coap_address_t *remote_addr)
ssize_t coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_len)
ssize_t coap_socket_send(coap_socket_t *sock, struct coap_session_t *session, const uint8_t *data, size_t data_len)
Representation of network addresses.
void coap_mfree_endpoint(struct coap_endpoint_t *ep)
void coap_packet_set_addr(struct coap_packet_t *packet, const coap_address_t *src, const coap_address_t *dst)
uint16_t coap_socket_flags_t
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.
coap_address_t dst
the packet's destination address
size_t length
length of payload
ssize_t coap_network_read(coap_socket_t *sock, struct coap_packet_t *packet)
Function interface for reading data.
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
ssize_t coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len)