coap_event.c
Go to the documentation of this file.
/*
* coap_event.c -- 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.
*/
#include "coap3/coap_internal.h"
/*
* This replaces coap_set_event_handler() so that handler registration is
* consistent in the naming.
*/
void
coap_register_event_handler(coap_context_t *context,
coap_event_handler_t hnd) {
context->handle_event = hnd;
}
void
coap_set_event_handler(coap_context_t *context,
coap_event_handler_t hnd) {
context->handle_event = hnd;
}
void
coap_clear_event_handler(coap_context_t *context) {
context->handle_event = NULL;
}
coap_clear_event_handler
void coap_clear_event_handler(coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:31
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:25
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 unction coap_se...
Definition: coap_event.h:63
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
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition: coap_net_internal.h:45
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:93