Protocol specific socket handle (client interface) More...
#include <senf/Socket/ProtocolClientSocketHandle.hh>
Public Types | |
typedef SocketProtocol | Protocol |
The sockets protocol. More... | |
Public Types inherited from senf::ClientSocketHandle< 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 ServerSocketHandle< SocketProtocol::Policy > | ServerHandle |
Corresponding server 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... | |
Protocol const & | protocol () const |
void | state (SocketStateMap &map, unsigned lod=0) |
std::string | dumpState (unsigned lod=0) |
Public Member Functions inherited from senf::ClientSocketHandle< SocketProtocol::Policy > | |
void | state (SocketStateMap &map, unsigned lod=0) |
std::string | dumpState (unsigned lod=0) |
unsigned | available () |
ClientSocketHandle () | |
ClientSocketHandle (ClientSocketHandle< OtherPolicy > other) | |
ClientSocketHandle< OtherPolicy > const & | operator= (ClientSocketHandle< OtherPolicy > other) |
std::string | read (unsigned limit=0) |
Read data from socket. More... | |
boost::range_iterator< ForwardWritableRange >::type | read (ForwardWritableRange const &range) |
Read data into range. More... | |
boost::range_iterator< ForwardWritableRange >::type | read (ForwardWritableRange &range) |
Read data into range. More... | |
void | read (Sequence &container, unsigned limit) |
Read data into container. More... | |
char * | read (char *start, char *end) |
Read data into memory area. More... | |
std::pair< std::string, Address > | readfrom (unsigned limit=0) |
Read data from unconnected socket returning address. More... | |
boost::range_iterator< ForwardWritableRange const >::type | readfrom (ForwardWritableRange const &range, Address &from) |
Read data into range. More... | |
boost::range_iterator< ForwardWritableRange >::type | readfrom (ForwardWritableRange &range, Address &from) |
Read data into range. More... | |
void | readfrom (Sequence &container, Address &from, unsigned limit) |
Read data into container. More... | |
char * | readfrom (char *start, char *end, Address &from) |
Read data into memory buffer. More... | |
boost::range_const_iterator< ForwardReadableRange const >::type | write (ForwardReadableRange const &range) |
Write data to socket. More... | |
char const * | write (char const *start, char const *end) |
Write data to socket from memory buffer. More... | |
boost::range_const_iterator< ForwardReadableRange const >::type | writeto (AddressParam addr, ForwardReadableRange const &range) |
Write data to unconnected socket. More... | |
char const * | writeto (AddressParam addr, char const *start, char const *end) |
Write data from memory buffer to unconnected socket. More... | |
boost::optional< typename SocketProtocol::Policy ::ReadPolicy::Buffer > | dequeue () |
Read data from packet queue. More... | |
void | release () |
Release all queue frames to the kernel. More... | |
boost::optional< typename SocketProtocol::Policy ::WritePolicy::Buffer > | enqueue () |
Write data to packet queue. More... | |
bool | send () |
Send all data in the write queue. More... | |
void | connect (AddressParam addr) const |
Connect to remote peer. More... | |
void | bind (AddressParam addr) const |
Set local address. More... | |
Address | peer () const |
Query remote address. More... | |
void | peer (Address &addr) const |
Query remote address. More... | |
Address | local () const |
Query local address. More... | |
void | local (Address &addr) const |
Query local address. 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 ProtocolClientSocketHandle | cast_static (FileHandle handle) |
static ProtocolClientSocketHandle | cast_dynamic (FileHandle handle) |
Static Public Member Functions inherited from senf::ClientSocketHandle< SocketProtocol::Policy > | |
static ClientSocketHandle | cast_static (FileHandle handle) |
static ClientSocketHandle | 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 | |
ProtocolClientSocketHandle (FileHandle other, bool isChecked) | |
Protected Member Functions inherited from senf::ClientSocketHandle< SocketProtocol::Policy > | |
ClientSocketHandle (FileHandle other, bool isChecked) | |
ClientSocketHandle (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 | |
ProtocolClientSocketHandle () | |
Create new client socket. More... | |
ProtocolClientSocketHandle (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 (client interface)
The ProtocolClientSocketHandle is the client 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 client 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 ProtocolClientSocketHandle 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 ClientSocketHandle) is accessible via the protocol() member.
Definition at line 53 of file ProtocolClientSocketHandle.hh.
typedef SocketProtocol senf::ProtocolClientSocketHandle< SocketProtocol >::Protocol |
The sockets protocol.
Definition at line 60 of file ProtocolClientSocketHandle.hh.
senf::ProtocolClientSocketHandle< SocketProtocol >::ProtocolClientSocketHandle | ( | ) |
Create new client socket.
This constructor is one of the possible constructors. The exact Signature of the constructor (or constructors) is defined by the init_client()
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_client()
member. See the documentation of the respective Protocol class for a detailed documentation of that protocols constructors.
senf::ProtocolClientSocketHandle< SocketProtocol >::ProtocolClientSocketHandle | ( | senf::NoInit_t | ) |
Create uninitialized socket variable.
This special constructor is called when passing senf::noinit
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 |
|
static |
|
static |
std::string senf::ProtocolClientSocketHandle< SocketProtocol >::dumpState | ( | unsigned | lod = 0 | ) |
Protocol& senf::ProtocolClientSocketHandle< 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.
Protocol const& senf::ProtocolClientSocketHandle< SocketProtocol >::protocol | ( | ) | const |
void senf::ProtocolClientSocketHandle< SocketProtocol >::state | ( | SocketStateMap & | map, |
unsigned | lod = 0 |
||
) |