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

List of all members.

Public Member Functions

 CACmdLnOptions ()
 ~CACmdLnOptions ()
SINT32 cleanup ()
 This is the final cleanup, which deletes every resource (including any locks necessary to synchronise read/write to properties).
void clean ()
 Deletes all resssource allocated by objects of this class EXPECT the locks necessary to controll access to the properties of this class.
SINT32 parse (int argc, const char **arg)
SINT32 initLogging ()
bool getDaemon ()
SINT32 getMixId (UINT8 *id, UINT32 len)
UINT16 getSOCKSServerPort ()
SINT32 createSockets (bool a_bPrintMessages, CASocket **a_sockets, UINT32 a_socketsLen)
UINT32 getListenerInterfaceCount ()
CAListenerInterfacegetListenerInterface (UINT32 nr)
UINT16 getMixPort ()
SINT32 getMixHost (UINT8 *host, UINT32 len)
UINT32 getTargetInterfaceCount ()
SINT32 getTargetInterface (CATargetInterface &oTargetInterface, UINT32 nr)
 Fills a TargetInterface struct with the values which belongs to the target interface nr.
UINT32 getVisibleAddressesCount ()
SINT32 getVisibleAddress (UINT8 *strAddressBuff, UINT32 len, UINT32 nr)
 Fills strAddressBuff with a outside visible adress.
UINT16 getSOCKSPort ()
SINT32 getSOCKSHost (UINT8 *host, UINT32 len)
CAListenerInterface ** getInfoServices (UINT32 &r_size)
SINT32 getMaxOpenFiles ()
CAMultiSignaturegetMultiSigner ()
SINT32 getOperatorSubjectKeyIdentifier (UINT8 *buffer, UINT32 *length)
 Returns a COPY of the public test certifcate for that mix.
CAXMLPriceCertgetPriceCertificate () const
SINT32 getCountryStatsDBConnectionLoginData (char **db_host, char **db_user, char **db_passwd)
bool hasPrevMixTestCertificate ()
CACertificategetPrevMixTestCertificate ()
SINT32 setPrevMixTestCertificate (CACertificate *cert)
bool hasNextMixTestCertificate ()
CACertificategetNextMixTestCertificate ()
SINT32 setNextMixTestCertificate (CACertificate *cert)
CACertStoregetTrustedCertificateStore ()
bool isEncryptedLogEnabled ()
 Returns if the encrpyted Log could/should be used.
bool isSyslogEnabled ()
SINT32 enableEncryptedLog (bool b)
 Set to true if the encrpyted log could/should be used.
CACertificategetLogEncryptionKey ()
 Returns a certificate which contains a key which could be used for log encryption.
DOMElement * getCascadeXML ()
SINT32 getCascadeName (UINT8 *name, UINT32 len) const
SINT32 setCascadeName (const UINT8 *name)
SINT32 reread (CAMix *pMix)
 Rereads the configuration file (if one was given on startup) and reconfigures the mix according to the new values.
SINT32 getEncryptedLogDir (UINT8 *name, UINT32 len)
SINT32 getMixXml (XERCES_CPP_NAMESPACE::DOMDocument *&docMixInfo)
 Get the XML describing the Mix.
UINT32 getNumberOfTermsAndConditionsTemplates ()
XERCES_CPP_NAMESPACE::DOMDocument ** getAllTermsAndConditionsTemplates ()
XERCES_CPP_NAMESPACE::DOMElement * getTermsAndConditions ()
UINT32 getKeepAliveSendInterval ()
UINT32 getKeepAliveRecvInterval ()
bool isInfoServiceEnabled ()
bool getCompressLogs ()
SINT32 getLogDir (UINT8 *name, UINT32 len)
SINT32 setLogDir (const UINT8 *name, UINT32 len)
SINT64 getMaxLogFileSize ()
UINT32 getMaxLogFiles ()
SINT32 getUser (UINT8 *user, UINT32 len)
SINT32 getPidFile (UINT8 *pidfile, UINT32 len)
bool isLocalProxy ()
bool isFirstMix ()
bool isMiddleMix ()
bool isLastMix ()
bool isSock5sSupported ()
bool getAutoReconnect ()
UINT32 getDelayChannelUnlimitTraffic ()
UINT32 getDelayChannelBucketGrow ()
UINT32 getDelayChannelBucketGrowIntervall ()
SINT32 getDatabaseHost (UINT8 *host, UINT32 len)
UINT16 getDatabasePort ()
SINT32 getDatabaseName (UINT8 *name, UINT32 len)
SINT32 getDatabaseUsername (UINT8 *user, UINT32 len)
SINT32 getDatabasePassword (UINT8 *pass, UINT32 len)
SINT32 getAiID (UINT8 *id, UINT32 len)
CAXMLBIgetBI ()
 Returns an CAXMLBI object, which describes the BI this AI uses.
