![]() |
VR-Link API Documentation for DIS
|
Utility functions for manipulating IP addresses. More...
Classes | |
| struct | DtInetPktHeaderDescriptor |
| The packet header descriptor struct supplants the sizeLength and sizeOffset values. More... | |
Typedefs | |
| typedef std::pair< DtU32, DtInetBufferChain > | DtInetChainEntry |
| typedef std::map < DtInetEndpoint, DtInetChainEntry > | DtInetSockOutboundBundleMap |
| typedef std::pair < DtInetEndpoint, DtInetBuffer * > | DtInetSockInboundBundleEntry |
| typedef std::deque < DtInetSockInboundBundleEntry > | DtInetSockInboundBundleQueue |
| typedef struct DtInetUtils::DtInetPktHeaderDescriptor | DtInetPktHeaderDescriptor |
| The packet header descriptor struct supplants the sizeLength and sizeOffset values. More... | |
InetInterfaceUtils Types | |
| typedef std::vector < DtInetDeviceSP > | DtHostDeviceList |
Enumerations | |
InetAddrUtils Types | |
| enum | DtInetAddrFamily { DtInetAddrFamily_INVALID = 0, DtInetAddrFamily_IPv4 = 4, DtInetAddrFamily_IPv6 = 6, DtInetAddrFamily_Both = 99 } |
Functions | |
| bool | IN6_IS_ADDR_BROADCAST (const struct in6_addr *a) |
| void | setMaxPacketBufferSize (int size) |
| int | getMaxPacketBufferSize () |
| void | initHostNetworkLayer () |
| void | initInetAsyncIoService () |
| void | stopInetAsyncIoService () |
| int | DtInetSockUtilAddToBundle (DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr) |
| Common utility callbacks. More... | |
| int | DtInetSockUtilFlushBundle (DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr) |
| int | DtInetSockUtilUnbundle (DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr) |
| int | DtInetSockUtilQueueBacklog (DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr) |
| int | DtInetSockUtilFlushBacklog (DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr) |
InetAddrUtils Static Functions | |
Accepts a string representing an IPv4 address or IPv6 address, either standalone or as part of a network resource locator string. Returns the equivalent DtInetAddrFamily if the notation conforms to a valid form for the address type. Returns DtInetAddrFamily_INVALID otherwise. Note that if the string is a network resource locator string with a valid address part but an invalid modifier the whole string will be considered invalid. | |
| DtInetAddrFamily | addrStringFamily (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string. More... | |
| bool | isIpv4AddrString (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string. More... | |
| bool | isIpv6AddrString (const DtString &addrString) |
| Accepts a string representing an IPv6 address either standalone or as part of a network resource locator string. More... | |
| bool | isLoopbackAddrString (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string. More... | |
| bool | isLocalhostAddrString (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string. More... | |
| bool | isLinkLocalAddrString (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string. More... | |
| bool | isMulticastAddrString (const DtString &addrString) |
| Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string. More... | |
| bool | isBroadcastAddrString (const DtString &addrString, const DtString &netmaskString="") |
| Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string. More... | |
| DtInetAddrFamily | parseNetResLoc (const DtString &nrl, DtString &parsedNrl, DtString &modifier, int &modifierType) |
| Accept a string reference representing either a network resource locator and parses the string into the hostname, device name, or address with any optional modifier components and indicates what type of modifier was found. More... | |
| bool | parseIpv4NetResLoc (const DtString &nrl, DtString &parsedNrl, DtString &modifier, int &modifierType) |
| Accept a string representing either an IPv4 address in dotted decimal format or an IPv6 address in hexadecimal format with or without modifiers. More... | |
| bool | parseIpv6NetResLoc (const DtString &nrl, DtString &parsedNrl, DtString &modifier, int &modifierType) |
| Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string. More... | |
| DtU32 | prefixLenToIpv4Netmask (DtU32 prefixLen) |
| Convert a CIDR prefix length value to an IPv4 netmask in host byte order. More... | |
| DtU32 | netmaskToPrefixLen (DtU32 netmask) |
| Convert an IPv4 netmask in host byte order to a CIDR prefix length value. More... | |
| DtU32 | convertStringToNetmask (DtString maskString) |
| Accept a string reference representing either an IPv4 netmask in dotted decimal notation or a CIDR prefix length (eg. More... | |
| DtU32 | convertStringToPrefixLen (DtString maskString) |
| Accept a string reference representing either an IPv4 or IPv6 netmask prefix length (eg. More... | |
| DtInetAddr * | getPrimaryBroadcastAddress (bool preferIpv6=false) |
| Attempts to find the primary device capable of broadcast and returns the broadcast address of the device. More... | |
| const char * | removeZoneIndex (char *addrStr) |
| Attempts to remove the zone index from the end of an IP string. More... | |
InetInterfaceUtils Static Functions | |
Returns the current host name as a DtString | |
| DtString | getLocalHostname () |
| Returns a list of DtInetInterface objects representing all IP network interfaces. More... | |
| DtHostDeviceList | scanInetDevices (bool includeUpOnly, bool preferIpV6=false) |
| Returns a list of DtInetInterface objects representing all IP network interfaces. More... | |
| DtHostDeviceList | scanBroadcastDevices (bool includeUpOnly, bool preferIpV6=false) |
| Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 broadcast communication. More... | |
| DtHostDeviceList | scanMulticastDevices (bool includeUpOnly, bool preferIpV6=false) |
| Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 multicast communication. More... | |
| DtHostDeviceList | scanIpv6Devices (bool includeUpOnly) |
| Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv6 communication. More... | |
| DtInetDeviceSP | defaultMulticastDevice () |
| Returns the DtInetInterface object representing the default interface chosen for multicast communication . More... | |
| DtInetDeviceSP | defaultBroadcastDevice (bool preferIpv6=false) |
| Returns the DtInetInterface object representing the default interface chosen for broadcast communication . More... | |
| int | fetchDeviceInfo (DtInetUtils::DtInetAddrFamily type, int sockFd, ifconf *ifc, unsigned int &buffSize, unsigned int &resizeFactor, DtString &errorStr) |
| Returns a block of ifreq structs containing the adapter information associated with devices with an IPv4 address assigned (type argument is ignored and only present for SOLARIS compatibility). More... | |
| struct ifreq * | findInterfaceByName (const char *ifName, int sock, ifconf *ifc) |
| Find a specific IPv4 device from a device configuration list (ifconf) More... | |
| struct ifreq * | findInterfaceByAddress (struct in_addr *ipv4Addr, int sock, ifconf *ifc) |
| Returns a list of DtInetInterface objects representing all IP network interfaces. More... | |
| struct ifreq_in6 * | findIpv6InterfaceByName (const char *ifName, int sock, ifconf *ifc) |
| Find a specific IPv6 device from a device configuration list (ifconf) More... | |
| struct ifreq_in6 * | findIpv6InterfaceByAddress (struct in6_addr *ipv6Addr, int sock, ifconf *ifc) |
| Find a specific IPv6 device from a device configuration list (ifconf) More... | |
Variables | |
| int | theMaxPacketBufferSize |
Utility functions for manipulating IP addresses.
Contains the declaration of miscellaneous platform-specifc functions.
| typedef std::vector<DtInetDeviceSP> DtInetUtils::DtHostDeviceList |
| typedef std::pair<DtU32, DtInetBufferChain> DtInetUtils::DtInetChainEntry |
The packet header descriptor struct supplants the sizeLength and sizeOffset values.
It is referenced when receiving TCP packets or unbundling UDP packets.
| typedef std::pair<DtInetEndpoint, DtInetBuffer*> DtInetUtils::DtInetSockInboundBundleEntry |
| typedef std::deque<DtInetSockInboundBundleEntry> DtInetUtils::DtInetSockInboundBundleQueue |
| typedef std::map<DtInetEndpoint, DtInetChainEntry> DtInetUtils::DtInetSockOutboundBundleMap |
| DtInetAddrFamily DtInetUtils::addrStringFamily | ( | const DtString & | addrString | ) |
Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string.
Returns true if the string is a valid form of an IPv4 address. It does not determine if the address itself is reachable. Examples: 192.168.0.100, 10.0.1.100/24, 172.16.2.200:3000
Accept a string reference representing either an IPv4 netmask in dotted decimal notation or a CIDR prefix length (eg.
"/24") and returns an IPv4 netmask as unsigned 32-bit integer in host byte order. If expressed as a CIDR prefix length the '/' may be omitted.
Accept a string reference representing either an IPv4 or IPv6 netmask prefix length (eg.
"/24" or "/128" ) and returns an unsigned integer representing the prefix length.
| DtInetDeviceSP DtInetUtils::defaultBroadcastDevice | ( | bool | preferIpv6 = false | ) |
Returns the DtInetInterface object representing the default interface chosen for broadcast communication .
| DtInetDeviceSP DtInetUtils::defaultMulticastDevice | ( | ) |
Returns the DtInetInterface object representing the default interface chosen for multicast communication .
| int DtInetUtils::DtInetSockUtilAddToBundle | ( | DtInetSocket * | sock, |
| int | size, | ||
| DtInetBufferChain & | buffChain, | ||
| DtInetEndpoint & | ep, | ||
| void * | usr | ||
| ) |
Common utility callbacks.
All pre- and post- processing callbacks must return the total number of bytes in buffChain after processing or a negative value if an error occurs.
| int DtInetUtils::DtInetSockUtilFlushBacklog | ( | DtInetSocket * | sock, |
| int | size, | ||
| DtInetBufferChain & | buffChain, | ||
| DtInetEndpoint & | ep, | ||
| void * | usr | ||
| ) |
| int DtInetUtils::DtInetSockUtilFlushBundle | ( | DtInetSocket * | sock, |
| int | size, | ||
| DtInetBufferChain & | buffChain, | ||
| DtInetEndpoint & | ep, | ||
| void * | usr | ||
| ) |
| int DtInetUtils::DtInetSockUtilQueueBacklog | ( | DtInetSocket * | sock, |
| int | size, | ||
| DtInetBufferChain & | buffChain, | ||
| DtInetEndpoint & | ep, | ||
| void * | usr | ||
| ) |
| int DtInetUtils::DtInetSockUtilUnbundle | ( | DtInetSocket * | sock, |
| int | size, | ||
| DtInetBufferChain & | buffChain, | ||
| DtInetEndpoint & | ep, | ||
| void * | usr | ||
| ) |
| int DtInetUtils::fetchDeviceInfo | ( | DtInetUtils::DtInetAddrFamily | type, |
| int | sockFd, | ||
| ifconf * | ifc, | ||
| unsigned int & | buffSize, | ||
| unsigned int & | resizeFactor, | ||
| DtString & | errorStr | ||
| ) |
Returns a block of ifreq structs containing the adapter information associated with devices with an IPv4 address assigned (type argument is ignored and only present for SOLARIS compatibility).
If an error occurs function returns -1 and copies error description into errorStr argument if it is not NULL. Note that this routine allocates storage for the ifconf struct which must be released by the calling object.
| struct ifreq* DtInetUtils::findInterfaceByAddress | ( | struct in_addr * | ipv4Addr, |
| int | sock, | ||
| ifconf * | ifc | ||
| ) |
Returns a list of DtInetInterface objects representing all IP network interfaces.
List includes loopback and virtual interfaces. If includeUpOnly set only enabled (UP) interfaces are listed. Setting includeUpOnly to false forces all IP interfaces regardless of state to be included.
| struct ifreq* DtInetUtils::findInterfaceByName | ( | const char * | ifName, |
| int | sock, | ||
| ifconf * | ifc | ||
| ) |
Find a specific IPv4 device from a device configuration list (ifconf)
| struct ifreq_in6* DtInetUtils::findIpv6InterfaceByAddress | ( | struct in6_addr * | ipv6Addr, |
| int | sock, | ||
| ifconf * | ifc | ||
| ) |
Find a specific IPv6 device from a device configuration list (ifconf)
| struct ifreq_in6* DtInetUtils::findIpv6InterfaceByName | ( | const char * | ifName, |
| int | sock, | ||
| ifconf * | ifc | ||
| ) |
Find a specific IPv6 device from a device configuration list (ifconf)
| DtString DtInetUtils::getLocalHostname | ( | ) |
Returns a list of DtInetInterface objects representing all IP network interfaces.
List includes loopback and virtual interfaces. If includeUpOnly set only enabled (UP) interfaces are listed. Setting includeUpOnly to false forces all IP interfaces regardless of state to be included.
| int DtInetUtils::getMaxPacketBufferSize | ( | ) |
| DtInetAddr* DtInetUtils::getPrimaryBroadcastAddress | ( | bool | preferIpv6 = false | ) |
Attempts to find the primary device capable of broadcast and returns the broadcast address of the device.
If the preferIpv6 flag is set to true, it will attempt to get the broadcast address of the primary NIC that's IPv6 capable.
|
inline |
| void DtInetUtils::initHostNetworkLayer | ( | ) |
| void DtInetUtils::initInetAsyncIoService | ( | ) |
| bool DtInetUtils::isBroadcastAddrString | ( | const DtString & | addrString, |
| const DtString & | netmaskString = "" |
||
| ) |
Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string.
Returns true if the address is a broadcast address (IPv4 192.255.255.255, IPv6: ff01::1, ff02::1)
Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string.
Returns true if the string is a valid form of an IPv4 address. It does not determine if the address itself is reachable. Examples: 192.168.0.100, 10.0.1.100/24, 172.16.2.200:3000
Accepts a string representing an IPv6 address either standalone or as part of a network resource locator string.
Returns true if the string is a valid form of an IPv4 address. It does not determine if the address itself is reachable. Examples: 2001:0db8::abcd:ef09/128
Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string.
Returns true if the address is a link-local address (IPv4 169.254.0.0/16, IPv6 fe80::/10)
Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string.
Returns true if the address is a loopback address or is assigned to one of the host network devices.
Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string.
Returns true if the address is the loopback address (IPv4 127.0.0.1, IPv6 0000:0000:0000:0000:0000:0000:0000:0001 and all valid shortforms)
Accepts a string representing an IPv4 address (dotted decimal) or IPv6 address, either standalone or as part of a network resource locator string.
Returns true if the address is a multicast address (IPv4 224.0.0.0/4, IPv6 ff00::/8 - note that in IPv6 this encompasses the 'broadcast' addresses as well, since they are special forms of multicast address)
Convert an IPv4 netmask in host byte order to a CIDR prefix length value.
| bool DtInetUtils::parseIpv4NetResLoc | ( | const DtString & | nrl, |
| DtString & | parsedNrl, | ||
| DtString & | modifier, | ||
| int & | modifierType | ||
| ) |
Accept a string representing either an IPv4 address in dotted decimal format or an IPv6 address in hexadecimal format with or without modifiers.
Returns true if the string matches an acceptable format for the address type. Returns the parsed network resource locator without modifiers in parsedNrl. Returns any port, prefix length, or netmask modifier information in the 'modifier' and 'modifierType' parameters.
| bool DtInetUtils::parseIpv6NetResLoc | ( | const DtString & | nrl, |
| DtString & | parsedNrl, | ||
| DtString & | modifier, | ||
| int & | modifierType | ||
| ) |
Accepts a string representing an IPv4 address (dotted decimal) either standalone or as part of a network resource locator string.
Returns true if the string is a valid form of an IPv4 address. It does not determine if the address itself is reachable. Examples: 192.168.0.100, 10.0.1.100/24, 172.16.2.200:3000
| DtInetAddrFamily DtInetUtils::parseNetResLoc | ( | const DtString & | nrl, |
| DtString & | parsedNrl, | ||
| DtString & | modifier, | ||
| int & | modifierType | ||
| ) |
Accept a string reference representing either a network resource locator and parses the string into the hostname, device name, or address with any optional modifier components and indicates what type of modifier was found.
Returns address family indication if the network resource locator matches a valid format for a network resource locator or DtInetAddrFamily_INVALID if it does not. Returns the parsed network resource locator without modifiers in parsedNrl. Returns any port, prefix length, or netmask modifier information in the 'modifier' and 'modifierType' parameters. Acceptable network resource locator strings include: hostname - string representing a host computer (ie. DNS name) hostname:8080 - hostname with port modifier deviceName - string representing a interface on the local host (eg. eth0) a.b.c.d - IPv4 address, no modifier (modifierType==DtNetResLocType_NONE) a.b.c.d/255.255.0.0 - IPv4 address with netmask modifier a.b.c.d/8 - IPv4 address with prefix length modifier a.b.c.d:8080 - IPv4 address with port modifier 2001:0db8::abcd - IPv6 address, no modifier 2001:0db8::/128 - IPv6 address with netmask modifier [2001:0db8::abcdzone]:8080 - IPv6 address + scope (aka zone) with port modifier (scope is left as part of address string)
Convert a CIDR prefix length value to an IPv4 netmask in host byte order.
| const char* DtInetUtils::removeZoneIndex | ( | char * | addrStr | ) |
Attempts to remove the zone index from the end of an IP string.
This only works in Linux, as it is necessary for many other address calls.
| DtHostDeviceList DtInetUtils::scanBroadcastDevices | ( | bool | includeUpOnly, |
| bool | preferIpV6 = false |
||
| ) |
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 broadcast communication.
List includes virtual interfaces. Note that all IPv6 enabled interfaces MUST be capable of broadcast.
| DtHostDeviceList DtInetUtils::scanInetDevices | ( | bool | includeUpOnly, |
| bool | preferIpV6 = false |
||
| ) |
Returns a list of DtInetInterface objects representing all IP network interfaces.
List includes loopback and virtual interfaces. If includeUpOnly set only enabled (UP) interfaces are listed. Setting includeUpOnly to false forces all IP interfaces regardless of state to be included.
| DtHostDeviceList DtInetUtils::scanIpv6Devices | ( | bool | includeUpOnly | ) |
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv6 communication.
List includes virtual interfaces.
| DtHostDeviceList DtInetUtils::scanMulticastDevices | ( | bool | includeUpOnly, |
| bool | preferIpV6 = false |
||
| ) |
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 multicast communication.
List includes virtual interfaces. Note that all IPv6 enabled interfaces MUST be capable of multicast.
| void DtInetUtils::setMaxPacketBufferSize | ( | int | size | ) |
| void DtInetUtils::stopInetAsyncIoService | ( | ) |
| int DtInetUtils::theMaxPacketBufferSize |