The SENF Socket Library

The Socket library provides a high level and object oriented abstraction based on the BSD socket API (but not limited to it).


     →  see Overview of the Socket Library Structure
     →  see Using the Socket Library

The socket library abstraction is based on several concepts:

Socket Handles

     →  see The Handle Hierarchy
     →  see Protocol Implementations (Concrete Protocol Classes)

The handle/body architecture provides automatic reference counted management of socket instances. This is the visible interface to the socket library.

Each specific protocol is used primarily via a protocol specific handle (a typedef symbol). However, more generic kinds of handles can be defined for more generic functionality.

The Policy interface

     →  see The Policy Framework

The policy framework configures the exact features, a specific type of socket handle provides. This offers highly efficient access to the most important socket functions (like reading and writing). The policy interface however is a static, non-polymorphic interface.

The Protocol interface

     →  see The Protocol Classes

The protocol interface provides further protocol dependent and (possibly) polymorphic access to further socket functionality. On the other hand, this type of interface is not as flexible, generic and fast as the policy interface.

Auxiliary Addressing classes

     →  see Addressing classes

To supplement the socket library, there are a multitude of addressing classes. These come in two basic groups:

Whereas the protocol specific addresses are custom value types which represent their corresponding low-level address, the socket addresses are based on the corresponding sockaddr structures.

Going further

     →  see Extending the Library
     →  see Implementation notes

The socket library is highly flexible and extensible. The implementation is not restricted to plain BSD sockets: Any type of read/write communication can be wrapped into the socket library (one Example is the TapSocketHandle which provides access to a Linux tap device).