libcoap
4.3.0
|
API functions for Application Input / Output. More...
Macros | |
#define | COAP_IO_WAIT 0 |
#define | COAP_IO_NO_WAIT ((uint32_t)-1) |
Functions | |
int | coap_io_process (coap_context_t *ctx, uint32_t timeout_ms) |
The main I/O processing function. More... | |
int | coap_io_process_with_fds (coap_context_t *ctx, uint32_t timeout_ms, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds) |
The main message processing loop with additional fds for internal select. More... | |
API functions for Application Input / Output.
int coap_io_process | ( | coap_context_t * | ctx, |
uint32_t | timeout_ms | ||
) |
The main I/O processing function.
All pending network I/O is completed, and then optionally waits for the next input packet.
This internally calls coap_io_prepare_io(), then select() for the appropriate sockets, updates COAP_SOCKET_CAN_xxx where appropriate and then calls coap_io_do_io() before returning with the time spent in the function.
Alternatively, if libcoap is compiled with epoll support, this internally calls coap_io_prepare_epoll(), then epoll_wait() for waiting for any file descriptors that have (internally) been set up with epoll_ctl() and finally coap_io_do_epoll() before returning with the time spent in the function.
ctx | The CoAP context |
timeout_ms | Minimum number of milliseconds to wait for new packets before returning after doing any processing. If COAP_IO_WAIT, the call will block until the next internal action (e.g. packet retransmit) if any, or block until the next packet is received whichever is the sooner and do the necessary processing. If COAP_IO_NO_WAIT, the function will return immediately after processing without waiting for any new input packets to arrive. |
-1
if there was an error Definition at line 1261 of file coap_io.c.
int coap_io_process_with_fds | ( | coap_context_t * | ctx, |
uint32_t | timeout_ms, | ||
int | nfds, | ||
fd_set * | readfds, | ||
fd_set * | writefds, | ||
fd_set * | exceptfds | ||
) |
The main message processing loop with additional fds for internal select.
ctx | The CoAP context |
timeout_ms | Minimum number of milliseconds to wait for new packets before returning after doing any processing. If COAP_IO_WAIT, the call will block until the next internal action (e.g. packet retransmit) if any, or block until the next packet is received whichever is the sooner and do the necessary processing. If COAP_IO_NO_WAIT, the function will return immediately after processing without waiting for any new input packets to arrive. |
nfds | The maximum FD set in readfds, writefds or exceptfds plus one, |
readfds | Read FDs to additionally check for in internal select() or NULL if not required. |
writefds | Write FDs to additionally check for in internal select() or NULL if not required. |
exceptfds | Except FDs to additionally check for in internal select() or NULL if not required. |
-1
if there was an error. If defined, readfds, writefds, exceptfds are updated as returned by the internal select() call. Definition at line 1266 of file coap_io.c.