UINT32 getPaymentHardLimit ()
UINT32 getPaymentSoftLimit ()
UINT32 getPrepaidInterval ()
UINT32 getPaymentSettleInterval ()
SINT32 setNextMix (XERCES_CPP_NAMESPACE::DOMDocument *pDoc)
 Modifies the next mix settings (target interface and certificate) according to the specified options object.
SINT32 setPrevMix (XERCES_CPP_NAMESPACE::DOMDocument *pDoc)
 Modifies the next mix settings (target interface and certificate) according to the specified options object.
bool acceptReconfiguration ()
UINT32 getMaxNrOfUsers ()
bool verifyMixCertificates ()

Static Public Member Functions

static SINT32 createMixOnCDConfiguration (const UINT8 *strFileName)
 Writes a default configuration file into the file named by filename.
static SINT32 saveToFile (XERCES_CPP_NAMESPACE::DOMDocument *a_doc, const UINT8 *a_strFileName)
 Saves the given XML Document to a file.

Public Attributes

XERCES_CPP_NAMESPACE::DOMDocument ** m_termsAndConditionsTemplates
UINT32 m_nrOfTermsAndConditionsTemplates

Private Member Functions

SINT32 parseInfoServices (DOMElement *a_infoServiceNode)
 LERNGRUPPE Parses the InfoServices Node in a) a mix configuration or b) out of infoservices.xml (Code refactored from CACmdLnOptions::processXmlConfiguration.
SINT32 setNewValues (CACmdLnOptions &newOptions)
 Copies options from newOptions.
SINT32 readXmlConfiguration (XERCES_CPP_NAMESPACE::DOMDocument *&docConfig, const UINT8 *const configFileName)
 Tries to read the XML configuration file configFile and parses (but not process) it.
SINT32 readXmlConfiguration (XERCES_CPP_NAMESPACE::DOMDocument *&docConfig, const UINT8 *const buf, UINT32 len)
 Tries to read the XML configuration from byte array buf.
SINT32 processXmlConfiguration (XERCES_CPP_NAMESPACE::DOMDocument *docConfig)
 Processes a XML configuration document.
SINT32 clearVisibleAddresses ()
 Deletes all information about the visible addresses.
SINT32 addVisibleAddresses (DOMNode *nodeProxy)
 Add all the visible addresses to the list of visible addresses found in the XML description of the <Proxy> element given.
SINT32 clearTargetInterfaces ()
 Deletes all information about the target interfaces.
SINT32 clearListenerInterfaces ()
 Deletes all information about the listener interfaces.
SINT32 setGeneralOptions (DOMElement *elemRoot)
SINT32 setMixDescription (DOMElement *elemRoot)
SINT32 setCertificateOptions (DOMElement *elemRoot)
SINT32 setNetworkOptions (DOMElement *elemRoot)
SINT32 setRessourceOptions (DOMElement *elemRoot)
SINT32 setTermsAndConditions (DOMElement *elemRoot)
SINT32 setMixType (DOMElement *elemGeneral)
 determines whether this mix is a first a middle or a last mix appears in <General></General> and must be set.
SINT32 setMixName (DOMElement *elemGeneral)
SINT32 setMixID (DOMElement *elemGeneral)
SINT32 setDynamicMix (DOMElement *elemGeneral)
 determines whether this mix is a dynamic mix or not appears in <General></General> and is optional.
SINT32 setMinCascadeLength (DOMElement *elemGeneral)
SINT32 setCascadeNameFromOptions (DOMElement *elemGeneral)
SINT32 setUserID (DOMElement *elemGeneral)
SINT32 setNrOfFileDescriptors (DOMElement *elemGeneral)
SINT32 setDaemonMode (DOMElement *elemGeneral)
SINT32 setMaxUsers (DOMElement *elemGeneral)
SINT32 setLoggingOptions (DOMElement *elemGeneral)
SINT32 setPaymentReminder (DOMElement *elemGeneral)
SINT32 setOwnCertificate (DOMElement *elemCertificates)
SINT32 setOwnOperatorCertificate (DOMElement *elemCertificates)
SINT32 setMixCertificateVerification (DOMElement *elemCertificates)
SINT32 setNextMixCertificate (DOMElement *elemCertificates)
SINT32 setPrevMixCertificate (DOMElement *elemCertificates)
SINT32 setTrustedRootCertificates (DOMElement *elemCertificates)
SINT32 setPriceCertificate (DOMElement *elemAccounting)
SINT32 setPaymentInstance (DOMElement *elemAccounting)
SINT32 setAccountingSoftLimit (DOMElement *elemAccounting)
SINT32 setAccountingHardLimit (DOMElement *elemAccounting)
SINT32 setPrepaidInterval (DOMElement *elemAccounting)
SINT32 setSettleInterval (DOMElement *elemAccounting)
SINT32 setAccountingDatabase (DOMElement *elemAccounting)
void initAccountingOptionSetters ()
SINT32 setAccountingOptions (DOMElement *elemRoot)
SINT32 setInfoServices (DOMElement *elemNetwork)
SINT32 setListenerInterfaces (DOMElement *elemNetwork)
SINT32 setTargetInterfaces (DOMElement *elemNetwork)
SINT32 setServerMonitoring (DOMElement *elemNetwork)
SINT32 setKeepAliveTraffic (DOMElement *elemNetwork)
SINT32 setTermsAndConditionsTemplates (DOMElement *elemTnCs)
SINT32 setTermsAndConditionsList (DOMElement *elemTnCs)
SINT32 appendMixInfo_internal (DOMNode *a_node, bool with_subtree)
SINT32 addMixIdToMixInfo ()
 Just add the id of the Mix to the MixInfo Document.
SINT32 invokeOptionSetters (const optionSetter_pt *optionsSetters, DOMElement *target, SINT32 optionsSettersLength)
 framework-function for calling predefined option setter functions.
void initMainOptionSetters ()
void initGeneralOptionSetters ()
void initMixDescriptionSetters ()
void initCertificateOptionSetters ()
void initNetworkOptionSetters ()
void initTermsAndConditionsOptionSetters ()

Static Private Member Functions

static SINT32 buildDefaultConfig (XERCES_CPP_NAMESPACE::DOMDocument *a_doc, bool bForLastMix)
 Creates a default mix configuration.

Private Attributes

bool m_bDynamic
UINT8m_strConfigFile
bool m_bDaemon
UINT16 m_iSOCKSServerPort
UINT16 m_iTargetPort
char * m_strTargetHost
char * m_strSOCKSHost
UINT16 m_iSOCKSPort
bool m_bIsRunReConfigure
CAMutexm_pcsReConfigure
CAThread m_threadReConfigure
CAListenerInterface ** m_addrInfoServices
UINT32 m_addrInfoServicesSize
CAMultiSignaturem_pMultiSignature
CAXMLPriceCertm_pPriceCertificate
CACertificatem_OpCert
DOMNodeList * m_opCertList
bool m_bVerifyMixCerts
CACertStorem_pTrustedRootCertificates
CACertificatem_pPrevMixCertificate
CACertificatem_pNextMixCertificate
CACertificatem_pLogEncryptionCertificate
UINT32 m_maxNrOfUsers
SINT32 m_PaymentReminderProbability
DOMElement * m_pCascadeXML
bool m_bAcceptReconfiguration
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixInfo
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixXml
XERCES_CPP_NAMESPACE::DOMDocument * m_docOpTnCs
UINT32 m_u32KeepAliveSendInterval
UINT32 m_u32KeepAliveRecvInterval
bool m_perfTestEnabled
bool m_bLocalProxy
bool m_bFirstMix
bool m_bMiddleMix
bool m_bLastMix
bool m_bAutoReconnect
UINT8m_strCascadeName
char * m_strLogDir
char * m_strLogLevel
SINT64 m_maxLogFileSize
UINT32 m_maxLogFiles
char * m_strEncryptedLogDir
bool m_bCompressedLogs
bool m_bSocksSupport
bool m_bSyslog
bool m_bLogConsole
char * m_strUser
char * m_strPidFile
SINT32 m_nrOfOpenFiles
char * m_strMixID
char * m_strMixName
bool m_bIsEncryptedLogEnabled
CATargetInterfacem_arTargetInterfaces
UINT32 m_cnTargets
CAListenerInterface ** m_arListenerInterfaces
UINT32 m_cnListenerInterfaces
UINT8 ** m_arStrVisibleAddresses
UINT32 m_cnVisibleAddresses
UINT32 m_u32DelayChannelUnlimitTraffic
UINT32 m_u32DelayChannelBucketGrow
UINT32 m_u32DelayChannelBucketGrowIntervall
CAXMLBIm_pBI
UINT8m_strDatabaseHost
UINT8m_strDatabaseName
UINT8m_strDatabaseUser
UINT8m_strDatabasePassword
UINT8m_strAiID
UINT16 m_iDatabasePort
UINT32 m_iPaymentHardLimit
UINT32 m_iPaymentSoftLimit
UINT32 m_iPrepaidInterval
UINT32 m_iPaymentSettleInterval
optionSetter_ptaccountingOptionSetters
optionSetter_ptmainOptionSetters
optionSetter_ptgeneralOptionSetters
optionSetter_ptcertificateOptionSetters
optionSetter_ptnetworkOptionSetters
optionSetter_pttermsAndConditionsOptionSetters
char * m_dbCountryStatsHost
char * m_dbCountryStatsUser
char * m_dbCountryStatsPasswd
UINT32 m_nCertificateOptionsSetters

Friends

THREAD_RETURN threadReConfigure (void *param)
 Thread that does the actual reconfigure work.

Constructor & Destructor Documentation

References createDOMDocument(), DELAY_USERS_BUCKET_GROW, DELAY_USERS_BUCKET_GROW_INTERVALL, initAccountingOptionSetters(), initCertificateOptionSetters(), initGeneralOptionSetters(), initMainOptionSetters(), initNetworkOptionSetters(), initTermsAndConditionsOptionSetters(), isFirstMix(), m_addrInfoServices, m_addrInfoServicesSize, m_arListenerInterfaces, m_arStrVisibleAddresses, m_arTargetInterfaces, m_bAcceptReconfiguration, m_bAutoReconnect, m_bCompressedLogs, m_bDaemon, m_bFirstMix, m_bIsEncryptedLogEnabled, m_bIsRunReConfigure, m_bLastMix, m_bLocalProxy, m_bLogConsole, m_bMiddleMix, m_bSocksSupport, m_bSyslog, m_bVerifyMixCerts, m_cnListenerInterfaces, m_cnTargets, m_cnVisibleAddresses, m_dbCountryStatsHost, m_dbCountryStatsPasswd, m_dbCountryStatsUser, m_docMixInfo, m_docMixXml, m_docOpTnCs, m_iSOCKSPort, m_iSOCKSServerPort, m_iTargetPort, m_maxLogFileSize, m_maxNrOfUsers, m_nrOfOpenFiles, m_nrOfTermsAndConditionsTemplates, m_OpCert, m_PaymentReminderProbability, m_pBI, m_pCascadeXML, m_pcsReConfigure, m_pLogEncryptionCertificate, m_pMultiSignature, m_pNextMixCertificate, m_pPrevMixCertificate, m_pTrustedRootCertificates, m_strAiID, m_strCascadeName, m_strConfigFile, m_strDatabaseHost, m_strDatabaseName, m_strDatabasePassword, m_strDatabaseUser, m_strEncryptedLogDir, m_strLogDir, m_strLogLevel, m_strMixID, m_strMixName, m_strPidFile, m_strSOCKSHost, m_strTargetHost, m_strUser, m_termsAndConditionsTemplates, m_u32DelayChannelBucketGrow, m_u32DelayChannelBucketGrowIntervall, m_u32DelayChannelUnlimitTraffic, and setZero64().

References cleanup().


Member Function Documentation

References m_bAcceptReconfiguration.

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

Just add the id of the Mix to the MixInfo Document.

References E_UNKNOWN, m_docMixInfo, m_strMixID, MIXINFO_ATTRIBUTE_MIX_ID, CAMsg::printMsg(), and setDOMElementAttribute().

Referenced by setMixID(), and setOwnCertificate().

SINT32 CACmdLnOptions::addVisibleAddresses ( DOMNode *  nodeProxy) [private]

Add all the visible addresses to the list of visible addresses found in the XML description of the <Proxy> element given.

The structur is as follows:

	* <Proxy>
	*      <VisibleAddresses> <!-- Describes the visible addresses from the 'outside world' -->
 *       <VisibleAddress>
	*        <Host> <!-- Host or IP -->
	 *       </Host>
	 *     </VisibleAddress>
	 *   </VisibleAddresses>
*
	* </Proxy>
	

References ASSERT_PARENT_NODE_NAME, E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), getDOMElementValue(), len, m_arStrVisibleAddresses, m_cnVisibleAddresses, OPTIONS_NODE_HOST, OPTIONS_NODE_PROXY, OPTIONS_NODE_VISIBLE_ADDRESS, OPTIONS_NODE_VISIBLE_ADDRESS_LIST, and TMP_BUFF_SIZE.

