From b49bfde8cf4d9dc10a365da4a7dddd904718b4eb Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 12 May 2018 08:47:15 +0200 Subject: cxx: bring few modern functions, and allow to get the raw session Signed-off-by: Nikos Mavrogiannopoulos --- lib/gnutlsxx.cpp | 15 +++++++++++++++ lib/includes/gnutls/gnutlsxx.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/lib/gnutlsxx.cpp b/lib/gnutlsxx.cpp index 6a3de6af16..98f12a1358 100644 --- a/lib/gnutlsxx.cpp +++ b/lib/gnutlsxx.cpp @@ -46,6 +46,11 @@ namespace gnutls gnutls_deinit (s); } + gnutls_session_t session::ptr() + { + return s; + } + int session::bye (gnutls_close_request_t how) { return RETWRAP (gnutls_bye (s, how)); @@ -292,6 +297,11 @@ namespace gnutls } // client session + void client_session::set_verify_cert (const char *hostname, unsigned flags) + { + gnutls_session_set_verify_cert(s, hostname, flags); + } + void client_session::set_server_name (gnutls_server_name_type_t type, const void *name, size_t name_length) { @@ -469,6 +479,11 @@ namespace gnutls gnutls_transport_set_pull_function (s, pull_func); } + void session::set_transport_pull_timeout_function (gnutls_pull_timeout_func pull_timeout_func) + { + gnutls_transport_set_pull_timeout_function (s, pull_timeout_func); + } + void session::set_user_ptr (void *ptr) { gnutls_session_set_ptr (s, ptr); diff --git a/lib/includes/gnutls/gnutlsxx.h b/lib/includes/gnutls/gnutlsxx.h index 561dcaca1f..28f38e93e5 100644 --- a/lib/includes/gnutls/gnutlsxx.h +++ b/lib/includes/gnutls/gnutlsxx.h @@ -107,6 +107,7 @@ namespace gnutls { session(unsigned int); virtual ~ session(); + gnutls_session_t ptr(); int bye(gnutls_close_request_t how); int handshake(); @@ -189,6 +190,7 @@ namespace gnutls { vec_push_func); void set_transport_pull_function(gnutls_pull_func pull_func); + void set_transport_pull_timeout_function (gnutls_pull_timeout_func pull_timeout_func); void set_user_ptr(void *ptr); void *get_user_ptr() const; @@ -265,6 +267,7 @@ namespace gnutls { client_session(int flags); ~client_session(); + void set_verify_cert(const char *hostname, unsigned flags); void set_server_name(gnutls_server_name_type_t type, const void *name, size_t name_length); -- cgit v1.2.1