From e1fa280d887e3ccc357239f6d4e1cf20ba9c5375 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Sat, 10 Feb 2018 18:34:42 +0000 Subject: [PATCH] coap_dtls.h: Add in TLS library determination support A new function coap_get_tls_library_version() that returns a pointer to a coap_tls_version_t structure that contains both the TLS library type libcoap was compiled against as well as the current TLS library version. --- include/coap/coap_dtls.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/coap/coap_dtls.h b/include/coap/coap_dtls.h index 3e640eff..e6235a8a 100644 --- a/include/coap/coap_dtls.h +++ b/include/coap/coap_dtls.h @@ -27,6 +27,21 @@ int coap_dtls_is_supported(void); /** Returns 1 if support for TLS is enabled, or 0 otherwise. */ int coap_tls_is_supported( void ); +#define COAP_TLS_LIBRARY_NOTLS 0 +#define COAP_TLS_LIBRARY_TINYDTLS 1 +#define COAP_TLS_LIBRARY_OPENSSL 2 +#define COAP_TLS_LIBRARY_GNUTLS 3 + +typedef struct coap_tls_version_t { + uint64_t version; /* Library Version */ + int type; /* One of COAP_TLS_LIBRARY_* */ +} coap_tls_version_t; + +/** + * Returns the version and type of library libcoap was compiled against + */ +coap_tls_version_t *coap_get_tls_library_version(void); + /** Sets the log level to the specified value. */ void coap_dtls_set_log_level(int level);