DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Network host. More...
#include <Host.hpp>
Public Member Functions | |
Host (const Host &other) | |
copy constructor | |
Host (const std::string &name) | |
constructor from name | |
Host (struct sockaddr_in ip_addr) | |
constructor from ip address | |
virtual | ~Host () throw () |
destructor | |
operator struct sockaddr_in () const throw () | |
cast to ip address | |
bool | equals (const Host &other) const throw () |
equality method | |
struct sockaddr_in | ip () const throw () |
get ip address | |
const std::string & | name () const throw () |
get name | |
const std::string & | full_name () const throw () |
get fully qualified name | |
std::string | ip_string () const throw () |
get ip in string mode | |
Static Public Member Functions | |
static struct sockaddr_in | resolve (const std::string &name) throw () |
name to ip conversion | |
static std::string | resolve (struct sockaddr_in address) throw () |
ip to name conversion | |
static std::string | expand (const std::string &name) throw () |
expands to full name | |
static std::string | to_string (struct sockaddr_in ip_addr) |
ip to string conversion | |
Protected Member Functions | |
Host () throw () | |
constructor for current host | |
Protected Attributes | |
std::string | m_name |
name of the host | |
std::string | m_full_name |
cached fully qualified host name | |
Network host.
This class represents an network host. It offers facilities to translate name to addresses and vice versa.
|
protected |
OksSystem::Host::Host | ( | const Host & | other | ) |
copy constructor
Definition at line 94 of file Host.cpp.
OksSystem::Host::Host | ( | const std::string & | s_name | ) |
OksSystem::Host::Host | ( | struct sockaddr_in | ip_addr | ) |
constructor from ip address
Definition at line 111 of file Host.cpp.
|
virtual |
bool OksSystem::Host::equals | ( | const Host & | other | ) | const | |
throw | ( | ) |
equality method
Comparison method We try to expand both name and compare those
other | the host to compare to |
true
if both have the same fully qualified name Definition at line 137 of file Host.cpp.
|
static |
expands to full name
Tries to build a fully qualified name. This is done first by converting the name to ip then the ip to a name. If this fails (basically, we cannot do DNS resolves) the non fully qualified name is returned
name | the (partial) name |
Definition at line 69 of file Host.cpp.
const std::string & OksSystem::Host::full_name | ( | ) | const | |||
throw | ( | ) |
get fully qualified name
Fully qualified name of the host
Definition at line 161 of file Host.cpp.
struct sockaddr_in OksSystem::Host::ip | ( | ) | const | |||
throw | ( | ) |
std::string OksSystem::Host::ip_string | ( | ) | const | |||
throw | ( | ) |
get ip in string mode
The IP Address of the host, as a string
Definition at line 172 of file Host.cpp.
const std::string & OksSystem::Host::name | ( | ) | const | |||
throw | ( | ) |
OksSystem::Host::operator struct sockaddr_in | ( | ) | const | |||
throw | ( | ) |
|
static |
name to ip conversion
Translates an hostname into an ip address
name | hostname to translate |
|
static |
ip to name conversion
Translates an ip address into an hostname
address | the address to translate |
|
static |
ip to string conversion
Transliterate an ip address into the canonical dotted text version (w.x.y.z).
ip_addr | the address to translate |
Definition at line 81 of file Host.cpp.
|
mutableprotected |
|
protected |