RWSockAddrBaseRWSockType
Networking Tools: Network Communication Classes (net library)
addressType() as<Addr>() asSockaddr() domain() |
family() familyName() id() is<Addr>() |
operator const RWCString() operator<<() prepare() protocol() |
sockaddrSize() type() |
#include <rw/toolpro/sockaddr.h>
net, tls (and possibly std)
The RWSockAddrBase class is an interface class that represents a socket address. All member functions are pure virtual. A specific derived class is RWInetSockAddr defined in its own header file. The class RWSockAddr is a proxy class that provides an interface to an RWSockAddrBase object whose exact type is known.
virtual RWSockType addressType() const =0;
Returns the type of address.
virtual sockaddr* asSockaddr() const =0;
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 U network communication interface). The pointer is 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.
int domain() const; int family() const;
Returns the integer identifier of the address domain for the socket type (for example, AF_INET for an Internet domain.) family() and domain() are synonyms.
RWCString familyName() const {return familyName_;}
Gets at the pieces that describe the socket type.
RWCString id(unsigned level=0);
Returns a string describing self. The verbosity of the output is controlled by level with level=0 being the most basic output and level=9 the most verbose.
virtual void prepare() const;
Sets up all internal data so that subsequent calls to interfaces on this address do not block.
int protocol() const {return protocol_;}
Gets the pieces that describe the socket type.
virtual size_t sockaddrSize() const =0;
Returns the size of an internal representation of the socket address defined by the sockets.
int type() const {return type_;}
Gets the pieces that describe the socket type.
virtual operator const RWCString () const;
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.
ostream& operator<<(ostream& strm, const RWSockAddrBase& x);
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.
Addr as<Addr>(const RWSockAddr& addr)
Returns addr typed as an Addr. If addr is not of type Addr, an exception is thrown. For compilers that do not support explicit template functions, you can use Addr::as(const RWSockAddr& addr) for each derived type Addr.
RWBoolean is<Addr>(const RWSockAddr& addr)
Returns TRUE if addr is of type Addr. For compilers that do not support explicit template functions, you can use Addr::is(const RWSockAddr& addr) for each derived type Addr.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.