diff options
Diffstat (limited to 'src/lib/tls/tls_channel.h')
-rw-r--r-- | src/lib/tls/tls_channel.h | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/src/lib/tls/tls_channel.h b/src/lib/tls/tls_channel.h index 71356f382..d10ac2b6e 100644 --- a/src/lib/tls/tls_channel.h +++ b/src/lib/tls/tls_channel.h @@ -13,6 +13,7 @@ #include <botan/tls_session.h> #include <botan/tls_alert.h> #include <botan/tls_session_manager.h> +#include <botan/tls_callbacks.h> #include <botan/x509cert.h> #include <vector> #include <string> @@ -35,50 +36,6 @@ class BOTAN_DLL Channel public: static size_t IO_BUF_DEFAULT_SIZE; - class Callbacks - { - public: - typedef std::function<void (const byte[], size_t)> output_fn; - typedef std::function<void (const byte[], size_t)> data_cb; - typedef std::function<void (Alert)> alert_cb; - typedef std::function<bool (const Session&)> handshake_cb; - typedef std::function<void (const Handshake_Message&)> handshake_msg_cb; - /** - * Encapsulates a set of callback functions required by a TLS Channel. - * @param output_fn is called with data for the outbound socket - * - * @param app_data_cb is called when new application data is received - * - * @param alert_cb is called when a TLS alert is received - * - * @param handshake_cb is called when a handshake is completed - */ - Callbacks(output_fn out, data_cb app_data_cb, alert_cb alert_cb, - handshake_cb hs_cb) - : m_output_function(out), m_app_data_cb(app_data_cb), - m_alert_cb(alert_cb), m_hs_cb(hs_cb), m_hs_msg_cb() {} - - Callbacks(output_fn out, data_cb app_data_cb, alert_cb alert_cb, - handshake_cb hs_cb, handshake_msg_cb hs_msg_cb) - : m_output_function(out), m_app_data_cb(app_data_cb), - m_alert_cb(alert_cb), m_hs_cb(hs_cb), m_hs_msg_cb(hs_msg_cb) {} - - const output_fn& out_fn() const { return m_output_function; } - const data_cb& app_data() const { return m_app_data_cb; } - const alert_cb& alert() const { return m_alert_cb; } - const handshake_cb& handshake() const { return m_hs_cb; } - const handshake_msg_cb& handshake_msg() const { return m_hs_msg_cb; } - - private: - const output_fn m_output_function; - const data_cb m_app_data_cb; - const alert_cb m_alert_cb; - const handshake_cb m_hs_cb; - const handshake_msg_cb m_hs_msg_cb; - }; - - - Channel(const Callbacks& callbacks, Session_Manager& session_manager, RandomNumberGenerator& rng, @@ -237,7 +194,7 @@ class BOTAN_DLL Channel const Policy& policy() const { return m_policy; } - bool save_session(const Session& session) const { return m_callbacks.handshake()(session); } + bool save_session(const Session& session) const { return m_callbacks.handshake(session); } Callbacks get_callbacks() const { return m_callbacks; } private: |