#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 27 of file tls_wrapper.hpp.
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 |
Suspends current task until the socket has data available. | |
bool | WaitWriteable (Deadline) override |
Suspends current task until the socket can accept more data. | |
size_t | RecvSome (void *buf, size_t len, Deadline deadline) |
Receives at least one byte 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. | |
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 () |
Public Member Functions inherited from engine::io::RwBase | |
ReadableBase & | GetReadableBase () |
WritableBase & | GetWritableBase () |
Public Member Functions inherited from engine::io::ReadableBase | |
impl::ContextAccessor * | TryGetContextAccessor () |
For internal use only. | |
Public Member Functions inherited from engine::io::WritableBase | |
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 | StartTlsServer (Socket &&socket, const crypto::Certificate &cert, const crypto::PrivateKey &key, Deadline deadline, const std::vector< crypto::Certificate > &cert_authorities={}) |
Starts a TLS server on an opened socket. | |
Additional Inherited Members | |
Protected Member Functions inherited from engine::io::ReadableBase | |
void | SetReadableContextAccessor (impl::ContextAccessor *ca) |
Protected Member Functions inherited from engine::io::WritableBase | |
void | SetWritableContextAccessor (impl::ContextAccessor *ca) |
|
overridevirtual |
Whether the socket is valid.
Implements engine::io::ReadableBase.
|
inlineexplicit |
Whether the socket is valid.
Definition at line 46 of file tls_wrapper.hpp.
|
inlineoverridevirtual |
Receives exactly len bytes from the socket.
Implements engine::io::ReadableBase.
Definition at line 85 of file tls_wrapper.hpp.
|
inlineoverridevirtual |
Receives at least one byte from the socket.
Implements engine::io::ReadableBase.
Definition at line 78 of file tls_wrapper.hpp.
size_t engine::io::TlsWrapper::RecvAll | ( | void * | buf, |
size_t | len, | ||
Deadline | deadline ) |
Receives exactly len bytes from the socket.
size_t engine::io::TlsWrapper::RecvSome | ( | void * | buf, |
size_t | len, | ||
Deadline | deadline ) |
Receives at least one byte from the socket.
size_t engine::io::TlsWrapper::SendAll | ( | const void * | buf, |
size_t | len, | ||
Deadline | deadline ) |
Sends exactly len bytes to the socket.
Finishes TLS session and returns the socket.
|
overridevirtual |
Suspends current task until the socket has data available.
Implements engine::io::ReadableBase.
|
overridevirtual |
Suspends current task until the socket can accept more data.
Implements engine::io::WritableBase.
|
inlineoverridevirtual |
Writes exactly len bytes to the socket.
Implements engine::io::WritableBase.
Definition at line 92 of file tls_wrapper.hpp.
|
overridevirtual |
Reimplemented from engine::io::WritableBase.