Interface class that represents a socket address.
More...
#include <rw/network/RWSockAddrBase.h>
RWSockAddrBase is an interface class that represents a socket address. All member functions are virtual. The class RWSockAddr is a proxy class that provides an interface to an RWSockAddrBase object whose exact type can be known only at run time.
◆ ~RWSockAddrBase()
virtual RWSockAddrBase::~RWSockAddrBase |
( |
| ) |
|
|
virtual |
◆ addressType()
virtual RWSockType RWSockAddrBase::addressType |
( |
| ) |
const |
|
pure virtual |
◆ asSockaddr()
virtual sockaddr * RWSockAddrBase::asSockaddr |
( |
| ) |
const |
|
pure virtual |
Returns a pointer to an internal representation of the address cast to a sockaddr
structure, as defined by the sockets and TLI APIs (TLI is the Unix System V network communication interface). The pointer points to an internal data structure, so it becomes invalid if this object is changed in any way or goes out of scope. If the address has no representation as a sockaddr
, a null pointer is returned. These operations may block if prepare() has not been called.
Implemented in RWInet6Addr, RWInetAddr, and RWSockAddr.
◆ getDomain()
int RWSockAddrBase::getDomain |
( |
| ) |
const |
◆ getFamily()
int RWSockAddrBase::getFamily |
( |
| ) |
const |
Returns the integer identifier of the address domain for the socket type, such as AF_INET
for an Internet domain.
◆ getFamilyName()
RWCString RWSockAddrBase::getFamilyName |
( |
| ) |
const |
Gets the socket family name. The RWCString should contain 7-bit US-ASCII data.
◆ getProtocol()
int RWSockAddrBase::getProtocol |
( |
| ) |
const |
Gets the socket protocol.
◆ getType()
int RWSockAddrBase::getType |
( |
| ) |
const |
Gets the socket address type.
◆ id()
virtual RWCString RWSockAddrBase::id |
( |
unsigned | level = 0 | ) |
const |
|
pure virtual |
Returns a string describing self. The verbosity of the output is controlled by level where level=0
is the most basic output, and level=9
is the most verbose. The RWCString should contain 7-bit US-ASCII data.
Implemented in RWInet6Addr, RWInetAddr, and RWSockAddr.
◆ myAddress()
Used by derived classes to implement narrowing conversions from an RWSockAddr or an RWSockAddrBase to a derived address type. It returns this
, unless this
address is a proxy, in which case it returns the pointer to the base class of the object being proxied.
Reimplemented in RWSockAddr.
◆ operator RWCString()
virtual RWSockAddrBase::operator RWCString |
( |
| ) |
const |
|
virtual |
Conversion operator. Converts its address to an RWCString. This operator is similar to the id() function, but it can be used for implicit conversion to an RWCString. The RWCString should contain 7-bit US-ASCII data.
◆ prepare()
virtual void RWSockAddrBase::prepare |
( |
| ) |
const |
|
virtual |
◆ sockaddrSize()
virtual size_t RWSockAddrBase::sockaddrSize |
( |
| ) |
const |
|
pure virtual |
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | strm, |
|
|
const RWSockAddrBase & | x ) |
|
friend |
Outputs a representation of x on strm. The representation is generated using the member function x.id() with level=0
.
- Note
- This class does not have an extraction (>>) operator.