Documentation
Includes
assert.h
#include <assert.h>
sys/types.h
#include <sys/types.h>
address.h
#include "address.h"
Macros
Marco COAP_IO_H_
#define COAP_IO_H_
Marco COAP_RXBUFFER_SIZE
#define COAP_RXBUFFER_SIZE 1472
Marco COAP_SOCKET_EMPTY
#define COAP_SOCKET_EMPTY 0 /**< the socket is not used */
Marco COAP_SOCKET_NOT_EMPTY
#define COAP_SOCKET_NOT_EMPTY 1 /**< the socket is not empty */
Marco COAP_SOCKET_BOUND
#define COAP_SOCKET_BOUND 2 /**< the socket is bound */
Marco COAP_SOCKET_CONNECTED
#define COAP_SOCKET_CONNECTED 4 /**< the socket is connected */
Marco COAP_SOCKET_WANT_READ
#define COAP_SOCKET_WANT_READ 16 /**< non blocking socket is waiting for reading */
Marco COAP_SOCKET_WANT_WRITE
#define COAP_SOCKET_WANT_WRITE 32 /**< non blocking socket is waiting for writing */
Marco COAP_SOCKET_WANT_ACCEPT
#define COAP_SOCKET_WANT_ACCEPT 64 /**< non blocking server socket is waiting for accept */
Marco COAP_SOCKET_WANT_CONNECT
#define COAP_SOCKET_WANT_CONNECT 128 /**< non blocking client socket is waiting for connect */
Marco COAP_SOCKET_CAN_READ
#define COAP_SOCKET_CAN_READ 256 /**< non blocking socket can now read without blocking */
Marco COAP_SOCKET_CAN_WRITE
#define COAP_SOCKET_CAN_WRITE 512 /**< non blocking socket can now write without blocking */
Marco COAP_SOCKET_CAN_ACCEPT
#define COAP_SOCKET_CAN_ACCEPT 1024 /**< non blocking server socket can now accept without blocking */
Marco COAP_SOCKET_CAN_CONNECT
#define COAP_SOCKET_CAN_CONNECT 2048 /**< non blocking client socket can now connect without blocking */
Marco COAP_SOCKET_MULTICAST
#define COAP_SOCKET_MULTICAST 4096 /**< socket is used for multicast communication */
Functions
Func coap_mfree_endpoint
void coap_mfree_endpoint( struct coap_endpoint_t *ep );
Func coap_socket_connect_udp
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);
Func coap_socket_bind_udp
int
coap_socket_bind_udp(coap_socket_t *sock,
const coap_address_t *listen_addr,
coap_address_t *bound_addr );
Func coap_socket_connect_tcp1
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);
Func coap_socket_connect_tcp2
int
coap_socket_connect_tcp2(coap_socket_t *sock,
coap_address_t *local_addr,
coap_address_t *remote_addr);
Func coap_socket_bind_tcp
int
coap_socket_bind_tcp(coap_socket_t *sock,
const coap_address_t *listen_addr,
coap_address_t *bound_addr);
Func coap_socket_accept_tcp
int
coap_socket_accept_tcp(coap_socket_t *server,
coap_socket_t *new_client,
coap_address_t *local_addr,
coap_address_t *remote_addr);
Func coap_socket_close
void coap_socket_close(coap_socket_t *sock);
Func coap_socket_send
ssize_t
coap_socket_send( coap_socket_t *sock, struct coap_session_t *session,
const uint8_t *data, size_t data_len );
Func coap_socket_write
ssize_t
coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_len);
Func coap_socket_read
ssize_t
coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len);
Func coap_socket_send_pdu
ssize_t
coap_socket_send_pdu( coap_socket_t *sock, struct coap_session_t *session,
struct coap_pdu_t *pdu );
Func coap_network_send
ssize_t coap_network_send( coap_socket_t *sock, const struct coap_session_t *session, const uint8_t *data, size_t datalen );
Func coap_network_read
ssize_t coap_network_read( coap_socket_t *sock, struct coap_packet_t *packet );
Func coap_packet_get_memmapped
void coap_packet_get_memmapped(struct coap_packet_t *packet,
unsigned char **address,
size_t *length);
Func coap_packet_set_addr
void coap_packet_set_addr( struct coap_packet_t *packet, const coap_address_t *src,
const coap_address_t *dst );
Vars
Variable
struct coap_packet_t;
Variable coap_session_t
struct coap_session_t;
Variable coap_pdu_t
struct coap_pdu_t;
Variable coap_endpoint_t
struct coap_endpoint_t *coap_malloc_endpoint( void );
Variable pbuf
struct pbuf *coap_packet_extract_pbuf(struct coap_packet_t *packet);
Consts
Const
const char *coap_socket_strerror( void );
Types
Typedefs
Typedef SOCKET
typedef SOCKET coap_fd_t;
#define coap_closesocket closesocket
#define COAP_SOCKET_ERROR SOCKET_ERROR
#define COAP_INVALID_SOCKET INVALID_SOCKET
#else
typedef int coap_fd_t;
#define coap_closesocket tuya_hal_net_close
#define COAP_SOCKET_ERROR (-1)
#define COAP_INVALID_SOCKET (-1)
Typedef coap_socket_flags_t
typedef uint16_t coap_socket_flags_t;
Typedef coap_socket_t;
typedef struct coap_socket_t {
#if defined(WITH_LWIP)
struct udp_pcb *pcb;
#elif defined(WITH_CONTIKI)
void *conn;
#else
coap_fd_t fd;
#endif /* WITH_LWIP */
coap_socket_flags_t flags;
} coap_socket_t;
Typedef coap_packet_t
typedef struct coap_packet_t coap_packet_t;
Typedef coap_nack_reason_t;
typedef enum {
COAP_NACK_TOO_MANY_RETRIES,
COAP_NACK_NOT_DELIVERABLE,
COAP_NACK_RST,
COAP_NACK_TLS_FAILED
} coap_nack_reason_t;