![]() |
VR-Link API Documentation for HLA 1516
|
The DtInetEndpoint class provides a protocol independant, address family independent mechanism to represent the IP address, port, and protocol of one end of a network socket connection. More...
Collaboration diagram for DtInetEndpoint:Public Member Functions | |
| DtInetEndpoint () | |
| Default Constructor. More... | |
| DtInetEndpoint (const DtInetAddr &addr, DtU16 port=0, DtInetProtocol protocol=DtInetProtocol_Unspecified) | |
| Constructor. More... | |
| DtInetEndpoint (DtString &netResLoc, DtU16 port=0, DtInetProtocol protocol=DtInetProtocol_Unspecified, DtInetUtils::DtInetAddrFamily familyHint=DtInetUtils::DtInetAddrFamily_IPv4) | |
| Constructor. More... | |
| virtual | ~DtInetEndpoint () |
| Destructor. More... | |
| DtInetEndpoint (const DtInetEndpoint &orig) | |
| Copy constructor. More... | |
| DtInetEndpoint & | operator= (const DtInetEndpoint &orig) |
| Assignment. More... | |
| virtual void | hostLookup (DtString &addr, DtU16 port=0, DtInetUtils::DtInetAddrFamily familyHint=DtInetUtils::DtInetAddrFamily_Both) |
| Lookup the endpoint information via DNS. More... | |
| virtual void | setEndpoint (DtInetProtocol protocol, const DtInetAddr &addr, DtU16 port) |
| Set all endpoint parameters at once. A new Boost endpoint object will be created. More... | |
| virtual DtInetUtils::DtInetAddrFamily | family () const |
| Get the address family, IPv4 or IPv6. More... | |
| virtual const DtString & | toDtString (bool showProtocol=false) const |
| Return a DtString reporting the address, port, and (optionally) protocol of the endpoint. More... | |
| virtual bool | isOk () |
| Return indication that the endpoint is not in an error state. More... | |
| virtual DtString | getLastErrorString () |
| Return string describing last error and clear error indication. More... | |
| virtual void * | boostEndpoint () |
| Return the Boost endpoint object, regardless of its specific protocol. More... | |
| virtual void | setAddress (const DtInetAddr &addr) |
| Set / get the individual endpoint parameters. More... | |
| virtual const DtInetAddr & | address () const |
| Set / get the individual endpoint parameters. More... | |
| virtual void | setPort (DtU16 port) |
| Set / get the port number of the endpoint. More... | |
| virtual DtU16 | port () const |
| Set / get the port number of the endpoint. More... | |
| virtual void | setProtocol (DtInetProtocol protocol) |
| Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP). More... | |
| virtual DtInetProtocol | protocol () const |
| Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP). More... | |
| virtual bool | isIPv4 () const |
| Return true if the endpoint matches the queried family or protocol. More... | |
| virtual bool | isIPv6 () const |
| Return true if the endpoint matches the queried family or protocol. More... | |
| virtual bool | isTcp () const |
| Return true if the endpoint matches the queried family or protocol. More... | |
| virtual bool | isTls () const |
| Return true if the endpoint matches the queried family or protocol. More... | |
| virtual bool | isUdp () const |
| Return true if the endpoint matches the queried family or protocol. More... | |
| virtual int | toSockaddr (struct sockaddr_in *s) |
| Copy address, port, and family into sockaddr struct in network byte order. More... | |
| virtual int | toSockaddr (struct sockaddr_in6 *s) |
| Copy address, port, and family into sockaddr struct in network byte order. More... | |
| virtual void * | tcpEndpoint () |
| Return the specific Boost endpoint object. More... | |
| virtual void * | tlsEndpoint () |
| Return the specific Boost endpoint object. More... | |
| virtual void * | udpEndpoint () |
| Return the specific Boost endpoint object. More... | |
Protected Member Functions | |
| void | initEndpoint () |
Protected Attributes | |
| void * | myTcpEndpoint |
| void * | myTlsEndpoint |
| void * | myUdpEndpoint |
| DtInetAddr | myAddr |
| DtU16 | myPort |
| DtInetProtocol | myProtocol |
| bool | myError |
| DtString | myLastErrorString |
| bool | myMutableStringsInitialized |
| These are mutable so that the string can be initialized only if needed, but may then be stored to avoid future re-initialization. More... | |
| DtString | myMutableShortString |
| DtString | myMutableFullString |
Friends | |
| bool | operator== (const DtInetEndpoint &ep1, const DtInetEndpoint &ep2) |
| Comparison operator. More... | |
| bool | operator!= (const DtInetEndpoint &ep1, const DtInetEndpoint &ep2) |
| Comparison operator. More... | |
| bool | operator< (const DtInetEndpoint &ep1, const DtInetEndpoint &ep2) |
| Comparison operator. More... | |
| bool | operator> (const DtInetEndpoint &ep1, const DtInetEndpoint &ep2) |
| Comparison operator. More... | |
The DtInetEndpoint class provides a protocol independant, address family independent mechanism to represent the IP address, port, and protocol of one end of a network socket connection.
| DtInetEndpoint::DtInetEndpoint | ( | ) |
Default Constructor.
| DtInetEndpoint::DtInetEndpoint | ( | const DtInetAddr & | addr, |
| DtU16 | port = 0, |
||
| DtInetProtocol | protocol = DtInetProtocol_Unspecified |
||
| ) |
Constructor.
Takes a DtInetAddr representing the address, a protocol identifier, and a port number. Address family is assumed from the addr object. If addr is the ANY address for its family the endpoint will be considered a local endpoint which can be bound to any network interface on the host. If addr specifies the address of one of the local host's assigned IP addresses the endpoint will be a local endpoint which can only be bound to the interface that address is assigned to. The port parameter is optional for local endpoints. If port is not specified an ephemeral port may be selected by the socket this endpoint is associated multicast address the endpoint will be a destination endpoint. The port parameter must be set before a destination endpoint can be assigned to a socket.
| DtInetEndpoint::DtInetEndpoint | ( | DtString & | netResLoc, |
| DtU16 | port = 0, |
||
| DtInetProtocol | protocol = DtInetProtocol_Unspecified, |
||
| DtInetUtils::DtInetAddrFamily | familyHint = DtInetUtils::DtInetAddrFamily_IPv4 |
||
| ) |
Constructor.
Takes a DtString representing a network resource locator, a port number, and a protocol identifier, and an address family hint and attempts to resolve the network resource locator to a host IP address. If the network resource locator contains an IPv4 or IPv6 address the endpoint address family is set to match. If the network resource locator specifies a remote hostname a DNS lookup is performed. If the network resource locator contains a port modifier the value in the network res- ource locator overrides the port parameter passed in the argument list. object. If network resource locator resolves to the local host the endpoint will be a local endpoint which can be bound to all interfaces. However if the network resource locator resolves to the device name of an interface on the localhost the endpoint will adopt the appropriate IP address for that interface based on the family hint. The endpoint can only be bound to the interface that address is assigned to. The port parameter is optional for local endpoints. If port is not specified an ephemeral port may be selected by the socket this endpoint is associated address, broadcast address, or multicast address the endpoint will be a destination endpoint. The port parameter must be set before a destination endpoint can be assigned to a socket.
|
virtual |
Destructor.
| DtInetEndpoint::DtInetEndpoint | ( | const DtInetEndpoint & | orig | ) |
Copy constructor.
|
virtual |
Set / get the individual endpoint parameters.
If the protocol has been initialized, setting any of these parameters will cause a new Boost endpoint object to be created and any old Boost endpoint object safely destroyed. It is advised that the address and port are initialized before setting the protocol to avoid multiple initializations of the Boost endpoint object.Set / get the address of the endpoint. (New Boost endpoint object is created if protocol is already initialized, so set address before protocol if possible).
|
virtual |
Return the Boost endpoint object, regardless of its specific protocol.
|
virtual |
Get the address family, IPv4 or IPv6.
|
virtual |
Return string describing last error and clear error indication.
|
virtual |
Lookup the endpoint information via DNS.
If the protocol has been initialized when hostLookup is called a new Boost endpoint object will be created and any old Boost endpoint object safely destroyed.
|
protected |
|
virtual |
Return true if the endpoint matches the queried family or protocol.
|
virtual |
Return true if the endpoint matches the queried family or protocol.
|
virtual |
Return indication that the endpoint is not in an error state.
Possible errors include: hostname lookup failed, invalid address
|
virtual |
Return true if the endpoint matches the queried family or protocol.
|
virtual |
Return true if the endpoint matches the queried family or protocol.
|
virtual |
Return true if the endpoint matches the queried family or protocol.
| DtInetEndpoint& DtInetEndpoint::operator= | ( | const DtInetEndpoint & | orig | ) |
Assignment.
|
virtual |
Set / get the port number of the endpoint.
(New Boost endpoint object is created if protocol is already initialized, so set port before protocol if possible).
|
virtual |
Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP).
A new (New Boost endpoint object is created when protocol is set).
|
virtual |
Set / get the individual endpoint parameters.
If the protocol has been initialized, setting any of these parameters will cause a new Boost endpoint object to be created and any old Boost endpoint object safely destroyed. It is advised that the address and port are initialized before setting the protocol to avoid multiple initializations of the Boost endpoint object.Set / get the address of the endpoint. (New Boost endpoint object is created if protocol is already initialized, so set address before protocol if possible).
|
virtual |
Set all endpoint parameters at once. A new Boost endpoint object will be created.
|
virtual |
Set / get the port number of the endpoint.
(New Boost endpoint object is created if protocol is already initialized, so set port before protocol if possible).
|
virtual |
Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP).
A new (New Boost endpoint object is created when protocol is set).
|
virtual |
Return the specific Boost endpoint object.
The returned endpoint will be null if this instance's protocol doesn't match
|
virtual |
Return the specific Boost endpoint object.
The returned endpoint will be null if this instance's protocol doesn't match
Return a DtString reporting the address, port, and (optionally) protocol of the endpoint.
The output will resemble one of the following depending upon the family of the address: IPv4: address:port or address:port (TCP | UDP) (address is in dotted decimal notation) IPv6: [address]:port or [address]:port (TCP | UDP) (address is in compact hexadecimal notation, scope included if set)
|
virtual |
Copy address, port, and family into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
|
virtual |
Copy address, port, and family into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
|
virtual |
Return the specific Boost endpoint object.
The returned endpoint will be null if this instance's protocol doesn't match
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
friend |
Comparison operator.
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
These are mutable so that the string can be initialized only if needed, but may then be stored to avoid future re-initialization.
Saves considerable time when setting new endpoint values.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |