libcoap  4.2.1
coap_dtls.h File Reference
#include "coap_time.h"
+ Include dependency graph for coap_dtls.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  coap_tls_version_t
 The structure used for returning the underlying (D)TLS library information. More...
 
struct  coap_pki_key_pem_t
 The structure that holds the PKI PEM definitions. More...
 
struct  coap_pki_key_asn1_t
 The structure that holds the PKI ASN.1 (DER) definitions. More...
 
struct  coap_dtls_key_t
 The structure that holds the PKI key information. More...
 
struct  coap_dtls_pki_t
 The structure used for defining the PKI setup data to be used. More...
 

Macros

#define COAP_DTLS_PKI_SETUP_VERSION   1
 Latest PKI setup version. More...
 

Typedefs

typedef enum coap_tls_library_t coap_tls_library_t
 
typedef struct coap_tls_version_t coap_tls_version_t
 The structure used for returning the underlying (D)TLS library information. More...
 
typedef int(* coap_dtls_security_setup_t) (void *tls_session, struct coap_dtls_pki_t *setup_data)
 Additional Security setup handler that can be set up by coap_context_set_pki(). More...
 
typedef int(* coap_dtls_cn_callback_t) (const char *cn, const uint8_t *asn1_public_cert, size_t asn1_length, struct coap_session_t *coap_session, unsigned depth, int validated, void *arg)
 CN Validation call-back that can be set up by coap_context_set_pki(). More...
 
typedef enum coap_asn1_privatekey_type_t coap_asn1_privatekey_type_t
 The enum used for determining the provided PKI ASN.1 (DER) Private Key formats. More...
 
typedef enum coap_pki_key_t coap_pki_key_t
 The enum used for determining the PKI key formats. More...
 
typedef struct coap_pki_key_pem_t coap_pki_key_pem_t
 The structure that holds the PKI PEM definitions. More...
 
typedef struct coap_pki_key_asn1_t coap_pki_key_asn1_t
 The structure that holds the PKI ASN.1 (DER) definitions. More...
 
typedef struct coap_dtls_key_t coap_dtls_key_t
 The structure that holds the PKI key information. More...
 
typedef coap_dtls_key_t *(* coap_dtls_sni_callback_t) (const char *sni, void *arg)
 Server Name Indication (SNI) Validation call-back that can be set up by coap_context_set_pki(). More...
 
typedef struct coap_dtls_pki_t coap_dtls_pki_t
 The structure used for defining the PKI setup data to be used. More...
 
typedef enum coap_dtls_role_t coap_dtls_role_t
 

Enumerations

enum  coap_tls_library_t { COAP_TLS_LIBRARY_NOTLS = 0, COAP_TLS_LIBRARY_TINYDTLS, COAP_TLS_LIBRARY_OPENSSL, COAP_TLS_LIBRARY_GNUTLS }
 
enum  coap_asn1_privatekey_type_t {
  COAP_ASN1_PKEY_NONE, COAP_ASN1_PKEY_RSA, COAP_ASN1_PKEY_RSA2, COAP_ASN1_PKEY_DSA,
  COAP_ASN1_PKEY_DSA1, COAP_ASN1_PKEY_DSA2, COAP_ASN1_PKEY_DSA3, COAP_ASN1_PKEY_DSA4,
  COAP_ASN1_PKEY_DH, COAP_ASN1_PKEY_DHX, COAP_ASN1_PKEY_EC, COAP_ASN1_PKEY_HMAC,
  COAP_ASN1_PKEY_CMAC, COAP_ASN1_PKEY_TLS1_PRF, COAP_ASN1_PKEY_HKDF
}
 The enum used for determining the provided PKI ASN.1 (DER) Private Key formats. More...
 
enum  coap_pki_key_t { COAP_PKI_KEY_PEM = 0, COAP_PKI_KEY_ASN1 }
 The enum used for determining the PKI key formats. More...
 
