oasys::IPClient Class Reference

#include <IPClient.h>

Inheritance diagram for oasys::IPClient:

oasys::IPSocket oasys::IOClient oasys::Logger oasys::IOHandlerBase oasys::IOHandlerBase oasys::TCPClient oasys::UDPClient dtn::APIClient oasys::SMTPClient dtn::UDPConvergenceLayer::Receiver List of all members.

Detailed Description

Base class that unifies the IPSocket and IOClient interfaces.

Both TCPClient and UDPClient derive from IPClient.

Definition at line 30 of file IPClient.h.

Public Member Functions

 IPClient (int socktype, const char *logbase, Notifier *intr=0)
 IPClient (int socktype, int sock, in_addr_t remote_addr, u_int16_t remote_port, const char *logbase, Notifier *intr=0)
virtual ~IPClient ()
virtual int read (char *bp, size_t len)
 System call wrappers.
virtual int write (const char *bp, size_t len)
 System call wrappers.
virtual int readv (const struct iovec *iov, int iovcnt)
 System call wrappers.
virtual int writev (const struct iovec *iov, int iovcnt)
 System call wrappers.
virtual int readall (char *bp, size_t len)
 Read/write out the entire supplied buffer, potentially requiring multiple system calls.
virtual int writeall (const char *bp, size_t len)
 Read/write out the entire supplied buffer, potentially requiring multiple system calls.
virtual int readvall (const struct iovec *iov, int iovcnt)
 Read/write out the entire supplied buffer, potentially requiring multiple system calls.
virtual int writevall (const struct iovec *iov, int iovcnt)
 Read/write out the entire supplied buffer, potentially requiring multiple system calls.
