Skip to content

Commit

Permalink
gcoap: Added support for the module GDTLS
Browse files Browse the repository at this point in the history
  • Loading branch information
rfuentess committed Jun 13, 2017
1 parent aa58148 commit e9ed85b
Show file tree
Hide file tree
Showing 2 changed files with 546 additions and 11 deletions.
44 changes: 41 additions & 3 deletions sys/include/net/gcoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,32 @@
#include "nanocoap.h"
#include "xtimer.h"

#ifdef MODULE_GNRC_DTLS
# include "net/dtls/gdtls.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Size for module message queue
*/
#define GCOAP_MSG_QUEUE_SIZE (4)
#ifndef MODULE_GNRC_DTLS
#define GCOAP_MSG_QUEUE_SIZE (4)
#else
#define GCOAP_MSG_QUEUE_SIZE DTLS_READER_QUEUE_SIZE
#endif

/**
* @brief Server port; use RFC 7252 default if not defined
*/
#ifndef GCOAP_PORT
#define GCOAP_PORT (5683)
#ifndef MODULE_GNRC_DTLS
#define GCOAP_PORT (5683)
#else
#define GCOAP_PORT DTLS_DEFAULT_PORT
#endif
#endif

/**
Expand Down Expand Up @@ -304,7 +316,11 @@ extern "C" {
*
* Set to 0 to disable timeout.
*/
#define GCOAP_NON_TIMEOUT (5000000U)
#ifndef MODULE_GNRC_DTLS
#define GCOAP_NON_TIMEOUT (5000000U)
#else
#define GCOAP_NON_TIMEOUT (5000000U) * 2
#endif

/**
* @brief Identifies waiting timed out for a response to a sent message
Expand Down Expand Up @@ -386,6 +402,16 @@ extern "C" {
#define GCOAP_OBS_INIT_UNUSED (-2)
/** @} */

/** @brief Stack size for module thread */
#ifndef GCOAP_STACK_SIZE
#define GCOAP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
#endif

#ifdef MODULE_GNRC_DTLS
#undef GCOAP_STACK_SIZE
#define GCOAP_STACK_SIZE DTLS_STACKSIZE
#endif

/**
* @brief Stack size for module thread
*/
Expand Down Expand Up @@ -628,6 +654,18 @@ size_t gcoap_obs_send(const uint8_t *buf, size_t len,
*/
uint8_t gcoap_op_state(void);

#ifdef MODULE_GNRC_DTLS
/**
* @brief A fast command to close the DTLS session(s)
*
* This will terminate any client DTLS session.
*
* @return < 0 on error
*/
int8_t gcoap_end_dtls_session(void);

#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit e9ed85b

Please sign in to comment.