#include <cabal_address.h>
Public Member Functions | |
Address (const std::string &c_address, const NetPort nPort=0) | |
Address (const char *c_address, const NetPort nPort=0) | |
Address (const Address &src) | |
Address (const SockAddrInet &addr) | |
void | set (const std::string &str, const NetPort nPort=0) |
void | set (const char *str, const NetPort nPort=0) |
void | set (const SockAddrInet &addr) |
void | copy (const Address &addr) |
Address * | clone () |
const std::string & | host () |
void | host (const std::string &h) |
Changes the internal host name. | |
const char * | ip () |
const SockAddrInet & | address () const |
Returns a const version of the internal address. | |
SockAddrInet & | varAddress () |
Returns read-write version of the address. | |
void | invalidate () |
Makes the addres representation strings no longer valid. | |
StringList * | listOfIps () const |
Returns a newly allocated list containings all the ips in quad-dot format. | |
const NetAddr * | aliasIpList () const |
int | port () const |
void | port (const int nPort) |
bool | isReady () const |
bool | Address::scan () |
Scan the network searching for the m_host field. | |
bool | Address::scan (const std::string &host) |
Scan the network searching for the m_host field. | |
void | operator= (const Address &orig) |
Copy operator. | |
bool | operator== (const Address &a2) const |
bool | operator!= (const Address &a2) const |
This class encapsulates an internet address (Net::SockAddrInet, generally mapping to underlying system "struct sockaddr_in") and various methods that can be done on that:
Definition at line 32 of file cabal_address.h.
|
Returns a const version of the internal address. Read-only version. Definition at line 139 of file cabal_address.h. Referenced by Cabal::Socket::bind(), Cabal::TCPSocket::connect(), Cabal::UDPSocket::rawSend(), and Cabal::UDPSocket::sendTo(). |
|
Scan the network searching for the m_host field. Resolves to a call to scan() after having set the host. Definition at line 202 of file cabal_address.h. |
|
Scan the network searching for the m_host field. If an host name has been given, this searches the net for corresponding ip or ip list. If an entry is found, the internall address reference is updated; up to 5 secondary ips are fetched. On failure it returns null. If the host element of this address is not set, it makes an assertion to fail and terminates your program. Definition at line 192 of file cabal_address.h. References Address::scan(), and host(). Referenced by Address::scan(). |
|
Changes the internal host name. This also clears all the internal data, as this function is to be used ONLY when there is a subquesent need to scan (search for) the host. Definition at line 121 of file cabal_address.h. Referenced by Address::scan(). |
|
Makes the addres representation strings no longer valid. This forces to re-create representation strings on request for ip() and/or host() methods. Definition at line 161 of file cabal_address.h. Referenced by varAddress(). |
|
Returns a newly allocated list containings all the ips in quad-dot format. For logging or debugging purposes, this function provides the caller with a StringList (std::list< std::string > ) containing all the quad-dot strings bound with this ip, provided it has been scanned. it returns null. Freeing the list is responsibilty of the caller.
Definition at line 19 of file ltlib/cabal_address.cpp. |
|
Copy operator. This operator returns void so that it not breaks internal m_address const correctness. Definition at line 211 of file cabal_address.h. |
|
Returns read-write version of the address. This also invalidates the address, causing ips representation and eventually host name to be recalculate on request. Be carefull using this method in multithreading because if you don't pay attention, some other threads may re-validate the address even before the calling thread is able to change the value in the address. Definition at line 151 of file cabal_address.h. References invalidate(). Referenced by Cabal::UDPSocket::rawRecv(), and Cabal::UDPSocket::recvFrom(). |