![]() |
VR-Link API Documentation for HLA 1516
|
Represents a IPv4 or IPv6 address. More...
Collaboration diagram for DtInetAddr:Public Member Functions | |
| DtInetAddr (DtInetUtils::DtInetAddrFamily family=DtInetUtils::DtInetAddrFamily_IPv4) | |
| Default Constructor. | |
| DtInetAddr (const struct sockaddr_in6 &addr, DtU32 prefixLen=0) | |
| IPv6 Constructors. | |
| DtInetAddr (const struct sockaddr_storage &addr, DtU32 prefixLen=0) | |
| Constructor taking a sockaddr_storage, which may contain either an IPv4 or IPv6 address. | |
| DtInetAddr (const DtU128 &addr, DtInetUtils::DtInetAddrFamily family, DtU32 prefixLen=0) | |
| Constructor taking a 128-bit value, which may contain either an IPv4 or IPv6 address. | |
| DtInetAddr (void *boostAsioIpAddress) | |
| Constructor taking a boost::asio::ip::address which is abstracted to a void pointer. | |
| virtual | ~DtInetAddr () |
| Destructor. | |
| DtInetAddr (const DtInetAddr &orig) | |
| Copy constructor. | |
| DtInetAddr & | operator= (const DtInetAddr &orig) |
| Assignment. | |
| virtual DtString | toDtString (bool useShortForm=false) const |
| Returns a DtString representation of the address in the appropriate format. | |
| virtual DtInetUtils::DtInetAddrFamily | family () const |
| Returns the family, IPv4 or IPv6, of the address object. | |
| virtual void | setNetmask (DtU32 mask) |
| Set the IPv4 netmask. | |
| virtual DtU32 | netmask () const |
| Return the IPv4 netmask derived from the address class as an unsigned 32-bit integer in host byte order. | |
| virtual void | setPrefixLen (DtU64 prefixLen) |
| Set the IPv4 or IPv6 netmask based on the supplied CIDR prefix length. | |
| virtual DtU64 | prefix () const |
| Return the IPv4 or IPv6 prefix length. | |
| virtual bool | isMulticast () const |
| Return true if the address is a multicast address. | |
| virtual bool | isBroadcast () const |
| Return true if the address is a broadcast address. | |
| virtual bool | isLoopback () const |
| Return true if the address is a loopback address. | |
| virtual bool | isAnyAddr () const |
| Return true if the address represents the INADDR_ANY (or IN6ADDR_ANY) address. | |
| virtual const DtInetAddr * | getBroadcastAddr () |
| Return the default broadcast address associated with the address based on its class & netmask (if IPv4) or link scope (if IPv6) | |
| virtual const DtInetAddr * | getLoopbackAddr () |
| Return the default loopback address based on the family, IPv4 or IPv6. | |
| virtual void | toAddrStorage (struct sockaddr_storage *addrStor) const |
| Stores the address in a sockaddr_storage to be sent in a message. | |
| virtual DtU128 | toU128 () const |
| Return the address value as a DtU128 in host byte order (IPv4 & IPv6). | |
| virtual DtU32 | toULong () const |
| Return the address value as a DtU32 in host byte order (IPv4 only). | |
| virtual void | setScope (DtInetIpv6Scope scopeId) |
| Sets the link scope (IPv6 only). | |
| virtual DtInetIpv6Scope | scope () const |
| Returns the link scope (IPv6 only). | |
| virtual void * | boostAddress () |
| Returns the Boost address class object. | |
| virtual const void * | boostAddress () const |
| DtInetAddr (const DtString &addrString, const DtString &netmaskString="") | |
| Constructors. | |
| DtInetAddr (const char *addrString, const char *netmaskString=NULL) | |
| Constructors. | |
| DtInetAddr (const struct sockaddr_in &addr, DtU32 netmask=0) | |
| IPv4 Constructors. | |
| DtInetAddr (const DtU32 addr, DtU32 netmask=0) | |
| IPv4 Constructors. | |
| virtual bool | isIPv4 () const |
| Return true if the address matches the queried family. | |
| virtual bool | isIPv6 () const |
| Return true if the address matches the queried family. | |
| virtual int | toSockaddr (struct sockaddr_in *s) const |
| Copy address into sockaddr struct in network byte order. | |
| virtual int | toSockaddr (struct sockaddr_in6 *s) const |
| Copy address into sockaddr struct in network byte order. | |
Static Public Member Functions | |
| static const DtInetAddr & | inaddrAny (DtInetUtils::DtInetAddrFamily family=DtInetUtils::DtInetAddrFamily_IPv4) |
| static const DtInetAddr & | loopbackAddress (DtInetUtils::DtInetAddrFamily family=DtInetUtils::DtInetAddrFamily_IPv4) |
Protected Member Functions | |
| void | init () |
| void | initFromStrings (const char *addrString, const char *netmaskString) |
Protected Attributes | |
| void * | myAddr |
| Private data, do not change. | |
| DtU64 | myIpv4Netmask |
| DtU64 | myPrefixLen |
| DtInetAddr * | myBroadcastAddr |
| DtInetAddr * | myLoopbackAddr |
| bool | myIsBroadcast |
| bool | myIsMulticast |
| bool | myIsLoopback |
| bool | myIsAnyAddr |
| DtInetIpv6Scope | myIpv6ScopeId |
Friends | |
| bool | operator== (const DtInetAddr &addr1, const DtInetAddr &addr2) |
| Comparison operator. | |
| bool | operator!= (const DtInetAddr &addr1, const DtInetAddr &addr2) |
| Comparison operator. | |
| bool | operator< (const DtInetAddr &addr1, const DtInetAddr &addr2) |
| Comparison operator. | |
| bool | operator> (const DtInetAddr &addr1, const DtInetAddr &addr2) |
| Comparison operator. | |
Represents a IPv4 or IPv6 address.
| DtInetAddr::DtInetAddr | ( | DtInetUtils::DtInetAddrFamily | family = DtInetUtils::DtInetAddrFamily_IPv4 | ) |
Default Constructor.
Takes an optional address family and creates an INADDR_ANY (IPv4) or IN6ADDR_ANY (IPv6) address
Constructors.
Takes a string representing either IPv4 or IPv6 address and a netmask string. For IPv4 addresses the netmask string can be expressed in either dotted decimal notation (eg. "/255.255.0.0") or as a CIDR prefix length (eg. "/24"). For IPv6 addresses the netmask string must be expressed as a CIDR prefix length. The '/' may be omitted.
| DtInetAddr::DtInetAddr | ( | const char * | addrString, |
| const char * | netmaskString = NULL |
||
| ) |
Constructors.
Takes a string representing either IPv4 or IPv6 address and a netmask string. For IPv4 addresses the netmask string can be expressed in either dotted decimal notation (eg. "/255.255.0.0") or as a CIDR prefix length (eg. "/24"). For IPv6 addresses the netmask string must be expressed as a CIDR prefix length. The '/' may be omitted.
| DtInetAddr::DtInetAddr | ( | const struct sockaddr_in & | addr, |
| DtU32 | netmask = 0 |
||
| ) |
IPv4 Constructors.
If netmask is specified is must be expressed as a 32-bit integer representing the bitmask, not as a prefix length. Use DtInetUtils::prefixLenToIpv4Netmask() to make the conversion.
IPv4 Constructors.
If netmask is specified is must be expressed as a 32-bit integer representing the bitmask, not as a prefix length. Use DtInetUtils::prefixLenToIpv4Netmask() to make the conversion.
| DtInetAddr::DtInetAddr | ( | const struct sockaddr_in6 & | addr, |
| DtU32 | prefixLen = 0 |
||
| ) |
IPv6 Constructors.
| DtInetAddr::DtInetAddr | ( | const struct sockaddr_storage & | addr, |
| DtU32 | prefixLen = 0 |
||
| ) |
Constructor taking a sockaddr_storage, which may contain either an IPv4 or IPv6 address.
| DtInetAddr::DtInetAddr | ( | const DtU128 & | addr, |
| DtInetUtils::DtInetAddrFamily | family, | ||
| DtU32 | prefixLen = 0 |
||
| ) |
Constructor taking a 128-bit value, which may contain either an IPv4 or IPv6 address.
Must specify if it is IPv4 or IPv6, cannot tell otherwise.
| DtInetAddr::DtInetAddr | ( | void * | boostAsioIpAddress | ) |
Constructor taking a boost::asio::ip::address which is abstracted to a void pointer.
|
virtual |
Destructor.
| DtInetAddr::DtInetAddr | ( | const DtInetAddr & | orig | ) |
Copy constructor.
|
virtual |
Returns the Boost address class object.
|
virtual |
|
virtual |
Returns the family, IPv4 or IPv6, of the address object.
|
virtual |
Return the default broadcast address associated with the address based on its class & netmask (if IPv4) or link scope (if IPv6)
|
virtual |
Return the default loopback address based on the family, IPv4 or IPv6.
|
static |
|
protected |
|
protected |
|
virtual |
Return true if the address represents the INADDR_ANY (or IN6ADDR_ANY) address.
|
virtual |
Return true if the address is a broadcast address.
|
virtual |
Return true if the address matches the queried family.
|
virtual |
Return true if the address matches the queried family.
|
virtual |
Return true if the address is a loopback address.
|
virtual |
Return true if the address is a multicast address.
|
static |
|
virtual |
Return the IPv4 netmask derived from the address class as an unsigned 32-bit integer in host byte order.
Returns 0 if called on an IPv6 address object.
| DtInetAddr& DtInetAddr::operator= | ( | const DtInetAddr & | orig | ) |
Assignment.
|
virtual |
Return the IPv4 or IPv6 prefix length.
|
virtual |
Returns the link scope (IPv6 only).
Returns 0 if called on an IPv4 address.
|
virtual |
Set the IPv4 netmask.
Argument must be an unsigned 32-bit integer in host byte order.
|
virtual |
Set the IPv4 or IPv6 netmask based on the supplied CIDR prefix length.
|
virtual |
Sets the link scope (IPv6 only).
|
virtual |
Stores the address in a sockaddr_storage to be sent in a message.
Returns a DtString representation of the address in the appropriate format.
If useShortForm is set to true it will omit the zone index from the IPv6 address string.
|
virtual |
Copy address into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
|
virtual |
Copy address into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
|
virtual |
Return the address value as a DtU128 in host byte order (IPv4 & IPv6).
|
virtual |
Return the address value as a DtU32 in host byte order (IPv4 only).
Returns 0 if the address is not an IPv4 address
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
protected |
Private data, do not change.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |