libcoap 4.3.0
coap_event.h
Go to the documentation of this file.
1/*
2 * coap_event.h -- libcoap Event API
3 *
4 * Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
12#ifndef COAP_EVENT_H_
13#define COAP_EVENT_H_
14
15#include "libcoap.h"
16
27 typedef unsigned int coap_event_t;
28
32#define COAP_EVENT_DTLS_CLOSED 0x0000
33#define COAP_EVENT_DTLS_CONNECTED 0x01DE
34#define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF
35#define COAP_EVENT_DTLS_ERROR 0x0200
36
40#define COAP_EVENT_TCP_CONNECTED 0x1001
41#define COAP_EVENT_TCP_CLOSED 0x1002
42#define COAP_EVENT_TCP_FAILED 0x1003
43
47#define COAP_EVENT_SESSION_CONNECTED 0x2001
48#define COAP_EVENT_SESSION_CLOSED 0x2002
49#define COAP_EVENT_SESSION_FAILED 0x2003
50
54#define COAP_EVENT_PARTIAL_BLOCK 0x3001
55
63typedef int (*coap_event_handler_t)(coap_session_t *session,
64 const coap_event_t event);
65
77
93
103
104#endif /* COAP_EVENT_H */
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_DEPRECATED void coap_clear_event_handler(coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:31
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
unsigned int coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:27
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
#define COAP_DEPRECATED
Definition: libcoap.h:48
The CoAP stack's global state is stored in a coap_context_t object.
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...