VR-Link API Documentation for HLA 1.3
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DtInetDevice Class Reference
+ Collaboration diagram for DtInetDevice:

List of all members.

Public Member Functions

 DtInetDevice (const DtInetAddr &addr)
 Basic Constructors.
 DtInetDevice (const DtString &deviceName, DtInetUtils::DtInetAddrFamily fam=DtInetUtils::DtInetAddrFamily_IPv4)
 DtInetDevice (int sock, struct ifreq *devInfo, struct ifreq_in6 *ipv6DevInfo, DtInetUtils::DtInetAddrFamily fam=DtInetUtils::DtInetAddrFamily_IPv4)
 Constructors.
 DtInetDevice (const DtInetDevice &orig)
 Copy Constructor.
DtInetDeviceoperator= (const DtInetDevice &orig)
 Assignment Operator.
virtual ~DtInetDevice ()
 Destructor.
virtual const DtStringdeviceName () const
 Returns a DtString representation of the device name, eg.
virtual const DtInetAddraddr () const
 Returns the IP address of the device corresponding to the default address family the user specified via the constructor.
virtual const DtInetAddrbroadcastAddr () const
 Returns the broadcast IP address of the device corresponding to the default address family the user specified via the constructor.
virtual const DtInetAddripv4Addr () const
 Returns the IPv4 address object for this device.
virtual const DtInetAddripv4Netmask () const
 Returns the IPv4 address object representing the netmask set for this device.
virtual const DtInetAddripv4BroadcastAddr () const
 Returns the IPv4 address object representing the broadcast address set for this device.
virtual const DtInetAddripv6Addr () const
 Returns the IPv6 address object for this device.
virtual const DtInetAddripv6BroadcastAddr () const
 Returns the IPv6 address object representing the broadcast address for this device.
virtual unsigned int macAddr (DtInetMacAddr &mac) const
 Returns size of the device's MAC address with the MAC address in the byte array pointed to by the argument.
virtual const DtStringmacAddrString () const
 Returns a DtString representation of the MAC address.
virtual DtInetIfLinkType type () const
 Returns the device type: Ethernet, loopback, IEEE 1395, FDDI, etc of the device.
virtual unsigned int mtu () const
 Returns MTU (Maximum Transfer Unit) of device.
virtual unsigned int linkState () const
 Returns the link state enum equivalent.
virtual DtInetIpv6Scope linkScope () const
 Returns the link scope of the device (IPv6 only).
virtual unsigned int interfaceIndex () const
 Return the interface index.
virtual bool isOk () const
 Return indication that the device is not in an error state.
virtual const DtStringgetLastErrorString () const
 Return string describing last error and clear error indication.
virtual bool isUp () const
 Return true if the queried condition is met.
virtual bool isActive () const
 Return true if the queried condition is met.
virtual bool isBroadcastCapable () const
 Return true if the queried condition is met.
virtual bool isMulticastCapable () const
 Return true if the queried condition is met.
virtual bool hasIpv4Addr () const
 Return true if the queried condition is met.
virtual bool hasIpv6Addr () const
 Return true if the queried condition is met.

Protected Member Functions

void scanDeviceByName (const DtString &deviceName)
void initMACAddrString ()
void init (int sockFd, struct ifreq *devInfo, struct ifreq_in6 *ipv6DevInfo)

Protected Attributes

DtString myDeviceName
DtInetMacAddr myMACAddr
unsigned int myMACAddrLen
DtString myMACAddrString
DtInetAddrmyIpv4Addr
DtInetAddrmyIpv4Netmask
DtInetAddrmyIpv6Addr
DtInetIpv6Scope myLinkScope
bool myBroadcastEnabled
DtInetAddrmyIpv4BroadcastAddr
DtInetAddrmyIpv6BroadcastAddr
DtInetUtils::DtInetAddrFamily myDefaultAddrFam
bool myMulticastEnabled
std::vector< DtInetAddr * > myIpv4McastAddrList
std::vector< DtInetAddr * > myIpv6McastAddrList
unsigned int myMtu
unsigned int myLinkState
DtInetIfLinkType myLinkHwType
unsigned int myIfIndex
bool myDeviceError
DtString myLastErrorString
unsigned int myIfconfBufferSize
unsigned int myIfconfResizeFactor

Friends

bool operator== (const DtInetDevice &dev1, const DtInetDevice &dev2)
 Comparison Operators.

Constructor & Destructor Documentation

Basic Constructors.

Take a device name (which could be the IP address string) or IP address object (IPv4 or IPv6) and scans the host device list to retrieve interface info.

DtInetDevice::DtInetDevice ( int  sock,
struct ifreq *  devInfo,
struct ifreq_in6 ipv6DevInfo,
DtInetUtils::DtInetAddrFamily  fam = DtInetUtils::DtInetAddrFamily_IPv4 
)

Constructors.

Takes a pointer to a structure containing the host device information. Structures are platform dependent.

Copy Constructor.

