libcoap  4.3.0rc1
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 "coap2/libcoap.h"
14 
25  typedef unsigned int coap_event_t;
26 
30 #define COAP_EVENT_DTLS_CLOSED 0x0000
31 #define COAP_EVENT_DTLS_CONNECTED 0x01DE
32 #define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF
33 #define COAP_EVENT_DTLS_ERROR 0x0200
34 
38 #define COAP_EVENT_TCP_CONNECTED 0x1001
39 #define COAP_EVENT_TCP_CLOSED 0x1002
40 #define COAP_EVENT_TCP_FAILED 0x1003
41 
45 #define COAP_EVENT_SESSION_CONNECTED 0x2001
46 #define COAP_EVENT_SESSION_CLOSED 0x2002
47 #define COAP_EVENT_SESSION_FAILED 0x2003
48 
52 #define COAP_EVENT_PARTIAL_BLOCK 0x3001
53 
62 typedef int (*coap_event_handler_t)(struct coap_context_t *,
63  coap_event_t event,
64  struct coap_session_t *session);
65 
77 
93 
103 
104 #endif /* COAP_EVENT_H */
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
COAP_DEPRECATED void coap_clear_event_handler(struct coap_context_t *context)
Clears the event handler registered with context.
Definition: coap_event.c:29
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:62
unsigned int coap_event_t
Scalar type to represent different events, e.g.
Definition: coap_event.h:25
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
#define COAP_DEPRECATED
Definition: libcoap.h:46
The CoAP stack's global state is stored in a coap_context_t object.
Definition: net.h:150
struct coap_context_t * context
session's context
Definition: coap_session.h:73