mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-09 10:32:53 +03:00
If epoll is available, use it within libcoap to speed things up, as well as present to applications a file descriptor that can be used in a select() or returned as an event in a epoll_wait() call. Whenever coap_new_context() is called. set up a new epoll infrastructure with epoll_create() and destroy it with coap_free_context(). For each new endpoint or session, add the socket fd to epoll. When the socket is closed, remove the socket fd from epoll. Whenever a socket wants a write, the appropriate epoll event gets EPOLLOUT added and when the write happens reset the event back to just EPOLLIN. As there may be a packet retry event sometime in the future, a timerfd is created and added to the epoll structure (done in coap_new_context) which gets freed off in coap_free_context. If coap_run_once() determines that there is a future retry, timerfd is informed of when the event is to occur. When timerfd times out, the application file descriptor will indicate a read is available. A new function coap_context_get_coap_fd(ctx) returns the application file descriptor. The only other API change is that if wait_ms is set to 1 for coap_run_once(ctx, wait_ms), there is no waiting for a new packet to arrive. coap_run_once() is called, whether epoll support is available or not, to process all the underlying required i/o. If there is no epoll support, coap_run_once() continues to use the old select() method, otherwise it will use epoll_wait(). If there is epoll support, a modified version of coap_read() (coap_io_do_events()) is used instead. Makefile.am: Do not expose coap_epoll_ctl_mod() and coap_io_do_events() to applications. configure.ac: Test for the presence of sys/epoll.h and sys/timerfd.h and if so setup COAP_EPOLL_SUPPORT to be used for #ifdef testing. Include new man page coap_io.txt. examples/coap-server.c: Include support for using this new exposed file descriptor. include/coap2/coap_io.h: Define COAP_MAX_EPOLL_EVENTS (to limit the number of events processed at once) and include coap_endpoint_t and coap_session_t in coap_socket_t. Include (internal) definition for coap_epoll_ctl_mod() include/coap2/net.h: Add epfd and eptimerfd to coap_context_t. Define coap_context_get_coap_fd() for applications to use. Include (internal) definition for coap_io_do_events(). Define COAP_RUN_BLOCK and COAP_RUN_NONBLOCK. libcoap-2.map: libcoap-2.sym: Include coap_context_get_coap_fd. configure.ac: man/Makefile.am: man/coap.txt.in: man/coap_io.txt.in: (New) Include the new coap_in(3) man page that documents coap_run_once() and coap_context_get_coap_fd(). src/coap_io.c: src/coap_openssl.c: src/coap_session.c: src/net.c: Add in the epoll support. src/net.c: Add in coap_context_get_coap_fd() function.
This README documents the test cases supported for the 1st ETSI CoAP plugtest on March 24/25 in Paris, France. <http://www.etsi.org/plugtests/coap/coap.htm> Legend: [+] full support [o] partial support [-] no support [?] needs check [ ] has open issues Mandatory Tests [+] TD_COAP_CORE_01 Perform GET transaction (CON mode) [+] TD_COAP_CORE_02 Perform POST transaction (CON mode) [+] TD_COAP_CORE_03 Perform PUT transaction (CON mode) [+] TD_COAP_CORE_04 Perform DELETE transaction (CON mode) [+] TD_COAP_CORE_05 Perform GET transaction (NON mode) [+] TD_COAP_CORE_06 Perform POST transaction (NON mode) [+] TD_COAP_CORE_07 Perform PUT transaction (NON mode) [+] TD_COAP_CORE_08 Perform DELETE transaction (NON mode) [+] TD_COAP_CORE_09 Perform GET transaction with delayed response (CON mode, no piggyback) [+] TD_COAP_CORE_10 Handle request containing Token option [+] TD_COAP_CORE_11 Handle request not containing Token option [+] TD_COAP_CORE_12 Handle request containing several Uri-Path options [+] TD_COAP_CORE_13 Handle request containing several Uri-Query options [?] TD_COAP_CORE_14 Interoperate in lossy context (CON mode, piggybacked response) [?] TD_COAP_CORE_15 Interoperate in lossy context (CON mode, delayed response) Optional Tests [ ] TD_COAP_LINK_01 Access to well-known interface for resource discovery [-] TD_COAP_LINK_02 Use filtered requests for limiting discovery results [+] TD_COAP_BLOCK_01 Handle GET blockwise transfer for large resource (early negotiation) [+] TD_COAP_BLOCK_02 Handle GET blockwise transfer for large resource (late negotiation) [-] TD_COAP_BLOCK_03 Handle PUT blockwise transfer for large resource [-] TD_COAP_BLOCK_04 Handle POST blockwise transfer for large resource [-] TD_COAP_OBS_01 Handle resource observation [-] TD_COAP_OBS_02 Stop resource observation [-] TD_COAP_OBS_03 Client detection of deregistration (Max-Age) [-] TD_COAP_OBS_04 Server detection of deregistration (client OFF) [-] TD_COAP_OBS_05 Server detection of deregistration (explicit RST)