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:
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.
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 >>]