senf::ProtocolServerSocketHandle< SocketProtocol > Class Template Reference

Protocol specific socket handle (server interface) More...

#include <senf/Socket/ProtocolClientSocketHandle.hh>

Inheritance diagram for senf::ProtocolServerSocketHandle< SocketProtocol >:

Public Types

typedef SocketProtocol Protocol
 The socket protocol. More...
 
- Public Types inherited from senf::ServerSocketHandle< SocketProtocol::Policy >
typedef SocketProtocol::Policy ::AddressingPolicy::Address Address
 Address type from the addressing policy. More...
 
typedef boost::call_traits< Address >::param_type AddressParam
 'Best' type for passing address as parameter More...
 
typedef ClientSocketHandle< SocketProtocol::Policy > ClientHandle
 Corresponding client socket handle with the same policy. More...
 
- Public Types inherited from senf::SocketHandle< SPolicy >
typedef SPolicy Policy
 

Public Member Functions

Protocolprotocol ()
 Access the protocol interface. More...
 
ProtocolClientSocketHandle< SocketProtocolaccept ()
 
void state (SocketStateMap &map, unsigned lod=0)
 
std::string dumpState (unsigned lod=0)
 
- Public Member Functions inherited from senf::ServerSocketHandle< SocketProtocol::Policy >
void state (SocketStateMap &map, unsigned lod=0)
 
std::string dumpState (unsigned lod=0)
 
 ServerSocketHandle ()
 
 ServerSocketHandle (ServerSocketHandle< OtherPolicy > other, typename SocketHandle< SocketProtocol::Policy >::template IsCompatible< OtherPolicy >::type *=0)
 
SocketHandle< SocketProtocol::Policy >::template IsCompatible< OtherPolicy >::type const & operator= (ServerSocketHandle< OtherPolicy > other)
 
void bind (AddressParam addr)
 Set local address. More...
 
void listen (unsigned backlog=0)
 Allow clients to connect to this server socket. More...
 
Address local ()
 Query local address. More...
 
void local (Address &addr)
 Query local address. More...
 
ClientHandle accept ()
 Accept new connection. More...
 
std::pair< ClientHandle, Addressacceptfrom ()
 Accept new connection. More...
 
ClientHandle acceptfrom (Address &addr)
 Accept new connection. More...
 
- Public Member Functions inherited from senf::SocketHandle< SPolicy >
template<class OtherPolicy >
IsCompatible< OtherPolicy >::type const & operator= (SocketHandle< OtherPolicy > other)
 Assign from other socket handle checking policy compatibility. More...
 
void state (SocketStateMap &map, unsigned lod=0)
 Inquire state information of socket handle. More...
 
std::string dumpState (unsigned lod=0)
 Format complete state information as string. More...
 
template<class Facet >
Facet & facet ()
 Access a protocol facet. More...
 
 SocketHandle ()
 
template<class OtherPolicy >
 SocketHandle (SocketHandle< OtherPolicy > other, typename IsCompatible< OtherPolicy >::type *=0)
 Convert from other socket handle checking policy compatibility. More...
 
- Public Member Functions inherited from senf::FileHandle
void close ()
 Close filehandle. More...
 
void terminate ()
 Close filehandle ignoring error conditions. More...
 
bool readable () const
 Check, whether a read on the handle would not block (ignoring blocking state) More...
 
bool waitReadable (senf::ClockService::clock_type timeout=senf::ClockService::clock_type(-1)) const
 Wait, until read on the handle would not block (ignoring blocking state) More...
 
bool writeable () const
 Check, whether a write on the handle would not block (ignoring blocking state) More...
 
bool waitWriteable (senf::ClockService::clock_type timeout=senf::ClockService::clock_type(-1)) const
 Wait, until a write on the handle would not block (ignoring blocking state) More...
 
bool oobReadable () const
 Check, whether a read of prioritized data on the handle would not block (ignoring blocking state) More...
 
bool waitOOBReadable (senf::ClockService::clock_type timeout=senf::ClockService::clock_type(-1)) const
 Wait, until read of prioritized data on the handle does not block (ignoring blocking state) More...
 
bool blocking () const
 Return current blocking state. More...
 
void blocking (bool status)
 Set blocking state. More...
 
bool eof () const
 Check EOF condition. More...
 
bool valid () const
 Check filehandle validity. More...
 
bool boolean_test () const
 Short for valid() && ! eof() More...
 
int fd () const
 Return the raw FileHandle. More...
 
int refcount () const
 
bool is_shared () const
 
 FileHandle ()
 
 ~FileHandle ()
 
- Public Member Functions inherited from senf::comparable_safe_bool< class >
 operator bool_type () const
 
bool operator! () const
 

Static Public Member Functions

static ProtocolServerSocketHandle cast_static (FileHandle handle)
 
static ProtocolServerSocketHandle cast_dynamic (FileHandle handle)
 
- Static Public Member Functions inherited from senf::ServerSocketHandle< SocketProtocol::Policy >
static ServerSocketHandle cast_static (FileHandle handle)
 
static ServerSocketHandle cast_dynamic (FileHandle handle)
 
- Static Public Member Functions inherited from senf::SocketHandle< SPolicy >
static SocketHandle cast_static (FileHandle handle)
 
static SocketHandle cast_dynamic (FileHandle handle)
 
- Static Public Member Functions inherited from senf::FileHandle
static FileHandle cast_static (FileHandle handle)
 
static FileHandle cast_dynamic (FileHandle handle)
 

Protected Member Functions

 ProtocolServerSocketHandle (FileHandle other, bool isChecked)
 
