libcoap 4.3.2
|
API for Application Input / Output checking. 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... | |
int | coap_io_pending (coap_context_t *context) |
Check to see if there is any i/o pending for the context . More... | |
API for Application Input / Output checking.
#define COAP_IO_NO_WAIT ((uint32_t)-1) |
Definition at line 572 of file coap_net.h.
#define COAP_IO_WAIT 0 |
Definition at line 571 of file coap_net.h.
int coap_io_pending | ( | coap_context_t * | context | ) |
Check to see if there is any i/o pending for the context
.
This includes Observe active (client) and partial large block transfers.
coap_io_process() is called internally to try to send outstanding data as well as process any packets just received.
context | The CoAP context. |
1
I/O still pending, 0
no I/O pending. Definition at line 1708 of file coap_io.c.
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 1524 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 1529 of file coap_io.c.