libcoap 4.3.5-develop-ea01661
|
Internal API for handling CoAP Datagrams (UDP) (RFC7252) More...
Functions | |
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) |
Create a new UDP socket and 'connect' it to the address tuple. | |
int | coap_socket_bind_udp (coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr) |
Create a new UDP socket and then listen for new incoming UDP sessions to the specified IP address and port. | |
ssize_t | coap_socket_send (coap_socket_t *sock, coap_session_t *session, const uint8_t *data, size_t datalen) |
Function interface for data transmission. | |
ssize_t | coap_socket_recv (coap_socket_t *sock, coap_packet_t *packet) |
Function interface for reading data. | |
void | coap_socket_close (coap_socket_t *sock) |
Function interface to close off a socket (for both TCP and UDP). | |
Internal API for handling CoAP Datagrams (UDP) (RFC7252)
int coap_socket_bind_udp | ( | coap_socket_t * | sock, |
const coap_address_t * | listen_addr, | ||
coap_address_t * | bound_addr | ||
) |
Create a new UDP socket and then listen for new incoming UDP sessions to the specified IP address and port.
Internal function.
sock | Where socket information is to be filled in. |
listen_addr | The address to be listening for new incoming sessions. |
bound_addr | Filled in with the address that the UDP layer. is listening on for new incoming UDP sessions. |
1
if succesful, 0
if failure of some sort 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 | ||
) |
Create a new UDP socket and 'connect' it to the address tuple.
Internal function.
sock | Where socket information is to be filled in. |
local_if | The local address to use or NULL. |
server | The address to connect to. |
default_port | The port to use if not set in server . |
local_addr | Filled in after connection initiation with the local address. |
remote_addr | Filled in after connection initiation with the remote address. |
1
if succesful, 0
if failure of some sort. ssize_t coap_socket_recv | ( | coap_socket_t * | sock, |
coap_packet_t * | packet | ||
) |
Function interface for reading data.
This function returns the number of bytes that have been read, or a value less than zero on error. In case of an error, *packet
is set to NULL.
Internal function.
sock | Socket to read data from. |
packet | Received packet metadata and payload. src and dst should be preset. |
Definition at line 1070 of file coap_io.c.
ssize_t coap_socket_send | ( | coap_socket_t * | sock, |
coap_session_t * | session, | ||
const uint8_t * | data, | ||
size_t | datalen | ||
) |
Function interface for data transmission.
This function returns the number of bytes that have been transmitted, or a value less than zero on error.
Internal function.
sock | Socket to send data over. |
session | Addressing information for unconnected sockets, or NULL |
data | The data to send. |
datalen | The actual length of data . |
Definition at line 869 of file coap_io.c.