libcoap 4.3.5-develop-ea01661
Loading...
Searching...
No Matches
Datagram (UDP) Support

Internal API for handling CoAP Datagrams (UDP) (RFC7252) More...

+ Collaboration diagram for Datagram (UDP) Support:

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).
 

Detailed Description

Internal API for handling CoAP Datagrams (UDP) (RFC7252)

Function Documentation

◆ coap_socket_bind_udp()

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.

Parameters
sockWhere socket information is to be filled in.
listen_addrThe address to be listening for new incoming sessions.
bound_addrFilled in with the address that the UDP layer. is listening on for new incoming UDP sessions.
Returns
1 if succesful, 0 if failure of some sort

◆ coap_socket_close()

void coap_socket_close ( coap_socket_t sock)

Function interface to close off a socket (for both TCP and UDP).

Parameters
sockSocket to close.

Definition at line 395 of file coap_io.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 
)

Create a new UDP socket and 'connect' it to the address tuple.

Internal function.

Parameters
sockWhere socket information is to be filled in.
local_ifThe local address to use or NULL.
serverThe address to connect to.
default_portThe port to use if not set in server.
local_addrFilled in after connection initiation with the local address.
remote_addrFilled in after connection initiation with the remote address.
Returns
1 if succesful, 0 if failure of some sort.

◆ coap_socket_recv()

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.

Parameters
sockSocket to read data from.
packetReceived packet metadata and payload. src and dst should be preset.
Returns
The number of bytes received on success, or a value less than zero on error.

Definition at line 1070 of file coap_io.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coap_socket_send()

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.

Parameters
sockSocket to send data over.
sessionAddressing information for unconnected sockets, or NULL
dataThe data to send.
datalenThe actual length of data.
Returns
The number of bytes written on success, or a value less than zero on error.

Definition at line 869 of file coap_io.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: