#include <Util.h>
Most of these have to do with DNS, MaceAddr, SockAddr, and error strings
Definition at line 64 of file Util.h.
Static Public Member Functions | |
static const MaceAddr & | getMaceAddr () throw (AddressException) |
method to get the local MaceAddr | |
static int | getAddr () throw (AddressException) |
method to get the local ipaddress as a packed int | |
static int | getAddr (const std::string &hostname) throw (AddressException) |
method to convert a string (ip or hostname) into a packed int IP. | |
static uint16_t | getPort () |
return the default port (params::MACE_PORT, the port from params::MACE_LOCAL_ADDRESS, or the DEFAULT_MACE_PORT otherwise) | |
static int | getHostByName (const std::string &hostname) throw (AddressException) |
equivalent to getAddr(const std::string&) | |
static MaceAddr | getMaceAddr (const std::string &hostname) throw (AddressException) |
translate the address string into a MaceAddr | |
static std::string | getHostname () |
return the local hostname | |
static bool | isPrivateAddr (uint32_t a) |
takes a packed int, determines if it is a private IP. | |
static bool | isHostReachable (const MaceKey &k) |
static std::string | getHostname (const MaceKey &k) throw (AddressException) |
returns the hostname of the key if the host can be directly routed to. | |
static std::string | getHostname (const std::string &ipaddr) throw (AddressException) |
return the hostname of the IP address | |
static std::string | getHostname (int ipaddr) |
return the hostname of the IP address | |
static std::string | getHostByAddr (int ipaddr) |
equivalent to getHostname(int) | |
static std::string | getAddrString (int ipaddr) |
returns the IP address as a string | |
static std::string | getAddrString (const std::string &hostname) throw (AddressException) |
returns the IP address as a string | |
static std::string | getAddrString (const MaceAddr &addr, bool resolve=true) |
prints the address string of the MaceAddr, optionally use DNS | |
static std::string | getAddrString (const SockAddr &addr, bool resolve=true) |
prints the address string of the SockAddr, optionally use DNS | |
static void | printAddrString (std::ostream &out, const MaceAddr &addr, bool resolve=true) |
prints the address string to an ostream optionally using DNS | |
static void | printAddrString (std::ostream &out, const SockAddr &addr, bool resolve=true) |
prints the address string to an ostream optionally using DNS | |
static void | printAddrString (std::ostream &out, const std::string &hostname) throw (AddressException) |
prints the address string to an ostream optionally using DNS | |
static void | printAddrString (std::ostream &out, int ipaddr) |
prints the address string to an ostream optionally using DNS | |
static std::string | getErrorString (int err) |
return an error string for an error code (a la strerror()) | |
static std::string | getSslErrorString () |
return the SSL last error string | |
Static Public Attributes | |
static const uint16_t | DEFAULT_MACE_PORT = 5377 |
The default port if none is provided. | |
static const bool | REPLAY = false |
UNUSED. Designed for a flag indicating replay. |
bool Util::isPrivateAddr | ( | uint32_t | a | ) | [static] |
bool Util::isHostReachable | ( | const MaceKey & | k | ) | [static] |
either params::MACE_ALL_HOSTS_REACHABLE, or address has either a valid proxy or local address
Definition at line 864 of file Util.cc.
References getMaceAddr(), params::MACE_ALL_HOSTS_REACHABLE, and SockUtil::NULL_MSOCKADDR.
Referenced by getHostname().
std::string Util::getHostname | ( | const MaceKey & | k | ) | throw (AddressException) [static] |
returns the hostname of the key if the host can be directly routed to.
throws an UnreachablePrivateAddressException if the host can only be reached through the proxy address
Definition at line 886 of file Util.cc.
References getHostname(), getMaceAddr(), isHostReachable(), and SockUtil::NULL_MSOCKADDR.
std::string Util::getAddrString | ( | const MaceAddr & | addr, | |
bool | resolve = true | |||
) | [static] |
prints the address string of the MaceAddr, optionally use DNS
Address string format is one of
Definition at line 754 of file Util.cc.
References printAddrString().
std::string Util::getAddrString | ( | const SockAddr & | addr, | |
bool | resolve = true | |||
) | [static] |
prints the address string of the SockAddr, optionally use DNS
Address string format is one of
Definition at line 768 of file Util.cc.
References printAddrString().
void Util::printAddrString | ( | std::ostream & | out, | |
const MaceAddr & | addr, | |||
bool | resolve = true | |||
) | [static] |
prints the address string to an ostream optionally using DNS
Address string format is one of
Definition at line 760 of file Util.cc.
References SockUtil::NULL_MSOCKADDR.
Referenced by getAddrString(), and printAddrString().
void Util::printAddrString | ( | std::ostream & | out, | |
const SockAddr & | addr, | |||
bool | resolve = true | |||
) | [static] |
prints the address string to an ostream optionally using DNS
Address string format is one of
Definition at line 774 of file Util.cc.
References getHostname(), and printAddrString().
void Util::printAddrString | ( | std::ostream & | out, | |
const std::string & | hostname | |||
) | throw (AddressException) [static] |
prints the address string to an ostream optionally using DNS
Address string format is one of
Definition at line 799 of file Util.cc.
References getAddr(), and printAddrString().
void Util::printAddrString | ( | std::ostream & | out, | |
int | ipaddr | |||
) | [static] |