join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicStreamAcceptor< Protocol > Class Template Reference

basic stream acceptor class. More...

#include <acceptor.hpp>

Inheritance diagram for join::BasicStreamAcceptor< Protocol >:
Collaboration diagram for join::BasicStreamAcceptor< Protocol >:

Public Types

using Endpoint = typename Protocol::Endpoint
 
using Socket = typename Protocol::Socket
 
using Stream = typename Protocol::Stream
 

Public Member Functions

 BasicStreamAcceptor ()=default
 create the acceptor instance.
 
 BasicStreamAcceptor (const BasicStreamAcceptor &other)=delete
 copy constructor.
 
BasicStreamAcceptoroperator= (const BasicStreamAcceptor &other)=delete
 copy assignment operator.
 
 BasicStreamAcceptor (BasicStreamAcceptor &&other)
 move constructor.
 
BasicStreamAcceptoroperator= (BasicStreamAcceptor &&other)
 move assignment operator.
 
virtual ~BasicStreamAcceptor ()
 destroy instance.
 
virtual int create (const Endpoint &endpoint) noexcept
 create acceptor
 
virtual void close () noexcept
 close acceptor.
 
virtual Socket accept () const
 accept new connection and fill in the client object with connection parameters.
 
virtual Stream acceptStream () const
 accept new connection and fill in the client object with connection parameters.
 
Endpoint localEndpoint () const
 determine the local endpoint associated with this socket.
 
bool opened () const noexcept
 check if the socket is opened.
 
int family () const noexcept
 get address family.
 
int type () const noexcept
 get the protocol communication semantic.
 
int protocol () const noexcept
 get acceptor protocol.
 
int handle () const noexcept override
 get socket native handle.
 
- Public Member Functions inherited from join::EventHandler
 EventHandler ()=default
 create instance.
 
virtual ~EventHandler ()=default
 destroy instance.
 

Protected Attributes

int _handle = -1
 socket handle.
 
Protocol _protocol
 protocol.
 

Additional Inherited Members

- Protected Member Functions inherited from join::EventHandler
virtual void onReceive ()
 method called when data are ready to be read on handle.
 
virtual void onClose ()
 method called when handle is closed.
 
virtual void onError ()
 method called when an error occured on handle.
 

Detailed Description

template<class Protocol>
class join::BasicStreamAcceptor< Protocol >

basic stream acceptor class.

Member Typedef Documentation

◆ Endpoint

template<class Protocol >
using join::BasicStreamAcceptor< Protocol >::Endpoint = typename Protocol::Endpoint

◆ Socket

template<class Protocol >
using join::BasicStreamAcceptor< Protocol >::Socket = typename Protocol::Socket

◆ Stream

template<class Protocol >
using join::BasicStreamAcceptor< Protocol >::Stream = typename Protocol::Stream

Constructor & Destructor Documentation

◆ BasicStreamAcceptor() [1/3]

template<class Protocol >
join::BasicStreamAcceptor< Protocol >::BasicStreamAcceptor ( )
default

create the acceptor instance.

◆ BasicStreamAcceptor() [2/3]

template<class Protocol >
join::BasicStreamAcceptor< Protocol >::BasicStreamAcceptor ( const BasicStreamAcceptor< Protocol > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicStreamAcceptor() [3/3]

template<class Protocol >
join::BasicStreamAcceptor< Protocol >::BasicStreamAcceptor ( BasicStreamAcceptor< Protocol > && other)
inline

move constructor.

Parameters
otherother object to move.

◆ ~BasicStreamAcceptor()

template<class Protocol >
virtual join::BasicStreamAcceptor< Protocol >::~BasicStreamAcceptor ( )
inlinevirtual

destroy instance.

Member Function Documentation

◆ accept()

template<class Protocol >
virtual Socket join::BasicStreamAcceptor< Protocol >::accept ( ) const
inlinevirtual

accept new connection and fill in the client object with connection parameters.

Returns
the accepted client socket object.

Reimplemented in join::BasicTlsAcceptor< Protocol >.

◆ acceptStream()

template<class Protocol >
virtual Stream join::BasicStreamAcceptor< Protocol >::acceptStream ( ) const
inlinevirtual

accept new connection and fill in the client object with connection parameters.

Returns
The client stream object on success, nullptr on failure.

◆ close()

template<class Protocol >
virtual void join::BasicStreamAcceptor< Protocol >::close ( )
inlinevirtualnoexcept

close acceptor.

◆ create()

template<class Protocol >
virtual int join::BasicStreamAcceptor< Protocol >::create ( const Endpoint & endpoint)
inlinevirtualnoexcept

create acceptor

Parameters
endpointendpoint to assign to the acceptor.
Returns
0 on success, -1 on failure.

◆ family()

template<class Protocol >
int join::BasicStreamAcceptor< Protocol >::family ( ) const
inlinenoexcept

get address family.

Returns
address family.

◆ handle()

template<class Protocol >
int join::BasicStreamAcceptor< Protocol >::handle ( ) const
inlineoverridevirtualnoexcept

get socket native handle.

Returns
socket native handle.

Implements join::EventHandler.

◆ localEndpoint()

template<class Protocol >
Endpoint join::BasicStreamAcceptor< Protocol >::localEndpoint ( ) const
inline

determine the local endpoint associated with this socket.

Returns
local endpoint.

◆ opened()

template<class Protocol >
bool join::BasicStreamAcceptor< Protocol >::opened ( ) const
inlinenoexcept

check if the socket is opened.

Returns
true if opened, false otherwise.

◆ operator=() [1/2]

template<class Protocol >
BasicStreamAcceptor & join::BasicStreamAcceptor< Protocol >::operator= ( BasicStreamAcceptor< Protocol > && other)
inline

move assignment operator.

Parameters
otherother object to assign.
Returns
assigned object.

◆ operator=() [2/2]

template<class Protocol >
BasicStreamAcceptor & join::BasicStreamAcceptor< Protocol >::operator= ( const BasicStreamAcceptor< Protocol > & other)
delete

copy assignment operator.

Parameters
otherother object to assign.
Returns
assigned object.

◆ protocol()

template<class Protocol >
int join::BasicStreamAcceptor< Protocol >::protocol ( ) const
inlinenoexcept

get acceptor protocol.

Returns
acceptor protocol.

◆ type()

template<class Protocol >
int join::BasicStreamAcceptor< Protocol >::type ( ) const
inlinenoexcept

get the protocol communication semantic.

Returns
the protocol communication semantic.

Member Data Documentation

◆ _handle

template<class Protocol >
int join::BasicStreamAcceptor< Protocol >::_handle = -1
protected

socket handle.

◆ _protocol

template<class Protocol >
Protocol join::BasicStreamAcceptor< Protocol >::_protocol
protected

protocol.


The documentation for this class was generated from the following files: