The Machine is a simple place holder for the hostname and the ip address of an internet host. More...
#include <Machine.h>
Inherits Server.
Public Types | |
typedef Machine | self |
Self reference type. | |
Public Member Functions | |
Machine (char *hostname=NULL, unsigned int ip=0, int acluster_port=0) | |
~Machine () | |
~Machine () | |
Static Public Member Functions | |
static self * | init (char const *name=0, sockaddr const *addr=0) |
Initialize the singleton. | |
static self * | instance () |
static Machine * | instance () |
Data Fields | |
bool | dead |
char * | hostname |
int | hostname_len |
unsigned int | ip |
int | cluster_port |
Link< Machine > | link |
uint16_t | msg_proto_major |
uint16_t | msg_proto_minor |
ClusterHandler * | clusterHandler |
IpEndpoint | ip |
Prefered IP address of the host (network order). | |
IpEndpoint | ip4 |
IPv4 address if present. | |
IpEndpoint | ip6 |
IPv6 address if present. | |
ip_text_buffer | ip_string |
int | ip_string_len |
char | ip_hex_string [TS_IP6_SIZE *2+1] |
IP address as hex string. | |
int | ip_hex_string_len |
Protected Member Functions | |
Machine (char const *hostname, sockaddr const *addr) | |
Static Protected Attributes | |
static self * | _instance = NULL |
Singleton for the class. |
The Machine is a simple place holder for the hostname and the ip address of an internet host.
If a hostname or an IP address is not provided in the constructor, the hostname defaults to the name of the current processor and the IP address is the address of the current host. If the host has multiple IP addresses, the numerically lowest IP address is used. The IP address is stored in the network byte order.
Definition at line 62 of file Machine.h.
typedef Machine Machine::self |
Self reference type.
Definition at line 50 of file I_Machine.h.
Machine::Machine | ( | char * | hostname = NULL , |
|
unsigned int | ip = 0 , |
|||
int | acluster_port = 0 | |||
) |
Referenced by init().
Machine::~Machine | ( | ) |
Definition at line 190 of file Machine.cc.
References ats_free(), and hostname.
Machine::~Machine | ( | ) |
Machine::Machine | ( | char const * | hostname, | |
sockaddr const * | addr | |||
) | [protected] |
Definition at line 47 of file Machine.cc.
References ats_ip_copy(), ats_ip_ntop(), ats_ip_size(), ats_ip_to_hex(), ats_is_ip(), ats_is_ip4(), ats_is_ip6(), ats_is_ip_linklocal(), ats_is_ip_loopback(), ats_is_ip_multicast(), ats_is_ip_private(), ats_strdup, Connection::close(), HAVE_IFADDRS_H, hostname, hostname_len, ink_release_assert, ink_strlcpy(), ip, ip4, ip6, ip_hex_string, ip_hex_string_len, ip_string, ip_string_len, IpEndpoint::sa, and Warning.
Machine * Machine::init | ( | char const * | name = 0 , |
|
sockaddr const * | addr = 0 | |||
) | [static] |
Initialize the singleton.
If hostname or ip are NULL
then system defaults are used.
instance
so that the singleton is not inadvertently default initialized. name | Host name of the machine. | |
addr | Primary IP adddress of the machine. |
Definition at line 41 of file Machine.cc.
References _instance, ink_assert, and Machine().
Referenced by main().
static Machine* Machine::instance | ( | ) | [static] |
Machine * Machine::instance | ( | ) | [static] |
Definition at line 35 of file Machine.cc.
References _instance, and ink_assert.
Referenced by HttpTransact::HandleICPLookup(), HttpTransactHeaders::insert_via_header_in_request(), LogAccess::marshal_proxy_host_ip(), LogAccess::marshal_proxy_host_name(), LogFile::roll(), and HttpTransact::will_this_request_self_loop().
Machine * Machine::_instance = NULL [static, protected] |
Singleton for the class.
Definition at line 83 of file I_Machine.h.
Referenced by init(), and instance().
bool Machine::dead |
char * Machine::hostname |
Definition at line 65 of file Machine.h.
Referenced by Machine(), LogAccess::marshal_proxy_host_name(), and ~Machine().
unsigned int Machine::ip |
Prefered IP address of the host (network order).
Definition at line 55 of file I_Machine.h.
char Machine::ip_hex_string[TS_IP6_SIZE *2+1] |
Definition at line 63 of file I_Machine.h.
Referenced by Machine().
Definition at line 59 of file I_Machine.h.
Referenced by Machine().
Definition at line 60 of file I_Machine.h.
Referenced by Machine().
uint16_t Machine::msg_proto_major |
uint16_t Machine::msg_proto_minor |