# Connection.hpp
This File On Github
Ask A Question
API: latest
module: oatpp-mbedtls
#include "oatpp-mbedtls/Connection.hpp"
# Connection
TLS Connection implementation based on Mbed TLS. Extends oatpp::base::Countable and oatpp::data::stream::IOStream.
namespace oatpp { namespace mbedtls {
class Connection : public oatpp::base::Countable, public oatpp::data::stream::IOStream {}
}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | Connection | Constructor. |
[none] | ~Connection | Virtual destructor. |
v_io_size | write | Write operation callback. |
oatpp::v_io_size | read | Read operation callback. |
void | setOutputStreamIOMode | Set OutputStream I/O mode. |
oatpp::data::stream::IOMode | getOutputStreamIOMode | Set OutputStream I/O mode. |
oatpp::data::stream::Context& | getOutputStreamContext | Get output stream context. |
void | setInputStreamIOMode | Set InputStream I/O mode. |
oatpp::data::stream::IOMode | getInputStreamIOMode | Get InputStream I/O mode. |
oatpp::data::stream::Context& | getInputStreamContext | Get input stream context. |
void | closeTLS | Close TLS handles. |
mbedtls_ssl_context* | getTlsHandle | Get TLS handle. |
provider::ResourceHandle<data::stream::IOStream> | getTransportStream | Get the underlying transport stream. |
# Connection::Connection
Constructor.
- @param tlsHandle -
mbedtls_ssl_context*
. - @param stream - underlying transport stream. oatpp::data::stream::IOStream.
- @param initialized - is stream initialized (do we have handshake already).
Connection(mbedtls_ssl_context* tlsHandle, const provider::ResourceHandle<data::stream::IOStream>& stream, bool initialized)
# Connection::~Connection
Virtual destructor.
~Connection()
# Connection::write
Write operation callback.
- @param data - pointer to data.
- @param count - size of the data in bytes.
- @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
- @return - actual number of bytes written. 0 - to indicate end-of-file.
v_io_size write(const void *data, v_buff_size count, async::Action& action) override
# Connection::read
Read operation callback.
- @param buffer - pointer to buffer.
- @param count - size of the buffer in bytes.
- @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
- @return - actual number of bytes written to buffer. 0 - to indicate end-of-file.
oatpp::v_io_size read(void *buff, v_buff_size count, async::Action& action) override
# Connection::setOutputStreamIOMode
Set OutputStream I/O mode.
- @param ioMode
void setOutputStreamIOMode(oatpp::data::stream::IOMode ioMode) override
# Connection::getOutputStreamIOMode
Set OutputStream I/O mode.
- @return
oatpp::data::stream::IOMode getOutputStreamIOMode() override
# Connection::getOutputStreamContext
Get output stream context.
- @return - oatpp::data::stream::Context.
oatpp::data::stream::Context& getOutputStreamContext() override
# Connection::setInputStreamIOMode
Set InputStream I/O mode.
- @param ioMode
void setInputStreamIOMode(oatpp::data::stream::IOMode ioMode) override
# Connection::getInputStreamIOMode
Get InputStream I/O mode.
- @return
oatpp::data::stream::IOMode getInputStreamIOMode() override
# Connection::getInputStreamContext
Get input stream context.
- @return - oatpp::data::stream::Context.
oatpp::data::stream::Context& getInputStreamContext() override
# Connection::closeTLS
Close TLS handles.
void closeTLS()
# Connection::getTlsHandle
Get TLS handle.
- @return -
mbedtls_ssl_context*
.
mbedtls_ssl_context* getTlsHandle()
# Connection::getTransportStream
Get the underlying transport stream.
- @return - underlying transport stream. oatpp::data::stream::IOStream.
provider::ResourceHandle<data::stream::IOStream> getTransportStream()