Classes | |
class | senf::ServerSocketHandle< SPolicy > |
Generic SocketHandle with server interface. More... | |
class | senf::ClientSocketHandle< SPolicy > |
Generic SocketHandle with client interface. More... | |
class | senf::FileHandle |
Basic file handle wrapper. More... | |
class | senf::ProtocolServerSocketHandle< SocketProtocol > |
Protocol specific socket handle (server interface) More... | |
class | senf::ProtocolClientSocketHandle< SocketProtocol > |
Protocol specific socket handle (client interface) More... | |
class | senf::SocketHandle< SPolicy > |
basic SocketHandle supporting protocol and policy abstraction More... | |
Functions | |
int | retrieve_filehandle (FileHandle handle) |
Adapt FileHandle to senf::scheduler. More... | |
template<class SPolicy > | |
std::ostream & | operator<< (std::ostream &os, SocketHandle< SPolicy > handle) |
Write stream status dump to output stream. More... | |
template<class Target , class Source > | |
Target | static_socket_cast (Source handle) |
static socket (down-)cast More... | |
template<class Target , class Source > | |
Target | dynamic_socket_cast (Source handle) |
dynamic socket (down-)cast More... | |
template<class Target , class Source > | |
bool | check_socket_cast (Source handle) |
dynamically check cast validity More... | |
The senf::FileHandle class is the base of a hierarchy of socket handle classes (realized as templates). These classes provide an interface to the complete socket API. While going down the inheritance hierarchy, the interface will be more and more complete.
The most complete interface is provided by senf::ProtocolClientSocketHandle and senf::ProtocolServerSocketHandle. The template Arguments specifies the Protocol class of the underlying socket type. These are the only classes having public constructors and are therefore the only classes, which may be created by the library user. You will normally use these classes by naming a specific socket typedef (e.g. senf::TCPv4ClientSocketHandle).
However, to aid writing flexible and generic code, the socket library provides the senf::ClientSocketHandle and senf::ServerSocketHandle class templates. These templates implement a family of closely related classes based on the specification of the socket policy. This policy specification may be incomplete (see below). Instances of senf::ClientSocketHandle/senf::ServerSocketHandle can be assigned and converted to different ClientSocketHandle/ServerSocketHandle types as long as the policy specifications are compatible.
|
related |
dynamically check cast validity
This function will check, whether the given cast is valid. This is the same as checking, that dynamic_socket_cast does not throw.
This member is needed, since there is no 'null' SocketHandle (comparable to a null pointer) which could be returned by a non-throwing variant of dynamic_socket_cast.
|
related |
dynamic socket (down-)cast
This function is like dynamic_cast
but for socket handles. It is a runtime typechecked version of static_socket_cast.
std::bad_cast | You have tried to perform an invalid down- or crosscast. |
|
related |
Write stream status dump to output stream.
Write senf::SocketHandle::dumpState() to os
|
related |
Adapt FileHandle to senf::scheduler.
This function will be called by the Scheduler to retrieve the file descriptor of the FileHandle.
|
related |
static socket (down-)cast
This function is like static_cast
but for socket handles. It allows to downcast any FileHandle to any SocketHandle (and its derived types). static_socket_cast will not check the validity of the cast, it will assume, that the cast is valid.
The function will however check, that the cast is possible. Casting between (at compile time) known incompatible types (like casting a SocketHandle with a communication policy of ConnectedCommunicationPolicy to a SocketHandle with UnconnectedCommunicationPolicy will fail at compile time).