Protocol Facets
[The Protocol Classes]


Detailed Description

The protocol facets are classes used as building blocks to build concrete protocol classes. Each protocol facet will implement some functional part of the protocol interface. The protocol facets all inherit from SocketProtocol by public virtual inheritance. This ensures the accessibility of the socket body from all facets.

Classes

class   senf::BSDSocketProtocol
  Protocol facet providing basic BSD socket functionality. More...
class   senf::AddressableBSDSocketProtocol
  Protocol facet providing basic connection oriented BSD socket functions. More...
class   senf::DatagramSocketProtocol
  Protocol facet providing generic BSD datagram socket functionality. More...
class   senf::DVBDemuxSocketProtocol
class   senf::INetSocketProtocol
  Generic addressing type independent INet protocol facet. More...
class   senf::MulticastSocketProtocol
  Generic addressing type independent multicast protocol facet. More...
class   senf::INet4MulticastSocketProtocol
  Multicast protocol facet for INet4 addressable multicast enabled sockets. More...
class   senf::INet6MulticastSocketProtocol
  Multicast protocol facet for INet6 addressable multicast enabled sockets. More...
class   senf::RawINetSocketProtocol
  Protocol facet to support RAW operations upon IPv4/6. More...
class   senf::TCPSocketProtocol
  Protocol facet to support TCP operations. More...
class   senf::UDPSocketProtocol
  Protocol facet to support UDP operations. More...
class   senf::UNSocketProtocol
  Protocol facet providing Unix Domain Addressing related API. More...

Functions

virtual void  senf::UNSocketProtocol::terminate () const
  Forcibly close socket.

Abstract Interface Implementation

unsigned  senf::UNSocketProtocol::available () const
  Return (maximum) number of bytes available for reading < without < blocking.
bool  senf::UNSocketProtocol::eof () const
  Check for end-of-file condition.

Function Documentation

unsigned senf::UNSocketProtocol::
available ()

Return (maximum) number of bytes available for reading < without < blocking.

This member will check in a (very, sigh) protocol dependent way, how many bytes may be read from a socket in a single (non-blocking) read operation. If the socket does not support reading (viz. NotReadablePolicy is set), this member should always return 0.

Depending on the protocol, it may not be possible to return a good value. In this case, an upper bound may be returned (e.g.: When reading from a socket which returns ethernet frames, returning 1500 from available() is ok). However, this should only be done as a last resort. Also beware, that this number should not be too large since the socket layer will always need to allocate that number of bytes for the data to be read.

Implements senf::SocketProtocol.

Definition at line 41 of file UNSocketProtocol.cc.

bool senf::UNSocketProtocol::
eof ()

Check for end-of-file condition.

This is another check which (like available()) is extremely protocol dependent. This member will return true only, if at end-of-file. If the protocol does not support the notion of EOF, this member should always return false.

Implements senf::SocketProtocol.

Definition at line 50 of file UNSocketProtocol.cc.

void senf::UNSocketProtocol::
terminate ()

Forcibly close socket.

This override will automatically shutdown() the socket whenever it is called. Additionally it will disable SO_LINGER to ensure, that v_terminate will not block. Like the overridden method, this member will ignore failures and will never throw. It therefore safe to be called from a destructor.

Reimplemented from senf::SocketProtocol.

Definition at line 63 of file UNSocketProtocol.cc.