SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Friends
RWSockAddrBase Class Referenceabstract

Interface class that represents a socket address. More...

#include <rw/network/RWSockAddrBase.h>

Inheritance diagram for RWSockAddrBase:
RWInet6Addr RWInetAddr RWSockAddr

Public Member Functions

virtual ~RWSockAddrBase ()
 
virtual RWSockType addressType () const =0
 
virtual sockaddr * asSockaddr () const =0
 
int getDomain () const
 
int getFamily () const
 
RWCString getFamilyName () const
 
int getProtocol () const
 
int getType () const
 
virtual RWCString id (unsigned level=0) const =0
 
virtual const RWSockAddrBasemyAddress () const
 
virtual operator RWCString () const
 
virtual void prepare () const
 
virtual size_t sockaddrSize () const =0
 

Friends

std::ostream & operator<< (std::ostream &strm, const RWSockAddrBase &x)
 

Detailed Description

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.

Constructor & Destructor Documentation

virtual RWSockAddrBase::~RWSockAddrBase ( )
virtual

Virtual destructor.

Member Function Documentation

virtual RWSockType RWSockAddrBase::addressType ( ) const
pure virtual

Returns the type of address.

Implemented in RWInetAddr, RWInet6Addr, and RWSockAddr.

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 RWInetAddr, RWInet6Addr, and RWSockAddr.

int RWSockAddrBase::getDomain ( ) const

Alias for 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.

RWCString RWSockAddrBase::getFamilyName ( ) const

Gets the socket family name. The RWCString should contain 7-bit US-ASCII data.

int RWSockAddrBase::getProtocol ( ) const

Gets the socket protocol.

int RWSockAddrBase::getType ( ) const

Gets the socket address type.

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.

virtual const RWSockAddrBase* RWSockAddrBase::myAddress ( ) const
virtual

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.

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.

virtual void RWSockAddrBase::prepare ( ) const
virtual

Sets up all internal data so that subsequent calls to interfaces on this address do not block.

Reimplemented in RWInetAddr, RWSockAddr, and RWInet6Addr.

virtual size_t RWSockAddrBase::sockaddrSize ( ) const
pure virtual

Returns the size of an internal representation of the socket address defined by the sockets.

Implemented in RWInetAddr, RWInet6Addr, and RWSockAddr.

Friends And Related Function Documentation

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.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.