coap_event.h
Go to the documentation of this file.
/*
* coap_event.h -- libcoap Event API
*
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_EVENT_H_
#define COAP_EVENT_H_
#include "libcoap.h"
struct coap_context_t;
struct coap_session_t;
typedef unsigned int coap_event_t;
#define COAP_EVENT_DTLS_CLOSED 0x0000
#define COAP_EVENT_DTLS_CONNECTED 0x01DE
#define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF
#define COAP_EVENT_DTLS_ERROR 0x0200
#define COAP_EVENT_TCP_CONNECTED 0x1001
#define COAP_EVENT_TCP_CLOSED 0x1002
#define COAP_EVENT_TCP_FAILED 0x1003
#define COAP_EVENT_SESSION_CONNECTED 0x2001
#define COAP_EVENT_SESSION_CLOSED 0x2002
#define COAP_EVENT_SESSION_FAILED 0x2003
typedef int (*coap_event_handler_t)(struct coap_context_t *,
coap_event_t event,
struct coap_session_t *session);
void coap_register_event_handler(struct coap_context_t *context,
coap_event_handler_t hnd);
COAP_DEPRECATED
void coap_set_event_handler(struct coap_context_t *context,
coap_event_handler_t hnd);
COAP_DEPRECATED
void coap_clear_event_handler(struct coap_context_t *context);
#endif /* COAP_EVENT_H */
coap_set_event_handler
COAP_DEPRECATED void coap_set_event_handler(struct coap_context_t *context, coap_event_handler_t hnd)
Registers the function hnd as callback for events from the given CoAP context context.
Definition: coap_event.c:23
coap_event_handler_t
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_se...
Definition: coap_event.h:60
coap_clear_event_handler
COAP_DEPRECATED void coap_clear_event_handler(struct coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:29
coap_event_t
unsigned int coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:28
coap_register_event_handler
void coap_register_event_handler(struct coap_context_t *context, coap_event_handler_t hnd)
Registers the function hnd as callback for events from the given CoAP context context.
Definition: coap_event.c:17
libcoap.h
COAP_DEPRECATED
#define COAP_DEPRECATED
Definition: libcoap.h:46
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition: net.h:147
coap_session_t
Definition: coap_session.h:59
coap_session_t::context
struct coap_context_t * context
session's context
Definition: coap_session.h:72