Referenced by setTargetInterfaces().

SINT32 CACmdLnOptions::appendMixInfo_internal ( DOMNode *  a_node,
bool  with_subtree 
) [private]

Here we remove any given e-mail address to reduce the spam problem.

References E_SUCCESS, E_UNKNOWN, getElementsByTagName(), m_docMixInfo, and CAMsg::printMsg().

Referenced by setListenerInterfaces(), setMinCascadeLength(), setMixDescription(), setMixType(), setPriceCertificate(), and setServerMonitoring().

SINT32 CACmdLnOptions::buildDefaultConfig ( XERCES_CPP_NAMESPACE::DOMDocument *  doc,
bool  bForLastMix = false 
) [static, private]

Creates a default mix configuration.

Returns:
r_doc The XML Document containing the default mix configuration
Return values:
E_SUCCESS
Todo:
MixType can be chosen randomly between FirstMix and MiddleMix but not LastMix! sk13: ok this is a hack - but this way it can also create configurations for LastMixes which makes testing of the dynamic szenario much easier...

MixID must be the SubjectKeyIdentifier of the mix' certificate

Todo:
Add a list of default InfoServices to the default configuration

We add this for compatability reasons. ListenerInterfaces can be determined dynamically now

Todo:
Add Description section because InfoService doesn't accept MixInfos without Location or Operator

