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...
|
| | 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 | setAddress (const DtInetAddr &addr) |
| | Set / get the address of the endpoint. More...
|
| |
| virtual const DtInetAddr & | address () const |
| |
| virtual void | setPort (DtU16 port) |
| | Set / get the port number of the endpoint. More...
|
| |
| virtual DtU16 | port () const |
| |
| virtual void | setProtocol (DtInetProtocol protocol) |
| | Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP). More...
|
| |
| virtual DtInetProtocol | protocol () const |
| |
virtual
DtInetUtils::DtInetAddrFamily | family () const |
| | Get the address family, IPv4 or IPv6. More...
|
| |
| virtual void | setEndpoint (DtInetProtocol protocol, const DtInetAddr &addr, DtU16 port) |
| | Set all endpoint parameters at once. 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 * | tcpEndpoint () |
| | Return the appropriate Boost class endpoint object. More...
|
| |
| virtual void * | udpEndpoint () |
| |
|
| 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 | 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...
|
| |
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 |
( |
| ) |
|
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.
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 DtInetEndpoint::~DtInetEndpoint |
( |
| ) |
|
|
virtual |
| virtual const DtInetAddr& DtInetEndpoint::address |
( |
| ) |
const |
|
virtual |
Get the address family, IPv4 or IPv6.
| virtual DtString DtInetEndpoint::getLastErrorString |
( |
| ) |
|
|
virtual |
Return string describing last error and clear error indication.
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.
| void DtInetEndpoint::initEndpoint |
( |
| ) |
|
|
protected |
| virtual bool DtInetEndpoint::isIPv4 |
( |
| ) |
const |
|
virtual |
Return true if the endpoint matches the queried family or protocol.
| virtual bool DtInetEndpoint::isIPv6 |
( |
| ) |
const |
|
virtual |
Return true if the endpoint matches the queried family or protocol.
| virtual bool DtInetEndpoint::isOk |
( |
| ) |
|
|
virtual |
Return indication that the endpoint is not in an error state.
Possible errors include: hostname lookup failed, invalid address
| virtual bool DtInetEndpoint::isTcp |
( |
| ) |
const |
|
virtual |
Return true if the endpoint matches the queried family or protocol.
| virtual bool DtInetEndpoint::isUdp |
( |
| ) |
const |
|
virtual |
Return true if the endpoint matches the queried family or protocol.
| virtual DtU16 DtInetEndpoint::port |
( |
| ) |
const |
|
virtual |
| virtual void DtInetEndpoint::setAddress |
( |
const DtInetAddr & |
addr | ) |
|
|
virtual |
Set / get the address of the endpoint.
If the protocol has been initialized when setAddress is called a new Boost endpoint object will be created and any old Boost endpoint object safely destroyed.
Set all endpoint parameters at once.
A new Boost endpoint object will be created.
| virtual void DtInetEndpoint::setPort |
( |
DtU16 |
port | ) |
|
|
virtual |
Set / get the port number of the endpoint.
If the protocol and address are initialized when setPort is called a new Boost endpoint object will be created and any old Boost endpoint object safely destroyed.
Set / get the protocol (DtInetProtocol_TCP or DtInetProtocol_UDP).
A new Boost endpoint object will be created whenever setProtocol is invoked and any old Boost endpoint object safely destroyed. Nevertheless it is advised that the address and port are initialized before calling setProtocol.
| virtual void* DtInetEndpoint::tcpEndpoint |
( |
| ) |
|
|
virtual |
Return the appropriate Boost class endpoint object.
| virtual const DtString& DtInetEndpoint::toDtString |
( |
bool |
showProtocol = false | ) |
const |
|
virtual |
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 int DtInetEndpoint::toSockaddr |
( |
struct sockaddr_in * |
s | ) |
|
|
virtual |
Copy address, port, and family into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
| virtual int DtInetEndpoint::toSockaddr |
( |
struct sockaddr_in6 * |
s | ) |
|
|
virtual |
Copy address, port, and family into sockaddr struct in network byte order.
Returns 0 on success, -1 on error.
| virtual void* DtInetEndpoint::udpEndpoint |
( |
| ) |
|
|
virtual |
| bool DtInetEndpoint::myError |
|
protected |
| DtString DtInetEndpoint::myLastErrorString |
|
protected |
| DtString DtInetEndpoint::myMutableFullString |
|
mutableprotected |
| DtString DtInetEndpoint::myMutableShortString |
|
mutableprotected |
| bool DtInetEndpoint::myMutableStringsInitialized |
|
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.
| DtU16 DtInetEndpoint::myPort |
|
protected |
| void* DtInetEndpoint::myTcpEndpoint |
|
protected |
| void* DtInetEndpoint::myUdpEndpoint |
|
protected |
The documentation for this class was generated from the following file: