# Interface.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/virtual_/Interface.hpp"

# Interface

"Virtual" Interface provides functionality for accepting "virtual" connections. "virtual" connection is represented by oatpp::network::virtual_::Socket.

namespace oatpp { namespace network { namespace virtual_ { 
  class Interface : public oatpp::base::Countable {}
}}}

# Methods

Return Type Name Summary
[none] ~Interface Destructor.
std::shared_ptr<Interface> obtainShared Obtain interface for given name.
std::shared_ptr<ListenerLock> bind Aquire Interface::ListenerLock.
std::shared_ptr<ConnectionSubmission> connect Connect to interface.
std::shared_ptr<ConnectionSubmission> connectNonBlocking Connect to interface.
std::shared_ptr<Socket> accept Block and wait for incloming connection.
std::shared_ptr<Socket> acceptNonBlocking Check if incoming connection is available. NonBlocking.
void dropAllConnection Drop all waiting connections.
void notifyAcceptors Notify all threads that are waiting on accept().
oatpp::String getName Get interface name.

# Interface::~Interface

Destructor.

~Interface()

# Interface::obtainShared

Obtain interface for given name.

  • @param name - name of the interface.
  • @return - std::shared_ptr to Interface.

static std::shared_ptr<Interface> obtainShared(const oatpp::String& name)

# Interface::bind

Aquire Interface::ListenerLock.

std::shared_ptr<ListenerLock> bind()

# Interface::connect

Connect to interface.

std::shared_ptr<ConnectionSubmission> connect()

# Interface::connectNonBlocking

Connect to interface.

std::shared_ptr<ConnectionSubmission> connectNonBlocking()

# Interface::accept

Block and wait for incloming connection.

std::shared_ptr<Socket> accept(const bool& waitingHandle = true,
                               const std::chrono::duration<v_int64, std::micro>& timeout = std::chrono::minutes (10))

# Interface::acceptNonBlocking

Check if incoming connection is available. NonBlocking.

std::shared_ptr<Socket> acceptNonBlocking()

# Interface::dropAllConnection

Drop all waiting connections.

void dropAllConnection()

# Interface::notifyAcceptors

Notify all threads that are waiting on accept(). Those threads that have waitingHandle changed to false will be unblocked.

void notifyAcceptors()

# Interface::getName

Get interface name.

oatpp::String getName()

# Interface::ListenerLock

ListenerLock is the Lock object, which represents interface binding ownership.

namespace oatpp { namespace network { namespace virtual_ { 
  class Interface : public oatpp::base::Countable {
    class ListenerLock {}
  };
}}}

# Interface::ConnectionSubmission

"Future" for oatpp::network::virtual_::Socket.

namespace oatpp { namespace network { namespace virtual_ { 
  class Interface : public oatpp::base::Countable {
    class ConnectionSubmission {}
  };
}}}

# Methods

Return Type Name Summary
[none] ConnectionSubmission Constructor.
void setSocket Set socket to be returned in call to Interface::ConnectionSubmission::getSocket()/Interface::ConnectionSubmission::getSocketNonBlocking().
std::shared_ptr<Socket> getSocket Block and wait for socket.
std::shared_ptr<Socket> getSocketNonBlocking Check if socket already available.
bool isValid Check if submission is still valid.

# Interface::ConnectionSubmission::ConnectionSubmission

Constructor.

ConnectionSubmission(bool valid) : m_valid(valid)

# Interface::ConnectionSubmission::setSocket

Set socket to be returned in call to Interface::ConnectionSubmission::getSocket()/Interface::ConnectionSubmission::getSocketNonBlocking().

void setSocket(const std::shared_ptr<Socket>& socket)

# Interface::ConnectionSubmission::getSocket

Block and wait for socket.

std::shared_ptr<Socket> getSocket()

# Interface::ConnectionSubmission::getSocketNonBlocking

Check if socket already available. User should repeat call if (!socket isPending()).

std::shared_ptr<Socket> getSocketNonBlocking()

# Interface::ConnectionSubmission::isValid

Check if submission is still valid.

  • @return - true if still valid.

bool isValid()