References createDOMElement(), DEFAULT_INFOSERVICE, E_SUCCESS, CACertificate::encode(), CASignature::generateSignKey(), CASignature::getSignKey(), CACertificate::getSubjectKeyIdentifier(), CASignature::getVerifyKey(), setDOMElementAttribute(), and setDOMElementValue().

Referenced by createMixOnCDConfiguration().

This is the final cleanup, which deletes every resource (including any locks necessary to synchronise read/write to properties).

References clean(), E_SUCCESS, and m_pcsReConfigure.

Referenced by setAccountingDatabase(), and ~CACmdLnOptions().

Deletes all information about the listener interfaces.

References E_SUCCESS, m_arListenerInterfaces, and m_cnListenerInterfaces.

Referenced by clean().

Deletes all information about the target interfaces.

References CATargetInterface::cleanAddr(), E_SUCCESS, m_arTargetInterfaces, and m_cnTargets.

Referenced by clean(), and setNewValues().

Deletes all information about the visible addresses.

References E_SUCCESS, m_arStrVisibleAddresses, and m_cnVisibleAddresses.

Referenced by clean(), and setTargetInterfaces().

SINT32 CACmdLnOptions::createMixOnCDConfiguration ( const UINT8 strFileName) [static]

Writes a default configuration file into the file named by filename.

