Merge pull request #236 from mrdeep1/dtls_event

openssl.c: Global dtls_event variable causing confusion when events happen
This commit is contained in:
obgm authored and GitHub committed 2018-09-24 16:28:19 +02:00
commit 395815e26d
10 files changed
+130 -47

No files matched your search

+24 -3
View File
@@ -10,11 +10,14 @@
#ifndef _COAP_EVENT_H_
#define _COAP_EVENT_H_
#include "libcoap.h"
struct coap_context_t;
struct coap_session_t;
/**
* @defgroup events Event API
* API functions for event deliver from lower-layer library functions.
* API functions for event delivery from lower-layer library functions.
* @{
*/
@@ -55,8 +58,8 @@ struct coap_context_t;
* passed as the third argument.
*/
typedef int (*coap_event_handler_t)(struct coap_context_t *,
coap_event_t,
void *);
coap_event_t event,
struct coap_session_t *session);
/**
* Registers the function @p hnd as callback for events from the given
@@ -64,16 +67,34 @@ typedef int (*coap_event_handler_t)(struct coap_context_t *,
* registered with @p context will be overwritten by this operation.
*
* @param context The CoAP context to register the event handler with.
* @param hnd The event handler to be registered. @c NULL if to be
* de-registered.
*/
void coap_register_event_handler(struct coap_context_t *context,
coap_event_handler_t hnd);
/**
* Registers the function @p hnd as callback for events from the given
* CoAP context @p context. Any event handler that has previously been
* registered with @p context will be overwritten by this operation.
*
* @deprecated Use coap_register_event_handler() instead.
*
* @param context The CoAP context to register the event handler with.
* @param hnd The event handler to be registered.
*/
COAP_DEPRECATED
void coap_set_event_handler(struct coap_context_t *context,
coap_event_handler_t hnd);
/**
* Clears the event handler registered with @p context.
*
* @deprecated Use coap_register_event_handler() instead with NULL for hnd.
*
* @param context The CoAP context whose event handler is to be removed.
*/
COAP_DEPRECATED
void coap_clear_event_handler(struct coap_context_t *context);
/** @} */
+2 -1
View File
@@ -87,7 +87,8 @@ typedef struct coap_session_t {
unsigned int max_retransmit; /**< maximum re-transmit count (default 4) */
coap_fixed_point_t ack_timeout; /**< timeout waiting for ack (default 2 secs) */
coap_fixed_point_t ack_random_factor; /**< ack random factor backoff (default 1.5) */
unsigned int dtls_timeout_count; /**<dtls setup retry counter */
unsigned int dtls_timeout_count; /**< dtls setup retry counter */
int dtls_event; /**< Tracking any (D)TLS events on this sesison */
} coap_session_t;
/**
+2 -2
View File
@@ -587,13 +587,13 @@ int coap_handle_dgram(coap_context_t *ctx, coap_session_t *session, uint8_t *dat
*
* @param context The CoAP context whose event handler is to be called.
* @param event The event to deliver.
* @param data Any data related to @p event.
* @param session The session related to @p event.
* @return The result from the associated event handler or 0 if none was
* registered.
*/
int coap_handle_event(coap_context_t *context,
coap_event_t event,
void *data);
coap_session_t *session);
/**
* This function removes the element with given @p id from the list given list.
* If @p id was found, @p node is updated to point to the removed element. Note