Mixes for Privacy and Anonymity in the Internet
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CAInfoService Class Reference

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...
 
UINT8getCascadeHeloXMLAsString (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...
 
UINT8getMixHeloXMLAsString (UINT32 &len)
 
UINT8xmlDocToStringWithSignature (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)
 
UINT8getStatusXMLAsString (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
 
CAMixm_pMix
 
CAConditionVariablem_pLoopCV
 
CAMultiSignaturem_pMultiSignature
 
UINT64 m_lastMixedPackets
 
UINT32 m_minuts
 
SINT32 m_expectedMixRelPos
 
CAThreadm_pthreadRunLoop
 

Constructor & Destructor Documentation

◆ CAInfoService() [1/2]

CAInfoService::CAInfoService ( )

◆ CAInfoService() [2/2]

CAInfoService::CAInfoService ( CAMix pMix)

◆ ~CAInfoService()

CAInfoService::~CAInfoService ( )

References m_pLoopCV, m_pthreadRunLoop, and stop().

Member Function Documentation

◆ getCascadeHeloXMLAsString()

UINT8 * CAInfoService::getCascadeHeloXMLAsString ( UINT32 len)
private

◆ getLevel()

SINT32 CAInfoService::getLevel ( SINT32 puser,
SINT32 prisk,
SINT32 ptraffic 
)
private

◆ getMixedPackets()

SINT32 CAInfoService::getMixedPackets ( UINT64 ppackets)
private

◆ getMixHeloXMLAsString()

UINT8 * CAInfoService::getMixHeloXMLAsString ( UINT32 len)
private

◆ getOperatorTnCsAsStrings()

UINT8 ** CAInfoService::getOperatorTnCsAsStrings ( UINT32 **  lengths,
UINT32 nrOfTnCs 
)
private

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

Parameters
lengthscontains the lengths of each corresponding object. Its memory is allocated by this method and has to be freed explicitly by calling delete []
nrOfTnCsis the length of the returned array
Return values
alist 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().

◆ getPaymentInstance() [1/2]

SINT32 CAInfoService::getPaymentInstance ( const UINT8 a_pstrPIID,
CAXMLBI **  pXMLBI 
)

◆ getPaymentInstance() [2/2]

SINT32 CAInfoService::getPaymentInstance ( const UINT8 a_pstrPIID,
CAXMLBI **  a_pXMLBI,
CASocketAddrINet a_socketAddress 
)
private

Gets a payment instance from the InfoService.

Parameters
a_pstrPIIDid of the payment instance for which the information is requested
a_pXMLBIa pointer to a pointer which on a successful return will point to a newly created CAXMLBI object
a_socketAddressadress of the InfoService from which the information is to be requested
Return values
E_SUCCESSif succesful
E_UNKNOWNif an error occured
Returns
a_pXMLBI will point to a pointer to the newly created CAXMLBI object or to NULL

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().

◆ getStatusXMLAsString()

UINT8 * CAInfoService::getStatusXMLAsString ( bool  bIncludeCerts,
UINT32 len 
)
private

◆ handleConfigEvent()

SINT32 CAInfoService::handleConfigEvent ( XERCES_CPP_NAMESPACE::DOMDocument *  doc) const
private

‍*** Nedd redesigning!*‍/

References E_SUCCESS.

◆ InfoLoop()

THREAD_RETURN CAInfoService::InfoLoop ( void *  p)
staticprivate

◆ isConfiguring()

bool CAInfoService::isConfiguring ( )

References m_bConfiguring.

Referenced by InfoLoop().

◆ isRunning()

bool CAInfoService::isRunning ( )

References m_bRun.

Referenced by InfoLoop(), and CAMix::start().

◆ sendCascadeHelo() [1/2]

SINT32 CAInfoService::sendCascadeHelo ( )

◆ sendCascadeHelo() [2/2]

SINT32 CAInfoService::sendCascadeHelo ( const UINT8 a_strCascadeHeloXML,
UINT32  a_len,
const CASocketAddrINet a_pSocketAddress 
) const
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.

Return values
E_SUCCESSon success
E_UNKNOWNon 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().

◆ sendHelo()

SINT32 CAInfoService::sendHelo ( UINT8 a_strXML,
UINT32  a_len,
THREAD_RETURN(*)(void *)  a_thread,
UINT8 a_strThreadName,
SINT32  requestCommand,
const UINT8 param = NULL 
)
private

◆ sendMixHelo() [1/2]

SINT32 CAInfoService::sendMixHelo ( const UINT8 strMixHeloXML,
UINT32  len,
SINT32  requestCommand,
const UINT8 param,
const CASocketAddrINet a_socketAddress 
)
private

◆ sendMixHelo() [2/2]

SINT32 CAInfoService::sendMixHelo ( SINT32  requestCommand = -1,
const UINT8 param = NULL 
)

◆ sendOperatorTnCData()

SINT32 CAInfoService::sendOperatorTnCData ( )
private

References E_SUCCESS.

◆ sendStatus() [1/2]

SINT32 CAInfoService::sendStatus ( bool  bIncludeCerts)

◆ sendStatus() [2/2]

SINT32 CAInfoService::sendStatus ( const UINT8 a_strStatusXML,
UINT32  a_len,
const CASocketAddrINet a_pSocketAddress 
) const
private

POSTs mix status to the InfoService.

[only first mix does this at the moment]

Return values
E_UNKNOWNif something goes wrong
E_SUCCESSotherwise 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().

◆ setConfiguring()

void CAInfoService::setConfiguring ( bool  a_configuring)

References m_bConfiguring.

Referenced by CAMix::start().

◆ setMultiSignature()

SINT32 CAInfoService::setMultiSignature ( CAMultiSignature pMultiSignature)

References E_SUCCESS, and m_pMultiSignature.

Referenced by CAMix::start().

◆ setSerial()

void CAInfoService::setSerial ( UINT64  a_serial)

References m_serial.

Referenced by CAMix::start().

◆ signal()

SINT32 CAInfoService::signal ( )

◆ start()

SINT32 CAInfoService::start ( )

◆ stop()

SINT32 CAInfoService::stop ( )

◆ TCascadeHelo()

THREAD_RETURN CAInfoService::TCascadeHelo ( void *  p)
staticprivate

◆ TCascadeStatus()

THREAD_RETURN CAInfoService::TCascadeStatus ( void *  p)
staticprivate

◆ TMixHelo()

THREAD_RETURN CAInfoService::TMixHelo ( void *  p)
staticprivate

◆ xmlDocToStringWithSignature()

UINT8 * CAInfoService::xmlDocToStringWithSignature ( DOMNode *  a_node,
UINT32 a_len,
bool  bIncludeCerts 
)
private

Member Data Documentation

◆ m_bConfiguring

bool CAInfoService::m_bConfiguring
private

◆ m_bRun

volatile bool CAInfoService::m_bRun
private

Referenced by CAInfoService(), isRunning(), start(), and stop().

◆ m_expectedMixRelPos

SINT32 CAInfoService::m_expectedMixRelPos
private

Referenced by CAInfoService().

◆ m_lastMixedPackets

UINT64 CAInfoService::m_lastMixedPackets
private

◆ m_minuts

UINT32 CAInfoService::m_minuts
private

◆ m_pLoopCV

CAConditionVariable* CAInfoService::m_pLoopCV
private

◆ m_pMix

CAMix* CAInfoService::m_pMix
private

◆ m_pMultiSignature

CAMultiSignature* CAInfoService::m_pMultiSignature
private

◆ m_pthreadRunLoop

CAThread* CAInfoService::m_pthreadRunLoop
private

◆ m_serial

UINT64 CAInfoService::m_serial
private

◆ MINUTE

const UINT64 CAInfoService::MINUTE = 60
static

◆ REPEAT_ON_STATUS_SENT_ERROR

const UINT32 CAInfoService::REPEAT_ON_STATUS_SENT_ERROR = 3
static

Referenced by InfoLoop().

◆ SEND_CASCADE_INFO_WAIT

const UINT64 CAInfoService::SEND_CASCADE_INFO_WAIT = MINUTE * 10
static

Referenced by InfoLoop().

◆ SEND_INFO_TIMEOUT_MS

const UINT32 CAInfoService::SEND_INFO_TIMEOUT_MS = 3000
static

◆ SEND_LOOP_SLEEP

const UINT64 CAInfoService::SEND_LOOP_SLEEP = 60
static

Referenced by InfoLoop().

◆ SEND_MIX_INFO_WAIT

const UINT64 CAInfoService::SEND_MIX_INFO_WAIT = MINUTE * 10
static

Referenced by InfoLoop().

◆ SEND_STATUS_INFO_WAIT

const UINT64 CAInfoService::SEND_STATUS_INFO_WAIT = MINUTE
static

Referenced by InfoLoop().