IBR-DTNSuite  0.10
ibrcommon::clientsocket Class Referenceabstract

#include <socket.h>

Inheritance diagram for ibrcommon::clientsocket:
Inheritance graph
Collaboration diagram for ibrcommon::clientsocket:
Collaboration graph

Public Types

enum  CLIENT_OPTION { NO_DELAY = 0, BLOCKING = 1 }
 

Public Member Functions

virtual ~clientsocket ()=0
 
virtual void up () throw (socket_exception)
 
virtual void down () throw (socket_exception)
 
ssize_t send (const char *data, size_t len, int flags=0) throw (socket_error)
 
ssize_t recv (char *data, size_t len, int flags=0) throw (socket_error)
 
void set (CLIENT_OPTION opt, bool val) throw (socket_error)
 
- Public Member Functions inherited from ibrcommon::basesocket
virtual ~basesocket ()=0
 
virtual int fd () const throw (socket_exception)
 
virtual int release () throw (socket_exception)
 
void close () throw (socket_exception)
 
void shutdown (int how) throw (socket_exception)
 
bool ready () const
 
sa_family_t get_family () const throw (socket_exception)
 

Protected Member Functions

 clientsocket ()
 
 clientsocket (int fd)
 
- Protected Member Functions inherited from ibrcommon::basesocket
 basesocket ()
 
 basesocket (int fd)
 
void check_socket_error (const int err) const throw (socket_exception)
 
void check_bind_error (const int err, const std::string &msg="") const throw (socket_exception)
 
void set_blocking_mode (bool val, int fd=-1) const throw (socket_exception)
 
void set_keepalive (bool val, int fd=-1) const throw (socket_exception)
 
void set_linger (bool val, int l=1, int fd=-1) const throw (socket_exception)
 
void set_reuseaddr (bool val, int fd=-1) const throw (socket_exception)
 
void set_nodelay (bool val, int fd=-1) const throw (socket_exception)
 
void init_socket (const vaddress &addr, int type, int protocol) throw (socket_exception)
 
void init_socket (int domain, int type, int protocol) throw (socket_exception)
 
void bind (int fd, struct sockaddr *addr, socklen_t len) throw (socket_exception)
 

Additional Inherited Members

- Static Public Member Functions inherited from ibrcommon::basesocket
static sa_family_t get_family (int fd) throw (socket_exception)
 
static bool hasSupport (const sa_family_t family, const int type=SOCK_DGRAM, const int protocol=0) throw ()
 
- Static Public Attributes inherited from ibrcommon::basesocket
static int DEFAULT_SOCKET_FAMILY = AF_INET6
 
static int DEFAULT_SOCKET_FAMILY_ALTERNATIVE = AF_INET
 
- Protected Types inherited from ibrcommon::basesocket
enum  socketstate { SOCKET_DOWN, SOCKET_UP, SOCKET_UNMANAGED, SOCKET_DESTROYED }
 
- Protected Attributes inherited from ibrcommon::basesocket
socketstate _state
 
int _fd
 
sa_family_t _family
 

Detailed Description

A clientsocket is used if a incoming connection has been accepted by the serversocket.

Definition at line 212 of file socket.h.

Member Enumeration Documentation

Enumerator
NO_DELAY 
BLOCKING 

Definition at line 214 of file socket.h.

Constructor & Destructor Documentation

ibrcommon::clientsocket::~clientsocket ( )
pure virtual

Definition at line 268 of file socket.cpp.

References down().

Here is the call graph for this function:

ibrcommon::clientsocket::clientsocket ( )
protected

Definition at line 259 of file socket.cpp.

ibrcommon::clientsocket::clientsocket ( int  fd)
protected

Definition at line 263 of file socket.cpp.

Member Function Documentation

void ibrcommon::clientsocket::down ( ) throw (socket_exception)
virtual

Close and destroy the file descriptor of this socket assignment.

Exceptions
socket_exceptionif the action has failed

Implements ibrcommon::basesocket.

Reimplemented in ibrcommon::tcpsocket, and ibrcommon::filesocket.

Definition at line 283 of file socket.cpp.

References ibrcommon::basesocket::_state, ibrcommon::basesocket::close(), ibrcommon::basesocket::SOCKET_DESTROYED, and ibrcommon::basesocket::SOCKET_DOWN.

Referenced by ~clientsocket().

Here is the call graph for this function:

ssize_t ibrcommon::clientsocket::recv ( char *  data,
size_t  len,
int  flags = 0 
) throw (socket_error)

Definition at line 316 of file socket.cpp.

References ibrcommon::ERROR_EPIPE, and ibrcommon::ERROR_READ.

Referenced by ibrcommon::socketstream::underflow().

ssize_t ibrcommon::clientsocket::send ( const char *  data,
size_t  len,
int  flags = 0 
) throw (socket_error)
void ibrcommon::clientsocket::set ( CLIENT_OPTION  opt,
bool  val 
) throw (socket_error)

Definition at line 334 of file socket.cpp.

Referenced by dtn::api::ApiServer::componentRun().

void ibrcommon::clientsocket::up ( ) throw (socket_exception)
virtual

Create the file descriptor for this socket and bind to the interface if necessary.

Exceptions
socket_exceptionif the action has failed

Implements ibrcommon::basesocket.

Reimplemented in ibrcommon::tcpsocket, and ibrcommon::filesocket.

Definition at line 275 of file socket.cpp.

References ibrcommon::basesocket::_state, ibrcommon::basesocket::SOCKET_DOWN, and ibrcommon::basesocket::SOCKET_UP.


The documentation for this class was generated from the following files: