libcoap 4.3.2rc2

Typedefs | Enumerations | Functions
coap_event.h File Reference

Event handling. More...

`#include "libcoap.h"`

Go to the source code of this file.

## 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(). More...

## Enumerations
enum | coap_event_t { COAP_EVENT_DTLS_CLOSED = 0x0000 , COAP_EVENT_DTLS_CONNECTED = 0x01DE , COAP_EVENT_DTLS_RENEGOTIATE = 0x01DF , COAP_EVENT_DTLS_ERROR = 0x0200 , COAP_EVENT_TCP_CONNECTED = 0x1001 , COAP_EVENT_TCP_CLOSED = 0x1002 , COAP_EVENT_TCP_FAILED = 0x1003 , COAP_EVENT_SESSION_CONNECTED = 0x2001 , COAP_EVENT_SESSION_CLOSED = 0x2002 , COAP_EVENT_SESSION_FAILED = 0x2003 , COAP_EVENT_PARTIAL_BLOCK = 0x3001 , COAP_EVENT_XMIT_BLOCK_FAIL = 0x3002 , COAP_EVENT_SERVER_SESSION_NEW = 0x4001 , COAP_EVENT_SERVER_SESSION_DEL = 0x4002 , COAP_EVENT_BAD_PACKET = 0x5001 , COAP_EVENT_MSG_RETRANSMITTED = 0x5002 , COAP_EVENT_OSCORE_DECRYPTION_FAILURE = 0x6001 , COAP_EVENT_OSCORE_NOT_ENABLED , COAP_EVENT_OSCORE_NO_PROTECTED_PAYLOAD , COAP_EVENT_OSCORE_NO_SECURITY , COAP_EVENT_OSCORE_INTERNAL_ERROR , COAP_EVENT_OSCORE_DECODE_ERROR , COAP_EVENT_WS_PACKET_SIZE = 0x7001 , COAP_EVENT_WS_CONNECTED , COAP_EVENT_WS_CLOSED , COAP_EVENT_KEEPALIVE_FAILURE = 0x8001 }
| Scalar type to represent different events, e.g. More...

## 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`. More...
COAP_DEPRECATED void | coap_set_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`. More...
COAP_DEPRECATED void | coap_clear_event_handler (coap_context_t *context)
| Clears the event handler registered with `context`. More...

## Detailed Description

Event handling.

Definition in file coap_event.h.

## Function Documentation

## ◆ coap_clear_event_handler()

COAP_DEPRECATED void coap_clear_event_handler | ( | coap_context_t * | context | ) |

Clears the event handler registered with `context`.

Deprecated:
  Use coap_register_event_handler() instead with NULL for handler.

Parameters

  context | The CoAP context whose event handler is to be removed.

Definition at line 36 of file coap_event.c.

## ◆ coap_set_event_handler()

COAP_DEPRECATED void coap_set_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.

Deprecated:
  Use coap_register_event_handler() instead.

Parameters

  context | The CoAP context to register the event handler with.
  hnd | The event handler to be registered.

Definition at line 30 of file coap_event.c.