diff options
author | lloyd <[email protected]> | 2012-04-25 14:30:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-04-25 14:30:52 +0000 |
commit | 28c64de10a4a6621e79879fe3047983bb8da9904 (patch) | |
tree | 46587772bebc38ee512111a0d23862f1f9837433 /doc/examples | |
parent | b72a44475d06263e1492f8913310b5f29515cba6 (diff) |
Huge pile of post merge fixups, mtn really fucked that merge
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/GNUmakefile | 2 | ||||
-rw-r--r-- | doc/examples/asio_tls_server.cpp | 44 | ||||
-rw-r--r-- | doc/examples/credentials.h | 2 | ||||
-rw-r--r-- | doc/examples/tls_client.cpp | 4 | ||||
-rw-r--r-- | doc/examples/tls_server.cpp | 14 |
5 files changed, 13 insertions, 53 deletions
diff --git a/doc/examples/GNUmakefile b/doc/examples/GNUmakefile index 1d4093fdb..fb2788218 100644 --- a/doc/examples/GNUmakefile +++ b/doc/examples/GNUmakefile @@ -1,7 +1,7 @@ BOTAN_CONFIG = botan-config -CXX = g++-4.7.0 +CXX = g++-4.6.0 CFLAGS = -O2 -ansi -std=c++0x -W -Wall -I../../build/include LIBS = -L../.. -lbotan-1.99 diff --git a/doc/examples/asio_tls_server.cpp b/doc/examples/asio_tls_server.cpp index e721d0455..0cf499e0a 100644 --- a/doc/examples/asio_tls_server.cpp +++ b/doc/examples/asio_tls_server.cpp @@ -1,7 +1,7 @@ #include <iostream> #include <string> #include <vector> - +#define _GLIBCXX_HAVE_GTHR_DEFAULT #include <boost/asio.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> @@ -186,46 +186,6 @@ class tls_server_session : public boost::enable_shared_from_this<tls_server_sess std::vector<byte> m_outbox; }; -class Session_Manager_Locked : public Botan::TLS::Session_Manager - { - public: - bool load_from_session_id(const Botan::MemoryRegion<byte>& session_id, - Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - return m_session_manager.load_from_session_id(session_id, session); - } - - bool load_from_host_info(const std::string& hostname, Botan::u16bit port, - Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - return m_session_manager.load_from_host_info(hostname, port, session); - }; - - void remove_entry(const Botan::MemoryRegion<byte>& session_id) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - m_session_manager.remove_entry(session_id); - } - - void save(const Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - m_session_manager.save(session); - } - - Botan::u32bit session_lifetime() const - { - return m_session_manager.session_lifetime(); - } - - private: - boost::mutex m_mutex; - Botan::TLS::Session_Manager_In_Memory m_session_manager; - - }; - class tls_server { public: @@ -282,7 +242,7 @@ class tls_server tcp::acceptor m_acceptor; Botan::AutoSeeded_RNG m_rng; - Session_Manager_Locked m_session_manager; + Botan::TLS::Session_Manager_In_Memory m_session_manager; Botan::TLS::Policy m_policy; Credentials_Manager_Simple m_creds; }; diff --git a/doc/examples/credentials.h b/doc/examples/credentials.h index 65d34aeee..4e4427585 100644 --- a/doc/examples/credentials.h +++ b/doc/examples/credentials.h @@ -50,7 +50,7 @@ class Credentials_Manager_Simple : public Botan::Credentials_Manager std::vector<Botan::X509_Certificate> certs; - try + if(type == "tls-server" && hostname == "localhost") { Botan::X509_Certificate testca("testCA.crt"); certs.push_back(testca); diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp index a787af1fe..5de8a59ce 100644 --- a/doc/examples/tls_client.cpp +++ b/doc/examples/tls_client.cpp @@ -24,7 +24,7 @@ using namespace Botan; -using namespace std::tr1::placeholders; +using namespace std::placeholders; int connect_to_host(const std::string& host, u16bit port) { @@ -125,7 +125,7 @@ void doit(RandomNumberGenerator& rng, { int sockfd = connect_to_host(host, port); - TLS::Client client(std::tr1::bind(socket_write, sockfd, _1, _2), + TLS::Client client(std::bind(socket_write, sockfd, _1, _2), process_data, handshake_complete, session_manager, diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp index 334d8f1fc..727f4c333 100644 --- a/doc/examples/tls_server.cpp +++ b/doc/examples/tls_server.cpp @@ -22,8 +22,8 @@ using namespace std::placeholders; class Blocking_TLS_Server { public: - Blocking_TLS_Server(std::tr1::function<void (const byte[], size_t)> output_fn, - std::tr1::function<size_t (byte[], size_t)> input_fn, + Blocking_TLS_Server(std::function<void (const byte[], size_t)> output_fn, + std::function<size_t (byte[], size_t)> input_fn, std::vector<std::string>& protocols, TLS::Session_Manager& sessions, Credentials_Manager& creds, @@ -32,8 +32,8 @@ class Blocking_TLS_Server input_fn(input_fn), server( output_fn, - std::tr1::bind(&Blocking_TLS_Server::reader_fn, std::tr1::ref(*this), _1, _2, _3), - std::tr1::bind(&Blocking_TLS_Server::handshake_complete, std::tr1::ref(*this), _1), + std::bind(&Blocking_TLS_Server::reader_fn, std::ref(*this), _1, _2, _3), + std::bind(&Blocking_TLS_Server::handshake_complete, std::ref(*this), _1), sessions, creds, policy, @@ -131,7 +131,7 @@ class Blocking_TLS_Server read_queue.write(buf, buf_len); } - std::tr1::function<size_t (byte[], size_t)> input_fn; + std::function<size_t (byte[], size_t)> input_fn; TLS::Server server; SecureQueue read_queue; bool exit; @@ -179,8 +179,8 @@ int main(int argc, char* argv[]) printf("Got new connection\n"); Blocking_TLS_Server tls( - std::tr1::bind(&Socket::write, std::tr1::ref(sock), _1, _2), - std::tr1::bind(&Socket::read, std::tr1::ref(sock), _1, _2, true), + std::bind(&Socket::write, std::ref(sock), _1, _2), + std::bind(&Socket::read, std::ref(sock), _1, _2, true), protocols, sessions, creds, |