WpcAddress Class Reference
[Classes hierarchy]

Class for representation an address associated to a network interface. More...

List of all members.

Public Member Functions

 WpcAddress (WpcAddress const &addr)
 Creates an WpcAddress object as a copy of another.
 WpcAddress (pcap_addr_t const &addr)
 Creates an WpcAddress object as a copy of pcap_addr_t.
 WpcAddress (unsigned int &addr)
 Creates an WpcAddress object from IPv4 address.
WpcAddressoperator= (WpcAddress const &addr)
 Assigns another Address object's contents to this one.
virtual ~WpcAddress ()
 Destroys an Address object.
struct sockaddr const * GetAddress () const
 Gets the address.
string const GetAddressStr () const
 Gets the address as string.
unsigned int GetAddressIP4 ()
 Gets the address as u_int32.
struct sockaddr const * GetNetmask () const
 Gets the netmask corresponding to the address.
string const GetNetmaskStr () const
 Gets the netmask corresponding to the address as string.
struct sockaddr const * GetBcastAddress () const
 Gets the broadcast address corresponding to the address.
string const GetBcastAddressStr () const
 Gets the broadcast address corresponding to the address as string.
struct sockaddr const * GetDestAddress () const
 Gets the destination address corresponding to the address.
string const GetDestAddressStr () const
 Gets the destination address corresponding to the address.
pcap_addr_t * c_obj ()
 Gets the underlying libpcap C structure.
pcap_addr_t const * c_obj () const
 Gets the underlying libpcap C structure.

Private Attributes

pcap_addr_t m_addr_t
 Inherited libpcap's address object.


Detailed Description

Class for representation an address associated to a network interface.

An WpcAddress object represents an address associated to a network interface.

Note that not all the addresses in the list of addresses are necessarily IPv4 or IPv6 addresses: You must check the sa_family member of the struct sockaddr before interpreting the contents of the address

Examples:

wpcGetMac.cpp, and wpcInit.cpp.


Constructor & Destructor Documentation

WpcAddress::WpcAddress ( WpcAddress const &  addr  ) 

Creates an WpcAddress object as a copy of another.

WpcAddress::WpcAddress ( pcap_addr_t const &  addr  ) 

Creates an WpcAddress object as a copy of pcap_addr_t.

WpcAddress::WpcAddress ( unsigned int &  addr  ) 

Creates an WpcAddress object from IPv4 address.

Address must be given in the network order

virtual WpcAddress::~WpcAddress (  )  [inline, virtual]

Destroys an Address object.


Member Function Documentation

pcap_addr_t const* WpcAddress::c_obj (  )  const [inline]

Gets the underlying libpcap C structure.

Returns:
A const pointer to the underlying pcap_addr_t

pcap_addr_t* WpcAddress::c_obj (  )  [inline]

Gets the underlying libpcap C structure.

Returns:
A pointer to the underlying pcap_addr_t

struct sockaddr const* WpcAddress::GetAddress (  )  const [inline, read]

Gets the address.

unsigned int WpcAddress::GetAddressIP4 (  ) 

Gets the address as u_int32.

string const WpcAddress::GetAddressStr (  )  const

Gets the address as string.

Examples:
wpcGetMac.cpp, and wpcInit.cpp.

struct sockaddr const* WpcAddress::GetBcastAddress (  )  const [inline, read]

Gets the broadcast address corresponding to the address.

Returns:
A pointer to the broadcast address, or NULL if the device does not support broadcasts

string const WpcAddress::GetBcastAddressStr (  )  const

Gets the broadcast address corresponding to the address as string.

Returns:
A pointer to the broadcast address, or NULL if the device does not support broadcasts
Examples:
wpcInit.cpp.

struct sockaddr const* WpcAddress::GetDestAddress (  )  const [inline, read]

Gets the destination address corresponding to the address.

Returns:
A pointer to the destination address, or NULL if the device is not a point-to-point one

string const WpcAddress::GetDestAddressStr (  )  const

Gets the destination address corresponding to the address.

Returns:
A pointer to the destination address, or NULL if the device is not a point-to-point one
Examples:
wpcInit.cpp.

struct sockaddr const* WpcAddress::GetNetmask (  )  const [inline, read]

Gets the netmask corresponding to the address.

Returns:
A pointer to the netmask, or NULL

string const WpcAddress::GetNetmaskStr (  )  const

Gets the netmask corresponding to the address as string.

Examples:
wpcInit.cpp.

WpcAddress& WpcAddress::operator= ( WpcAddress const &  addr  )  [inline]

Assigns another Address object's contents to this one.


Member Data Documentation

pcap_addr_t WpcAddress::m_addr_t [private]

Inherited libpcap's address object.



 
©2009 Positive Technologies
 
Generated on Fri May 22 18:17:01 2009 for wpcObj by 
 
 
1.5.7
 
Get wpcObj at SourceForge.net. Fast, secure and Free Open Source software downloads