libcoap  4.2.1
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  * This file is part of the CoAP library libcoap. Please see README for terms
7  * of use.
8  */
9 
10 #ifndef COAP_EVENT_H_
11 #define COAP_EVENT_H_
12 
13 #include "libcoap.h"
14 
15 struct coap_context_t;
16 struct coap_session_t;
17 
28  typedef unsigned int coap_event_t;
29 
33 #define COAP_EVENT_DTLS_CLOSED 0x0000
34 #define COAP_EVENT_DTLS_CONNECTED 0x01DE
35 #define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF
36 #define COAP_EVENT_DTLS_ERROR 0x0200
37 
41 #define COAP_EVENT_TCP_CONNECTED 0x1001
42 #define COAP_EVENT_TCP_CLOSED 0x1002
43 #define COAP_EVENT_TCP_FAILED 0x1003
44 
48 #define COAP_EVENT_SESSION_CONNECTED 0x2001
49 #define COAP_EVENT_SESSION_CLOSED 0x2002
50 #define COAP_EVENT_SESSION_FAILED 0x2003
51 
60 typedef int (*coap_event_handler_t)(struct coap_context_t *,
61  coap_event_t event,
62  struct coap_session_t *session);
63 
75 
89 
99 
102 #endif /* COAP_EVENT_H */
struct coap_context_t * context
session&#39;s context
Definition: coap_session.h:72
COAP_DEPRECATED 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:23
#define COAP_DEPRECATED
Definition: libcoap.h:46
COAP_DEPRECATED void coap_clear_event_handler(struct coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:29
unsigned int coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:28
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:17
The CoAP stack&#39;s global state is stored in a coap_context_t object.
Definition: net.h:147