Protocol specific socket handle (server interface) More...
#include <senf/Socket/ProtocolClientSocketHandle.hh>
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 | |
Protocol & | protocol () |
Access the protocol interface. More... | |
ProtocolClientSocketHandle< SocketProtocol > | accept () |
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, Address > | acceptfrom () |
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... | |
SocketProtocol & | protocol () 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) | |
FileBody & | body () |
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_base & | operator= (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 FileBody & | body (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... | |
Related Functions inherited from senf::SocketHandle< SPolicy > | |
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... | |
Related Functions inherited from senf::FileHandle | |
int | retrieve_filehandle (FileHandle handle) |
Adapt FileHandle to senf::scheduler. More... | |
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).
Definition at line 34 of file ProtocolClientSocketHandle.hh.
typedef SocketProtocol senf::ProtocolServerSocketHandle< SocketProtocol >::Protocol |
The socket protocol.
Definition at line 64 of file ProtocolServerSocketHandle.hh.
senf::ProtocolServerSocketHandle< SocketProtocol >::ProtocolServerSocketHandle | ( | ) |
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.
senf::ProtocolServerSocketHandle< SocketProtocol >::ProtocolServerSocketHandle | ( | senf::NoInit_t | ) |
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.
body
allocated.
|
protected |
ProtocolClientSocketHandle<SocketProtocol> senf::ProtocolServerSocketHandle< SocketProtocol >::accept | ( | ) |
|
static |
|
static |
std::string senf::ProtocolServerSocketHandle< SocketProtocol >::dumpState | ( | unsigned | lod = 0 | ) |
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.
void senf::ProtocolServerSocketHandle< SocketProtocol >::state | ( | SocketStateMap & | map, |
unsigned | lod = 0 |
||
) |