libcoap 4.3.5-develop-ea01661
Loading...
Searching...
No Matches
Stream (TCP) Support

Internal API for handling CoAP TCP (RFC8323) More...

+ Collaboration diagram for Stream (TCP) Support:

Functions

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)
 Create a new TCP socket and initiate the connection.
 
int coap_socket_connect_tcp2 (coap_socket_t *sock, coap_address_t *local_addr, coap_address_t *remote_addr)
 Complete the TCP Connection.
 
int coap_socket_bind_tcp (coap_socket_t *sock, const coap_address_t *listen_addr, coap_address_t *bound_addr)
 Create a new TCP socket and then listen for new incoming TCP sessions.
 
int coap_socket_accept_tcp (coap_socket_t *server, coap_socket_t *new_client, coap_address_t *local_addr, coap_address_t *remote_addr, void *extra)
 Accept a new incoming TCP session.
 
ssize_t coap_socket_write (coap_socket_t *sock, const uint8_t *data, size_t data_len)
 Function interface for data stream sending off a socket.
 
ssize_t coap_socket_read (coap_socket_t *sock, uint8_t *data, size_t data_len)
 Function interface for data stream receiving off a socket.
 

Detailed Description

Internal API for handling CoAP TCP (RFC8323)

Function Documentation

◆ 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,
void *  extra 
)

Accept a new incoming TCP session.

Internal function.

Parameters
serverThe socket information to use to accept the TCP connection.
new_clientFilled in socket information with the new incoming session information.
local_addrFilled in with the local address.
remote_addrFilled in with the remote address.
extraAvailable for use by any underlying network stack.
Returns
1 if succesful, 0 if failure of some sort.

Definition at line 322 of file coap_tcp.c.

+ Here is the call graph for this function:

◆ coap_socket_bind_tcp()

int coap_socket_bind_tcp ( coap_socket_t sock,
const coap_address_t listen_addr,
coap_address_t bound_addr 
)

Create a new TCP socket and then listen for new incoming TCP sessions.

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 TCP layer is listening on for new incoming TCP sessions.
Returns
1 if succesful, 0 if failure of some sort.

Definition at line 231 of file coap_tcp.c.

+ Here is the call graph for this function:

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

Create a new TCP socket and initiate the connection.

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.

Definition at line 65 of file coap_tcp.c.

+ Here is the call graph for this function:

◆ coap_socket_connect_tcp2()

int coap_socket_connect_tcp2 ( coap_socket_t sock,
coap_address_t local_addr,
coap_address_t remote_addr 
)

Complete the TCP Connection.

Internal function.

Parameters
sockThe socket information to use.
local_addrFilled in with the final local address.
remote_addrFilled in with the final remote address.
Returns
1 if succesful, 0 if failure of some sort.

Definition at line 192 of file coap_tcp.c.

+ Here is the call graph for this function:

◆ coap_socket_read()

ssize_t coap_socket_read ( coap_socket_t sock,
uint8_t *  data,
size_t  data_len 
)

Function interface for data stream receiving off a socket.

Parameters
sockSocket to receive data on.
dataThe data to receive.
data_lenThe maximum length of data.
Returns
>=0 Number of bytes read. -1 Error error in errno.

Definition at line 713 of file coap_io.c.

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

◆ coap_socket_write()

ssize_t coap_socket_write ( coap_socket_t sock,
const uint8_t *  data,
size_t  data_len 
)

Function interface for data stream sending off a socket.

Parameters
sockSocket to send data over.
dataThe data to send.
data_lenThe length of data.
Returns
>=0 Number of bytes sent. -1 Error error in errno.

Definition at line 654 of file coap_io.c.

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