Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

Public Member Functions | Static Public Member Functions | Protected Attributes | Friends

PIPSocket::Address Class Reference

#include <ipsock.h>

Inheritance diagram for PIPSocket::Address:
Inheritance graph
Collaboration diagram for PIPSocket::Address:
Collaboration graph

List of all members.

Public Member Functions

PString AsString () const
 Format an address as a string.
BYTE Byte1 () const
 Return first byte of IPv4 address.
BYTE Byte2 () const
 Return second byte of IPv4 address.
BYTE Byte3 () const
 Return third byte of IPv4 address.
BYTE Byte4 () const
 Return fourth byte of IPv4 address.
Comparison Compare (const PObject &obj) const
 Compare two adresses for absolute (in)equality.
BOOL FromString (const PString &str)
 Convert string to IP address. Returns TRUE if was a valid address.
const char * GetPointer () const
 Get the pointer to IP address data.
PINDEX GetSize () const
 Get the address length (will be either 4 or 16)
unsigned GetVersion () const
 Get the version of the IP address being used.
BOOL IsAny () const
BOOL IsBroadcast () const
 Check for Broadcast address
BOOL IsLoopback () const
 Check address or ::1.
BOOL IsRFC1918 () const
BOOL IsValid () const
 Check address or ::
 operator DWORD () const
 Return IPv4 address in network order.
 operator in_addr () const
 Return IPv4 address in network order.
 operator PString () const
 Format an address as a string.
bool operator!= (int i) const
bool operator!= (const Address &addr) const
bool operator!= (DWORD dw) const
bool operator!= (in_addr &addr) const
bool operator*= (const Address &addr) const
bool operator== (int i) const
bool operator== (const Address &addr) const
bool operator== (in_addr &addr) const
bool operator== (DWORD dw) const
BYTE operator[] (PINDEX idx) const
 return specified byte of IPv4 or IPv6 address
Address constructors
 Address ()
 Create an IPv4 address with the default address: (loopback)
 Address (const PString &dotNotation)
 Address (PINDEX len, const BYTE *bytes)
 Create an IPv4 or IPv6 address from 4 or 16 byte values.
 Address (BYTE b1, BYTE b2, BYTE b3, BYTE b4)
 Create an IP address from four byte values.
 Address (DWORD dw)
 Create an IPv4 address from a four byte value in network byte order.
 Address (const in_addr &addr)
 Create an IPv4 address from an in_addr structure.
Addressoperator= (const in_addr &addr)
 Copy an address from another IP v4 address.
Addressoperator= (const PString &dotNotation)
 Copy an address from a string.
Addressoperator= (DWORD dw)
 Copy an address from a four byte value in network order.
Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const

Static Public Member Functions

static const AddressGetBroadcast ()
static const AddressGetLoopback ()

Protected Attributes

union {
   in_addr   four
unsigned version


ostream & operator<< (ostream &s, const PString &str)
 need this to avoid intepreting string as addresses
ostream & operator<< (ostream &s, const Address &a)
 output IPv6 & IPv4 address as a string to the specified string
istream & operator>> (istream &s, Address &a)
 input IPv4 (not IPv6 yet!) address as a string from the specified string

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
BOOL IsClass (const char *cls) const
virtual BOOL InternalIsDescendant (const char *clsName) const
static const char * Class ()

Comparison functions

virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

I/O functions

virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

Detailed Description

A class describing an IP address

Definition at line 331 of file ipsock.h.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index