enum  coap_dtls_role_t { COAP_DTLS_ROLE_CLIENT, COAP_DTLS_ROLE_SERVER }
 

Functions

int coap_dtls_is_supported (void)
 Check whether DTLS is available. More...
 
int coap_tls_is_supported (void)
 Check whether TLS is available. More...
 
coap_tls_version_tcoap_get_tls_library_version (void)
 Determine the type and version of the underlying (D)TLS library. More...
 
void * coap_dtls_new_context (struct coap_context_t *coap_context)
 Creates a new DTLS context for the given coap_context. More...
 
int coap_dtls_context_set_psk (struct coap_context_t *coap_context, const char *identity_hint, coap_dtls_role_t role)
 Set the DTLS context's default PSK information. More...
 
int coap_dtls_context_set_pki (struct coap_context_t *coap_context, coap_dtls_pki_t *setup_data, coap_dtls_role_t role)
 Set the DTLS context's default server PKI information. More...
 
int coap_dtls_context_set_pki_root_cas (struct coap_context_t *coap_context, const char *ca_file, const char *ca_dir)
 Set the dtls context's default Root CA information for a client or server. More...
 
int coap_dtls_context_check_keys_enabled (struct coap_context_t *coap_context)
 Check whether one of the coap_dtls_context_set_{psk|pki}() functions have been called. More...
 
void coap_dtls_free_context (void *dtls_context)
 Releases the storage allocated for dtls_context. More...
 
void * coap_dtls_new_client_session (struct coap_session_t *coap_session)
 Create a new client-side session. More...
 
void * coap_dtls_new_server_session (struct coap_session_t *coap_session)
 Create a new DTLS server-side session. More...
 
void coap_dtls_free_session (struct coap_session_t *coap_session)
 Terminates the DTLS session (may send an ALERT if necessary) then frees the underlying TLS library object containing security parameters for the session. More...
 
void coap_dtls_session_update_mtu (struct coap_session_t *coap_session)
 Notify of a change in the CoAP session's MTU, for example after a PMTU update. More...
 
int coap_dtls_send (struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
 Send data to a DTLS peer. More...
 
int coap_dtls_is_context_timeout (void)
 Check if timeout is handled per CoAP session or per CoAP context. More...
 
coap_tick_t coap_dtls_get_context_timeout (void *dtls_context)
 Do all pending retransmits and get next timeout. More...
 
coap_tick_t coap_dtls_get_timeout (struct coap_session_t *coap_session, coap_tick_t now)
 Get next timeout for this session. More...
 
void coap_dtls_handle_timeout (struct coap_session_t *coap_session)
 Handle a DTLS timeout expiration. More...
 
int coap_dtls_receive (struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
 Handling incoming data from a DTLS peer. More...
 
int coap_dtls_hello (struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
 Handling client HELLO messages from a new candiate peer. More...
 
unsigned int coap_dtls_get_overhead (struct coap_session_t *coap_session)
 Get DTLS overhead over cleartext PDUs. More...
 
void * coap_tls_new_client_session (struct coap_session_t *coap_session, int *connected)
 Create a new TLS client-side session. More...
 
void * coap_tls_new_server_session (struct coap_session_t *coap_session, int *connected)
 Create a TLS new server-side session. More...
 
void coap_tls_free_session (struct coap_session_t *coap_session)
 Terminates the TLS session (may send an ALERT if necessary) then frees the underlying TLS library object containing security parameters for the session. More...
 
ssize_t coap_tls_write (struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
 Send data to a TLS peer, with implicit flush. More...
 
ssize_t coap_tls_read (struct coap_session_t *coap_session, uint8_t *data, size_t data_len)
 Read some data from a TLS peer. More...
 
void coap_dtls_startup (void)
 Initialize the underlying (D)TLS Library layer. More...
 
void coap_dtls_set_log_level (int level)
 Sets the (D)TLS logging level to the specified level. More...
 
int coap_dtls_get_log_level (void)
 Get the current (D)TLS logging. More...