blocxx
|
#include <SocketBaseImpl.hpp>
Public Member Functions | |
SocketBaseImpl () | |
SocketBaseImpl (SocketHandle_t fd, SocketAddress::AddressType addrType) | |
SocketBaseImpl (const SocketAddress &addr) | |
virtual | ~SocketBaseImpl () |
virtual void | connect (const SocketAddress &addr) |
virtual void | disconnect () |
void | setReceiveTimeout (const Timeout &timeout) |
Timeout | getReceiveTimeout () const |
void | setSendTimeout (const Timeout &timeout) |
Timeout | getSendTimeout () const |
void | setConnectTimeout (const Timeout &timeout) |
Timeout | getConnectTimeout () const |
void | setTimeouts (const Timeout &timeout) |
bool | receiveTimeOutExpired () const |
int | write (const void *dataOut, int dataOutLen, ErrorAction errorAsException=E_RETURN_ON_ERROR) |
Write a specified number of bytes to the device that is exposing the IOIFC interface. | |
int | read (void *dataIn, int dataInLen, ErrorAction errorAsException=E_RETURN_ON_ERROR) |
Read a specified number of bytes from the device that is exposing the IOIFC interface. | |
virtual bool | waitForInput (const Timeout &timeout) |
bool | waitForOutput (const Timeout &timeout) |
std::istream & | getInputStream () |
std::ostream & | getOutputStream () |
std::iostream & | getIOStream () |
SocketAddress | getLocalAddress () const |
SocketAddress | getPeerAddress () const |
SocketHandle_t | getfd () const |
Select_t | getSelectObj () const |
bool | isConnected () const |
![]() | |
virtual | ~SelectableIFC () |
![]() | |
virtual | ~IOIFC () |
Static Public Member Functions | |
static void | setDumpFiles (const String &in, const String &out) |
Protected Member Functions | |
virtual int | readAux (void *dataIn, int dataInLen)=0 |
virtual int | writeAux (const void *dataOut, int dataOutLen)=0 |
![]() | |
IntrusiveCountableBase () | |
IntrusiveCountableBase (const IntrusiveCountableBase &) | |
IntrusiveCountableBase & | operator= (const IntrusiveCountableBase &) |
virtual | ~IntrusiveCountableBase () |
Protected Attributes | |
bool | m_isConnected |
SocketHandle_t | m_sockfd |
SocketAddress | m_localAddress |
SocketAddress | m_peerAddress |
Private Member Functions | |
void | fillInetAddrParms () |
void | fillUnixAddrParms () |
SocketBaseImpl (const SocketBaseImpl &arg) | |
SocketBaseImpl & | operator= (const SocketBaseImpl &arg) |
Private Attributes | |
bool | m_recvTimeoutExprd |
SocketStreamBuffer | m_streamBuf |
std::istream | m_in |
std::ostream | m_out |
std::iostream | m_inout |
Timeout | m_recvTimeout |
Timeout | m_sendTimeout |
Timeout | m_connectTimeout |
Static Private Attributes | |
static String | m_traceFileOut |
static String | m_traceFileIn |
Additional Inherited Members | |
![]() | |
enum | ErrorAction { E_THROW_ON_ERROR , E_RETURN_ON_ERROR } |
Definition at line 68 of file SocketBaseImpl.hpp.
BLOCXX_NAMESPACE::SocketBaseImpl::SocketBaseImpl | ( | ) |
Definition at line 97 of file SocketBaseImpl.cpp.
References m_connectTimeout, m_in, m_inout, m_isConnected, m_localAddress, m_out, m_peerAddress, m_recvTimeout, m_recvTimeoutExprd, m_sendTimeout, m_sockfd, and m_streamBuf.
Referenced by operator=(), SocketBaseImpl(), BLOCXX_NAMESPACE::SocketImpl::SocketImpl(), BLOCXX_NAMESPACE::SocketImpl::SocketImpl(), and BLOCXX_NAMESPACE::SocketImpl::SocketImpl().
BLOCXX_NAMESPACE::SocketBaseImpl::SocketBaseImpl | ( | SocketHandle_t | fd, |
SocketAddress::AddressType | addrType ) |
Definition at line 117 of file SocketBaseImpl.cpp.
References BLOCXX_ASSERT, fillInetAddrParms(), fillUnixAddrParms(), BLOCXX_NAMESPACE::SocketAddress::INET, m_connectTimeout, m_in, m_inout, m_isConnected, m_localAddress, m_out, m_peerAddress, m_recvTimeout, m_recvTimeoutExprd, m_sendTimeout, m_sockfd, m_streamBuf, and BLOCXX_NAMESPACE::SocketAddress::UDS.
BLOCXX_NAMESPACE::SocketBaseImpl::SocketBaseImpl | ( | const SocketAddress & | addr | ) |
Definition at line 150 of file SocketBaseImpl.cpp.
References connect(), m_connectTimeout, m_in, m_inout, m_isConnected, m_localAddress, m_out, m_peerAddress, m_recvTimeout, m_recvTimeoutExprd, m_sendTimeout, m_sockfd, and m_streamBuf.
|
virtual |
Definition at line 171 of file SocketBaseImpl.cpp.
References disconnect().
|
private |
References SocketBaseImpl().
|
virtual |
Reimplemented in BLOCXX_NAMESPACE::SSLSocketImpl.
Definition at line 190 of file SocketBaseImpl.cpp.
References BLOCXX_NAMESPACE::TimeoutTimer::asRelativeTimeout(), BLOCXX_ASSERT, BLOCXX_THROW, BLOCXX_THROW_ERRNO_MSG, BLOCXX_NAMESPACE::Format::c_str(), BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::IntrusiveReference< T >::cast_to(), connect(), disconnect(), BLOCXX_NAMESPACE::TimeoutTimer::expired(), fillInetAddrParms(), fillUnixAddrParms(), BLOCXX_NAMESPACE::AutoResource< Policy >::get(), getfd(), BLOCXX_NAMESPACE::SocketAddress::getInetAddress(), BLOCXX_NAMESPACE::PosixUnnamedPipe::getInputHandle(), BLOCXX_NAMESPACE::DateTime::getMicrosecond(), BLOCXX_NAMESPACE::SocketAddress::getNativeForm(), BLOCXX_NAMESPACE::SocketAddress::getNativeFormSize(), BLOCXX_NAMESPACE::Socket::getShutDownMechanism(), BLOCXX_NAMESPACE::SocketAddress::getType(), BLOCXX_NAMESPACE::SocketAddress::INET, BLOCXX_NAMESPACE::TimeoutTimer::loop(), m_connectTimeout, m_in, m_inout, m_isConnected, m_out, m_peerAddress, m_sockfd, m_streamBuf, m_traceFileOut, BLOCXX_NAMESPACE::Array< T >::push_back(), BLOCXX_NAMESPACE::AutoResource< Policy >::release(), BLOCXX_NAMESPACE::Select::SELECT_ERROR, BLOCXX_NAMESPACE::Select::SELECT_TIMEOUT, BLOCXX_NAMESPACE::Select::selectRW(), BLOCXX_NAMESPACE::DateTime::setToCurrent(), BLOCXX_NAMESPACE::Array< T >::size(), BLOCXX_NAMESPACE::TimeoutTimer::start(), BLOCXX_NAMESPACE::Thread::testCancel(), BLOCXX_NAMESPACE::DateTime::toString(), BLOCXX_NAMESPACE::SocketAddress::toString(), BLOCXX_NAMESPACE::SocketAddress::UDS, BLOCXX_NAMESPACE::Select::SelectObject::waitForRead, and BLOCXX_NAMESPACE::Select::SelectObject::waitForWrite.
Referenced by connect(), and SocketBaseImpl().
|
virtual |
Reimplemented in BLOCXX_NAMESPACE::SSLSocketImpl.
Definition at line 355 of file SocketBaseImpl.cpp.
References BLOCXX_LOG_ERROR, BLOCXX_THROW_ERRNO_MSG, BLOCXX_NAMESPACE::String::c_str(), getfd(), BLOCXX_NAMESPACE::DateTime::getMicrosecond(), m_in, m_inout, m_isConnected, m_out, m_sockfd, m_traceFileOut, BLOCXX_NAMESPACE::DateTime::setToCurrent(), and BLOCXX_NAMESPACE::DateTime::toString().
Referenced by connect(), and ~SocketBaseImpl().
|
private |
Definition at line 401 of file SocketBaseImpl.cpp.
References m_localAddress, m_peerAddress, and m_sockfd.
Referenced by connect(), and SocketBaseImpl().
|
private |
Definition at line 423 of file SocketBaseImpl.cpp.
References BLOCXX_THROW_ERRNO_MSG, m_localAddress, m_peerAddress, and m_sockfd.
Referenced by connect(), and SocketBaseImpl().
|
inline |
Definition at line 82 of file SocketBaseImpl.hpp.
References m_connectTimeout.
|
inline |
Definition at line 96 of file SocketBaseImpl.hpp.
References m_sockfd.
Referenced by connect(), disconnect(), read(), and write().
istream & BLOCXX_NAMESPACE::SocketBaseImpl::getInputStream | ( | ) |
Definition at line 574 of file SocketBaseImpl.cpp.
References m_in.
iostream & BLOCXX_NAMESPACE::SocketBaseImpl::getIOStream | ( | ) |
Definition at line 586 of file SocketBaseImpl.cpp.
References m_inout.
|
inline |
Definition at line 94 of file SocketBaseImpl.hpp.
References m_localAddress.
ostream & BLOCXX_NAMESPACE::SocketBaseImpl::getOutputStream | ( | ) |
Definition at line 580 of file SocketBaseImpl.cpp.
References m_out.
|
inline |
Definition at line 95 of file SocketBaseImpl.hpp.
References m_peerAddress.
|
inline |
Definition at line 78 of file SocketBaseImpl.hpp.
References m_recvTimeout.
|
virtual |
Implements BLOCXX_NAMESPACE::SelectableIFC.
Reimplemented in BLOCXX_NAMESPACE::SocketImpl, and BLOCXX_NAMESPACE::SSLSocketImpl.
Definition at line 184 of file SocketBaseImpl.cpp.
References m_sockfd.
|
inline |
Definition at line 80 of file SocketBaseImpl.hpp.
References m_sendTimeout.
|
inline |
Definition at line 98 of file SocketBaseImpl.hpp.
References m_isConnected.
|
private |
References SocketBaseImpl().
|
virtual |
Read a specified number of bytes from the device that is exposing the IOIFC interface.
dataIn | A pointer to a location in memory to put the bytes that have been read. |
dataInLen | The number of bytes being requested from the device. |
errorAsException | If true and an error occurs durring the read operation, then throw an exception. |
An | exception will be thrown upon an error condition if errorAsException is true. |
Implements BLOCXX_NAMESPACE::IOIFC.
Definition at line 494 of file SocketBaseImpl.cpp.
References BLOCXX_THROW_ERRNO_MSG, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::IOIFC::E_THROW_ON_ERROR, getfd(), BLOCXX_NAMESPACE::DateTime::getMicrosecond(), m_isConnected, m_recvTimeout, m_traceFileIn, m_traceFileOut, readAux(), BLOCXX_NAMESPACE::DateTime::setToCurrent(), BLOCXX_NAMESPACE::DateTime::toString(), and waitForInput().
|
protectedpure virtual |
Implemented in BLOCXX_NAMESPACE::SocketImpl, and BLOCXX_NAMESPACE::SSLSocketImpl.
Referenced by read().
|
inline |
Definition at line 84 of file SocketBaseImpl.hpp.
References m_recvTimeoutExprd.
|
inline |
Definition at line 81 of file SocketBaseImpl.hpp.
References m_connectTimeout.
|
static |
Definition at line 593 of file SocketBaseImpl.cpp.
References m_traceFileIn, and m_traceFileOut.
|
inline |
Definition at line 77 of file SocketBaseImpl.hpp.
References m_recvTimeout.
|
inline |
Definition at line 79 of file SocketBaseImpl.hpp.
References m_sendTimeout.
|
inline |
Definition at line 83 of file SocketBaseImpl.hpp.
References m_connectTimeout, m_recvTimeout, and m_sendTimeout.
|
virtual |
Reimplemented in BLOCXX_NAMESPACE::SSLSocketImpl.
Definition at line 553 of file SocketBaseImpl.cpp.
References BLOCXX_NAMESPACE::SocketFlags::E_WAIT_FOR_INPUT, ETIMEDOUT, m_recvTimeoutExprd, m_sockfd, and BLOCXX_NAMESPACE::SocketUtils::waitForIO().
Referenced by read().
bool BLOCXX_NAMESPACE::SocketBaseImpl::waitForOutput | ( | const Timeout & | timeout | ) |
Definition at line 568 of file SocketBaseImpl.cpp.
References BLOCXX_NAMESPACE::SocketFlags::E_WAIT_FOR_OUTPUT, m_sockfd, and BLOCXX_NAMESPACE::SocketUtils::waitForIO().
Referenced by write().
|
virtual |
Write a specified number of bytes to the device that is exposing the IOIFC interface.
dataOut | A pointer to a location in memory that contains the bytes that will be written to the device. |
dataOutLen | The length of the data pointed to by the dataOut param. |
errorAsException | If true and an error occurs durring the write operation, then throw an exception. |
An | exception will be thrown upon an error condition if errorAsException is true. |
Implements BLOCXX_NAMESPACE::IOIFC.
Definition at line 438 of file SocketBaseImpl.cpp.
References BLOCXX_THROW_ERRNO_MSG, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::IOIFC::E_THROW_ON_ERROR, getfd(), BLOCXX_NAMESPACE::DateTime::getMicrosecond(), m_isConnected, m_sendTimeout, m_traceFileOut, BLOCXX_NAMESPACE::DateTime::setToCurrent(), BLOCXX_NAMESPACE::DateTime::toString(), waitForOutput(), and writeAux().
|
protectedpure virtual |
Implemented in BLOCXX_NAMESPACE::SocketImpl, and BLOCXX_NAMESPACE::SSLSocketImpl.
Referenced by write().
|
private |
Definition at line 130 of file SocketBaseImpl.hpp.
Referenced by connect(), getConnectTimeout(), setConnectTimeout(), setTimeouts(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
private |
Definition at line 125 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), getInputStream(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
private |
Definition at line 127 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), getIOStream(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
protected |
Definition at line 104 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), isConnected(), read(), SocketBaseImpl(), SocketBaseImpl(), SocketBaseImpl(), and write().
|
protected |
Definition at line 106 of file SocketBaseImpl.hpp.
Referenced by fillInetAddrParms(), fillUnixAddrParms(), getLocalAddress(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
private |
Definition at line 126 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), getOutputStream(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
protected |
Definition at line 107 of file SocketBaseImpl.hpp.
Referenced by connect(), fillInetAddrParms(), fillUnixAddrParms(), getPeerAddress(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
private |
Definition at line 128 of file SocketBaseImpl.hpp.
Referenced by getReceiveTimeout(), read(), setReceiveTimeout(), setTimeouts(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
private |
Definition at line 123 of file SocketBaseImpl.hpp.
Referenced by receiveTimeOutExpired(), SocketBaseImpl(), SocketBaseImpl(), SocketBaseImpl(), and waitForInput().
|
private |
Definition at line 129 of file SocketBaseImpl.hpp.
Referenced by getSendTimeout(), setSendTimeout(), setTimeouts(), SocketBaseImpl(), SocketBaseImpl(), SocketBaseImpl(), and write().
|
protected |
Definition at line 105 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), fillInetAddrParms(), fillUnixAddrParms(), getfd(), getSelectObj(), BLOCXX_NAMESPACE::SocketImpl::getSelectObj(), BLOCXX_NAMESPACE::SocketImpl::readAux(), SocketBaseImpl(), SocketBaseImpl(), SocketBaseImpl(), waitForInput(), waitForOutput(), and BLOCXX_NAMESPACE::SocketImpl::writeAux().
|
private |
Definition at line 124 of file SocketBaseImpl.hpp.
Referenced by connect(), SocketBaseImpl(), SocketBaseImpl(), and SocketBaseImpl().
|
staticprivate |
Definition at line 133 of file SocketBaseImpl.hpp.
Referenced by read(), and setDumpFiles().
|
staticprivate |
Definition at line 132 of file SocketBaseImpl.hpp.
Referenced by connect(), disconnect(), read(), setDumpFiles(), and write().