|
libcoap 4.3.5-develop-3a2cdb1
|
API for event delivery from lower-layer library functions. More...
Typedefs | |
| typedef int(* | coap_event_handler_t) (coap_session_t *session, const coap_event_t event) |
| Type for event handler functions that can be registered with a CoAP context using the function coap_set_event_handler(). | |
Functions | |
| void | coap_register_event_handler (coap_context_t *context, coap_event_handler_t hnd) |
Registers the function hnd as callback for events from the given CoAP context context. | |
API for event delivery from lower-layer library functions.
| typedef int(* coap_event_handler_t) (coap_session_t *session, const coap_event_t event) |
Type for event handler functions that can be registered with a CoAP context using the function coap_set_event_handler().
| session | The current CoAP session. |
| event | The event type that has occurred. |
0 No further action required by libcoap 1 Depending from where called, libcoap may take further action (reserved for future use) Definition at line 175 of file coap_event.h.
| enum coap_event_t |
Scalar type to represent different events, e.g.
DTLS events or retransmission timeouts.
| Enumerator | |
|---|---|
| COAP_EVENT_DTLS_CLOSED | Triggerrd when (D)TLS session closed. |
| COAP_EVENT_DTLS_CONNECTED | Triggered when (D)TLS session connected. |
| COAP_EVENT_DTLS_RENEGOTIATE | Triggered when (D)TLS session renegotiated. |
| COAP_EVENT_DTLS_ERROR | Triggered when (D)TLS error occurs. |
| COAP_EVENT_TCP_CONNECTED | Triggered when TCP layer connects. |
| COAP_EVENT_TCP_CLOSED | Triggered when TCP layer is closed. |
| COAP_EVENT_TCP_FAILED | Triggered when TCP layer fails for some reason. |
| COAP_EVENT_SESSION_CONNECTED | Triggered when TCP layer completes exchange of CSM information. |
| COAP_EVENT_SESSION_CLOSED | Triggered when TCP layer closes following exchange of CSM information. |
| COAP_EVENT_SESSION_FAILED | Triggered when TCP layer fails following exchange of CSM information. |
| COAP_EVENT_PARTIAL_BLOCK | Triggered when not all of a large body has been received. |
| COAP_EVENT_XMIT_BLOCK_FAIL | Triggered when not all of a large body has been transmitted. |
| COAP_EVENT_BLOCK_ISSUE | Triggered when a block transfer could not be handled. |
| COAP_EVENT_SERVER_SESSION_NEW | Called in the CoAP IO loop if a new server-side session is created due to an incoming connection. Note that the session might not be a fully established connection yet, it might also refer to, e.g., a DTLS session in a handshake stage. |
| COAP_EVENT_SERVER_SESSION_DEL | Called in the CoAP IO loop if a server session is deleted (e.g., due to inactivity or because the maximum number of idle sessions was exceeded). The session will still contain valid data when the event handler is called. |
| COAP_EVENT_SERVER_SESSION_CONNECTED | Called in the CoAP IO loop once a server session is active and (D)TLS (if any) is established. |
| COAP_EVENT_BAD_PACKET | Triggered when badly formatted packet received. |
| COAP_EVENT_MSG_RETRANSMITTED | Triggered when a message is retransmitted. |
| COAP_EVENT_FIRST_PDU_FAIL | Triggered when the initial app PDU cannot be transmitted. |
| COAP_EVENT_OSCORE_DECRYPTION_FAILURE | Triggered when there is an OSCORE decryption failure. |
| COAP_EVENT_OSCORE_NOT_ENABLED | Triggered when trying to use OSCORE to decrypt, but it is not enabled. |
| COAP_EVENT_OSCORE_NO_PROTECTED_PAYLOAD | Triggered when there is no OSCORE encrypted payload provided. |
| COAP_EVENT_OSCORE_NO_SECURITY | Triggered when there is no OSCORE security definition found. |
| COAP_EVENT_OSCORE_INTERNAL_ERROR | Triggered when there is an OSCORE internal error i.e malloc failed. |
| COAP_EVENT_OSCORE_DECODE_ERROR | Triggered when there is an OSCORE decode of OSCORE option failure. |
| COAP_EVENT_OSCORE_RECIPIENT_CHANGED | Triggered when coap_oscore_session_set_recipient_ctx() replaces the recipient context bound to a session (not on first attach). The session still references the previous recipient when the handler runs. |
| COAP_EVENT_WS_PACKET_SIZE | Triggered when there is an oversize WebSockets packet. |
| COAP_EVENT_WS_CONNECTED | Triggered when the WebSockets layer is up. |
| COAP_EVENT_WS_CLOSED | Triggered when the WebSockets layer is closed. |
| COAP_EVENT_KEEPALIVE_FAILURE | Triggered when no response to a keep alive (ping) packet. |
| COAP_EVENT_RECONNECT_FAILED | Triggered when a session failed, and a reconnect is going to be attempted. |
| COAP_EVENT_RECONNECT_SUCCESS | Triggered when a session failed, and a reconnect is successful. |
| COAP_EVENT_RECONNECT_NO_MORE | Triggered when a session failed, and retry reconnect attempts failed. |
| COAP_EVENT_RECONNECT_STARTED | Triggered when a session starts to reconnect. |
Definition at line 36 of file coap_event.h.
| void coap_register_event_handler | ( | coap_context_t * | context, |
| coap_event_handler_t | hnd ) |
Registers the function hnd as callback for events from the given CoAP context context.
Any event handler that has previously been registered with context will be overwritten by this operation.
| context | The CoAP context to register the event handler with. |
| hnd | The event handler to be registered. NULL if to be de-registered. |
Definition at line 24 of file coap_event.c.