54 G_EXCEPTION( InvalidFormat ,
"invalid host:service format" ) ;
59 explicit Location(
const std::string & location_string ,
int family = AF_UNSPEC ) ;
67 std::string
host()
const ;
94 std::string
name()
const ;
113 static std::string head(
const std::string & ) ;
114 static std::string tail(
const std::string & ) ;
115 static bool socked(
const std::string & , std::string & ,
unsigned int & ) ;
116 static std::string sockless(
const std::string & ) ;
120 std::string m_service ;
121 bool m_address_valid ;
125 std::string m_canonical_name ;
128 std::string m_socks_far_host ;
129 unsigned int m_socks_far_port ;
A subsecond-resolution timestamp based on a time_t.
The GNet::Address class encapsulates a TCP/UDP transport address.
bool socks() const
Returns true if a socks location.
std::string displayString() const
Returns a string representation for logging and debug.
A class that holds a host/service name pair and the preferred address family (if any), and also the results of a name-to-address lookup, ie.
bool dgram() const
Returns true if the name resolution should be specifically for datagram sockets.
std::string name() const
Returns the remote canonical name.
void update(const Address &address, const std::string &canonical_name)
Updates the address and canonical name, typically after doing a name lookup on host() and service()...
Address address() const
Returns the remote address.
std::string socksFarHost() const
Returns the port for the socks far server.
bool resolved() const
Returns true after update() has been called.
std::string service() const
Returns the remote service name, as passed in to the constructor.
unsigned int socksFarPort() const
Returns the port number for the socks far server.
int family() const
Returns the preferred name resolution address family, or AF_UNSPEC.
Location(const std::string &host, const std::string &service, int family=AF_UNSPEC)
Constructor taking a host/service string.
void resolveTrivially()
If host() and service() are already in address format then do a trivial update() so that the location...
std::string host() const
Returns the remote host name, as passed in to the constructor.
G::EpochTime updateTime() const
Returns the time of the last update() or zero if never update()d.