Mixe for Privacy and Anonymity in the Internet
|
#include <CAInfoService.hpp>
Classes | |
struct | InfoServiceHeloMsg |
Public Member Functions | |
CAInfoService () | |
CAInfoService (CAMix *pMix) | |
~CAInfoService () | |
SINT32 | sendMixHelo (SINT32 requestCommand=-1, const UINT8 *param=NULL) |
SINT32 | sendStatus (bool bIncludeCerts) |
bool | isRunning () |
void | setConfiguring (bool a_configuring) |
bool | isConfiguring () |
void | setSerial (UINT64 a_serial) |
SINT32 | start () |
SINT32 | stop () |
SINT32 | signal () |
SINT32 | setMultiSignature (CAMultiSignature *pMultiSignature) |
SINT32 | sendCascadeHelo () |
SINT32 | getPaymentInstance (const UINT8 *a_pstrPIID, CAXMLBI **pXMLBI) |
Static Public Attributes | |
static const UINT64 | MINUTE = 60 |
static const UINT64 | SEND_LOOP_SLEEP = 60 |
static const UINT64 | SEND_CASCADE_INFO_WAIT = MINUTE * 10 |
static const UINT64 | SEND_MIX_INFO_WAIT = MINUTE * 10 |
static const UINT64 | SEND_STATUS_INFO_WAIT = MINUTE |
static const UINT32 | SEND_INFO_TIMEOUT_MS = 3000 |
static const UINT32 | REPEAT_ON_STATUS_SENT_ERROR = 3 |
Private Member Functions | |
SINT32 | getPaymentInstance (const UINT8 *a_pstrPIID, CAXMLBI **pXMLBI, CASocketAddrINet *a_socketAddress) |
Gets a payment instance from the InfoService. More... | |
UINT8 * | getCascadeHeloXMLAsString (UINT32 &len) |
SINT32 | sendCascadeHelo (const UINT8 *xml, UINT32 len, const CASocketAddrINet *a_socketAddress) const |
POSTs the HELO message for a whole cascade to the InfoService. More... | |
UINT8 ** | getOperatorTnCsAsStrings (UINT32 **lengths, UINT32 *nrOfTnCs) |
POSTs the MIXINFO message for a mix to the InfoService. More... | |
SINT32 | sendOperatorTnCData () |
SINT32 | handleConfigEvent (XERCES_CPP_NAMESPACE::DOMDocument *doc) const |
SINT32 | sendMixHelo (const UINT8 *strMixHeloXML, UINT32 len, SINT32 requestCommand, const UINT8 *param, const CASocketAddrINet *a_socketAddress) |
POSTs the HELO message for a mix to the InfoService. More... | |
UINT8 * | getMixHeloXMLAsString (UINT32 &len) |
UINT8 * | xmlDocToStringWithSignature (DOMNode *a_node, UINT32 &a_len, bool bIncludeCerts) |
SINT32 | sendHelo (UINT8 *a_strXML, UINT32 a_len, THREAD_RETURN(*a_thread)(void *), UINT8 *a_strThreadName, SINT32 requestCommand, const UINT8 *param=NULL) |
SINT32 | getLevel (SINT32 *puser, SINT32 *prisk, SINT32 *ptraffic) |
SINT32 | getMixedPackets (UINT64 &ppackets) |
UINT8 * | getStatusXMLAsString (bool bIncludeCerts, UINT32 &len) |
SINT32 | sendStatus (const UINT8 *strStatusXML, UINT32 len, const CASocketAddrINet *a_socketAddress) const |
POSTs mix status to the InfoService. More... | |
Static Private Member Functions | |
static THREAD_RETURN | TCascadeHelo (void *p) |
static THREAD_RETURN | TCascadeStatus (void *p) |
static THREAD_RETURN | TMixHelo (void *p) |
static THREAD_RETURN | InfoLoop (void *p) |
Private Attributes | |
volatile bool | m_bRun |
UINT64 | m_serial |
bool | m_bConfiguring |
CAMix * | m_pMix |
CAConditionVariable * | m_pLoopCV |
CAMultiSignature * | m_pMultiSignature |
UINT64 | m_lastMixedPackets |
UINT32 | m_minuts |
SINT32 | m_expectedMixRelPos |
CAThread * | m_pthreadRunLoop |
Definition at line 61 of file CAInfoService.hpp.
CAInfoService::CAInfoService | ( | ) |
Definition at line 398 of file CAInfoService.cpp.
References m_bRun, m_expectedMixRelPos, m_lastMixedPackets, m_minuts, m_pLoopCV, m_pMix, m_pMultiSignature, and m_pthreadRunLoop.
CAInfoService::CAInfoService | ( | CAMix * | pMix | ) |
Definition at line 413 of file CAInfoService.cpp.
References m_bRun, m_expectedMixRelPos, m_lastMixedPackets, m_minuts, m_pLoopCV, m_pMix, m_pMultiSignature, m_pthreadRunLoop, and pMix.
CAInfoService::~CAInfoService | ( | ) |
Definition at line 430 of file CAInfoService.cpp.
References m_pLoopCV, m_pthreadRunLoop, and stop().
Definition at line 1229 of file CAInfoService.cpp.
References ATTRIBUTE_SERIAL, createDOMElement(), DOM_Output::dumpToMem(), E_SUCCESS, getcurrentTimeMillis(), getDOMChildByName(), CAMix::getMixCascadeInfo(), m_pMix, m_pMultiSignature, m_serial, print64(), setDOMElementAttribute(), setDOMElementValue(), and CAMultiSignature::signXML().
Referenced by sendCascadeHelo().
Definition at line 444 of file CAInfoService.cpp.
References E_UNKNOWN, CALibProxytest::getOptions(), and m_pMix.
Referenced by getStatusXMLAsString().
Definition at line 455 of file CAInfoService.cpp.
References E_UNKNOWN, CALibProxytest::getOptions(), and m_pMix.
Referenced by getStatusXMLAsString().
Definition at line 770 of file CAInfoService.cpp.
References ATTRIBUTE_SERIAL, E_SUCCESS, CALibProxytest::getOptions(), m_serial, setDOMElementAttribute(), and xmlDocToStringWithSignature().
Referenced by sendMixHelo().
POSTs the MIXINFO message for a mix to the InfoService.
returns a string array with all signed Terms and Condition-Objects NOTE: this method has a side-effect: the DOMNodes are all signed and thus modified
lengths | contains the lengths of each corresponding object. Its memory is allocated by this method and has to be freed explicitly by calling delete [] |
nrOfTnCs | is the length of the returned array |
a | list with all Terms and conditions object which has to be freed explicitly by calling delete [] |
Definition at line 1071 of file CAInfoService.cpp.
References E_SUCCESS, getDOMElementAttribute(), getElementsByTagName(), CACmdLnOptions::getOperatorSubjectKeyIdentifier(), CALibProxytest::getOptions(), CACmdLnOptions::getTermsAndConditions(), LOCALE_DEFAULT, OPTIONS_ATTRIBUTE_TNC_DATE, OPTIONS_ATTRIBUTE_TNC_ID, OPTIONS_ATTRIBUTE_TNC_LOCALE, OPTIONS_ATTRIBUTE_TNC_SERIAL, OPTIONS_ATTRIBUTE_TNC_VERSION, OPTIONS_NODE_TNCS_TRANSLATION, setCurrentTimeMilliesAsDOMAttribute(), setDOMElementAttribute(), TMP_BUFF_SIZE, and xmlDocToStringWithSignature().
Definition at line 1444 of file CAInfoService.cpp.
References E_SUCCESS, E_UNKNOWN, CACmdLnOptions::getInfoServices(), CALibProxytest::getOptions(), and getPaymentInstance().
|
private |
Gets a payment instance from the InfoService.
a_pstrPIID | id of the payment instance for which the information is requested |
a_pXMLBI | a pointer to a pointer which on a successful return will point to a newly created CAXMLBI object |
a_socketAddress | adress of the InfoService from which the information is to be requested |
E_SUCCESS | if succesful |
E_UNKNOWN | if an error occured |
Definition at line 1471 of file CAInfoService.cpp.
References CASocket::close(), CASocket::connect(), E_SUCCESS, E_UNKNOWN, CAHttpClient::getContent(), CASocketAddrINet::getIPAsStr(), CASocketAddrINet::getPort(), parseDOMDocument(), CAHttpClient::parseHTTPHeader(), CAMsg::printMsg(), CAHttpClient::sendGetRequest(), CASocketAddrINet::setAddr(), and CAHttpClient::setSocket().
Referenced by getPaymentInstance().
Definition at line 547 of file CAInfoService.cpp.
References diff64(), div64(), E_SUCCESS, getcurrentTimeMillis(), getLevel(), getMixedPackets(), CACmdLnOptions::getMixId(), CALibProxytest::getOptions(), len, m_lastMixedPackets, m_minuts, m_pMultiSignature, min, print64(), set64(), CAMultiSignature::signXML(), and XML_MIX_CASCADE_STATUS.
Referenced by sendStatus().
|
private |
|
staticprivate |
Definition at line 86 of file CAInfoService.cpp.
References BEGIN_STACK, E_SUCCESS, FINISH_STACK, CAMix::getLastConnectionTime(), CALibProxytest::getOptions(), INIT_STACK, isConfiguring(), CAMix::isConnected(), isRunning(), CAMutex::lock(), m_pLoopCV, m_pMix, CAMsg::printMsg(), REPEAT_ON_STATUS_SENT_ERROR, SEND_CASCADE_INFO_WAIT, SEND_LOOP_SLEEP, SEND_MIX_INFO_WAIT, SEND_STATUS_INFO_WAIT, sendCascadeHelo(), sendMixHelo(), sendStatus(), sSleep(), THREAD_RETURN_SUCCESS, CAMutex::unlock(), and CAConditionVariable::wait().
Referenced by start().
|
inline |
Definition at line 84 of file CAInfoService.hpp.
References m_bConfiguring.
Referenced by InfoLoop().
|
inline |
Definition at line 74 of file CAInfoService.hpp.
References m_bRun.
Referenced by InfoLoop(), and CAMix::start().
SINT32 CAInfoService::sendCascadeHelo | ( | ) |
Definition at line 1198 of file CAInfoService.cpp.
References E_SUCCESS, E_UNKNOWN, getCascadeHeloXMLAsString(), CALibProxytest::getOptions(), CAMix::isConnected(), len, m_pMix, CAMsg::printMsg(), REQUEST_COMMAND_CASCADE, sendHelo(), and TCascadeHelo().
Referenced by InfoLoop(), CAMix::start(), and TCascadeHelo().
|
private |
POSTs the HELO message for a whole cascade to the InfoService.
If the running mix is a last mix, this method is used to inform the InfoService that it wants to create a new cascade. The InfoService then tells all involved mixes to join this cascade. If the current mix is a middle mix, this method does nothing.
E_SUCCESS | on success |
E_UNKNOWN | on any error |
Definition at line 1290 of file CAInfoService.cpp.
References CASocket::close(), CASocket::connect(), E_SUCCESS, E_UNKNOWN, getcurrentTimeMillis(), CASocketAddrINet::getIPAsStr(), CALibProxytest::getOptions(), CASocketAddrINet::getPort(), m_bConfiguring, MIX_TO_INFOSERVICE_TIMEOUT, CAMsg::printMsg(), CASocket::receiveFullyT(), SEND_INFO_TIMEOUT_MS, and CASocket::sendFullyTimeOut().
|
private |
Definition at line 619 of file CAInfoService.cpp.
References CAInfoService::InfoServiceHeloMsg::addr, E_SUCCESS, E_UNKNOWN, CACmdLnOptions::getInfoServices(), CALibProxytest::getOptions(), CAInfoService::InfoServiceHeloMsg::is, CAInfoService::InfoServiceHeloMsg::len, CAInfoService::InfoServiceHeloMsg::param, CAInfoService::InfoServiceHeloMsg::requestCommand, CAThread::setMainLoop(), CAThread::start(), CAInfoService::InfoServiceHeloMsg::strXML, and THREAD_RETURN.
Referenced by sendCascadeHelo(), sendMixHelo(), and sendStatus().
|
private |
POSTs the HELO message for a mix to the InfoService.
Definition at line 819 of file CAInfoService.cpp.
References CASocket::close(), CASocket::connect(), E_SUCCESS, E_UNKNOWN, GET_NET_ERROR, GET_NET_ERROR_STR, getcurrentTimeMillis(), CASocketAddrINet::getIPAsStr(), CASocketAddrINet::getPort(), len, m_bConfiguring, MIX_TO_INFOSERVICE_TIMEOUT, CAHttpClient::parseHTTPHeader(), CAMsg::printMsg(), CASocket::receiveFullyT(), REQUEST_COMMAND_CONFIGURE, REQUEST_COMMAND_HELO, REQUEST_COMMAND_MIXINFO, REQUEST_TYPE_GET, REQUEST_TYPE_POST, SEND_INFO_TIMEOUT_MS, CASocket::sendFullyTimeOut(), CASocket::setRecvBuff(), CAHttpClient::setSocket(), STRINGS_REQUEST_COMMANDS, and STRINGS_REQUEST_TYPES.
Definition at line 749 of file CAInfoService.cpp.
References E_UNKNOWN, getMixHeloXMLAsString(), len, CAMsg::printMsg(), sendHelo(), and TMixHelo().
Referenced by InfoLoop(), and TMixHelo().
|
private |
SINT32 CAInfoService::sendStatus | ( | bool | bIncludeCerts | ) |
Definition at line 507 of file CAInfoService.cpp.
References E_SUCCESS, E_UNKNOWN, CALibProxytest::getOptions(), getStatusXMLAsString(), CAMix::isConnected(), len, m_pMix, CAMsg::printMsg(), REQUEST_COMMAND_STATUS, sendHelo(), and TCascadeStatus().
Referenced by InfoLoop(), and TCascadeStatus().
|
private |
POSTs mix status to the InfoService.
[only first mix does this at the moment]
E_UNKNOWN | if something goes wrong |
E_SUCCESS | otherwise todo use httpclient class |
Definition at line 688 of file CAInfoService.cpp.
References CASocket::close(), CASocket::connect(), E_SUCCESS, E_UNKNOWN, GET_NET_ERROR, GET_NET_ERROR_STR, getcurrentTimeMillis(), CASocketAddrINet::getIPAsStr(), CALibProxytest::getOptions(), CASocketAddrINet::getPort(), MIX_TO_INFOSERVICE_TIMEOUT, CAMsg::printMsg(), SEND_INFO_TIMEOUT_MS, and CASocket::sendFullyTimeOut().
|
inline |
Definition at line 79 of file CAInfoService.hpp.
References m_bConfiguring.
Referenced by CAMix::start().
SINT32 CAInfoService::setMultiSignature | ( | CAMultiSignature * | pMultiSignature | ) |
Definition at line 438 of file CAInfoService.cpp.
References E_SUCCESS, and m_pMultiSignature.
Referenced by CAMix::start().
|
inline |
Definition at line 88 of file CAInfoService.hpp.
References m_serial.
Referenced by CAMix::start().
SINT32 CAInfoService::signal | ( | ) |
Definition at line 484 of file CAInfoService.cpp.
References E_SUCCESS, CAMutex::lock(), m_pLoopCV, CAConditionVariable::signal(), and CAMutex::unlock().
Referenced by CAMix::start().
SINT32 CAInfoService::start | ( | ) |
Definition at line 466 of file CAInfoService.cpp.
References E_UNKNOWN, InfoLoop(), m_bRun, m_lastMixedPackets, m_minuts, m_pMultiSignature, m_pthreadRunLoop, CAMsg::printMsg(), set64(), CAThread::setMainLoop(), and CAThread::start().
Referenced by CAMix::start().
SINT32 CAInfoService::stop | ( | ) |
Definition at line 492 of file CAInfoService.cpp.
References E_SUCCESS, CAThread::join(), CAMutex::lock(), m_bRun, m_pLoopCV, m_pthreadRunLoop, CAConditionVariable::signal(), and CAMutex::unlock().
Referenced by CAFirstMix::clean(), CAFirstMixA::shutDown(), CAMix::start(), and ~CAInfoService().
|
staticprivate |
Definition at line 291 of file CAInfoService.cpp.
References CAInfoService::InfoServiceHeloMsg::addr, BEGIN_STACK, FINISH_STACK, INIT_STACK, CAInfoService::InfoServiceHeloMsg::is, CAInfoService::InfoServiceHeloMsg::len, CAInfoService::InfoServiceHeloMsg::retVal, sendCascadeHelo(), CAInfoService::InfoServiceHeloMsg::strXML, and THREAD_RETURN_SUCCESS.
Referenced by sendCascadeHelo().
|
staticprivate |
Definition at line 264 of file CAInfoService.cpp.
References CAInfoService::InfoServiceHeloMsg::addr, BEGIN_STACK, FINISH_STACK, INIT_STACK, CAInfoService::InfoServiceHeloMsg::is, CAInfoService::InfoServiceHeloMsg::len, CAInfoService::InfoServiceHeloMsg::retVal, sendStatus(), CAInfoService::InfoServiceHeloMsg::strXML, and THREAD_RETURN_SUCCESS.
Referenced by sendStatus().
|
staticprivate |
Definition at line 276 of file CAInfoService.cpp.
References CAInfoService::InfoServiceHeloMsg::addr, BEGIN_STACK, FINISH_STACK, INIT_STACK, CAInfoService::InfoServiceHeloMsg::is, CAInfoService::InfoServiceHeloMsg::len, CAInfoService::InfoServiceHeloMsg::param, CAInfoService::InfoServiceHeloMsg::requestCommand, CAInfoService::InfoServiceHeloMsg::retVal, sendMixHelo(), CAInfoService::InfoServiceHeloMsg::strXML, and THREAD_RETURN_SUCCESS.
Referenced by sendMixHelo().
|
private |
Definition at line 792 of file CAInfoService.cpp.
References DOM_Output::dumpToMem(), E_SUCCESS, m_pMultiSignature, and CAMultiSignature::signXML().
Referenced by getMixHeloXMLAsString(), and getOperatorTnCsAsStrings().
|
private |
Definition at line 151 of file CAInfoService.hpp.
Referenced by isConfiguring(), sendCascadeHelo(), sendMixHelo(), and setConfiguring().
|
private |
Definition at line 149 of file CAInfoService.hpp.
Referenced by CAInfoService(), isRunning(), start(), and stop().
|
private |
Definition at line 157 of file CAInfoService.hpp.
Referenced by CAInfoService().
|
private |
Definition at line 155 of file CAInfoService.hpp.
Referenced by CAInfoService(), getStatusXMLAsString(), and start().
|
private |
Definition at line 156 of file CAInfoService.hpp.
Referenced by CAInfoService(), getStatusXMLAsString(), and start().
|
private |
Definition at line 153 of file CAInfoService.hpp.
Referenced by CAInfoService(), InfoLoop(), signal(), stop(), and ~CAInfoService().
|
private |
Definition at line 152 of file CAInfoService.hpp.
Referenced by CAInfoService(), getCascadeHeloXMLAsString(), getLevel(), getMixedPackets(), InfoLoop(), sendCascadeHelo(), and sendStatus().
|
private |
Definition at line 154 of file CAInfoService.hpp.
Referenced by CAInfoService(), getCascadeHeloXMLAsString(), getStatusXMLAsString(), setMultiSignature(), start(), and xmlDocToStringWithSignature().
|
private |
Definition at line 158 of file CAInfoService.hpp.
Referenced by CAInfoService(), start(), stop(), and ~CAInfoService().
|
private |
Definition at line 150 of file CAInfoService.hpp.
Referenced by getCascadeHeloXMLAsString(), getMixHeloXMLAsString(), and setSerial().
|
static |
Definition at line 162 of file CAInfoService.hpp.
|
static |
Definition at line 168 of file CAInfoService.hpp.
Referenced by InfoLoop().
Definition at line 164 of file CAInfoService.hpp.
Referenced by InfoLoop().
|
static |
Definition at line 167 of file CAInfoService.hpp.
Referenced by sendCascadeHelo(), sendMixHelo(), and sendStatus().
|
static |
Definition at line 163 of file CAInfoService.hpp.
Referenced by InfoLoop().
Definition at line 165 of file CAInfoService.hpp.
Referenced by InfoLoop().
Definition at line 166 of file CAInfoService.hpp.
Referenced by InfoLoop().