libcoap 4.3.4
Application I/O Handling

Internal API for Application Input / Output checking. More...

+ Collaboration diagram for Application I/O Handling:

Functions

unsigned int coap_io_prepare_io (coap_context_t *ctx, coap_socket_t *sockets[], unsigned int max_sockets, unsigned int *num_sockets, coap_tick_t now)
 Iterates through all the coap_socket_t structures embedded in endpoints or sessions associated with the ctx to determine which are wanting any read, write, accept or connect I/O (COAP_SOCKET_WANT_xxx is set). More...
 
void coap_io_do_io (coap_context_t *ctx, coap_tick_t now)
 Processes any outstanding read, write, accept or connect I/O as indicated in the coap_socket_t structures (COAP_SOCKET_CAN_xxx set) embedded in endpoints or sessions associated with ctx. More...
 
unsigned int coap_io_prepare_epoll (coap_context_t *ctx, coap_tick_t now)
 Any now timed out delayed packet is transmitted, along with any packets associated with requested observable response. More...
 
void coap_io_do_epoll (coap_context_t *ctx, struct epoll_event *events, size_t nevents)
 Process all the epoll events. More...
 

Detailed Description

Internal API for Application Input / Output checking.

Function Documentation

◆ coap_io_do_epoll()

void coap_io_do_epoll ( coap_context_t ctx,
struct epoll_event *  events,
size_t  nevents 
)

Process all the epoll events.

Note: If epoll support is compiled into libcoap, coap_io_do_epoll() must be used instead of coap_io_do_io().

Internal function

Parameters
ctxThe current CoAP context.
eventsThe list of events returned from an epoll_wait() call.
neventsThe number of events.

Definition at line 2096 of file coap_net.c.

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

◆ coap_io_do_io()

void coap_io_do_io ( coap_context_t ctx,
coap_tick_t  now 
)

Processes any outstanding read, write, accept or connect I/O as indicated in the coap_socket_t structures (COAP_SOCKET_CAN_xxx set) embedded in endpoints or sessions associated with ctx.

Note: If epoll support is compiled into libcoap, coap_io_do_epoll() must be used instead of coap_io_do_io().

Internal function.

Parameters
ctxThe CoAP context
nowCurrent time

Definition at line 2039 of file coap_net.c.

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

◆ coap_io_prepare_epoll()

unsigned int coap_io_prepare_epoll ( coap_context_t ctx,
coap_tick_t  now 
)

Any now timed out delayed packet is transmitted, along with any packets associated with requested observable response.

In addition, it returns when the next expected I/O is expected to take place (e.g. a packet retransmit).

Note: If epoll support is compiled into libcoap, coap_io_prepare_epoll() must be used instead of coap_io_prepare_io().

Internal function.

Parameters
ctxThe CoAP context
nowCurrent time.
Returns
timeout Maxmimum number of milliseconds that can be used by a epoll_wait() to wait for network events or 0 if wait should be forever.

Definition at line 1220 of file coap_io.c.

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

◆ coap_io_prepare_io()

unsigned int coap_io_prepare_io ( coap_context_t ctx,
coap_socket_t sockets[],
unsigned int  max_sockets,
unsigned int *  num_sockets,
coap_tick_t  now 
)

Iterates through all the coap_socket_t structures embedded in endpoints or sessions associated with the ctx to determine which are wanting any read, write, accept or connect I/O (COAP_SOCKET_WANT_xxx is set).

If set, the coap_socket_t is added to the sockets.

Any now timed out delayed packet is transmitted, along with any packets associated with requested observable response.

In addition, it returns when the next expected I/O is expected to take place (e.g. a packet retransmit).

Prior to calling coap_io_do_io(), the sockets must be tested to see if any of the COAP_SOCKET_WANT_xxx have the appropriate information and if so, COAP_SOCKET_CAN_xxx is set. This typically will be done after using a select() call.

Note: If epoll support is compiled into libcoap, coap_io_prepare_epoll() must be used instead of coap_io_prepare_io().

Internal function.

Parameters
ctxThe CoAP context
socketsArray of socket descriptors, filled on output
max_socketsSize of socket array.
num_socketsPointer to the number of valid entries in the socket arrays on output.
nowCurrent time.
Returns
timeout Maxmimum number of milliseconds that can be used by a select() to wait for network events or 0 if wait should be forever.

Definition at line 1270 of file coap_io.c.

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