libcoap  4.2.0
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  * This file is part of the CoAP library libcoap. Please see README for terms
7  * of use.
8  */
9 
10 #include "coap_event.h"
11 #include "net.h"
12 
13 /*
14  * This replaces coap_set_event_handler() so that handler registration is
15  * consistent in the naming.
16  */
17 void
20  context->handle_event = hnd;
21 }
22 
23 void
26  context->handle_event = hnd;
27 }
28 
29 void
31  context->handle_event = NULL;
32 }
void coap_set_event_handler(struct 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
void coap_clear_event_handler(struct coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:30
coap_event_handler_t handle_event
Callback function that is used to signal events to the application.
Definition: net.h:197
int(* coap_event_handler_t)(struct coap_context_t *, coap_event_t event, struct coap_session_t *session)
Type for event handler functions that can be registered with a CoAP context using the unction coap_se...
Definition: coap_event.h:60
void coap_register_event_handler(struct 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:18
The CoAP stack&#39;s global state is stored in a coap_context_t object.
Definition: net.h:148