A static class for getting information about the local machine's network name and address. More...
#include <glocal.h>
Static Public Member Functions | |
static std::string | hostname () |
Returns the hostname. More... | |
static Address | canonicalAddress () |
Returns the canonical address associated with hostname(). More... | |
static std::string | fqdn () |
Returns the fully-qualified-domain-name. More... | |
static std::string | domainname () |
Returns the fqdn()'s domainname. More... | |
static void | fqdn (const std::string &fqdn_override) |
Sets the fqdn() (and therefore domainname()) override. More... | |
static Address | localhostAddress () |
A convenience function that returns the "127.0.0.1:0" address. More... | |
static bool | isLocal (const Address &) |
Returns true if the given address appears to be local. More... | |
static bool | isLocal (const Address &, std::string &reason) |
An override that returns a helpful message by reference if the address not local. More... | |
A static class for getting information about the local machine's network name and address.
|
static |
Returns the canonical address associated with hostname().
Definition at line 41 of file glocal.cpp.
References G_ASSERT.
|
static |
Returns the fqdn()'s domainname.
Throws if the fqdn() does not contain a domain part.
Definition at line 51 of file glocal.cpp.
References G_DEBUG.
|
static |
Returns the fully-qualified-domain-name.
This is typically implemented by doing a DNS lookup on hostname(), but it is overridable by calling fdqn(string).
Definition at line 67 of file glocal.cpp.
Referenced by GAuth::SaslServerBasicImp::init(), GSmtp::ExecutableVerifier::verify(), and GSmtp::NetworkVerifier::verify().
|
static |
Sets the fqdn() (and therefore domainname()) override.
Definition at line 76 of file glocal.cpp.
|
static |
Returns the hostname.
On unix systems this ususally comes from uname().
Definition at line 33 of file glocal.cpp.
References G::hostname().
|
static |
Returns true if the given address appears to be local.
A simple implementation may compare the given address with localhostAddress() and canonicalAddress().
Definition at line 82 of file glocal.cpp.
Referenced by GPop::Server::newPeer(), GSmtp::Server::newPeer(), and GSmtp::AdminServer::newPeer().
|
static |
An override that returns a helpful message by reference if the address not local.
Definition at line 88 of file glocal.cpp.
References GNet::Address::isLocal().
|
static |
A convenience function that returns the "127.0.0.1:0" address.
Definition at line 62 of file glocal.cpp.
References GNet::Address::localhost().