coap_event.h
Go to the documentation of this file.
/*
* coap_event.h -- libcoap Event API
*
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* 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"
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
#define COAP_EVENT_PARTIAL_BLOCK 0x3001
typedef int (*coap_event_handler_t)(coap_session_t *session,
const coap_event_t event);
void coap_register_event_handler(coap_context_t *context,
coap_event_handler_t hnd);
COAP_DEPRECATED
void coap_set_event_handler(coap_context_t *context,
coap_event_handler_t hnd);
COAP_DEPRECATED
void coap_clear_event_handler(coap_context_t *context);
#endif /* COAP_EVENT_H */
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.
Definition: coap_event.c:25
coap_clear_event_handler
COAP_DEPRECATED void coap_clear_event_handler(coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:31
coap_event_handler_t
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 unction coap_se...
Definition: coap_event.h:63
coap_event_t
unsigned int coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:27
coap_register_event_handler
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.
Definition: coap_event.c:19
libcoap.h
COAP_DEPRECATED
#define COAP_DEPRECATED
Definition: libcoap.h:48
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition: coap_net_internal.h:45
coap_session_t
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Definition: coap_session_internal.h:48