coap_tinydtls.c
Go to the documentation of this file.
/*
* coap_tinydtls.c -- Datagram Transport Layer Support for libcoap with tinydtls
*
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#include "coap_internal.h"
#ifdef HAVE_LIBTINYDTLS
/* We want TinyDTLS versions of these, not libcoap versions */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_URL
#undef PACKAGE_VERSION
#include <tinydtls.h>
#include <dtls.h>
#include <dtls_debug.h>
static dtls_tick_t dtls_tick_0 = 0;
static coap_tick_t coap_tick_0 = 0;
int
coap_dtls_is_supported(void) {
return 1;
}
void coap_dtls_startup(void) {
dtls_init();
dtls_ticks(&dtls_tick_0);
coap_ticks(&coap_tick_0);
}
void
coap_dtls_set_log_level(int level) {
dtls_set_log_level(level);
}
int
coap_dtls_get_log_level(void) {
return dtls_get_log_level();
}
static void get_session_addr(const session_t *s, coap_address_t *a) {
#ifdef WITH_CONTIKI
a->addr = s->addr;
a->port = s->port;
#else
if (s->addr.sa.sa_family == AF_INET6) {
a->size = (socklen_t)sizeof(a->addr.sin6);
a->addr.sin6 = s->addr.sin6;
} else if (s->addr.sa.sa_family == AF_INET) {
a->size = (socklen_t)sizeof(a->addr.sin);
a->addr.sin = s->addr.sin;
} else {
a->size = (socklen_t)s->size;
a->addr.sa = s->addr.sa;
}
#endif
}
static void put_session_addr(const coap_address_t *a, session_t *s) {
#ifdef WITH_CONTIKI
s->size = (unsigned char)sizeof(s->addr);
s->addr = a->addr;
s->port = a->port;
#else
if (a->addr.sa.sa_family == AF_INET6) {
s->size = (socklen_t)sizeof(s->addr.sin6);
s->addr.sin6 = a->addr.sin6;
} else if (a->addr.sa.sa_family == AF_INET) {
s->size = (socklen_t)sizeof(s->addr.sin);
s->addr.sin = a->addr.sin;
} else {
s->size = (socklen_t)a->size;
s->addr.sa = a->addr.sa;
}
#endif
}
static int
dtls_send_to_peer(struct dtls_context_t *dtls_context,
session_t *dtls_session, uint8 *data, size_t len) {
coap_context_t *coap_context = (coap_context_t *)dtls_get_app_data(dtls_context);
coap_session_t *coap_session;
coap_address_t remote_addr;
get_session_addr(dtls_session, &remote_addr);
coap_session = coap_session_get_by_peer(coap_context, &remote_addr, dtls_session->ifindex);
if (!coap_session) {
coap_log(LOG_WARNING, "dtls_send_to_peer: cannot find local interface\n");
return -3;
}
return (int)coap_session_send(coap_session, data, len);
}
static int
dtls_application_data(struct dtls_context_t *dtls_context,
session_t *dtls_session, uint8 *data, size_t len) {
coap_context_t *coap_context = (coap_context_t *)dtls_get_app_data(dtls_context);
coap_session_t *coap_session;
coap_address_t remote_addr;
get_session_addr(dtls_session, &remote_addr);
coap_session = coap_session_get_by_peer(coap_context, &remote_addr, dtls_session->ifindex);
if (!coap_session) {
coap_log(LOG_DEBUG,
"dropped message that was received on invalid interface\n");
return -1;
}
return coap_handle_dgram(coap_context, coap_session, data, len);
}
static int coap_event_dtls = 0;
static int
dtls_event(struct dtls_context_t *dtls_context,
session_t *dtls_session,
dtls_alert_level_t level,
uint16_t code) {
(void)dtls_context;
(void)dtls_session;
if (level == DTLS_ALERT_LEVEL_FATAL)
coap_event_dtls = COAP_EVENT_DTLS_ERROR;
/* handle DTLS events */
switch (code) {
case DTLS_ALERT_CLOSE_NOTIFY:
{
coap_event_dtls = COAP_EVENT_DTLS_CLOSED;
break;
}
case DTLS_EVENT_CONNECTED:
{
coap_event_dtls = COAP_EVENT_DTLS_CONNECTED;
break;
}
case DTLS_EVENT_RENEGOTIATE:
{
coap_event_dtls = COAP_EVENT_DTLS_RENEGOTIATE;
break;
}
default:
;
}
return 0;
}
/* This function is the "key store" for tinyDTLS. It is called to
* retrieve a key for the given identity within this particular
* session. */
static int
get_psk_info(struct dtls_context_t *dtls_context,
const session_t *dtls_session,
dtls_credentials_type_t type,
const uint8_t *id, size_t id_len,
unsigned char *result, size_t result_length) {
coap_context_t *coap_context;
coap_session_t *coap_session;
int fatal_error = DTLS_ALERT_INTERNAL_ERROR;
size_t identity_length;
static int client = 0;
static uint8_t psk[128];
static size_t psk_len = 0;
coap_address_t remote_addr;
if (type == DTLS_PSK_KEY && client) {
if (psk_len > result_length) {
coap_log(LOG_WARNING, "cannot set psk -- buffer too small\n");
goto error;
}
memcpy(result, psk, psk_len);
client = 0;
return (int)psk_len;
}
client = 0;
coap_context = (coap_context_t *)dtls_get_app_data(dtls_context);
get_session_addr(dtls_session, &remote_addr);
coap_session = coap_session_get_by_peer(coap_context, &remote_addr, dtls_session->ifindex);
if (!coap_session) {
coap_log(LOG_DEBUG, "cannot get PSK, session not found\n");
goto error;
}
switch (type) {
case DTLS_PSK_IDENTITY:
if (id_len)
coap_log(LOG_DEBUG, "got psk_identity_hint: '%.*s'\n", (int)id_len, id);
if (!coap_context || !coap_context->get_client_psk)
goto error;
identity_length = 0;
psk_len = coap_context->get_client_psk(coap_session, (const uint8_t*)id, id_len, (uint8_t*)result, &identity_length, result_length, psk, sizeof(psk));
if (!psk_len) {
coap_log(LOG_WARNING, "no PSK identity for given realm\n");
fatal_error = DTLS_ALERT_CLOSE_NOTIFY;
goto error;
}
client = 1;
return (int)identity_length;
case DTLS_PSK_KEY:
if (coap_context->get_server_psk)
return (int)coap_context->get_server_psk(coap_session, (const uint8_t*)id, id_len, (uint8_t*)result, result_length);
return 0;
break;
case DTLS_PSK_HINT:
client = 0;
if (coap_context->get_server_hint)
return (int)coap_context->get_server_hint(coap_session, (uint8_t *)result, result_length);
return 0;
default:
coap_log(LOG_WARNING, "unsupported request type: %d\n", type);
}
error:
client = 0;
return dtls_alert_fatal_create(fatal_error);
}
static dtls_handler_t cb = {
.write = dtls_send_to_peer,
.read = dtls_application_data,
.event = dtls_event,
.get_psk_info = get_psk_info,
#ifdef WITH_ECC
.get_ecdsa_key = NULL,
.verify_ecdsa_key = NULL
#endif
};
void *
coap_dtls_new_context(struct coap_context_t *coap_context) {
struct dtls_context_t *dtls_context = dtls_new_context(coap_context);
if (!dtls_context)
goto error;
dtls_set_handler(dtls_context, &cb);
return dtls_context;
error:
coap_dtls_free_context(dtls_context);
return NULL;
}
void
coap_dtls_free_context(void *handle) {
if (handle) {
struct dtls_context_t *dtls_context = (struct dtls_context_t *)handle;
dtls_free_context(dtls_context);
}
}
static session_t *
coap_dtls_new_session(coap_session_t *session) {
session_t *dtls_session = coap_malloc_type(COAP_DTLS_SESSION, sizeof(session_t));
if (dtls_session) {
/* create tinydtls session object from remote address and local
* endpoint handle */
dtls_session_init(dtls_session);
put_session_addr(&session->addr_info.remote, dtls_session);
dtls_session->ifindex = session->ifindex;
coap_log(LOG_DEBUG, "***new session %p\n", (void *)dtls_session);
}
return dtls_session;
}
void *coap_dtls_new_server_session(coap_session_t *session) {
return coap_dtls_new_session(session);
}
void *coap_dtls_new_client_session(coap_session_t *session) {
dtls_peer_t *peer;
session_t *dtls_session = coap_dtls_new_session(session);
if (!dtls_session)
return NULL;
peer =
dtls_get_peer((struct dtls_context_t *)session->context->dtls_context,
dtls_session);
if (!peer) {
/* The peer connection does not yet exist. */
/* dtls_connect() returns a value greater than zero if a new
* connection attempt is made, 0 for session reuse. */
if (dtls_connect((struct dtls_context_t *)session->context->dtls_context,
dtls_session) >= 0) {
peer =
dtls_get_peer((struct dtls_context_t *)session->context->dtls_context,
dtls_session);
}
}
if (!peer) {
/* delete existing session because the peer object has been invalidated */
coap_free_type(COAP_DTLS_SESSION, dtls_session);
dtls_session = NULL;
}
return dtls_session;
}
void
coap_dtls_session_update_mtu(coap_session_t *session) {
(void)session;
}
void
coap_dtls_free_session(coap_session_t *coap_session) {
struct dtls_context_t *ctx;
if (coap_session->context == NULL)
return;
ctx = (struct dtls_context_t *)coap_session->context->dtls_context;
if (coap_session->tls && ctx) {
dtls_peer_t *peer = dtls_get_peer(ctx, (session_t *)coap_session->tls);
if ( peer )
dtls_reset_peer(ctx, peer);
else
dtls_close(ctx, (session_t *)coap_session->tls);
coap_log(LOG_DEBUG, "***removed session %p\n", coap_session->tls);
coap_free_type(COAP_DTLS_SESSION, coap_session->tls);
coap_session->tls = NULL;
coap_handle_event(coap_session->context, COAP_EVENT_DTLS_CLOSED, coap_session);
}
}
int
coap_dtls_send(coap_session_t *session,
const uint8_t *data,
size_t data_len
) {
int res;
uint8_t *data_rw;
coap_log(LOG_DEBUG, "call dtls_write\n");
coap_event_dtls = -1;
/* Need to do this to not get a compiler warning about const parameters */
memcpy (&data_rw, &data, sizeof(data_rw));
res = dtls_write((struct dtls_context_t *)session->context->dtls_context,
(session_t *)session->tls, data_rw, data_len);
if (res < 0)
coap_log(LOG_WARNING, "coap_dtls_send: cannot send PDU\n");
if (coap_event_dtls >= 0) {
/* COAP_EVENT_DTLS_CLOSED event reported in coap_session_disconnected() */
if (coap_event_dtls != COAP_EVENT_DTLS_CLOSED)
coap_handle_event(session->context, coap_event_dtls, session);
if (coap_event_dtls == COAP_EVENT_DTLS_CONNECTED)
coap_session_connected(session);
else if (coap_event_dtls == COAP_EVENT_DTLS_CLOSED || coap_event_dtls == COAP_EVENT_DTLS_ERROR)
coap_session_disconnected(session, COAP_NACK_TLS_FAILED);
}
return res;
}
int coap_dtls_is_context_timeout(void) {
return 1;
}
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context) {
clock_time_t next = 0;
dtls_check_retransmit((struct dtls_context_t *)dtls_context, &next);
if (next > 0)
return ((coap_tick_t)(next - dtls_tick_0)) * COAP_TICKS_PER_SECOND / DTLS_TICKS_PER_SECOND + coap_tick_0;
return 0;
}
coap_tick_t coap_dtls_get_timeout(coap_session_t *session, coap_tick_t now) {
(void)session;
(void)now;
return 0;
}
void coap_dtls_handle_timeout(coap_session_t *session) {
(void)session;
return;
}
int
coap_dtls_receive(coap_session_t *session,
const uint8_t *data,
size_t data_len
) {
session_t *dtls_session = (session_t *)session->tls;
int err;
uint8_t *data_rw;
coap_event_dtls = -1;
/* Need to do this to not get a compiler warning about const parameters */
memcpy (&data_rw, &data, sizeof(data_rw));
err = dtls_handle_message(
(struct dtls_context_t *)session->context->dtls_context,
dtls_session, data_rw, (int)data_len);
if (err){
coap_event_dtls = COAP_EVENT_DTLS_ERROR;
}
if (coap_event_dtls >= 0) {
/* COAP_EVENT_DTLS_CLOSED event reported in coap_session_disconnected() */
if (coap_event_dtls != COAP_EVENT_DTLS_CLOSED)
coap_handle_event(session->context, coap_event_dtls, session);
if (coap_event_dtls == COAP_EVENT_DTLS_CONNECTED)
coap_session_connected(session);
else if (coap_event_dtls == COAP_EVENT_DTLS_CLOSED || coap_event_dtls == COAP_EVENT_DTLS_ERROR)
coap_session_disconnected(session, COAP_NACK_TLS_FAILED);
}
return err;
}
int
coap_dtls_hello(coap_session_t *session,
const uint8_t *data,
size_t data_len
) {
session_t dtls_session;
struct dtls_context_t *dtls_context =
(struct dtls_context_t *)session->context->dtls_context;
uint8_t *data_rw;
dtls_session_init(&dtls_session);
put_session_addr(&session->addr_info.remote, &dtls_session);
dtls_session.ifindex = session->ifindex;
/* Need to do this to not get a compiler warning about const parameters */
memcpy (&data_rw, &data, sizeof(data_rw));
int res = dtls_handle_message(dtls_context, &dtls_session,
data_rw, (int)data_len);
if (res >= 0) {
if (dtls_get_peer(dtls_context, &dtls_session))
res = 1;
else
res = 0;
}
return res;
}
unsigned int coap_dtls_get_overhead(coap_session_t *session) {
(void)session;
return 13 + 8 + 8;
}
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else /* __GNUC__ */
#define UNUSED
#endif /* __GNUC__ */
int coap_tls_is_supported(void) {
return 0;
}
coap_tls_version_t *
coap_get_tls_library_version(void) {
static coap_tls_version_t version;
const char *vers = dtls_package_version();
version.version = 0;
if (vers) {
long int p1, p2 = 0, p3 = 0;
char* endptr;
p1 = strtol(vers, &endptr, 10);
if (*endptr == '.') {
p2 = strtol(endptr+1, &endptr, 10);
if (*endptr == '.') {
p3 = strtol(endptr+1, &endptr, 10);
}
}
version.version = (p1 << 16) | (p2 << 8) | p3;
}
version.built_version = version.version;
version.type = COAP_TLS_LIBRARY_TINYDTLS;
return &version;
}
int
coap_dtls_context_set_pki(coap_context_t *ctx UNUSED,
coap_dtls_pki_t* setup_data UNUSED,
coap_dtls_role_t role UNUSED
) {
return 0;
}
int
coap_dtls_context_set_pki_root_cas(struct coap_context_t *ctx UNUSED,
const char *ca_file UNUSED,
const char *ca_path UNUSED
) {
return 0;
}
int
coap_dtls_context_set_psk(coap_context_t *ctx UNUSED,
const char *hint UNUSED,
coap_dtls_role_t role UNUSED
) {
return 1;
}
int
coap_dtls_context_check_keys_enabled(coap_context_t *ctx UNUSED)
{
return 1;
}
void *coap_tls_new_client_session(coap_session_t *session UNUSED, int *connected UNUSED) {
return NULL;
}
void *coap_tls_new_server_session(coap_session_t *session UNUSED, int *connected UNUSED) {
return NULL;
}
void coap_tls_free_session(coap_session_t *coap_session UNUSED) {
}
ssize_t coap_tls_write(coap_session_t *session UNUSED,
const uint8_t *data UNUSED,
size_t data_len UNUSED
) {
return -1;
}
ssize_t coap_tls_read(coap_session_t *session UNUSED,
uint8_t *data UNUSED,
size_t data_len UNUSED
) {
return -1;
}
#undef UNUSED
#else /* !HAVE_LIBTINYDTLS */
#ifdef __clang__
/* Make compilers happy that do not like empty modules. As this function is
* never used, we ignore -Wunused-function at the end of compiling this file
*/
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
static inline void dummy(void) {
}
#endif /* HAVE_LIBTINYDTLS */
coap_dtls_set_log_level
void coap_dtls_set_log_level(int level)
Sets the (D)TLS logging level to the specified level.
Definition: coap_notls.c:74
coap_dtls_hello
int coap_dtls_hello(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:139
coap_addr_tuple_t::remote
coap_address_t remote
remote address and port
Definition: coap_io.h:50
coap_session_t
Definition: coap_session.h:59
COAP_TLS_LIBRARY_TINYDTLS
Using TinyDTLS library.
Definition: coap_dtls.h:42
coap_tls_free_session
void coap_tls_free_session(coap_session_t *coap_session UNUSED)
Definition: coap_notls.c:158
coap_session_t::context
struct coap_context_t * context
session&#39;s context
Definition: coap_session.h:72
coap_address_t::sin6
struct sockaddr_in6 sin6
Definition: address.h:67
coap_address_t::sin
struct sockaddr_in sin
Definition: address.h:66
coap_session_t::tls
void * tls
security parameters
Definition: coap_session.h:73
coap_dtls_receive
int coap_dtls_receive(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:131
coap_address_t
multi-purpose address abstraction
Definition: address.h:62
coap_dtls_context_check_keys_enabled
int coap_dtls_context_check_keys_enabled(coap_context_t *ctx UNUSED)
Definition: coap_notls.c:63
COAP_EVENT_DTLS_RENEGOTIATE
#define COAP_EVENT_DTLS_RENEGOTIATE
Definition: coap_event.h:35
coap_tls_read
ssize_t coap_tls_read(coap_session_t *session UNUSED, uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:168
coap_dtls_get_log_level
int coap_dtls_get_log_level(void)
Get the current (D)TLS logging.
Definition: coap_notls.c:79
coap_dtls_new_client_session
void * coap_dtls_new_client_session(coap_session_t *session UNUSED)
Definition: coap_notls.c:96
coap_dtls_is_supported
int coap_dtls_is_supported(void)
Check whether DTLS is available.
Definition: coap_notls.c:21
coap_dtls_free_context
void coap_dtls_free_context(void *handle UNUSED)
Definition: coap_notls.c:89
coap_dtls_context_set_pki
int coap_dtls_context_set_pki(coap_context_t *ctx UNUSED, coap_dtls_pki_t *setup_data UNUSED, coap_dtls_role_t role UNUSED)
Definition: coap_notls.c:39
coap_tls_new_server_session
void * coap_tls_new_server_session(coap_session_t *session UNUSED, int *connected UNUSED)
Definition: coap_notls.c:154
coap_tls_write
ssize_t coap_tls_write(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:161
coap_session_send
ssize_t coap_session_send(coap_session_t *session, const uint8_t *data, size_t datalen)
Function interface for datagram data transmission.
Definition: coap_session.c:216
coap_session_get_by_peer
coap_session_t * coap_session_get_by_peer(coap_context_t *ctx, const coap_address_t *remote_addr, int ifindex)
Definition: coap_session.c:1029
LOG_DEBUG
Debug.
Definition: coap_debug.h:55
coap_tls_version_t::version
uint64_t version
(D)TLS runtime Library Version
Definition: coap_dtls.h:52
coap_context_t::get_client_psk
size_t(* get_client_psk)(const coap_session_t *session, const uint8_t *hint, size_t hint_len, uint8_t *identity, size_t *identity_len, size_t max_identity_len, uint8_t *psk, size_t max_psk_len)
Definition: net.h:195
coap_tls_new_client_session
void * coap_tls_new_client_session(coap_session_t *session UNUSED, int *connected UNUSED)
Definition: coap_notls.c:150
coap_tls_is_supported
int coap_tls_is_supported(void)
Check whether TLS is available.
Definition: coap_notls.c:26
COAP_TICKS_PER_SECOND
#define COAP_TICKS_PER_SECOND
Use ms resolution on POSIX systems.
Definition: coap_time.h:108
coap_tls_version_t::type
coap_tls_library_t type
Library type.
Definition: coap_dtls.h:53
coap_get_tls_library_version
coap_tls_version_t * coap_get_tls_library_version(void)
Determine the type and version of the underlying (D)TLS library.
Definition: coap_notls.c:31
dummy
static void dummy(void)
Definition: coap_tinydtls.c:559
coap_session_t::addr_info
coap_addr_tuple_t addr_info
key: remote/local address info
Definition: coap_session.h:68
LOG_WARNING
Warning.
Definition: coap_debug.h:52
coap_tick_t
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition: coap_time.h:93
coap_dtls_get_overhead
unsigned int coap_dtls_get_overhead(coap_session_t *session UNUSED)
Definition: coap_notls.c:146
coap_ticks
void coap_ticks(coap_tick_t *t)
Sets t to the internal time with COAP_TICKS_PER_SECOND resolution.
coap_tls_version_t
The structure used for returning the underlying (D)TLS library information.
Definition: coap_dtls.h:51
COAP_EVENT_DTLS_CLOSED
#define COAP_EVENT_DTLS_CLOSED
(D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS
Definition: coap_event.h:33
coap_handle_dgram
int coap_handle_dgram(coap_context_t *ctx, coap_session_t *session, uint8_t *msg, size_t msg_len)
Parses and interprets a CoAP datagram with context ctx.
Definition: net.c:1557
coap_dtls_context_set_psk
int coap_dtls_context_set_psk(coap_context_t *ctx UNUSED, const char *hint UNUSED, coap_dtls_role_t role UNUSED)
Definition: coap_notls.c:55
coap_context_t::dtls_context
void * dtls_context
Definition: net.h:199
coap_dtls_role_t
coap_dtls_role_t
Definition: coap_dtls.h:266
coap_session_t::ifindex
int ifindex
interface index
Definition: coap_session.h:69
coap_context_t::get_server_hint
size_t(* get_server_hint)(const coap_session_t *session, uint8_t *hint, size_t max_hint_len)
Definition: net.h:197
coap_dtls_free_session
void coap_dtls_free_session(coap_session_t *coap_session UNUSED)
Definition: coap_notls.c:100
COAP_EVENT_DTLS_ERROR
#define COAP_EVENT_DTLS_ERROR
Definition: coap_event.h:36
COAP_EVENT_DTLS_CONNECTED
#define COAP_EVENT_DTLS_CONNECTED
Definition: coap_event.h:34
coap_handle_event
int coap_handle_event(coap_context_t *context, coap_event_t event, coap_session_t *session)
Invokes the event handler of context for the given event and data.
Definition: net.c:2542
coap_dtls_new_server_session
void * coap_dtls_new_server_session(coap_session_t *session UNUSED)
Definition: coap_notls.c:92
coap_session_connected
void coap_session_connected(coap_session_t *session)
Notify session that it has just connected or reconnected.
Definition: coap_session.c:330
coap_dtls_pki_t
The structure used for defining the PKI setup data to be used.
Definition: coap_dtls.h:193
coap_dtls_context_set_pki_root_cas
int coap_dtls_context_set_pki_root_cas(struct coap_context_t *ctx UNUSED, const char *ca_file UNUSED, const char *ca_path UNUSED)
Definition: coap_notls.c:47
coap_dtls_send
int coap_dtls_send(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:107
coap_context_t::get_server_psk
size_t(* get_server_psk)(const coap_session_t *session, const uint8_t *identity, size_t identity_len, uint8_t *psk, size_t max_psk_len)
Definition: net.h:196
coap_malloc_type
void * coap_malloc_type(coap_memory_tag_t type, size_t size)
Allocates a chunk of size bytes and returns a pointer to the newly allocated memory.
coap_dtls_handle_timeout
void coap_dtls_handle_timeout(coap_session_t *session UNUSED)
Definition: coap_notls.c:127
coap_dtls_startup
void coap_dtls_startup(void)
Initialize the underlying (D)TLS Library layer.
Definition: coap_notls.c:70
coap_dtls_get_timeout
coap_tick_t coap_dtls_get_timeout(coap_session_t *session UNUSED, coap_tick_t now UNUSED)
Definition: coap_notls.c:123
COAP_NACK_TLS_FAILED
Definition: coap_io.h:230
coap_session_disconnected
void coap_session_disconnected(coap_session_t *session, coap_nack_reason_t reason)
Notify session that it has failed.
Definition: coap_session.c:387
coap_log
#define coap_log(level,...)
Logging function.
Definition: coap_debug.h:129
coap_address_t::addr
union coap_address_t::@0 addr
coap_address_t::size
socklen_t size
size of addr
Definition: address.h:63
coap_free_type
void coap_free_type(coap_memory_tag_t type, void *p)
Releases the memory that was allocated by coap_malloc_type().
uint8_t
unsigned char uint8_t
Definition: uthash.h:79
UNUSED
#define UNUSED
Definition: coap_notls.c:17
coap_dtls_get_context_timeout
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context UNUSED)
Definition: coap_notls.c:118
coap_tls_version_t::built_version
uint64_t built_version
(D)TLS Built against Library Version
Definition: coap_dtls.h:54
coap_dtls_session_update_mtu
void coap_dtls_session_update_mtu(coap_session_t *session UNUSED)
Definition: coap_notls.c:103
coap_dtls_new_context
void * coap_dtls_new_context(struct coap_context_t *coap_context UNUSED)
Definition: coap_notls.c:84
coap_context_t
The CoAP stack&#39;s global state is stored in a coap_context_t object.
Definition: net.h:147
coap_dtls_is_context_timeout
int coap_dtls_is_context_timeout(void)
Check if timeout is handled per CoAP session or per CoAP context.
Definition: coap_notls.c:114
coap_address_t::sa
struct sockaddr sa
Definition: address.h:65
coap_internal.h
Pulls together all the internal only header files.