Builds a default Configuration.

Parameters:
strFileNamefilename of the file in which the default configuration is stored, if NULL stdout is used

References buildDefaultConfig(), createDOMDocument(), E_SUCCESS, and saveToFile().

Referenced by parse().

SINT32 CACmdLnOptions::createSockets ( bool  a_bPrintMessages,
CASocket **  a_sockets,
UINT32  a_socketsLen 
)

Set to true if the encrpyted log could/should be used.

References E_SUCCESS, and m_bIsEncryptedLogEnabled.

XERCES_CPP_NAMESPACE::DOMDocument ** CACmdLnOptions::getAllTermsAndConditionsTemplates ( )

References m_bAutoReconnect.

Returns an CAXMLBI object, which describes the BI this AI uses.

This is not a copy of the CAXMLBI object. The caller should not delete it!

Return values:
NULLif BI was not set in the configuration file
Returns:
information stored inthe configuration file about the BI

References m_pBI.

SINT32 CACmdLnOptions::getCascadeName ( UINT8 name,
UINT32  len 
) const

References m_pCascadeXML.

References m_bCompressedLogs.

Referenced by initLogging().

SINT32 CACmdLnOptions::getCountryStatsDBConnectionLoginData ( char **  db_host,
char **  db_user,
char **  db_passwd 
)

References m_bDaemon.

Referenced by initLogging().

References m_u32DelayChannelBucketGrow.

Referenced by setNewValues().

References m_u32DelayChannelUnlimitTraffic.

Referenced by setNewValues().

References E_SPACE, E_SUCCESS, E_UNKNOWN, and m_strLogDir.

Referenced by initLogging().

Returns a certificate which contains a key which could be used for log encryption.

References CACertificate::clone(), and m_pLogEncryptionCertificate.

Referenced by CAMsg::openEncryptedLog().

References m_maxLogFiles.

Referenced by CAMsg::rotateLog().

References m_maxLogFileSize.

References m_nrOfOpenFiles.

References E_SUCCESS, E_UNKNOWN, and m_strTargetHost.

Referenced by CALocalProxy::init().

References m_iTargetPort.

SINT32 CACmdLnOptions::getMixXml ( XERCES_CPP_NAMESPACE::DOMDocument *&  docMixInfo)

Get the XML describing the Mix.

Returns the XML tree describing the Mix .

this is not a string!

This is NOT a copy!

Parameters:
docMixInfodestination for the XML tree
Return values:
E_SUCCESSif it was successful
E_UNKNOWNin case of an error

References createDOMElement(), E_SUCCESS, E_UNKNOWN, getcurrentTimeMillis(), getDOMChildByName(), m_docMixInfo, print64(), CAMsg::printMsg(), setDOMElementValue(), and UNIVERSAL_NODE_LAST_UPDATE.

Returns a COPY of the public test certifcate for that mix.

Return values:
aCOPY of the mix test certifcate. Returns a COPY of the Operator Certificate of that mix.
Returns:
opCerts

References E_UNKNOWN, CACertificate::getSubjectKeyIdentifier(), and m_OpCert.

Referenced by CAMix::appendTermsAndConditionsExtension(), CAInfoService::getOperatorTnCsAsStrings(), getTermsAndConditions(), and CAMix::termsAndConditionsInfoNode().

