Mixes for Privacy and Anonymity in the Internet
|
This class represents a socket address for Internet (IP) connections. More...
Public Member Functions | |
SINT32 | getType () const |
The type (family) of socket for which this address is useful. More... | |
CASocketAddrINet () | |
Must be called once before using one of the CAsocketAddrINet functions. More... | |
CASocketAddrINet (UINT16 port) | |
Constructs an IP-Address for port and ANY local host ip. More... | |
CASocketAddrINet (const CASocketAddrINet &addr) | |
Constructs an IP-Address from an other IP Adress. More... | |
CASocketAddr * | clone () const |
Creates a copy of the Address. More... | |
const SOCKADDR * | LPSOCKADDR () const |
Makes a cast to struct SOCKADDR*. More... | |
SINT32 | getSize () const |
Returns the Size of the SOCKADDR struct used. More... | |
SINT32 | setAddr (const UINT8 *szIP, UINT16 port) |
Sets the address to szIP and port. More... | |
SINT32 | setIP (UINT8 ip[4]) |
Sets the IP-Numbers for this address. More... | |
SINT32 | setPort (UINT16 port) |
Changes only(!) the port value of the address. More... | |
UINT16 | getPort () const |
Returns the port value of the address. More... | |
SINT32 | getHostName (UINT8 *buff, UINT32 len) const |
Returns the hostname for this address. More... | |
SINT32 | getIP (UINT8 buff[4]) const |
Returns the IP-Numbers for this address. More... | |
SINT32 | getIPAsStr (UINT8 *buff, UINT32 len) const |
Returns the IP-Number as an address string (doted-format). More... | |
bool | isAnyIP () |
bool | equalsIP (UINT8 ip[4]) const |
virtual SINT32 | toString (UINT8 *buff, UINT32 bufflen) const |
Returns a human readable representation of this address. More... | |
Public Member Functions inherited from CASocketAddr | |
virtual | ~CASocketAddr () |
Static Public Member Functions | |
static SINT32 | init () |
static SINT32 | cleanup () |
static SINT32 | getLocalHostName (UINT8 *buff, UINT32 len) |
Returns the name of the local host. More... | |
static SINT32 | getLocalHostIP (UINT8 ip[4]) |
Returns the local IP-Address as four bytes. More... | |
static SINT32 | getIPForString (UINT8 *strIP, UINT8 ip[4]) |
Static Private Attributes | |
static CAMutex * | m_pcsGet =NULL |
This class represents a socket address for Internet (IP) connections.
CASocketAddrINet::CASocketAddrINet | ( | ) |
Must be called once before using one of the CAsocketAddrINet functions.
Should be called if CASocketAddrINEt functions are not longer needed. If needed again init() must be called Constructs a IP-Address for port 0 and ANY local host ip
References getSize(), and LPSOCKADDR().
Referenced by clone().
CASocketAddrINet::CASocketAddrINet | ( | UINT16 | port | ) |
Constructs an IP-Address for port and ANY local host ip.
References getSize(), and LPSOCKADDR().
CASocketAddrINet::CASocketAddrINet | ( | const CASocketAddrINet & | addr | ) |
Constructs an IP-Address from an other IP Adress.
References getSize(), and LPSOCKADDR().
|
static |
References E_SUCCESS, and m_pcsGet.
Referenced by CALibProxytest::cleanup().
|
virtual |
bool CASocketAddrINet::equalsIP | ( | UINT8 | ip[4] | ) | const |
Returns the hostname for this address.
buff | buffer for the returned zero terminated hostname |
len | the size of the buffer |
E_SUCCESS | if no error occured |
E_UNKNOWN_HOST | if the name of the host could not be resolved |
E_UNSPECIFIED | if buff was NULL |
E_SPACE | if size of the buffer is to small |
References E_SPACE, E_SUCCESS, E_UNKNOWN_HOST, E_UNSPECIFIED, len, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
Referenced by CAAccountingBIInterface::initBIConnection().
Returns the IP-Numbers for this address.
buff | buffer for the returned IP-Address (4 Bytes) |
E_SUCCESS | if no error occured |
References E_SUCCESS.
Referenced by getIPAsStr(), isAllowedToPassRestrictions(), and CALastMix::setTargets().
Returns the IP-Number as an address string (doted-format).
buff | buffer for the returned IP-Address |
len | buffer-space |
E_SUCCESS | if no error occured |
References E_SUCCESS, E_UNKNOWN, getIP(), and len.
Referenced by CAInfoService::getPaymentInstance(), CAInfoService::sendCascadeHelo(), CAInfoService::sendMixHelo(), CAInfoService::sendStatus(), and toString().
Returns the local IP-Address as four bytes.
ip | buffer for the returned IP-Address |
E_SUCCESS | if no error occurs |
E_UNKNOWN | in case of an error |
References E_SUCCESS, E_UNKNOWN, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
Returns the name of the local host.
buff | buffer for the returned zero terminated hostname |
len | the size of the buffer |
E_SUCCESS | if no error occured |
E_UNKNOWN_HOST | if the name of the host could not be resolved |
E_UNSPECIFIED | if buff was NULL |
E_SPACE | if size of the buffer is to small |
References E_SPACE, E_SUCCESS, E_UNKNOWN_HOST, E_UNSPECIFIED, len, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
UINT16 CASocketAddrINet::getPort | ( | ) | const |
Returns the port value of the address.
Referenced by CAInfoService::getPaymentInstance(), CALocalProxy::init(), CAAccountingBIInterface::initBIConnection(), CAInfoService::sendCascadeHelo(), CAInfoService::sendMixHelo(), CAInfoService::sendStatus(), CALastMix::setTargets(), and toString().
|
virtual |
Returns the Size of the SOCKADDR struct used.
Implements CASocketAddr.
Referenced by CASocketAddrINet().
|
virtual |
The type (family) of socket for which this address is useful.
Must be overwritten in subclasses.
Implements CASocketAddr.
|
static |
References E_SUCCESS, and m_pcsGet.
Referenced by CALibProxytest::init().
bool CASocketAddrINet::isAnyIP | ( | ) |
Referenced by CALocalProxy::init().
|
virtual |
Sets the address to szIP and port.
szIP could be either a hostname or an IP-Address of the form a.b.c.d . If szIP==NULL, the the IP-Adredress ist set to ANY local IP Address
szIP | new value for IP-Address or hostname (zero terminated string) |
port | new value for port |
E_SUCCESS | if no error occurs |
E_UNKNOWN_HOST | if the hostname couldt not be resolved (or the ip is wrong). In this case the old values are NOT changed. |
References E_SUCCESS, E_UNKNOWN_HOST, INADDR_NONE, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
Referenced by CAInfoService::getPaymentInstance(), CALocalProxy::init(), and CAAccountingBIInterface::setPIServerConfiguration().
Sets the IP-Numbers for this address.
ip | buffer with the IP-Address (4 Bytes) |
E_SUCCESS | if no error occured |
References E_SUCCESS.
Changes only(!) the port value of the address.
port | new value for port |
References E_SUCCESS.
Returns a human readable representation of this address.
buff | buffer which stores the address string |
bufflen | size of the buffer |
E_SPACE | if the buffer is to small |
E_UNKNOWN | if an error occured |
E_SUCCESS | if successfull |
Implements CASocketAddr.
References E_SPACE, E_SUCCESS, E_UNKNOWN, getIPAsStr(), and getPort().
|
staticprivate |
Referenced by cleanup(), getHostName(), getLocalHostIP(), getLocalHostName(), init(), and setAddr().