VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DtInetDevice Class Reference
+ Collaboration diagram for DtInetDevice:

Public Member Functions

 DtInetDevice (const DtInetAddr &addr)
 Basic Constructors. More...
 
 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. More...
 
 DtInetDevice (const DtInetDevice &orig)
 Copy Constructor. More...
 
DtInetDeviceoperator= (const DtInetDevice &orig)
 Assignment Operator. More...
 
virtual ~DtInetDevice ()
 Destructor. More...
 
virtual const DtStringdeviceName () const
 Returns a DtString representation of the device name, eg. More...
 
virtual const DtInetAddraddr () const
 Returns the IP address of the device corresponding to the default address family the user specified via the constructor. More...
 
virtual const DtInetAddrbroadcastAddr () const
 Returns the broadcast IP address of the device corresponding to the default address family the user specified via the constructor. More...
 
virtual const DtInetAddripv4Addr () const
 Returns the IPv4 address object for this device. More...
 
virtual const DtInetAddripv4Netmask () const
 Returns the IPv4 address object representing the netmask set for this device. More...
 
virtual const DtInetAddripv4BroadcastAddr () const
 Returns the IPv4 address object representing the broadcast address set for this device. More...
 
virtual const DtInetAddripv6Addr () const
 Returns the IPv6 address object for this device. More...
 
virtual const DtInetAddripv6BroadcastAddr () const
 Returns the IPv6 address object representing the broadcast address for this device. More...
 
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. More...
 
virtual const DtStringmacAddrString () const
 Returns a DtString representation of the MAC address. More...
 
virtual DtInetIfLinkType type () const
 Returns the device type: Ethernet, loopback, IEEE 1395, FDDI, etc of the device. More...
 
virtual unsigned int mtu () const
 Returns MTU (Maximum Transfer Unit) of device. More...
 
virtual unsigned int linkState () const
 Returns the link state enum equivalent. More...
 
virtual DtInetIpv6Scope linkScope () const
 Returns the link scope of the device (IPv6 only). More...
 
virtual unsigned int interfaceIndex () const
 Return the interface index. More...
 
virtual bool isOk () const
 Return indication that the device is not in an error state. More...
 
virtual const DtStringgetLastErrorString () const
 Return string describing last error and clear error indication. More...
 
virtual bool isUp () const
 Return true if the queried condition is met. More...
 
virtual bool isActive () const
 Return true if the queried condition is met. More...
 
virtual bool isBroadcastCapable () const
 Return true if the queried condition is met. More...
 
virtual bool isMulticastCapable () const
 Return true if the queried condition is met. More...
 
virtual bool hasIpv4Addr () const
 Return true if the queried condition is met. More...
 
virtual bool hasIpv6Addr () const
 Return true if the queried condition is met. More...
 

Static Public Member Functions

static DtInetDevicefindInterface (const DtInetAddr &dest)
 Find the interface to use with the given destination address. More...
 

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. More...
 

Constructor & Destructor Documentation

DtInetDevice::DtInetDevice ( const DtInetAddr addr)

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 ( const DtString deviceName,
DtInetUtils::DtInetAddrFamily  fam = DtInetUtils::DtInetAddrFamily_IPv4 
)
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.

DtInetDevice::DtInetDevice ( const DtInetDevice orig)

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.

static DtInetDevice* DtInetDevice::findInterface ( const DtInetAddr dest)
static

Find the interface to use with the given destination address.

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::myBroadcastEnabled
protected
DtInetUtils::DtInetAddrFamily DtInetDevice::myDefaultAddrFam
protected
bool DtInetDevice::myDeviceError
protected
DtString DtInetDevice::myDeviceName
protected
unsigned int DtInetDevice::myIfconfBufferSize
protected
unsigned int DtInetDevice::myIfconfResizeFactor
protected
unsigned int DtInetDevice::myIfIndex
protected
DtInetAddr* DtInetDevice::myIpv4Addr
protected
DtInetAddr* DtInetDevice::myIpv4BroadcastAddr
protected
std::vector<DtInetAddr*> DtInetDevice::myIpv4McastAddrList
protected
DtInetAddr* DtInetDevice::myIpv4Netmask
protected
DtInetAddr* DtInetDevice::myIpv6Addr
protected
DtInetAddr* DtInetDevice::myIpv6BroadcastAddr
protected
std::vector<DtInetAddr*> DtInetDevice::myIpv6McastAddrList
protected
DtString DtInetDevice::myLastErrorString
protected
DtInetIfLinkType DtInetDevice::myLinkHwType
protected
DtInetIpv6Scope DtInetDevice::myLinkScope
protected
unsigned int DtInetDevice::myLinkState
protected
DtInetMacAddr DtInetDevice::myMACAddr
protected
unsigned int DtInetDevice::myMACAddrLen
protected
DtString DtInetDevice::myMACAddrString
protected
unsigned int DtInetDevice::myMtu
protected
bool DtInetDevice::myMulticastEnabled
protected

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

Document ID: Generated on Tue Feb 2 21:02:17 EST 2021 from SVN revision 223668
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)