libcoap 4.3.1rc1
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 * Copyright (C) 2021-2022 Jon Shallow <supjps-libcoap@jpshallow.com>
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * This file is part of the CoAP library libcoap. Please see README for terms
10 * of use.
11 */
12
18#ifndef COAP_EVENT_H_
19#define COAP_EVENT_H_
20
21#include "libcoap.h"
22
34typedef enum coap_event_t {
42
49
56
61
75
84
87
95typedef int (*coap_event_handler_t)(coap_session_t *session,
96 const coap_event_t event);
97
109
125
135
136#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:30
COAP_DEPRECATED void coap_clear_event_handler(coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:36
coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:34
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:95
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:24
@ COAP_EVENT_SESSION_CONNECTED
CSM exchange events for reliable protocols only.
Definition: coap_event.h:53
@ COAP_EVENT_DTLS_CLOSED
(D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS
Definition: coap_event.h:38
@ COAP_EVENT_TCP_FAILED
Definition: coap_event.h:48
@ COAP_EVENT_DTLS_CONNECTED
Definition: coap_event.h:39
@ COAP_EVENT_SESSION_FAILED
Definition: coap_event.h:55
@ COAP_EVENT_PARTIAL_BLOCK
(Q-)Block receive errors
Definition: coap_event.h:60
@ COAP_EVENT_SERVER_SESSION_NEW
Called in the CoAP IO loop if a new server-side session is created due to an incoming connection.
Definition: coap_event.h:74
@ COAP_EVENT_SESSION_CLOSED
Definition: coap_event.h:54
@ COAP_EVENT_SERVER_SESSION_DEL
Called in the CoAP IO loop if a server session is deleted (e.g., due to inactivity or because the max...
Definition: coap_event.h:83
@ COAP_EVENT_DTLS_RENEGOTIATE
Definition: coap_event.h:40
@ COAP_EVENT_TCP_CLOSED
Definition: coap_event.h:47
@ COAP_EVENT_TCP_CONNECTED
TCP events for COAP_PROTO_TCP and COAP_PROTO_TLS.
Definition: coap_event.h:46
@ COAP_EVENT_DTLS_ERROR
Definition: coap_event.h:41
Platform specific header file for CoAP stack.
#define COAP_DEPRECATED
Definition: libcoap.h:53
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...