class Address

A class describing an IP address

Inheritance:


Public Methods

[more] Address constructors
[more]Comparison Compare (const PObject & obj) const
Compare two adresses
[more]PString AsString () const
Format an address as a string
[more]BOOL FromString ( const PString & str )
Convert string to IP address.
[more] operator PString () const
Format an address as a string
[more] operator in_addr () const
Return IPv4 address in network order
[more] operator in6_addr () const
Return IPv4 address in network order
[more] operator DWORD () const
Return IPv4 address in network order
[more]BYTE Byte1 () const
Return first byte of IPv4 address
[more]BYTE Byte2 () const
Return second byte of IPv4 address
[more]BYTE Byte3 () const
Return third byte of IPv4 address
[more]BYTE Byte4 () const
Return fourth byte of IPv4 address
[more]BYTE operator[] (PINDEX idx) const
return specified byte of IPv4 or IPv6 address
[more]PINDEX GetSize () const
Get the address length (will be either 4 or 16)
[more]const char* GetPointer () const
Get the pointer to IP address data
[more]unsigned GetVersion () const
Get the version of the IP address being used
[more]BOOL IsValid () const
Check address 0000 or ::
[more]BOOL IsLoopback () const
Check address 127001 or ::1
[more]BOOL IsBroadcast () const
Check for Broadcast address 255255255255
[more]BOOL IsV4Mapped () const
Check for v4 mapped i nv6 address ::ffff:abcd

Protected Members

[more]union Runtime test of IP addresse type


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Public Members

Comparison functions


Documentation

A class describing an IP address
o Address constructors

o Address()
Create an IPv4 address with the default address: 127001 (loopback)

o Address(const PString & dotNotation)
Create an IP address from string notation. eg dot notation x.x.x.x. for IPv4, or colon notation x:x:x::xxx for IPv6

o Address(PINDEX len, const BYTE* bytes)
Create an IPv4 or IPv6 address from 4 or 16 byte values

o Address(BYTE b1, BYTE b2, BYTE b3, BYTE b4)
Create an IP address from four byte values

o Address(DWORD dw)
Create an IPv4 address from a four byte value in network byte order

o Address(const in_addr & addr)
Create an IPv4 address from an in_addr structure

o Address(const in6_addr & addr)
Create an IPv6 address from an in_addr structure

o Create an IP (v4 or v6) address from a sockaddr (sockaddr_in,
Create an IP (v4 or v6) address from a sockaddr (sockaddr_in,

oAddress& operator=(const in_addr & addr)
Copy an address from another IP v4 address

oAddress& operator=(const in6_addr & addr)
Copy an address from another IPv6 address

oAddress& operator=(const PString & dotNotation)
Copy an address from a string

oAddress& operator=(DWORD dw)
Copy an address from a four byte value in network order

oComparison Compare(const PObject & obj) const
Compare two adresses

oPString AsString() const
Format an address as a string

oBOOL FromString( const PString & str )
Convert string to IP address. Returns TRUE if was a valid address.

o operator PString() const
Format an address as a string

o operator in_addr() const
Return IPv4 address in network order

o operator in6_addr() const
Return IPv4 address in network order

o operator DWORD() const
Return IPv4 address in network order

oBYTE Byte1() const
Return first byte of IPv4 address

oBYTE Byte2() const
Return second byte of IPv4 address

oBYTE Byte3() const
Return third byte of IPv4 address

oBYTE Byte4() const
Return fourth byte of IPv4 address

oBYTE operator[](PINDEX idx) const
return specified byte of IPv4 or IPv6 address

oPINDEX GetSize() const
Get the address length (will be either 4 or 16)

oconst char* GetPointer() const
Get the pointer to IP address data

ounsigned GetVersion() const
Get the version of the IP address being used

oBOOL IsValid() const
Check address 0000 or ::

oBOOL IsLoopback() const
Check address 127001 or ::1

oBOOL IsBroadcast() const
Check for Broadcast address 255255255255

oBOOL IsV4Mapped() const
Check for v4 mapped i nv6 address ::ffff:abcd

ounion Runtime test of IP addresse type
Runtime test of IP addresse type


This class has no child classes.
Friends:
ostream & operator<<(ostream & s, const Address & a)
istream & operator>>(istream & s, Address & a)

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.