|
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. | |
| CASocketAddrINet () | |
| Must be called once before using one of the CAsocketAddrINet functions. | |
| CASocketAddrINet (UINT16 port) | |
| Constructs an IP-Address for port and ANY local host ip. | |
| CASocketAddrINet (const CASocketAddrINet &addr) | |
| Constructs an IP-Address from an other IP Adress. | |
| CASocketAddr * | clone () const |
| Creates a copy of the Address. | |
| const SOCKADDR * | LPSOCKADDR () const |
| Makes a cast to struct SOCKADDR*. | |
| SINT32 | getSize () const |
| Returns the Size of the SOCKADDR struct used. | |
| SINT32 | setAddr (const UINT8 *szIP, UINT16 port) |
| Sets the address to szIP and port. | |
| SINT32 | setIP (UINT8 ip[4]) |
| Sets the IP-Numbers for this address. | |
| SINT32 | setPort (UINT16 port) |
| Changes only(!) the port value of the address. | |
| UINT16 | getPort () const |
| Returns the port value of the address. | |
| SINT32 | getHostName (UINT8 *buff, UINT32 len) const |
| Returns the hostname for this address. | |
| SINT32 | getIP (UINT8 buff[4]) const |
| Returns the IP-Numbers for this address. | |
| SINT32 | getIPAsStr (UINT8 *buff, UINT32 len) const |
| Returns the IP-Number as an address string (doted-format). | |
| bool | isAnyIP () |
| bool | equalsIP (UINT8 ip[4]) const |
| virtual SINT32 | toString (UINT8 *buff, UINT32 bufflen) const |
| Returns a human readable representation of this address. | |
Static Public Member Functions | |
| static SINT32 | init () |
| static SINT32 | cleanup () |
| static SINT32 | getLocalHostName (UINT8 *buff, UINT32 len) |
| Returns the name of the local host. | |
| static SINT32 | getLocalHostIP (UINT8 ip[4]) |
| Returns the local IP-Address as four bytes. | |
Static Private Attributes | |
| static CAMutex * | m_pcsGet = NULL |
This class represents a socket address for Internet (IP) connections.
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().
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 SINT32 CASocketAddrINet::cleanup | ( | ) | [static] |
| CASocketAddr* CASocketAddrINet::clone | ( | ) | const [virtual] |
| bool CASocketAddrINet::equalsIP | ( | UINT8 | ip[4] | ) | const |
| SINT32 CASocketAddrINet::getHostName | ( | UINT8 * | buff, |
| UINT32 | len | ||
| ) | 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, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
Referenced by CAAccountingBIInterface::initBIConnection().
| SINT32 CASocketAddrINet::getIP | ( | UINT8 | buff[4] | ) | const |
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().
| SINT32 CASocketAddrINet::getIPAsStr | ( | UINT8 * | buff, |
| UINT32 | len | ||
| ) | const |
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, and getIP().
Referenced by CAInfoService::getPaymentInstance(), CAInfoService::sendCascadeHelo(), CAInfoService::sendMixHelo(), CAInfoService::sendStatus(), and toString().
| SINT32 CASocketAddrINet::getLocalHostIP | ( | UINT8 | ip[4] | ) | [static] |
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().
| SINT32 CASocketAddrINet::getLocalHostName | ( | UINT8 * | buff, |
| UINT32 | len | ||
| ) | [static] |
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, 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().
| SINT32 CASocketAddrINet::getSize | ( | ) | const [virtual] |
Returns the Size of the SOCKADDR struct used.
Implements CASocketAddr.
Referenced by CASocketAddrINet().
| SINT32 CASocketAddrINet::getType | ( | ) | const [virtual] |
The type (family) of socket for which this address is useful.
Must be overwritten in subclasses.
Implements CASocketAddr.
| static SINT32 CASocketAddrINet::init | ( | ) | [static] |
| bool CASocketAddrINet::isAnyIP | ( | ) |
Referenced by CALocalProxy::init().
| const SOCKADDR* CASocketAddrINet::LPSOCKADDR | ( | ) | const [virtual] |
| SINT32 CASocketAddrINet::setAddr | ( | const UINT8 * | szIP, |
| UINT16 | port | ||
| ) |
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, CAMutex::lock(), m_pcsGet, and CAMutex::unlock().
Referenced by CAInfoService::getPaymentInstance(), CALocalProxy::init(), and CAAccountingBIInterface::setPIServerConfiguration().
| SINT32 CASocketAddrINet::setIP | ( | UINT8 | ip[4] | ) |
Sets the IP-Numbers for this address.
| ip | buffer with the IP-Address (4 Bytes) |
| E_SUCCESS | if no error occured |
References E_SUCCESS.
| SINT32 CASocketAddrINet::setPort | ( | UINT16 | port | ) |
Changes only(!) the port value of the address.
| port | new value for port |
References E_SUCCESS.
| virtual SINT32 CASocketAddrINet::toString | ( | UINT8 * | buff, |
| UINT32 | bufflen | ||
| ) | const [virtual] |
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().
CAMutex * CASocketAddrINet::m_pcsGet = NULL [static, private] |
Referenced by cleanup(), getHostName(), getLocalHostIP(), getLocalHostName(), init(), and setAddr().
1.7.6.1