- Protected Member Functions inherited from senf::ServerSocketHandle< SocketProtocol::Policy >
 ServerSocketHandle (FileHandle other, bool isChecked)
 
 ServerSocketHandle (std::unique_ptr< SocketBody > body)
 
- Protected Member Functions inherited from senf::SocketHandle< SPolicy >
 SocketHandle (std::unique_ptr< SocketBody > body)
 Initialize SocketHandle providing the protocol. More...
 
 SocketHandle (FileHandle other, bool isChecked)
 Initialize SocketHandle from arbitrary checked FileHandle. More...
 
SocketBody & body ()
 Access socket body. More...
 
SocketBody const & body () const
 Access socket body in const context. More...
 
SocketProtocolprotocol () const
 Access protocol class. More...
 
void assign (FileHandle other)
 
- Protected Member Functions inherited from senf::FileHandle
 FileHandle (std::unique_ptr< FileBody > body)
 create new FileHandle instance More...
 
 FileHandle (FileBody::ptr body)
 
FileBodybody ()
 Access body. More...
 
FileBody const & body () const
 Access body in const context. More...
 
void fd (int fd)
 Set raw filehandle. More...
 
void * extraPtr () const
 get extra data pointer More...
 
void extraPtr (void *ptr)
 set extra data pointer More...
 
- Protected Member Functions inherited from senf::comparable_safe_bool< class >
 ~comparable_safe_bool ()
 
- Protected Member Functions inherited from senf::safe_bool_base
void this_type_does_not_support_comparisons () const
 
 safe_bool_base ()
 
 safe_bool_base (const safe_bool_base &)
 
safe_bool_baseoperator= (const safe_bool_base &)
 
 ~safe_bool_base ()
 

Structors and default members

 ProtocolServerSocketHandle ()
 Create new server socket. More...
 
 ProtocolServerSocketHandle (senf::NoInit_t)
 Create uninitialized socket variable. More...
 

Additional Inherited Members

- Protected Types inherited from senf::safe_bool_base
typedef void(safe_bool_base::* bool_type) () const
 
- Static Protected Member Functions inherited from senf::FileHandle
static FileBodybody (FileHandle &handle)
 Access body of another FileHandle instance. More...
 
static FileBody const & body (FileHandle const &handle)
 Access body of another FileHandle instance in const context. More...
 

Detailed Description

template<class SocketProtocol>
class senf::ProtocolServerSocketHandle< SocketProtocol >

Protocol specific socket handle (server interface)

The ProtocolServerSocketHandle is the server interface leaf class of the handle hierarchy. This is the class to instantiate to open a new socket. This is also the only class, which can be used to open a server socket.

The Protocol template argument defines the protocol of the socket. This protocol provides the protocol interface of the socket as well as the complete socket policy of this protocol.

The ProtocolServerSocketHandle adds the protocol interface as an additional interface to the socket handle. This interface is only accessible via the protocol class. All socket functionality not available through the policy interface (see ServerSocketHandle) is accessible via the protocol() member.

A ProtocolServerSocketHandle is only meaningful for connection oriented addressable protocols (CommunicationPolicy is ConnectedCommunicationPolicy and AddressingPolicy is not NoAddressingPolicy).

See also
The Protocol Classes

Definition at line 34 of file ProtocolClientSocketHandle.hh.

Member Typedef Documentation

◆ Protocol

template<class SocketProtocol >
typedef SocketProtocol senf::ProtocolServerSocketHandle< SocketProtocol >::Protocol

The socket protocol.

Definition at line 64 of file ProtocolServerSocketHandle.hh.

Constructor & Destructor Documentation

◆ ProtocolServerSocketHandle() [1/3]

Create new server socket.

This constructor is one of the possible constructors. The exact Signature of the constructor (or constructors) is defined by the init_server() member (or members) of the Protocol class. ProtocolClientSocketHandle defines a number of constructors taking up to 9 arguments which just forward to a corresponding Protocol::init_server() member. See the documentation of the respective Protocol class for a detailed documentation of that protocols constructors.

◆ ProtocolServerSocketHandle() [2/3]

Create uninitialized socket variable.

This special constructor is called when passing ProtocolServerSocketHandle::Uninitialized as only argument to the constructor. This will create an in-valid() socket handle which can however be assigned later with another socket instance.

Implementation note:
The socket handle will have no body allocated.

◆ ProtocolServerSocketHandle() [3/3]

template<class SocketProtocol >
senf::ProtocolServerSocketHandle< SocketProtocol >::ProtocolServerSocketHandle ( FileHandle  other,
bool  isChecked 
)
protected

Member Function Documentation

◆ accept()

◆ cast_dynamic()

template<class SocketProtocol >
static ProtocolServerSocketHandle senf::ProtocolServerSocketHandle< SocketProtocol >::cast_dynamic ( FileHandle  handle)
static

◆ cast_static()

template<class SocketProtocol >
static ProtocolServerSocketHandle senf::ProtocolServerSocketHandle< SocketProtocol >::cast_static ( FileHandle  handle)
static

◆ dumpState()

template<class SocketProtocol >
std::string senf::ProtocolServerSocketHandle< SocketProtocol >::dumpState ( unsigned  lod = 0)

◆ protocol()

template<class SocketProtocol >
Protocol& senf::ProtocolServerSocketHandle< SocketProtocol >::protocol ( )

Access the protocol interface.

The returned protocol class reference gives access to the complete protocol interface as defined by that class. See the respective protocol class documentation.

Returns
Protocol class reference

◆ state()

template<class SocketProtocol >
void senf::ProtocolServerSocketHandle< SocketProtocol >::state ( SocketStateMap &  map,
unsigned  lod = 0 
)

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