Mixes for Privacy and Anonymity in the Internet
|
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 |
CAInfoService::CAInfoService | ( | ) |
References m_bRun, m_expectedMixRelPos, m_lastMixedPackets, m_minuts, m_pLoopCV, m_pMix, m_pMultiSignature, and m_pthreadRunLoop.
CAInfoService::CAInfoService | ( | CAMix * | pMix | ) |
References m_bRun, m_expectedMixRelPos, m_lastMixedPackets, m_minuts, m_pLoopCV, m_pMix, m_pMultiSignature, m_pthreadRunLoop, and pMix.
CAInfoService::~CAInfoService | ( | ) |
References m_pLoopCV, m_pthreadRunLoop, and stop().
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().
References E_UNKNOWN, CALibProxytest::getOptions(), and m_pMix.
Referenced by getStatusXMLAsString().
References E_UNKNOWN, CALibProxytest::getOptions(), and m_pMix.
Referenced by getStatusXMLAsString().
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 [] |
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().
|
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 |
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().
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 |
*** Nedd redesigning!*/
References E_SUCCESS.
|
staticprivate |
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().
bool CAInfoService::isConfiguring | ( | ) |
References m_bConfiguring.
Referenced by InfoLoop().
bool CAInfoService::isRunning | ( | ) |
References m_bRun.
Referenced by InfoLoop(), and CAMix::start().
SINT32 CAInfoService::sendCascadeHelo | ( | ) |
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 |
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 |
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.
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.
References E_UNKNOWN, getMixHeloXMLAsString(), len, CAMsg::printMsg(), sendHelo(), and TMixHelo().
Referenced by InfoLoop(), and TMixHelo().
SINT32 CAInfoService::sendStatus | ( | bool | bIncludeCerts | ) |
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 |
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().
void CAInfoService::setConfiguring | ( | bool | a_configuring | ) |
References m_bConfiguring.
Referenced by CAMix::start().
SINT32 CAInfoService::setMultiSignature | ( | CAMultiSignature * | pMultiSignature | ) |
References E_SUCCESS, and m_pMultiSignature.
Referenced by CAMix::start().
void CAInfoService::setSerial | ( | UINT64 | a_serial | ) |
References m_serial.
Referenced by CAMix::start().
SINT32 CAInfoService::signal | ( | ) |
References E_SUCCESS, CAMutex::lock(), m_pLoopCV, CAConditionVariable::signal(), and CAMutex::unlock().
Referenced by CAMix::start().
SINT32 CAInfoService::start | ( | ) |
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 | ( | ) |
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 |
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 |
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 |
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 |
References DOM_Output::dumpToMem(), E_SUCCESS, m_pMultiSignature, and CAMultiSignature::signXML().
Referenced by getMixHeloXMLAsString(), and getOperatorTnCsAsStrings().
|
private |
Referenced by isConfiguring(), sendCascadeHelo(), sendMixHelo(), and setConfiguring().
|
private |
Referenced by CAInfoService(), isRunning(), start(), and stop().
|
private |
Referenced by CAInfoService().
|
private |
Referenced by CAInfoService(), getStatusXMLAsString(), and start().
|
private |
Referenced by CAInfoService(), getStatusXMLAsString(), and start().
|
private |
Referenced by CAInfoService(), InfoLoop(), signal(), stop(), and ~CAInfoService().
|
private |
Referenced by CAInfoService(), getCascadeHeloXMLAsString(), getLevel(), getMixedPackets(), InfoLoop(), sendCascadeHelo(), and sendStatus().
|
private |
|
private |
Referenced by CAInfoService(), start(), stop(), and ~CAInfoService().
|
private |
Referenced by getCascadeHeloXMLAsString(), getMixHeloXMLAsString(), and setSerial().
|
static |
|
static |
Referenced by InfoLoop().
Referenced by InfoLoop().
|
static |
Referenced by sendCascadeHelo(), sendMixHelo(), and sendStatus().
|
static |
Referenced by InfoLoop().
Referenced by InfoLoop().
Referenced by InfoLoop().