Address abstraction to hold either proxy name or IPv4:port address. More...
#include <CommAddress.h>

Public Types | |
| enum | AddressType { NONE =0, PROXY, INET } |
| Enumeration for address type. More... | |
Public Member Functions | |
| CommAddress () | |
| Constructs an uninitialized CommAddress object. More... | |
| CommAddress (const sockaddr_in addr) | |
| Constructs a CommAddress object of type CommAddress::INET. More... | |
| void | set_proxy (const String &str) |
Sets address type to CommAddress::PROXY and proxy name to p. More... | |
| void | set_inet (sockaddr_in addr) |
Sets address type to CommAddress::INET and inet value to addr. More... | |
| CommAddress & | operator= (sockaddr_in addr) |
Sets address type to CommAddress::INET and inet value to addr. More... | |
| bool | operator== (const CommAddress &other) const |
| Equality operator. More... | |
| bool | operator!= (const CommAddress &other) const |
| Inequality operator. More... | |
| bool | operator< (const CommAddress &other) const |
| Less than operator. More... | |
| bool | is_proxy () const |
| Returns true if address is of type CommAddress::PROXY. More... | |
| bool | is_inet () const |
| Returns true if address is of type CommAddress::INET. More... | |
| bool | is_set () const |
| Returns true if address has been initialized. More... | |
| void | clear () |
| Clears address to uninitialized state. More... | |
| String | to_str () const |
| Returns string representation of address. More... | |
Public Attributes | |
| String | proxy |
| Proxy name. More... | |
| InetAddr | inet |
| IPv4:port address. More... | |
Private Attributes | |
| int32_t | m_type |
| Address type. More... | |
Address abstraction to hold either proxy name or IPv4:port address.
Proxy names are string mnemonics referring to IPv4:port addresses and are defined or modified via Comm::add_proxy method. Most Comm methods that operate on an address are abstracted to accept either a proxy name (translated internally) or an IPv4:port address. The CommAddress class is used to facilitate that abstraction.
Definition at line 52 of file CommAddress.h.
|
inline |
Constructs an uninitialized CommAddress object.
Definition at line 65 of file CommAddress.h.
|
inline |
Constructs a CommAddress object of type CommAddress::INET.
| addr | IPv4:port address |
Definition at line 70 of file CommAddress.h.
|
inline |
Clears address to uninitialized state.
Sets address type to CommAddress::NONE
Definition at line 164 of file CommAddress.h.
|
inline |
Returns true if address is of type CommAddress::INET.
Definition at line 153 of file CommAddress.h.
|
inline |
Returns true if address is of type CommAddress::PROXY.
Definition at line 147 of file CommAddress.h.
|
inline |
Returns true if address has been initialized.
Definition at line 159 of file CommAddress.h.
|
inline |
Inequality operator.
Returns the exact opposite of what is returned by operator==
| other | object to compare to |
Definition at line 117 of file CommAddress.h.
|
inline |
Less than operator.
If address types differ, then an integer less than comparison of the AddressType values (m_type) is returned. If addresses are of type CommAddress::PROXY, then string less than comparison of the proxy members is returned. If addresses are of type CommAddress::INET then Inet::operator< is used to compare the IP addresses, and if addresses are of type CommAddress::NONE, false is returned.
| other | object on right-hand side of comparison |
other, false otherwise Definition at line 132 of file CommAddress.h.
|
inline |
Sets address type to CommAddress::INET and inet value to addr.
| addr | IPv4:port address |
Definition at line 89 of file CommAddress.h.
|
inline |
Equality operator.
If address is of type CommAddress::PROXY, std::string::compare is used to compare proxy members. If address is of type CommAddress::INET, InetAddr::operator== is used to compare inet members. If both addresses are of type CommAddress::NONE, true is returned. false is returned if the addresses are of different types.
| other | object to compare to |
Definition at line 102 of file CommAddress.h.
|
inline |
Sets address type to CommAddress::INET and inet value to addr.
| addr | IPv4:port address |
Definition at line 82 of file CommAddress.h.
|
inline |
Sets address type to CommAddress::PROXY and proxy name to p.
| str | proxy name |
Definition at line 76 of file CommAddress.h.
| String CommAddress::to_str | ( | ) | const |
Returns string representation of address.
If address is of type CommAddress::PROXY, the proxy is returned. If address is of type CommAddress::INET, InetAddr::format is used to return a string representation of inet. If address is of type CommAddress::NONE, the string "[NULL]" is returned.
Definition at line 34 of file CommAddress.cc.
| InetAddr Hypertable::CommAddress::inet |
IPv4:port address.
Definition at line 176 of file CommAddress.h.
|
private |
Address type.
Definition at line 179 of file CommAddress.h.
| String Hypertable::CommAddress::proxy |
Proxy name.
Definition at line 175 of file CommAddress.h.
1.8.8