SINT32 CACmdLnOptions::getPidFile ( UINT8 pidfile,
UINT32  len 
)

References m_pPriceCertificate.

References E_UNKNOWN, and m_strSOCKSHost.

References m_iSOCKSPort.

References m_iSOCKSServerPort.

Referenced by CALocalProxy::loop().

Fills a TargetInterface struct with the values which belongs to the target interface nr.

This is actual a copy of all values, so the caller is responsible for destroying them after use!

Parameters:
oTargetInterfaceTargetInterface struct, which gets filles with the values of target interface nr
nrthe index of the target interface, for whcih information is request (starting with 1 for the first interface)
Return values:
E_SUCCESSif successful
E_UNKNOWNif nr is out of range

References CATargetInterface::cloneInto(), E_UNKNOWN, m_arTargetInterfaces, and m_cnTargets.

Referenced by CAMiddleMix::init(), CAFirstMix::init(), CAMix::needAutoConfig(), setNewValues(), and CALastMix::setTargets().

XERCES_CPP_NAMESPACE::DOMElement * CACmdLnOptions::getTermsAndConditions ( )
SINT32 CACmdLnOptions::getUser ( UINT8 user,
UINT32  len 
)

References E_SUCCESS, E_UNKNOWN, and m_strUser.

Referenced by setUserID().

SINT32 CACmdLnOptions::getVisibleAddress ( UINT8 strAddressBuff,
UINT32  len,
UINT32  nr 
)

Fills strAddressBuff with a outside visible adress.

Parameters:
strAddressBuffbuffer for adress information (either hostname or IP string)
lensize of strAddressBuff
nrthe number of the adress we request information about (starting with 1 for the first address)
Return values:
E_SUCCESSif successful
E_SPACEif buffer is to small for the requested address
E_UNKNOWNif nr is out of range

References E_SPACE, E_SUCCESS, E_UNKNOWN, m_arStrVisibleAddresses, and m_cnVisibleAddresses.

Referenced by setTargetInterfaces().

References m_cnVisibleAddresses.

Referenced by setTargetInterfaces().

References m_pNextMixCertificate.

SINT32 CACmdLnOptions::invokeOptionSetters ( const optionSetter_pt optionsSetters,
DOMElement *  optionsSource,
SINT32  optionsSettersLength 
) [private]

framework-function for calling predefined option setter functions.

Used by functions that handle a certain type of options, i.e. general settings, account setting, etc.

References E_SUCCESS, E_UNKNOWN, and CAMsg::printMsg().

Referenced by processXmlConfiguration(), setAccountingOptions(), setCertificateOptions(), setGeneralOptions(), setNetworkOptions(), and setTermsAndConditions().

Returns if the encrpyted Log could/should be used.

References m_bIsEncryptedLogEnabled.

Referenced by initLogging().

References m_bLocalProxy.

References m_bMiddleMix.

References m_bSocksSupport.

References m_bSyslog.

Referenced by initLogging().

SINT32 CACmdLnOptions::parse ( int  argc,
const char **  arg 
)
SINT32 CACmdLnOptions::parseInfoServices ( DOMElement *  a_infoServiceNode) [private]