virtual DtInetDevice::~DtInetDevice ( ) [virtual]

Destructor.


Member Function Documentation

virtual const DtInetAddr* DtInetDevice::addr ( ) const [virtual]

Returns the IP address of the device corresponding to the default address family the user specified via the constructor.

virtual const DtInetAddr* DtInetDevice::broadcastAddr ( ) const [virtual]

Returns the broadcast IP address of the device corresponding to the default address family the user specified via the constructor.

virtual const DtString& DtInetDevice::deviceName ( ) const [virtual]

Returns a DtString representation of the device name, eg.

eth0, en0 Local Area Connection, etc.

virtual const DtString& DtInetDevice::getLastErrorString ( ) const [virtual]

Return string describing last error and clear error indication.

virtual bool DtInetDevice::hasIpv4Addr ( ) const [virtual]

Return true if the queried condition is met.

virtual bool DtInetDevice::hasIpv6Addr ( ) const [virtual]

Return true if the queried condition is met.

void DtInetDevice::init ( int  sockFd,
struct ifreq *  devInfo,
struct ifreq_in6 ipv6DevInfo 
) [protected]
void DtInetDevice::initMACAddrString ( ) [protected]
virtual unsigned int DtInetDevice::interfaceIndex ( ) const [virtual]

Return the interface index.

Should be used with care, as it can be outdated if interface is restarted.

virtual const DtInetAddr* DtInetDevice::ipv4Addr ( ) const [virtual]

Returns the IPv4 address object for this device.

virtual const DtInetAddr* DtInetDevice::ipv4BroadcastAddr ( ) const [virtual]

Returns the IPv4 address object representing the broadcast address set for this device.

The broadcast address set for the device may not be the same as the default broadcast address derived from the device's IPv4 address class.

virtual const DtInetAddr* DtInetDevice::ipv4Netmask ( ) const [virtual]

Returns the IPv4 address object representing the netmask set for this device.

The set netmask may not be the same as the default netmask associated with the device's IPv4 address class.

virtual const DtInetAddr* DtInetDevice::ipv6Addr ( ) const [virtual]

Returns the IPv6 address object for this device.

virtual const DtInetAddr* DtInetDevice::ipv6BroadcastAddr ( ) const [virtual]

Returns the IPv6 address object representing the broadcast address for this device.

virtual bool DtInetDevice::isActive ( ) const [virtual]

Return true if the queried condition is met.

virtual bool DtInetDevice::isBroadcastCapable ( ) const [virtual]

Return true if the queried condition is met.

virtual bool DtInetDevice::isMulticastCapable ( ) const [virtual]

Return true if the queried condition is met.

virtual bool DtInetDevice::isOk ( ) const [virtual]

Return indication that the device is not in an error state.

Possible errors include: device not found, device not initialized, invalid name

virtual bool DtInetDevice::isUp ( ) const [virtual]

Return true if the queried condition is met.

virtual DtInetIpv6Scope DtInetDevice::linkScope ( ) const [virtual]

Returns the link scope of the device (IPv6 only).

(eg. link-local, global)

virtual unsigned int DtInetDevice::linkState ( ) const [virtual]

Returns the link state enum equivalent.

virtual unsigned int DtInetDevice::macAddr ( DtInetMacAddr mac) const [virtual]

Returns size of the device's MAC address with the MAC address in the byte array pointed to by the argument.

virtual const DtString& DtInetDevice::macAddrString ( ) const [virtual]

Returns a DtString representation of the MAC address.

Uses *nix notation convention (ie. colon separated hexadecimal) or Windows notation convention (ie. dash separated hexadecimal) depending on OS.

virtual unsigned int DtInetDevice::mtu ( ) const [virtual]

Returns MTU (Maximum Transfer Unit) of device.

DtInetDevice& DtInetDevice::operator= ( const DtInetDevice orig)

Assignment Operator.

void DtInetDevice::scanDeviceByName ( const DtString deviceName) [protected]
virtual DtInetIfLinkType DtInetDevice::type ( ) const [virtual]

Returns the device type: Ethernet, loopback, IEEE 1395, FDDI, etc of the device.


Friends And Related Function Documentation

bool operator== ( const DtInetDevice dev1,
const DtInetDevice dev2 
) [friend]

Comparison Operators.


Member Data Documentation

bool DtInetDevice::myDeviceError [protected]
unsigned int DtInetDevice::myIfconfBufferSize [protected]
unsigned int DtInetDevice::myIfconfResizeFactor [protected]
unsigned int DtInetDevice::myIfIndex [protected]
std::vector<DtInetAddr*> DtInetDevice::myIpv4McastAddrList [protected]
std::vector<DtInetAddr*> DtInetDevice::myIpv6McastAddrList [protected]
unsigned int DtInetDevice::myLinkState [protected]
unsigned int DtInetDevice::myMACAddrLen [protected]
unsigned int DtInetDevice::myMtu [protected]

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

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)