libcoap 4.3.2rc2

coap_event.c
Go to the documentation of this file.
1/*
2 * coap_event.c -- 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
17#include "coap3/coap_internal.h"
18
19/*
20 * This replaces coap_set_event_handler() so that handler registration is
21 * consistent in the naming.
22 */
23 void
24 coap_register_event_handler(coap_context_t *context,
25 coap_event_handler_t hnd) {
26 context->handle_event = hnd;
27}
28
29 void
30 coap_set_event_handler(coap_context_t *context,
31 coap_event_handler_t hnd) {
32 context->handle_event = hnd;
33}
34
35 void
36 coap_clear_event_handler(coap_context_t *context) {
37 context->handle_event = NULL;
38}
coap_clear_event_handler
void coap_clear_event_handler(coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:36
coap_set_event_handler
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_internal.h
Pulls together all the internal only header files.
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 function coap_s...
Definition: coap_event.h:142
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:24
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition: coap_net_internal.h:49
coap_context_t::handle_event
coap_event_handler_t handle_event
Callback function that is used to signal events to the application.
Definition: coap_net_internal.h:138