aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-10-13 19:26:38 +0000
committerlloyd <[email protected]>2012-10-13 19:26:38 +0000
commit5a6afba7f8d403cd29efe3302012ecf1b5f6ce5a (patch)
tree3f0835a6828e3b85674394e16e422ce1afe3a310 /doc
parent8232b76a8d332fab5a1023b37e8d0a18cc1e0985 (diff)
Add TLS::Server_Information to encapsulate the hostname/port pair.
Add a service identifier as well, to help out clients which may want to negotiate multiple protocols over a single port and need to keep the sessions disambiguated. Not sure if that is useful, but it might be.
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/tls_client.cpp3
-rw-r--r--doc/tls.rst41
2 files changed, 23 insertions, 21 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp
index d56143a36..a9efe21e1 100644
--- a/doc/examples/tls_client.cpp
+++ b/doc/examples/tls_client.cpp
@@ -168,8 +168,7 @@ int main(int argc, char* argv[])
creds,
policy,
rng,
- host,
- port,
+ TLS::Server_Information(host, port),
protocol_chooser);
while(!client.is_closed())
diff --git a/doc/tls.rst b/doc/tls.rst
index 2f560b72f..18af678b9 100644
--- a/doc/tls.rst
+++ b/doc/tls.rst
@@ -165,7 +165,7 @@ TLS Clients
Credentials_Manager& credendials_manager, \
const TLS::Policy& policy, \
RandomNumberGenerator& rng, \
- const std::string& servername = "", \
+ const Server_Information& server_info = Server_Information(), \
std::function<std::string, std::vector<std::string> > next_protocol)
Initialize a new TLS client. The constructor will immediately
@@ -206,7 +206,7 @@ TLS Clients
retrieve any certificates, secret keys, pre-shared keys, or SRP
intformation; see :doc:`credentials_manager` for more information.
- Use *servername* to specify the DNS name of the server you are
+ Use *server_info* to specify the DNS name of the server you are
attempting to connect to, if you know it. This helps the server
select what certificate to use and helps the client validate the
connection.
@@ -240,6 +240,16 @@ The first 7 arguments are treated similiarly to the :ref:`client
<tls_client>`. The final (optional) argument, protocols, specifies
the protocols the server is willing to advertise it supports.
+.. cpp:class:: std::string TLS::Server::next_protocol() const
+
+ If a handshake has completed, and if the client indicated a next
+ protocol (ie, the protocol that it intends to run over this TLS
+ session) this return value will specify it. The next protocol
+ extension is somewhat unusual in that it applies to the connection
+ rather than the session. The next protocol can not change during a
+ renegotiation, but might change across different connections using
+ that session.
+
A TLS server that can handle concurrent connections using asio:
.. literalinclude:: examples/asio_tls_server.cpp
@@ -270,9 +280,13 @@ information about that session:
Returns the :cpp:class:`ciphersuite <TLS::Ciphersuite>` that
was negotiated.
- .. cpp:function:: std::string sni_hostname() const
+ .. cpp:function:: Server_Information server_info() const
- Returns the hostname the client indicated in the hello message.
+ Returns information that identifies the server side of the
+ connection. This is useful for the client in that it
+ identifies what was originally passed to the constructor. For
+ the server, it includes the name the client specified in the
+ server name indicator extension.
.. cpp:function:: std::vector<X509_Certificate> peer_certs() const
@@ -331,17 +345,12 @@ implementation to the ``TLS::Client`` or ``TLS::Server`` constructor.
.. cpp:class:: TLS::Session_Mananger
- .. cpp:function:: void save(const Session& session, u16bit port)
+ .. cpp:function:: void save(const Session& session)
Save a new *session*. It is possible that this sessions session
ID will replicate a session ID already stored, in which case the
new session information should overwrite the previous information.
- Clients will specify *port* if they know it (it will be zero if
- they do not, or for servers). It specifies the remote port of the
- server which is used to assist with looking up the correct
- session when using :cpp:func:`load_from_host_info`.
-
.. cpp:function:: void remove_entry(const std::vector<byte>& session_id)
Remove the session identified by *session_id*. Future attempts
@@ -355,16 +364,10 @@ implementation to the ``TLS::Client`` or ``TLS::Server`` constructor.
to *save*, and ``true`` is returned. Otherwise *session* is not
modified and ``false`` is returned.
- .. cpp:function:: bool load_from_host_info(const std::string& hostname, \
- u16bit port, \
- Session& session)
-
- Attempt to resume a session for *hostname* / *port*.
+ .. cpp:function:: bool load_from_server_info(const Server_Information& server, \
+ Session& session)
- The session managers included in the library will, if they fail
- to find an exact match for *hostname* and *port*, will also
- check for a session saved using a matching hostname and a port
- of zero.
+ Attempt to resume a session with a known server.
.. cpp:function:: std::chrono::seconds session_lifetime() const