# 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.
[none] ~ConnectionProvider Virtual destructor.
void stop Close all handles.
std::shared_ptr<data::stream::IOStream> get Get incoming connection.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<data::stream::IOStream>&> getAsync No need to implement this.
void invalidate Will call invalidateConnection() for the underlying transport stream.

# 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.
    static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<Config>& config,
                                                            const network::Address& address,
                                                            bool useExtendedConnections = false)
    

# ConnectionProvider::~ConnectionProvider

Virtual destructor.

~ConnectionProvider()

# ConnectionProvider::stop

Close all handles.

void stop() override

# ConnectionProvider::get

Get incoming connection.

std::shared_ptr<data::stream::IOStream> get() override

# ConnectionProvider::getAsync

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<data::stream::IOStream>&> getAsync() override

# ConnectionProvider::invalidate

Will call invalidateConnection() for the underlying transport stream.

void invalidate(const std::shared_ptr<data::stream::IOStream>& connection) override