Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Static Protected Attributes

Machine Struct Reference

The Machine is a simple place holder for the hostname and the ip address of an internet host. More...

#include <Machine.h>

Inherits Server.

Collaboration diagram for Machine:
Collaboration graph
[legend]

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 selfinit (char const *name=0, sockaddr const *addr=0)
 Initialize the singleton.
static selfinstance ()
static Machineinstance ()

Data Fields

bool dead
char * hostname
int hostname_len
unsigned int ip
int cluster_port
Link< Machinelink
uint16_t msg_proto_major
uint16_t msg_proto_minor
ClusterHandlerclusterHandler
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.

Detailed Description

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.


Member Typedef Documentation

Self reference type.

Definition at line 50 of file I_Machine.h.


Constructor & Destructor Documentation

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]

Member Function Documentation

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.

Note:
This must be called before called instance so that the singleton is not inadvertently default initialized.
Parameters:
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]

Field Documentation

Machine * Machine::_instance = NULL [static, protected]

Singleton for the class.

Definition at line 83 of file I_Machine.h.

Referenced by init(), and instance().

Definition at line 72 of file Machine.h.

Definition at line 86 of file Machine.h.

Definition at line 64 of file Machine.h.

Definition at line 65 of file Machine.h.

Referenced by Machine(), LogAccess::marshal_proxy_host_name(), and ~Machine().

Definition at line 66 of file Machine.h.

Referenced by Machine().

unsigned int Machine::ip

Definition at line 71 of file Machine.h.

Referenced by Machine(), and test().

Prefered IP address of the host (network order).

Definition at line 55 of file I_Machine.h.

IPv4 address if present.

Definition at line 56 of file I_Machine.h.

Referenced by Machine().

IPv6 address if present.

Definition at line 57 of file I_Machine.h.

Referenced by Machine().

IP address as hex string.

Definition at line 62 of file I_Machine.h.

Referenced by Machine().

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().

Definition at line 74 of file Machine.h.

Definition at line 81 of file Machine.h.

Definition at line 82 of file Machine.h.


The documentation for this struct was generated from the following files: