ConnectionProvider.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-mbedtls
#include "oatpp-mbedtls/server/ConnectionProvider.hpp"

ConnectionProvider

MbedTLS server connection provider. Extends oatpp::base::Countable, oatpp::network::ServerConnectionProvider.

namespace oatpp { namespace mbedtls { namespace server { 
  class ConnectionProvider : public oatpp::base::Countable, public oatpp::network::ServerConnectionProvider {}
}}}

Methods

Return Type Name Summary
[none] ConnectionProvider Constructor.
std::shared_ptr<ConnectionProvider> createShared Multiple implementations:
  1. Create shared ConnectionProvider.
  2. Create shared ConnectionProvider using oatpp::network::server::SimpleTCPConnectionProvider
[none] ~ConnectionProvider Virtual destructor.
void close Close all handles.
std::shared_ptr<IOStream> getConnection Get incoming connection.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync No need to implement this.

ConnectionProvider::ConnectionProvider

Constructor.

ConnectionProvider(const std::shared_ptr<Config>& config,
                   const std::shared_ptr<oatpp::network::ServerConnectionProvider>& streamProvider)

ConnectionProvider::createShared

  1. Create shared ConnectionProvider.
    static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<Config>& config,
                                                            const std::shared_ptr<oatpp::network::ServerConnectionProvider>& streamProvider)
    
  2. Create shared ConnectionProvider using oatpp::network::server::SimpleTCPConnectionProvider as a provider of underlying transport stream.
    • @param config - oatpp::mbedtls::Config.
    • @param port - port to listen on.
    • @return - std::shared_ptr to ConnectionProvider.
    static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<Config>& config, v_word16 port)
    

ConnectionProvider::~ConnectionProvider

Virtual destructor.

~ConnectionProvider()

ConnectionProvider::close

Close all handles.

void close() override

ConnectionProvider::getConnection

Get incoming connection.

std::shared_ptr<IOStream> getConnection() override

ConnectionProvider::getConnectionAsync

No need to implement this.
For Asynchronous IO in oatpp it is considered to be a good practice to accept connections in a seperate thread with the blocking accept() and then process connections in Asynchronous manner with non-blocking read/write.
It may be implemented later

oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override