mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 17:52:54 +03:00
coap_read(), coap_write() and coap_run_once() are confusing in their names and do not really describe what they do. For example, coap_read() does both reading and writing, coap_write() may do some writing, but primarily is used to determine what should be monitored and for how long to wait in the following select() or epoll_wait() calls. coap_run_once() implies that the code is only to be run once - again confusing. By renaming coap_read() to coap_io_do_io(), this better describes what this function does. By renaming coap_write() to coap_io_prepare_io() this better describes what this function does. By renaming coap_run_once() to coap_io_process(), this better describes what this function does. By renaming coap_io_do_events() to coap_io_do_epoll(), this better describes what this function does and is associated with. A wrapper function coap_io_prepare_epoll() has been created, using coap_io_prepare_io() with some preset values to simplify function usage. include/coap2/net.h: Update with the new function names, and deprecate the old functions. Also document the fact that coap_io_prepare_io(), coap_io_do_io(), coap_io_prepare_epoll(), and coap_io_do_epoll() are really internal functions. Create app_io module for Doxygen. libcoap-2.map: libcoap-2.sym: Expose the new functions to applications. examples/client.c: examples/coap-rd.c: examples/coap-server.c: examples/contiki/coap-observer.c: examples/contiki/server.c: examples/etsi_iot_01.c: man/coap_io.txt.in: man/coap_observe.txt.in: src/coap_io.c: src/coap_io_lwip.c: src/net.c: src/pdu.c: Update using the new function names. Setting the etimer has been moved out of coap_io_process() into coap_io_do_epoll(), making the logic easier for applications to use coap_io_do_epoll() should they need to. This also gets rid of a potential timing window where a pending etimer event gets missed. coap_io_do_epoll() now calls coap_io_prepare_epoll() if the etimer has triggered removing the need for applications using coap_io_do_epoll() to set up their own loops if etimer is triggered.