virtual int timeout_read (char *bp, size_t len, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_readv (const struct iovec *iov, int iovcnt, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_readall (char *bp, size_t len, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_readvall (const struct iovec *iov, int iovcnt, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_write (const char *bp, size_t len, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_writev (const struct iovec *iov, int iovcnt, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_writeall (const char *bp, size_t len, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int timeout_writevall (const struct iovec *iov, int iovcnt, int timeout_ms)
 Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.
virtual int get_nonblocking (bool *nonblockingp)
 Set the file descriptor's nonblocking status.
virtual int set_nonblocking (bool nonblocking)

Private Member Functions

 IPClient (const IPClient &)
 Prohibited constructor.


Constructor & Destructor Documentation

oasys::IPClient::IPClient ( const IPClient  )  [private]

Prohibited constructor.

oasys::IPClient::IPClient ( int  socktype,
const char *  logbase,
Notifier intr = 0 
)

Definition at line 27 of file IPClient.cc.

oasys::IPClient::IPClient ( int  socktype,
int  sock,
in_addr_t  remote_addr,
u_int16_t  remote_port,
const char *  logbase,
Notifier intr = 0 
)

Definition at line 31 of file IPClient.cc.

oasys::IPClient::~IPClient (  )  [virtual]

Definition at line 38 of file IPClient.cc.


Member Function Documentation

int oasys::IPClient::read ( char *  bp,
size_t  len 
) [virtual]

System call wrappers.

Implements oasys::IOClient.

Definition at line 41 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::LOG_DEBUG, oasys::Logger::logf(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::Random::rand(), oasys::IO::read(), and oasys::IO::READV.

Referenced by dtn::APIClient::handle_begin_poll(), dtn::APIClient::handle_recv(), dtn::TCPConvergenceLayer::Connection::recv_data(), dtntunnel::TCPTunnel::Connection::run(), and dtn::APIClient::run().

int oasys::IPClient::write ( const char *  bp,
size_t  len 
) [virtual]

System call wrappers.

Implements oasys::IOClient.

Definition at line 69 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::write(), and oasys::IO::WRITEV.

Referenced by dtn::UDPConvergenceLayer::Sender::send_bundle(), and dtn::TCPConvergenceLayer::Connection::send_data().

int oasys::IPClient::readv ( const struct iovec *  iov,
int  iovcnt 
) [virtual]

System call wrappers.

Implements oasys::IOClient.

Definition at line 60 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::readv().

int oasys::IPClient::writev ( const struct iovec *  iov,
int  iovcnt 
) [virtual]

System call wrappers.

Implements oasys::IOClient.

Definition at line 78 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::WRITEV, and oasys::IO::writev().

int oasys::IPClient::readall ( char *  bp,
size_t  len 
) [virtual]

Read/write out the entire supplied buffer, potentially requiring multiple system calls.

Returns:
the total number of bytes read/written, or -1 on error

Implements oasys::IOClient.

Definition at line 87 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::readall(), and oasys::IO::READV.

Referenced by dtn::APIClient::handle_handshake(), and dtn::APIClient::run().

int oasys::IPClient::writeall ( const char *  bp,
size_t  len 
) [virtual]

Read/write out the entire supplied buffer, potentially requiring multiple system calls.

Returns:
the total number of bytes read/written, or -1 on error

Implements oasys::IOClient.

Definition at line 96 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::writeall(), and oasys::IO::WRITEV.

Referenced by dtn::APIClient::handle_handshake(), dtntunnel::TCPTunnel::Connection::run(), and dtn::APIClient::send_response().

int oasys::IPClient::readvall ( const struct iovec *  iov,
int  iovcnt 
) [virtual]

Read/write out the entire supplied buffer, potentially requiring multiple system calls.

Returns:
the total number of bytes read/written, or -1 on error

Implements oasys::IOClient.

Definition at line 105 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::readvall().

int oasys::IPClient::writevall ( const struct iovec *  iov,
int  iovcnt 
) [virtual]

Read/write out the entire supplied buffer, potentially requiring multiple system calls.

Returns:
the total number of bytes read/written, or -1 on error

Implements oasys::IOClient.

Definition at line 114 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::WRITEV, and oasys::IO::writevall().

int oasys::IPClient::timeout_read ( char *  bp,
size_t  len,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 123 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::timeout_read().

int oasys::IPClient::timeout_readv ( const struct iovec *  iov,
int  iovcnt,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 133 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::timeout_readv().

int oasys::IPClient::timeout_readall ( char *  bp,
size_t  len,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 143 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::timeout_readall().

int oasys::IPClient::timeout_readvall ( const struct iovec *  iov,
int  iovcnt,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 153 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::READV, and oasys::IO::timeout_readvall().

int oasys::IPClient::timeout_write ( const char *  bp,
size_t  len,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 163 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::timeout_write(), and oasys::IO::WRITEV.

int oasys::IPClient::timeout_writev ( const struct iovec *  iov,
int  iovcnt,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 173 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::timeout_writev(), and oasys::IO::WRITEV.

int oasys::IPClient::timeout_writeall ( const char *  bp,
size_t  len,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 183 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::timeout_writeall(), and oasys::IO::WRITEV.

int oasys::IPClient::timeout_writevall ( const struct iovec *  iov,
int  iovcnt,
int  timeout_ms 
) [virtual]

Try to read/write the specified number of bytes, but don't block for more than timeout milliseconds.

Returns:
the number of bytes read/written or the appropriate IOTimeoutReturn_t code

Implements oasys::IOClient.

Definition at line 193 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IOHandlerBase::get_notifier(), oasys::Logger::logpath_, oasys::IOHandlerBase::monitor(), oasys::IO::timeout_writevall(), and oasys::IO::WRITEV.

int oasys::IPClient::get_nonblocking ( bool nonblockingp  )  [virtual]

Set the file descriptor's nonblocking status.

Implements oasys::IOClient.

Definition at line 203 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::IO::get_nonblocking(), and oasys::Logger::logpath_.

int oasys::IPClient::set_nonblocking ( bool  nonblocking  )  [virtual]

Implements oasys::IOClient.

Definition at line 210 of file IPClient.cc.

References oasys::IPSocket::fd_, oasys::Logger::logpath_, and oasys::IO::set_nonblocking().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 12:54:35 2007 for DTN Reference Implementation by  doxygen 1.5.1