aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-03 17:50:56 +0000
committerlloyd <[email protected]>2012-01-03 17:50:56 +0000
commit7fbfe2369388ad58df4e2f30c833168cebec924b (patch)
treec02be8a11b09dfd521b755d4649f4ce59ec2e4a4
parent53188aed931d1e8ffd460b684466f1f68fde25b5 (diff)
Example fixes
-rw-r--r--doc/examples/tls_client.cpp9
-rw-r--r--doc/examples/tls_server.cpp3
2 files changed, 9 insertions, 3 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp
index 1787e8dea..b20c81765 100644
--- a/doc/examples/tls_client.cpp
+++ b/doc/examples/tls_client.cpp
@@ -67,7 +67,7 @@ int connect_to_host(const std::string& host, u16bit port)
return fd;
}
-void handshake_complete(const TLS_Session& session)
+bool handshake_complete(const TLS_Session& session)
{
printf("Handshake complete, protocol=%04X ciphersuite=%04X compression=%d\n",
session.version(), session.ciphersuite(),
@@ -75,6 +75,7 @@ void handshake_complete(const TLS_Session& session)
printf("Session id = %s\n", hex_encode(session.session_id()).c_str());
printf("Master secret = %s\n", hex_encode(session.master_secret()).c_str());
+ return true;
}
void socket_write(int sockfd, const byte buf[], size_t length)
@@ -115,6 +116,7 @@ void process_data(const byte buf[], size_t buf_size, u16bit alert_info)
void doit(RandomNumberGenerator& rng,
TLS_Policy& policy,
TLS_Session_Manager& session_manager,
+ Credentials_Manager& creds,
const std::string& host,
u16bit port)
{
@@ -124,6 +126,7 @@ void doit(RandomNumberGenerator& rng,
process_data,
handshake_complete,
session_manager,
+ creds,
policy,
rng,
host);
@@ -203,11 +206,13 @@ int main(int argc, char* argv[])
Client_TLS_Policy policy;
TLS_Session_Manager_In_Memory session_manager;
+ Credentials_Manager creds;
+
std::string host = argv[1];
u32bit port = argc == 3 ? Botan::to_u32bit(argv[2]) : 443;
while(true)
- doit(rng, policy, session_manager, host, port);
+ doit(rng, policy, session_manager, creds, host, port);
}
catch(std::exception& e)
diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp
index 10f294a3f..297a7b922 100644
--- a/doc/examples/tls_server.cpp
+++ b/doc/examples/tls_server.cpp
@@ -56,7 +56,7 @@ class Credentials_Manager_Simple : public Credentials_Manager
std::map<X509_Certificate, Private_Key*> certs_and_keys;
};
-void handshake_complete(const TLS_Session& session)
+bool handshake_complete(const TLS_Session& session)
{
printf("Handshake complete, protocol=%04X ciphersuite=%04X compression=%d\n",
session.version(), session.ciphersuite(),
@@ -64,6 +64,7 @@ void handshake_complete(const TLS_Session& session)
printf("Session id = %s\n", hex_encode(session.session_id()).c_str());
printf("Master secret = %s\n", hex_encode(session.master_secret()).c_str());
+ return true;
}
class Blocking_TLS_Server