#include <userver/engine/io/tls_wrapper.hpp>
Class for TLS communications over a Socket.
Not thread safe. E.g. you MAY NOT read and write concurrently from multiple coroutines.
Usage example:
Definition at line 28 of file tls_wrapper.hpp.
Inheritance diagram for engine::io::TlsWrapper:Public Member Functions | |
| TlsWrapper (const TlsWrapper &)=delete | |
| TlsWrapper (TlsWrapper &&) noexcept | |
| operator bool () const | |
| Whether the socket is valid. | |
| bool | IsValid () const override |
| Whether the socket is valid. | |
| bool | WaitReadable (Deadline) override |
| bool | WaitWriteable (Deadline) override |
| size_t | RecvSome (void *buf, size_t len, Deadline deadline) |
| Receives at least one byte from the socket. | |
| std::optional< size_t > | RecvNoblock (void *buf, size_t len) |
| Receives up to len bytes from the socket. | |
| size_t | RecvAll (void *buf, size_t len, Deadline deadline) |
| Receives exactly len bytes from the socket. | |
| size_t | SendAll (const void *buf, size_t len, Deadline deadline) |
| Sends exactly len bytes to the socket. | |
| Socket | StopTls (Deadline deadline) |
| Finishes TLS session and returns the socket. | |
| std::optional< size_t > | ReadNoblock (void *buf, size_t len) override |
| Receives up to len bytes from the stream. | |
| size_t | ReadSome (void *buf, size_t len, Deadline deadline) override |
| Receives at least one byte from the socket. | |
| size_t | ReadAll (void *buf, size_t len, Deadline deadline) override |
| Receives exactly len bytes from the socket. | |
| size_t | WriteAll (const void *buf, size_t len, Deadline deadline) override |
| Writes exactly len bytes to the socket. | |
| size_t | WriteAll (std::initializer_list< IoData > list, Deadline deadline) override |
| int | GetRawFd () |
| ReadableBase & | GetReadableBase () |
| WritableBase & | GetWritableBase () |
| impl::ContextAccessor * | TryGetContextAccessor () |
| For internal use only. | |
| impl::ContextAccessor * | TryGetContextAccessor () |
| For internal use only. | |
Static Public Member Functions | |
| static TlsWrapper | StartTlsClient (Socket &&socket, const std::string &server_name, Deadline deadline) |
| Starts a TLS client on an opened socket. | |
| static TlsWrapper | StartTlsClient (Socket &&socket, const std::string &server_name, const crypto::Certificate &cert, const crypto::PrivateKey &key, Deadline deadline, const std::vector< crypto::Certificate > &extra_cert_authorities={}) |
| Starts a TLS client with client cert on an opened socket. | |
| static TlsWrapper | StartTlsServer (Socket &&socket, const crypto::SslCtx &ctx, Deadline deadline) |
| Starts a TLS server on an opened socket. | |
Protected Member Functions | |
| void | SetReadableContextAccessor (impl::ContextAccessor *ca) |
| void | SetWritableContextAccessor (impl::ContextAccessor *ca) |
|
inlineinherited |
Definition at line 110 of file common.hpp.
|
inlineinherited |
Definition at line 112 of file common.hpp.
|
overridevirtual |
Whether the socket is valid.
Implements engine::io::ReadableBase.
|
inlineexplicit |
Whether the socket is valid.
Definition at line 52 of file tls_wrapper.hpp.
|
inlinenodiscardoverridevirtual |
Receives exactly len bytes from the socket.
Implements engine::io::ReadableBase.
Definition at line 108 of file tls_wrapper.hpp.
|
inlinenodiscardoverridevirtual |
Receives up to len bytes from the stream.
Reimplemented from engine::io::ReadableBase.
Definition at line 97 of file tls_wrapper.hpp.
|
inlinenodiscardoverridevirtual |
Receives at least one byte from the socket.
Implements engine::io::ReadableBase.
Definition at line 102 of file tls_wrapper.hpp.
|
nodiscard |
Receives exactly len bytes from the socket.
|
nodiscard |
Receives up to len bytes from the socket.
|
nodiscard |
Receives at least one byte from the socket.
|
nodiscard |
Sends exactly len bytes to the socket.
|
inlineprotectedinherited |
Definition at line 58 of file common.hpp.
|
inlineprotectedinherited |
Definition at line 96 of file common.hpp.
Finishes TLS session and returns the socket.
|
inlineinherited |
For internal use only.
Definition at line 55 of file common.hpp.
|
inlineinherited |
For internal use only.
Definition at line 93 of file common.hpp.
|
nodiscardoverridevirtual |
Suspends current task until the socket has data available.
Implements engine::io::ReadableBase.
|
nodiscardoverridevirtual |
Suspends current task until the socket can accept more data.
Implements engine::io::WritableBase.
|
inlinenodiscardoverridevirtual |
Writes exactly len bytes to the socket.
Implements engine::io::WritableBase.
Definition at line 114 of file tls_wrapper.hpp.
|
nodiscardoverridevirtual |
Reimplemented from engine::io::WritableBase.