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

List of all members.

Classes

struct  InfoServiceHeloMsg

Public Member Functions

 CAInfoService ()
 CAInfoService (CAMix *pMix)
 ~CAInfoService ()
SINT32 sendMixHelo (SINT32 requestCommand=-1, const UINT8 *param=NULL)
 POSTs the MIXINFO message for a mix to the InfoService.
SINT32 sendCascadeHelo ()
SINT32 sendStatus (bool bIncludeCerts)
SINT32 start ()
SINT32 stop ()
SINT32 signal ()
SINT32 getLevel (SINT32 *puser, SINT32 *prisk, SINT32 *ptraffic)
SINT32 getMixedPackets (UINT64 &ppackets)
SINT32 getPaymentInstance (const UINT8 *a_pstrPIID, CAXMLBI **pXMLBI)
bool isRunning ()
SINT32 setMultiSignature (CAMultiSignature *pMultiSignature)
bool isConfiguring ()
void setConfiguring (bool a_configuring)
void setSerial (UINT64 a_serial)
UINT8getStatusXMLAsString (bool bIncludeCerts, UINT32 &len)

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.
SINT32 sendHelo (UINT8 *a_strXML, UINT32 a_len, THREAD_RETURN(*a_thread)(void *), UINT8 *a_strThreadName, SINT32 requestCommand, const UINT8 *param=NULL)
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.
SINT32 sendStatus (const UINT8 *strStatusXML, UINT32 len, const CASocketAddrINet *a_socketAddress) const
 POSTs mix status to the InfoService.
UINT8 ** getOperatorTnCsAsStrings (UINT32 **lengths, XMLSize_t *nrOfTnCs)
 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
SINT32 sendOperatorTnCData ()
UINT8getMixHeloXMLAsString (UINT32 &len)
UINT8xmlDocToStringWithSignature (DOMNode *a_node, UINT32 &a_len, bool bIncludeCerts)
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.
SINT32 handleConfigEvent (XERCES_CPP_NAMESPACE::DOMDocument *doc) const

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
CAMultiSignaturem_pMultiSignature
CAMixm_pMix
CAThreadm_pthreadRunLoop
CAConditionVariablem_pLoopCV
UINT64 m_lastMixedPackets
UINT64 m_serial
UINT32 m_minuts
SINT32 m_expectedMixRelPos
bool m_bConfiguring

Constructor & Destructor Documentation

References m_pLoopCV, m_pthreadRunLoop, and stop().


Member Function Documentation

SINT32 CAInfoService::getLevel ( SINT32 puser,
SINT32 prisk,
SINT32 ptraffic 
)
UINT8 ** CAInfoService::getOperatorTnCsAsStrings ( UINT32 **  lengths,
XMLSize_t *  nrOfTnCs 
) [private]

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

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(), CAXMLBI::getInstance(), CASocketAddrINet::getIPAsStr(), CASocketAddrINet::getPort(), parseDOMDocument(), CAHttpClient::parseHTTPHeader(), CAMsg::printMsg(), CAHttpClient::sendGetRequest(), CASocketAddrINet::setAddr(), and CAHttpClient::setSocket().

Referenced by getPaymentInstance().

SINT32 CAInfoService::getPaymentInstance ( const UINT8 a_pstrPIID,
CAXMLBI **  pXMLBI 
)
UINT8 * CAInfoService::getStatusXMLAsString ( bool  bIncludeCerts,
UINT32 len 
)
SINT32 CAInfoService::handleConfigEvent ( XERCES_CPP_NAMESPACE::DOMDocument *  doc) const [private]

*** Nedd redesigning!*/

References E_SUCCESS.

THREAD_RETURN CAInfoService::InfoLoop ( void *  p) [static, private]

References m_bConfiguring.

Referenced by InfoLoop().

References m_bRun.

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

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(), CACmdLnOptions::isFirstMix(), CACmdLnOptions::isLastMix(), m_bConfiguring, MIX_TO_INFOSERVICE_TIMEOUT, CAMsg::printMsg(), CASocket::receiveFullyT(), SEND_INFO_TIMEOUT_MS, and CASocket::sendFullyTimeOut().

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

POSTs the MIXINFO message for a mix to the InfoService.

References E_UNKNOWN, getMixHeloXMLAsString(), len, CAMsg::printMsg(), sendHelo(), and TMixHelo().

Referenced by InfoLoop(), and TMixHelo().

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

References E_SUCCESS.

SINT32 CAInfoService::sendStatus ( bool  bIncludeCerts)
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_SUCCESSotherwisetodo 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().

References E_SUCCESS, and m_pMultiSignature.

Referenced by CAMix::start().

void CAInfoService::setSerial ( UINT64  a_serial)

References m_serial.

Referenced by CAMix::start().

THREAD_RETURN CAInfoService::TCascadeHelo ( void *  p) [static, private]
THREAD_RETURN CAInfoService::TCascadeStatus ( void *  p) [static, private]
THREAD_RETURN CAInfoService::TMixHelo ( void *  p) [static, private]
UINT8 * CAInfoService::xmlDocToStringWithSignature ( DOMNode *  a_node,
UINT32 a_len,
bool  bIncludeCerts 
) [private]

Member Data Documentation

volatile bool CAInfoService::m_bRun [private]

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

Referenced by CAInfoService().

const UINT64 CAInfoService::MINUTE = 60 [static]

Referenced by InfoLoop().

Referenced by InfoLoop().

Referenced by InfoLoop().

Referenced by InfoLoop().

Referenced by InfoLoop().