LERNGRUPPE Parses the InfoServices Node in a) a mix configuration or b) out of infoservices.xml (Code refactored from CACmdLnOptions::processXmlConfiguration.

Parameters:
a_infoServiceNodeThe InfoServices Element
Return values:
E_SUCCESS
Todo:
merge could be better...
Todo:
Take more than one listener interface for a given IS...

References E_SUCCESS, getDOMChildByName(), getDOMElementValue(), getElementsByTagName(), CAListenerInterface::getInstance(), m_addrInfoServices, m_addrInfoServicesSize, m_bAcceptReconfiguration, OPTIONS_NODE_ALLOW_AUTO_CONF, OPTIONS_NODE_INFOSERVICE, and CAListenerInterface::XML_ELEMENT_CONTAINER_NAME.

Referenced by setInfoServices().

SINT32 CACmdLnOptions::processXmlConfiguration ( XERCES_CPP_NAMESPACE::DOMDocument *  docConfig) [private]

Processes a XML configuration document.

This sets the values of the options to the values found in the XML document. Note that only the values are changed, which are given in the XML document!

Parameters:
docConfigthe configuration as XML document
Return values:
E_UNKNOWNif an error occurs
E_SUCCESSotherwise

References createDOMElement(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), getElementsByTagName(), hasPrevMixTestCertificate(), invokeOptionSetters(), isLastMix(), m_dbCountryStatsHost, m_dbCountryStatsPasswd, m_dbCountryStatsUser, m_docMixInfo, m_PaymentReminderProbability, m_pCascadeXML, MAIN_OPTION_SETTERS_NR, mainOptionSetters, MIX_VERSION, MIXINFO_NODE_PARENT, MIXINFO_NODE_PAYMENTREMINDER, MIXINFO_NODE_SOFTWARE, MIXINFO_NODE_VERSION, CAMsg::printMsg(), setDOMElementValue(), and verifyMixCertificates().

Referenced by parse(), setNextMix(), setPrevMix(), and threadReConfigure().

SINT32 CACmdLnOptions::readXmlConfiguration ( XERCES_CPP_NAMESPACE::DOMDocument *&  docConfig,
const UINT8 *const  configFile 
) [private]

Tries to read the XML configuration file configFile and parses (but not process) it.

Returns the parsed document as DOM_Document.

Parameters:
docConfigon return contains the parsed XMl document
configFilefile name of the XML config file
Return values:
E_SUCCESSif successful
E_FILE_OPENif error in opening the file
E_FILE_READif not the whole file could be read
E_XML_PARSEif the file could not be parsed

References E_FILE_OPEN, E_FILE_READ, filesize32(), and len.

Referenced by parse(), and threadReConfigure().

SINT32 CACmdLnOptions::readXmlConfiguration ( XERCES_CPP_NAMESPACE::DOMDocument *&  docConfig,
const UINT8 *const  buf,
UINT32  len 
) [private]

Tries to read the XML configuration from byte array buf.

The parsed XML document is parsed only, not processed. Returns the parsed document as a DOM_Document.

Parameters:
docConfigon return contains the parsed XMl document
bufa byte array containing the XML data
lenthe length of the byte array
Return values:
E_SUCCESSif successful
E_XML_PARSEif the data could not be parsed

References E_SUCCESS, E_UNKNOWN, parseDOMDocument(), and CAMsg::printMsg().

Rereads the configuration file (if one was given on startup) and reconfigures the mix according to the new values.

This is done asyncronous. A new thread is started, which does the actual work. Note: We have to avoid an blocking on any mutex, as this function typically is called from a signal handler - and who knows which mutexes are blocked if this happend...

Return values:
E_SUCCESSif successful
E_UNKNOWNif an error occurs

References E_SUCCESS, E_UNKNOWN, m_bIsRunReConfigure, m_threadReConfigure, t_CMNDLN_REREAD_PARAMS::pCmdLnOptions, pMix, t_CMNDLN_REREAD_PARAMS::pMix, CAThread::setMainLoop(), CAThread::start(), and threadReConfigure.

Referenced by signal_hup().

SINT32 CACmdLnOptions::saveToFile ( XERCES_CPP_NAMESPACE::DOMDocument *  p_doc,
const UINT8 p_strFileName 
) [static]

Saves the given XML Document to a file.

Parameters:
p_docThe XML Document to be saved
p_strFileNameThe name of the file to be saved to
Return values:
E_SUCCESS
Todo:
Check for errors

References DOM_Output::dumpToMem(), E_SUCCESS, and len.

Referenced by createMixOnCDConfiguration().

SINT32 CACmdLnOptions::setAccountingDatabase ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setAccountingHardLimit ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setAccountingOptions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setAccountingSoftLimit ( DOMElement *  elemAccounting) [private]

References E_SUCCESS, and m_strCascadeName.

Referenced by setCascadeNameFromOptions().

SINT32 CACmdLnOptions::setCascadeNameFromOptions ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setCertificateOptions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setDaemonMode ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setDynamicMix ( DOMElement *  elemGeneral) [private]

determines whether this mix is a dynamic mix or not appears in <General></General> and is optional.

References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_bDynamic, OPTIONS_NODE_DYNAMIC_MIX, CAMsg::printMsg(), and TMP_BUFF_SIZE.

Referenced by initGeneralOptionSetters().

SINT32 CACmdLnOptions::setGeneralOptions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setInfoServices ( DOMElement *  elemNetwork) [private]
SINT32 CACmdLnOptions::setKeepAliveTraffic ( DOMElement *  elemNetwork) [private]
SINT32 CACmdLnOptions::setListenerInterfaces ( DOMElement *  elemNetwork) [private]
SINT32 CACmdLnOptions::setLogDir ( const UINT8 name,
UINT32  len 
)

References E_SUCCESS, len, and m_strLogDir.

SINT32 CACmdLnOptions::setLoggingOptions ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setMaxUsers ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setMinCascadeLength ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setMixCertificateVerification ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setMixDescription ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setMixID ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setMixName ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setMixType ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setNetworkOptions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setNewValues ( CACmdLnOptions newOptions) [private]

Copies options from newOptions.

Only those options which are specified in newOptions are copied. The others are left untouched!

Parameters:
newOptionsCACmdLnOptions object from which the new values are copied
Return values:
E_UNKNOWNif an error occurs
E_SUCCESSotherwise

References clearTargetInterfaces(), E_SUCCESS, getDelayChannelBucketGrow(), getDelayChannelBucketGrowIntervall(), getDelayChannelUnlimitTraffic(), getMaxNrOfUsers(), getTargetInterface(), getTargetInterfaceCount(), m_arTargetInterfaces, m_cnTargets, m_maxNrOfUsers, m_u32DelayChannelBucketGrow, m_u32DelayChannelBucketGrowIntervall, and m_u32DelayChannelUnlimitTraffic.

Referenced by threadReConfigure().

SINT32 CACmdLnOptions::setNextMix ( XERCES_CPP_NAMESPACE::DOMDocument *  doc)

Modifies the next mix settings (target interface and certificate) according to the specified options object.

Target interfaces are only copied if they denote a next mix. HTTP and SOCKS proxy settings are ignored.

Parameters:
doca DOM document containing XML data with the new options

References CERT_X509CERTIFICATE, createDOMElement(), CACertificate::decode(), E_SUCCESS, getDOMChildByName(), m_docMixXml, m_pNextMixCertificate, OPTIONS_NODE_CERTIFICATE_LIST, OPTIONS_NODE_LISTENER_INTERFACE, OPTIONS_NODE_NETWORK, OPTIONS_NODE_NEXT_MIX, OPTIONS_NODE_NEXT_MIX_CERTIFICATE, OPTIONS_NODE_SIGNATURE, OPTIONS_NODE_X509DATA, CAMsg::printMsg(), and processXmlConfiguration().

SINT32 CACmdLnOptions::setNextMixCertificate ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setNrOfFileDescriptors ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setOwnCertificate ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setOwnOperatorCertificate ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setPaymentInstance ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setPaymentReminder ( DOMElement *  elemGeneral) [private]
SINT32 CACmdLnOptions::setPrepaidInterval ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setPrevMix ( XERCES_CPP_NAMESPACE::DOMDocument *  doc)

Modifies the next mix settings (target interface and certificate) according to the specified options object.

Target interfaces are only copied if they denote a next mix. HTTP and SOCKS proxy settings are ignored.

Parameters:
doca DOM document containing XML data with the new options

References createDOMElement(), DOM_Output::dumpToMem(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), len, m_docMixXml, OPTIONS_NODE_CERTIFICATE_LIST, OPTIONS_NODE_PREV_MIX_CERTIFICATE, OPTIONS_NODE_SIGNATURE, OPTIONS_NODE_X509_CERTIFICATE, OPTIONS_NODE_X509DATA, CAMsg::printMsg(), and processXmlConfiguration().

SINT32 CACmdLnOptions::setPrevMixCertificate ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setPriceCertificate ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setRessourceOptions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setServerMonitoring ( DOMElement *  elemNetwork) [private]
SINT32 CACmdLnOptions::setSettleInterval ( DOMElement *  elemAccounting) [private]
SINT32 CACmdLnOptions::setTargetInterfaces ( DOMElement *  elemNetwork) [private]
SINT32 CACmdLnOptions::setTermsAndConditions ( DOMElement *  elemRoot) [private]
SINT32 CACmdLnOptions::setTermsAndConditionsList ( DOMElement *  elemTnCs) [private]
SINT32 CACmdLnOptions::setTermsAndConditionsTemplates ( DOMElement *  elemTnCs) [private]
SINT32 CACmdLnOptions::setTrustedRootCertificates ( DOMElement *  elemCertificates) [private]
SINT32 CACmdLnOptions::setUserID ( DOMElement *  elemGeneral) [private]

Friends And Related Function Documentation

THREAD_RETURN threadReConfigure ( void *  param) [friend]

Thread that does the actual reconfigure work.

Only one is running at the same time.

Parameters:
parampointer to a t_CMNDLN_REREAD_PARAMS stuct containing a CACmdLnOptions object pointer and a CMix object pointer.

Referenced by reread().


Member Data Documentation

bool CACmdLnOptions::m_bDaemon [private]

Referenced by setDynamicMix().

Referenced by CACmdLnOptions(), isLocalProxy(), and parse().

bool CACmdLnOptions::m_bSyslog [private]
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docMixInfo [private]
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docMixXml [private]
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docOpTnCs [private]

Referenced by CACmdLnOptions(), getSOCKSPort(), and parse().

Referenced by CACmdLnOptions(), getMixPort(), and parse().

DOMNodeList* CACmdLnOptions::m_opCertList [private]
DOMElement* CACmdLnOptions::m_pCascadeXML [private]

Referenced by CACmdLnOptions(), and cleanup().

char* CACmdLnOptions::m_strLogDir [private]
char* CACmdLnOptions::m_strMixID [private]

Referenced by CACmdLnOptions(), clean(), and setMixName().

char* CACmdLnOptions::m_strUser [private]
XERCES_CPP_NAMESPACE::DOMDocument** CACmdLnOptions::m_termsAndConditionsTemplates

Referenced by reread().