diff options
author | Matthias Gierlings <[email protected]> | 2016-05-16 23:02:58 +0200 |
---|---|---|
committer | Matthias Gierlings <[email protected]> | 2016-06-19 18:28:38 +0200 |
commit | 490d538512b7f732268358b3a3a6fcbfd2bb67c6 (patch) | |
tree | 200ef15842e924860c33f79d3c8be9c76e47ea39 /src/lib/tls/tls_client.cpp | |
parent | 93df95db45fa126725808fbd53aa978b00cf08ad (diff) |
Compatibility patch for TLS::Callback interface
- Added legacy constructor support for TLS::Channel, TLS::Client,
TLS::Server.
Diffstat (limited to 'src/lib/tls/tls_client.cpp')
-rw-r--r-- | src/lib/tls/tls_client.cpp | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/src/lib/tls/tls_client.cpp b/src/lib/tls/tls_client.cpp index ab733d7a5..e2f090033 100644 --- a/src/lib/tls/tls_client.cpp +++ b/src/lib/tls/tls_client.cpp @@ -55,19 +55,65 @@ Client::Client(const Callbacks& callbacks, m_creds(creds), m_info(properties.get_server_info()) { + init(properties.get_protocol_version(), properties.get_next_protocols()); + } + +Client::Client(output_fn output_fn, + data_cb proc_cb, + alert_cb alert_cb, + handshake_cb handshake_cb, + Session_Manager& session_manager, + Credentials_Manager& creds, + const Policy& policy, + RandomNumberGenerator& rng, + const Server_Information& info, + const Protocol_Version& offer_version, + const std::vector<std::string>& next_protos, + size_t io_buf_sz) : + Channel(output_fn, proc_cb, alert_cb, handshake_cb, Channel::handshake_msg_cb(), + session_manager, rng, policy, offer_version.is_datagram_protocol(), io_buf_sz), + m_creds(creds), + m_info(info) + { + init(offer_version, next_protos); + } + +Client::Client(output_fn output_fn, + data_cb proc_cb, + alert_cb alert_cb, + handshake_cb handshake_cb, + handshake_msg_cb hs_msg_cb, + Session_Manager& session_manager, + Credentials_Manager& creds, + const Policy& policy, + RandomNumberGenerator& rng, + const Server_Information& info, + const Protocol_Version& offer_version, + const std::vector<std::string>& next_protos) : + Channel(output_fn, proc_cb, alert_cb, handshake_cb, hs_msg_cb, + session_manager, rng, policy, offer_version.is_datagram_protocol()), + m_creds(creds), + m_info(info) + { + init(offer_version, next_protos); + } + +void Client::init(const Protocol_Version& protocol_version, + const std::vector<std::string>& next_protocols) + { const std::string srp_identifier = m_creds.srp_identifier("tls-client", m_info.hostname()); - Handshake_State& state = create_handshake_state(properties.get_protocol_version()); - send_client_hello(state, false, properties.get_protocol_version(), - srp_identifier, properties.get_next_protocols()); + Handshake_State& state = create_handshake_state(protocol_version); + send_client_hello(state, false, protocol_version, + srp_identifier, next_protocols); } Handshake_State* Client::new_handshake_state(Handshake_IO* io) { - return new Client_Handshake_State(io, - std::bind(&TLS::Callbacks::handshake_msg, - get_callbacks(), - std::placeholders::_1)); + return new Client_Handshake_State(io, + std::bind(&TLS::Callbacks::handshake_msg, + get_callbacks(), + std::placeholders::_1)); } std::vector<X509_Certificate> |