Documentation

Documentation

Includes

libcoap.h

#include "libcoap.h"
#include "libcoap.h"

Macros

Marco COAP_EVENT_H_

#define COAP_EVENT_H_


      

Marco COAP_EVENT_DTLS_CLOSED

#define COAP_EVENT_DTLS_CLOSED       0
/**
 * (D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS
 */

Marco COAP_EVENT_DTLS_CONNECTED

#define COAP_EVENT_DTLS_CONNECTED    1DE


      

Marco COAP_EVENT_DTLS_RENEGOTIATE

#define COAP_EVENT_DTLS_RENEGOTIATE  1DF


      

Marco COAP_EVENT_DTLS_ERROR

#define COAP_EVENT_DTLS_ERROR        512


      

Marco COAP_EVENT_TCP_CONNECTED

#define COAP_EVENT_TCP_CONNECTED     4097
/**
 * TCP events for COAP_PROTO_TCP and COAP_PROTO_TLS
 */

Marco COAP_EVENT_TCP_CLOSED

#define COAP_EVENT_TCP_CLOSED        4098


      

Marco COAP_EVENT_TCP_FAILED

#define COAP_EVENT_TCP_FAILED        4099


      

Marco COAP_EVENT_SESSION_CONNECTED

#define COAP_EVENT_SESSION_CONNECTED 8193
/**
 * CSM exchange events for reliable protocols only
 */

Marco COAP_EVENT_SESSION_CLOSED

#define COAP_EVENT_SESSION_CLOSED    8194


      

Marco COAP_EVENT_SESSION_FAILED

#define COAP_EVENT_SESSION_FAILED    8195

      

Functions

Func coap_register_event_handler

void coap_register_event_handler(struct coap_context_t *context,
                           coap_event_handler_t hnd);
/**
 * Registers the function @p hnd as callback for events from the given
 * CoAP context @p context. Any event handler that has previously been
 * registered with @p context will be overwritten by this operation.
 *
 * @param context The CoAP context to register the event handler with.
 * @param hnd     The event handler to be registered.  @c NULL if to be
 *                de-registered.
 */

Vars

Variable coap_context_t

struct coap_context_t;


      

Variable coap_session_t

struct coap_session_t;


      

Variable COAP_DEPRECATED

COAP_DEPRECATED
void coap_set_event_handler(struct coap_context_t *context,
                           coap_event_handler_t hnd);
/**
 * Registers the function @p hnd as callback for events from the given
 * CoAP context @p context. Any event handler that has previously been
 * registered with @p context will be overwritten by this operation.
 *
 * @deprecated Use coap_register_event_handler() instead.
 *
 * @param context The CoAP context to register the event handler with.
 * @param hnd     The event handler to be registered.
 */

Variable COAP_DEPRECATED

COAP_DEPRECATED
void coap_clear_event_handler(struct coap_context_t *context);
/**
 * Clears the event handler registered with @p context.
 *
 * @deprecated Use coap_register_event_handler() instead with NULL for hnd.
 *
 * @param context The CoAP context whose event handler is to be removed.
 */

Consts

Types

Typedefs

Typedef coap_event_t

typedef unsigned int coap_event_t;
/**
 * Scalar type to represent different events, e.g. DTLS events or
 * retransmission timeouts.
 */

Typedef coap_event_handler_t

typedef int (*coap_event_handler_t)(struct coap_context_t *,
                                   coap_event_t event,
                                   struct coap_session_t *session);
/**
 * Type for event handler functions that can be registered with a CoAP
 * context using the unction coap_set_event_handler(). When called by
 * the library, the first argument will be the coap_context_t object
 * where the handler function has been registered. The second argument
 * is the event type that may be complemented by event-specific data
 * passed as the third argument.
 */