|
Mixe for Privacy and Anonymity in the Internet
|
This class represents a socket address for Internet (IP) connections. More...
#include <CASocketAddrINet.hpp>
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.
Definition at line 34 of file CASocketAddrINet.hpp.
| 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
Definition at line 58 of file CASocketAddrINet.cpp.
References getSize(), and LPSOCKADDR().
Referenced by clone().
| CASocketAddrINet::CASocketAddrINet | ( | UINT16 | port | ) |
Constructs an IP-Address for port and ANY local host ip.
Definition at line 67 of file CASocketAddrINet.cpp.
References getSize(), and LPSOCKADDR().
| CASocketAddrINet::CASocketAddrINet | ( | const CASocketAddrINet & | addr | ) |
Constructs an IP-Address from an other IP Adress.
Definition at line 76 of file CASocketAddrINet.cpp.
References getSize(), and LPSOCKADDR().
|
inlinestatic |
Definition at line 42 of file CASocketAddrINet.hpp.
References E_SUCCESS, and m_pcsGet.
Referenced by CALibProxytest::cleanup().
|
inlinevirtual |
Creates a copy of the Address.
Implements CASocketAddr.
Definition at line 59 of file CASocketAddrINet.hpp.
References CASocketAddrINet().
|
inline |
Definition at line 94 of file CASocketAddrINet.hpp.
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 |
Definition at line 145 of file CASocketAddrINet.cpp.
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 |
Definition at line 169 of file CASocketAddrINet.cpp.
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 |
Definition at line 190 of file CASocketAddrINet.cpp.
References E_SUCCESS, E_UNKNOWN, getIP(), and len.
Referenced by CAInfoService::getPaymentInstance(), CAInfoService::sendCascadeHelo(), CAInfoService::sendMixHelo(), CAInfoService::sendStatus(), and toString().
Definition at line 103 of file CASocketAddrINet.hpp.
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 |
Definition at line 244 of file CASocketAddrINet.cpp.
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 |
Definition at line 214 of file CASocketAddrINet.cpp.
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.
Definition at line 132 of file CASocketAddrINet.cpp.
Referenced by CAInfoService::getPaymentInstance(), CALocalProxy::init(), CAAccountingBIInterface::initBIConnection(), CAInfoService::sendCascadeHelo(), CAInfoService::sendMixHelo(), CAInfoService::sendStatus(), CALastMix::setTargets(), and toString().
|
inlinevirtual |
Returns the Size of the SOCKADDR struct used.
Implements CASocketAddr.
Definition at line 77 of file CASocketAddrINet.hpp.
Referenced by CASocketAddrINet().
|
inlinevirtual |
The type (family) of socket for which this address is useful.
Must be overwritten in subclasses.
Implements CASocketAddr.
Definition at line 50 of file CASocketAddrINet.hpp.
|
inlinestatic |
Definition at line 37 of file CASocketAddrINet.hpp.
References E_SUCCESS, and m_pcsGet.
Referenced by CALibProxytest::init().
|
inline |
Definition at line 89 of file CASocketAddrINet.hpp.
Referenced by CALocalProxy::init().
|
inlinevirtual |
Makes a cast to struct SOCKADDR*.
Implements CASocketAddr.
Definition at line 65 of file CASocketAddrINet.hpp.
Referenced by CASocketAddrINet().
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. |
Definition at line 93 of file CASocketAddrINet.cpp.
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 |
Definition at line 179 of file CASocketAddrINet.cpp.
References E_SUCCESS.
Changes only(!) the port value of the address.
| port | new value for port |
Definition at line 123 of file CASocketAddrINet.cpp.
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.
Definition at line 128 of file CASocketAddrINet.hpp.
References E_SPACE, E_SUCCESS, E_UNKNOWN, getIPAsStr(), and getPort().
|
staticprivate |
Definition at line 138 of file CASocketAddrINet.hpp.
Referenced by cleanup(), getHostName(), getLocalHostIP(), getLocalHostName(), init(), and setAddr().