senf::ConcreteSocketProtocol< SocketPolicy, Self > Class Template Referenceabstract

Concrete Socket Protocol implementation base class. More...

#include <senf/Socket/SocketProtocol.hh>

Inheritance diagram for senf::ConcreteSocketProtocol< SocketPolicy, Self >:

Public Types

typedef SocketPolicy Policy
 The protocols policy. More...
 

Public Member Functions

Policy const & policy () const
 Access the policy instance. More...
 
- Public Member Functions inherited from senf::SocketProtocol
virtual unsigned available () const =0
 Return (maximum) number of bytes available for reading without < blocking. More...
 
virtual bool eof () const =0
 Check for end-of-file condition. More...
 
virtual void close ()
 Close socket. More...
 
virtual void terminate () const
 Forcibly close socket. More...
 
virtual void state (SocketStateMap &map, unsigned lod) const
 Return socket state information. More...
 
int fd () const
 Get file descriptor. More...
 
 SocketProtocol ()
 
virtual ~SocketProtocol ()=0
 

Protected Member Functions

ClientSocketHandle< PolicyclientHandle () const
 Get client handle for associated socket. More...
 
ServerSocketHandle< PolicyserverHandle () const
 Get server handle for associated socket. More...
 
- Protected Member Functions inherited from senf::SocketProtocol
FileHandle fh () const
 Get a FileHandle for this instance. More...
 
void fd (int) const
 Initialize file descriptor. More...
 

Structors and default members

 ~ConcreteSocketProtocol ()=0
 

Detailed Description

template<class SocketPolicy, class Self>
class senf::ConcreteSocketProtocol< SocketPolicy, Self >

Concrete Socket Protocol implementation base class.

ConcreteSocketProtocol is the base class of a concrete socket protocol implementation. The final protocol class must inherit from ConcreteSocketProtocol. The template argument SocketPolicy must be set to the complete socket policy of the protocol. Self is the name of the final protocol class which inherits this class.

A protocol implementation may define the protocol interface directly. It can also (additionally) make use of multiple inheritance to combine a set of protocol facets into a specific protocol implementation (i.e. TCPv4SocketProtocol inherits from ConcreteSocketProtocol and from the protocol facets IPv4SocketProtocol, TCPSocketProtocol, BSDSocketProtocol and AddressableBSDSocketProtocol). The protocol facets are not concrete protocols themselves, they are combined to build concrete protocols. This structure will remove a lot of code duplication. It is important to ensure, that the protocol facets do not overlap, since otherwise there will be problems resolving overlapping members.

Documentation request:
init_client init_server

Definition at line 253 of file SocketProtocol.hh.

Member Typedef Documentation

◆ Policy

template<class SocketPolicy, class Self>
typedef SocketPolicy senf::ConcreteSocketProtocol< SocketPolicy, Self >::Policy

The protocols policy.

Definition at line 260 of file SocketProtocol.hh.

Constructor & Destructor Documentation

◆ ~ConcreteSocketProtocol()

template<class SocketPolicy, class Self>
senf::ConcreteSocketProtocol< SocketPolicy, Self >::~ConcreteSocketProtocol ( )
pure virtual

Member Function Documentation

◆ clientHandle()

template<class SocketPolicy, class Self>
ClientSocketHandle<Policy> senf::ConcreteSocketProtocol< SocketPolicy, Self >::clientHandle ( ) const
protected

Get client handle for associated socket.

Returns a client handle for the socket associated with this protocol instance

◆ policy()

template<class SocketPolicy, class Self>
Policy const& senf::ConcreteSocketProtocol< SocketPolicy, Self >::policy ( ) const
virtual

Access the policy instance.

Implements senf::SocketProtocol.

◆ serverHandle()

template<class SocketPolicy, class Self>
ServerSocketHandle<Policy> senf::ConcreteSocketProtocol< SocketPolicy, Self >::serverHandle ( ) const
protected

Get server handle for associated socket.

Returns a server handle for the socket associated with this protocol instance


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