VR-Link JAVA API Documentation
 All Classes Namespaces Files Functions Variables Enumerator Pages
13.7 - Functions for Manipulating IP Addresses

The header file vlutil.h, has a set of functions for obtaining and manipulating IP addresses.

These functions are often useful for generating addresses to use in initializing a DIS exercise connection.

VR-Link represents IP addresses with the DtInetAddr type, which is equivalent to an unsigned 32 bit integer.

DtStringToInetAddr() constructs a DtInetAddr from a string containing the common dot notation for an IP address. For example:

DtInetAddr myAddr = DtStringToInetAddr("207.86.232.1");

DtInetAddrString() goes the other way, returning a string representation of a DtInetAddr.

DtInetAddrOfDevice() returns the IP address of a particular device, specified by its device name. Device names are typically something like le0 or ec0. Similarly, DtNetMaskOfDevice() returns the netmask of a device.

DtInetBroadcastOfDevice() computes and returns the broadcast address of a device, by using those portions of the device's IP address that are covered by the netmask, and setting the lower order bits to 1's. For example, if the IP address of a device is 207.86.232.1, and the netmask is 0xffffff00 (class C network), then the broadcast address will be 207.86.232.255.

Note
On some UNIX platforms, this does not match the erroneous broadcast address reported by ifconfig.

DtFirstHostInetAddr() returns the IP address of the host's primary network device.

DtIsMulticastAddr() returns 1 if the address passed to it is a valid multicast address, that is, one between 224.0.0.0 and 239.255.255.255.

[<< The DtException Class] [Home] [Top of Page] [Miscellaneous Global Functions >>]


Document ID: Generated on Thu Sep 19 02:12:35 EDT 2024 from SVN revision 269601
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)