|
Mixe for Privacy and Anonymity in the Internet
|
#include <CACmdLnOptions.hpp>
Definition at line 234 of file CACmdLnOptions.hpp.
Definition at line 47 of file CACmdLnOptions.cpp.
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().
{
m_bDaemon=false;
m_bSyslog=false;
m_bLogConsole = false;
m_bSocksSupport = false;
m_bLocalProxy=m_bFirstMix=m_bLastMix=m_bMiddleMix=false;
#ifndef ONLY_LOCAL_PROXY
m_bIsRunReConfigure=false;
m_addrInfoServices = NULL;
m_addrInfoServicesSize=0;
m_pcsReConfigure=new CAMutex();
//m_pSignKey=NULL;
//m_pOwnCertificate=NULL;
m_OpCert=NULL;
m_pMultiSignature=NULL;
m_pPrevMixCertificate=NULL;
m_pNextMixCertificate=NULL;
m_pTrustedRootCertificates=NULL;
m_bVerifyMixCerts=false;
m_bCompressedLogs=false;
m_pLogEncryptionCertificate=NULL;
m_bIsEncryptedLogEnabled=false;
m_docMixInfo= createDOMDocument();
m_docMixXml=NULL;
m_pCascadeXML=NULL;
m_docOpTnCs=NULL; //Operator Terms and Conditions (if any)
m_bAcceptReconfiguration=false;
m_maxNrOfUsers = 0;
#ifdef PAYMENT
m_PaymentReminderProbability= -1;
#else
m_PaymentReminderProbability= 0;
#endif
#ifdef COUNTRY_STATS
m_dbCountryStatsHost=m_dbCountryStatsPasswd=m_dbCountryStatsUser=NULL;
#endif
#endif //ONLY_LOCAL_PROXY
m_iTargetPort=m_iSOCKSPort=m_iSOCKSServerPort=0xFFFF;
m_strTargetHost=m_strSOCKSHost=NULL;
m_strUser=NULL;
m_strCascadeName=NULL;
m_strLogDir=NULL;
m_strLogLevel=NULL;
setZero64(m_maxLogFileSize);
m_strEncryptedLogDir=NULL;
m_arTargetInterfaces=NULL;
m_cnTargets=0;
m_arListenerInterfaces=NULL;
m_cnListenerInterfaces=0;
m_arStrVisibleAddresses=NULL;
m_cnVisibleAddresses=0;
m_nrOfOpenFiles=-1;
m_strMixID=NULL;
m_strMixName=NULL;
m_bAutoReconnect=false;
m_strConfigFile=NULL;
m_strPidFile=NULL;
#ifdef PAYMENT
m_pBI=NULL;
m_strDatabaseHost=NULL;
m_strDatabaseName=NULL;
m_strDatabaseUser=NULL;
m_strDatabasePassword=NULL;
m_strAiID=NULL;
#endif
#ifdef SERVER_MONITORING
m_strMonitoringListenerHost = NULL;
m_iMonitoringListenerPort = 0xFFFF;
#endif
m_termsAndConditionsTemplates = NULL;
m_nrOfTermsAndConditionsTemplates = 0;
#ifdef LOG_CRIME
m_logPayload = false;
m_arCrimeRegExpsURL=NULL;
m_nCrimeRegExpsURL=0;
m_arCrimeRegExpsPayload=NULL;
m_nCrimeRegExpsPayload=0;
m_nrOfSurveillanceIPs = 0;
m_surveillanceIPs = NULL;
m_nrOfSurveillanceAccounts = 0;
m_surveillanceAccounts = NULL;
#endif
#ifdef DATA_RETENTION_LOG
m_strDataRetentionLogDir=NULL;
#endif
#ifdef EXPORT_ASYM_PRIVATE_KEY
m_strImportKeyFile=NULL;
m_strExportKeyFile=NULL;
#endif
#ifdef DYNAMIC_MIX
m_strLastCascadeProposal = NULL;
#endif
#if defined(DELAY_CHANNELS) && defined(DELAY_USERS)
if(isFirstMix())
{
m_u32DelayChannelUnlimitTraffic=DELAY_USERS_TRAFFIC;
m_u32DelayChannelBucketGrow=DELAY_USERS_BUCKET_GROW;
m_u32DelayChannelBucketGrowIntervall=DELAY_USERS_BUCKET_GROW_INTERVALL;
}
else
{
m_u32DelayChannelUnlimitTraffic=DELAY_CHANNEL_TRAFFIC;
m_u32DelayChannelBucketGrow=DELAY_BUCKET_GROW;
m_u32DelayChannelBucketGrowIntervall=DELAY_BUCKET_GROW_INTERVALL;
}
#elif defined(DELAY_CHANNELS)
m_u32DelayChannelUnlimitTraffic=DELAY_CHANNEL_TRAFFIC;
m_u32DelayChannelBucketGrow=DELAY_BUCKET_GROW;
m_u32DelayChannelBucketGrowIntervall=DELAY_BUCKET_GROW_INTERVALL;
#elif defined (DELAY_USERS)
m_u32DelayChannelUnlimitTraffic=DELAY_USERS_TRAFFIC;
m_u32DelayChannelBucketGrow=DELAY_USERS_BUCKET_GROW;
m_u32DelayChannelBucketGrowIntervall=DELAY_USERS_BUCKET_GROW_INTERVALL;
#endif
#if defined(DELAY_CHANNELS_LATENCY)
m_u32DelayChannelLatency = DELAY_CHANNEL_LATENCY;
#endif
/* initialize pointer to option setter functions */
initMainOptionSetters();
initGeneralOptionSetters();
initCertificateOptionSetters();
#ifdef PAYMENT
initAccountingOptionSetters();
#endif
initNetworkOptionSetters();
initTermsAndConditionsOptionSetters();
#ifdef LOG_CRIME
initCrimeDetectionOptionSetters();
#endif
}
Definition at line 189 of file CACmdLnOptions.cpp.
References cleanup().
{
cleanup();
}
| bool CACmdLnOptions::acceptReconfiguration | ( | ) | [inline] |
Definition at line 650 of file CACmdLnOptions.hpp.
References m_bAcceptReconfiguration.
Referenced by CAMix::CAMix(), and CAMix::start().
{ return m_bAcceptReconfiguration; }
| SINT32 CACmdLnOptions::addMixIdToMixInfo | ( | ) | [inline, private] |
Just add the id of the Mix to the MixInfo Document.
Definition at line 1835 of file CACmdLnOptions.cpp.
References E_UNKNOWN, m_docMixInfo, m_strMixID, MIXINFO_ATTRIBUTE_MIX_ID, CAMsg::printMsg(), and setDOMElementAttribute().
Referenced by setMixID(), and setOwnCertificate().
{
if( (m_docMixInfo != NULL) && (m_strMixID != NULL) )
{
return setDOMElementAttribute
(m_docMixInfo->getDocumentElement(), MIXINFO_ATTRIBUTE_MIX_ID, (UINT8*) m_strMixID);
}
CAMsg::printMsg(LOG_CRIT,"No mixinfo document initialized!\n");
return E_UNKNOWN;
}
| 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>
Definition at line 413 of file CACmdLnOptions.cpp.
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().
{
if(nodeProxy==NULL) return E_UNKNOWN;
ASSERT_PARENT_NODE_NAME
(nodeProxy->getNodeName(), OPTIONS_NODE_PROXY, OPTIONS_NODE_VISIBLE_ADDRESS_LIST);
DOMNode* elemVisAdresses=NULL;
getDOMChildByName(nodeProxy, OPTIONS_NODE_VISIBLE_ADDRESS_LIST, elemVisAdresses);
DOMNode* elemVisAddress=NULL;
getDOMChildByName(elemVisAdresses, OPTIONS_NODE_VISIBLE_ADDRESS ,elemVisAddress);
while(elemVisAddress!=NULL)
{
if(equals(elemVisAddress->getNodeName(), OPTIONS_NODE_VISIBLE_ADDRESS))
{
DOMElement* elemHost;
if(getDOMChildByName(elemVisAddress, OPTIONS_NODE_HOST ,elemHost)==E_SUCCESS)
{
UINT8 tmp[TMP_BUFF_SIZE];
UINT32 len = TMP_BUFF_SIZE;
if(getDOMElementValue(elemHost,tmp,&len)==E_SUCCESS)
{//append the new address to the list of addresses
UINT8** tmpAr=new UINT8*[m_cnVisibleAddresses+1];
if(m_arStrVisibleAddresses!=NULL)
{
memcpy(tmpAr,m_arStrVisibleAddresses,m_cnVisibleAddresses*sizeof(UINT8*));
delete[] m_arStrVisibleAddresses;
m_arStrVisibleAddresses = NULL;
}
tmpAr[m_cnVisibleAddresses]=new UINT8[len+1];
memcpy(tmpAr[m_cnVisibleAddresses],tmp,len+1);
m_cnVisibleAddresses++;
m_arStrVisibleAddresses=tmpAr;
}
}
}
elemVisAddress=elemVisAddress->getNextSibling();
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::appendMixInfo_internal | ( | DOMNode * | a_node, |
| bool | with_subtree | ||
| ) | [private] |
Here we remove any given e-mail address to reduce the spam problem.
Definition at line 1787 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, getElementsByTagName(), m_docMixInfo, and CAMsg::printMsg().
Referenced by setListenerInterfaces(), setMinCascadeLength(), setMixDescription(), setMixType(), setPriceCertificate(), and setServerMonitoring().
{
DOMNode *importedNode = NULL;
DOMNode *appendedNode = NULL;
if(a_node == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No node specified!\n");
return E_UNKNOWN;
}
if(m_docMixInfo == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No mixinfo document initialized!\n");
return E_UNKNOWN;
}
if(m_docMixInfo->getDocumentElement() == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No mixinfo dom structure initialized!\n");
return E_UNKNOWN;
}
importedNode = m_docMixInfo->importNode(a_node, with_subtree);
if(importedNode != NULL)
{
if (importedNode->getNodeType() == DOMNode::ELEMENT_NODE)
{
DOMNodeList* nodesMail = getElementsByTagName((DOMElement*)importedNode, "EMail");
for (UINT32 i = 0; i < nodesMail->getLength (); i++)
{
nodesMail->item(i)->getParentNode()->removeChild(nodesMail->item(i));
}
}
appendedNode = m_docMixInfo->getDocumentElement()->appendChild(importedNode);
if( appendedNode != NULL )
{
return E_SUCCESS;
}
}
CAMsg::printMsg(LOG_CRIT,"Could not append Node \"%s\" to Mixinfo!\n", a_node->getNodeName());
return E_UNKNOWN;
}
| SINT32 CACmdLnOptions::buildDefaultConfig | ( | XERCES_CPP_NAMESPACE::DOMDocument * | doc, |
| bool | bForLastMix = false |
||
| ) | [static, private] |
Creates a default mix configuration.
| E_SUCCESS |
MixID must be the SubjectKeyIdentifier of the mix' certificate
We add this for compatability reasons. ListenerInterfaces can be determined dynamically now
Definition at line 4865 of file CACmdLnOptions.cpp.
References createDOMElement(), DEFAULT_INFOSERVICE, E_SUCCESS, CACertificate::encode(), CASignature::generateSignKey(), CASignature::getSignKey(), CACertificate::getSubjectKeyIdentifier(), CASignature::getVerifyKey(), setDOMElementAttribute(), and setDOMElementValue().
Referenced by createMixOnCDConfiguration().
{
CASignature* pSignature=new CASignature();
pSignature->generateSignKey(1024);
DOMElement* elemRoot=createDOMElement(doc,"MixConfiguration");
doc->appendChild(elemRoot);
setDOMElementAttribute(elemRoot,"version",(UINT8*)"0.5");
DOMElement* elemGeneral=createDOMElement(doc,"General");
elemRoot->appendChild(elemGeneral);
DOMElement* elemTmp=createDOMElement(doc,"MixType");
if(bForLastMix)
setDOMElementValue(elemTmp,(UINT8*)"LastMix");
else
setDOMElementValue(elemTmp,(UINT8*)"FirstMix");
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"MixID");
CACertificate* pCert;
pSignature->getVerifyKey(&pCert);
UINT8 buf[255];
UINT32 len = 255;
pCert->getSubjectKeyIdentifier( buf, &len);
setDOMElementValue(elemTmp,buf);
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"Dynamic");
setDOMElementValue(elemTmp,(UINT8*)"True");
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"Daemon");
setDOMElementValue(elemTmp,(UINT8*)"True");
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"CascadeName");
setDOMElementValue(elemTmp,(UINT8*)"Dynamic Cascade");
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"MixName");
setDOMElementValue(elemTmp,(UINT8*)"Dynamic Mix");
elemGeneral->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"UserID");
setDOMElementValue(elemTmp,(UINT8*)"mix");
elemGeneral->appendChild(elemTmp);
DOMElement* elemLogging=createDOMElement(doc,"Logging");
elemGeneral->appendChild(elemLogging);
elemTmp=createDOMElement(doc,"SysLog");
setDOMElementValue(elemTmp,(UINT8*)"True");
elemLogging->appendChild(elemTmp);
DOMElement* elemNet=createDOMElement(doc,"Network");
elemRoot->appendChild(elemNet);
DOMElement*elemISs=createDOMElement(doc,"InfoServices");
elemNet->appendChild(elemISs);
elemTmp=createDOMElement(doc,"AllowAutoConfiguration");
setDOMElementValue(elemTmp,(UINT8*)"True");
elemISs->appendChild(elemTmp);
DOMElement* elemIS=createDOMElement(doc,"InfoService");
elemISs->appendChild(elemIS);
DOMElement* elemISListeners=createDOMElement(doc,"ListenerInterfaces");
elemIS->appendChild(elemISListeners);
DOMElement* elemISLi=createDOMElement(doc,"ListenerInterface");
elemISListeners->appendChild(elemISLi);
elemTmp=createDOMElement(doc,"Host");
setDOMElementValue(elemTmp,(UINT8*)DEFAULT_INFOSERVICE);
elemISLi->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"Port");
setDOMElementValue(elemTmp,6543U);
elemISLi->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"AllowAutoConfiguration");
setDOMElementValue(elemTmp,(UINT8*)"True");
elemISs->appendChild(elemTmp);
/* DOM_Element elemListeners=doc.createElement("ListenerInterfaces");
elemNet.appendChild(elemListeners);
DOM_Element elemListener=doc.createElement("ListenerInterface");
elemListeners.appendChild(elemListener);
elemTmp=doc.createElement("Port");
setDOMElementValue(elemTmp,6544U);
elemListener.appendChild(elemTmp);
elemTmp=doc.createElement("NetworkProtocol");
setDOMElementValue(elemTmp,(UINT8*)"RAW/TCP");
elemListener.appendChild(elemTmp);
*/
if(bForLastMix)
{
DOMElement* elemProxies=createDOMElement(doc,"Proxies");
DOMElement* elemProxy=createDOMElement(doc,"Proxy");
elemProxies->appendChild(elemProxy);
elemTmp=createDOMElement(doc,"ProxyType");
setDOMElementValue(elemTmp,(UINT8*)"HTTP");
elemProxy->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"Host");
setDOMElementValue(elemTmp,(UINT8*)"127.0.0.1");
elemProxy->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"Port");
setDOMElementValue(elemTmp,3128U);
elemProxy->appendChild(elemTmp);
elemTmp=createDOMElement(doc,"NetworkProtocol");
setDOMElementValue(elemTmp,(UINT8*)"RAW/TCP");
elemProxy->appendChild(elemTmp);
elemNet->appendChild(elemProxies);
}
DOMElement* elemCerts=createDOMElement(doc,"Certificates");
elemRoot->appendChild(elemCerts);
DOMElement* elemOwnCert=createDOMElement(doc,"OwnCertificate");
elemCerts->appendChild(elemOwnCert);
DOMElement* tmpElemSigKey=NULL;
pSignature->getSignKey(tmpElemSigKey,doc);
elemOwnCert->appendChild(tmpElemSigKey);
DOMElement* elemTmpCert=NULL;
pCert->encode(elemTmpCert,doc);
elemOwnCert->appendChild(elemTmpCert);
delete pCert;
pCert = NULL;
delete pSignature;
pSignature = NULL;
return E_SUCCESS;
}
| void CACmdLnOptions::clean | ( | ) |
Deletes all resssource allocated by objects of this class EXPECT the locks necessary to controll access to the properties of this class.
Definition at line 468 of file CACmdLnOptions.cpp.
References accountingOptionSetters, certificateOptionSetters, clearListenerInterfaces(), clearTargetInterfaces(), clearVisibleAddresses(), generalOptionSetters, m_addrInfoServices, m_addrInfoServicesSize, m_dbCountryStatsHost, m_dbCountryStatsPasswd, m_dbCountryStatsUser, m_docMixInfo, m_docMixXml, m_docOpTnCs, m_OpCert, m_pLogEncryptionCertificate, m_pMultiSignature, m_pNextMixCertificate, m_pPrevMixCertificate, m_strCascadeName, m_strConfigFile, m_strEncryptedLogDir, m_strLogDir, m_strLogLevel, m_strMixID, m_strMixName, m_strPidFile, m_strSOCKSHost, m_strTargetHost, m_strUser, mainOptionSetters, and networkOptionSetters.
Referenced by cleanup().
{
delete[] m_strConfigFile;
m_strConfigFile=NULL;
delete[] m_strTargetHost;
m_strTargetHost=NULL;
delete[] m_strSOCKSHost;
m_strSOCKSHost=NULL;
#ifndef ONLY_LOCAL_PROXY
if (m_addrInfoServices != NULL)
{
for (UINT32 i = 0; i < m_addrInfoServicesSize; i++)
{
delete m_addrInfoServices[i];
m_addrInfoServices[i] = NULL;
}
delete[] m_addrInfoServices;
m_addrInfoServices=NULL;
m_addrInfoServicesSize = 0;
}
#endif //ONLY_LOCAL_PROXY
delete[] m_strCascadeName;
m_strCascadeName=NULL;
delete[] m_strLogDir;
m_strLogDir=NULL;
delete[] m_strLogLevel;
m_strLogLevel=NULL;
delete[] m_strPidFile;
m_strPidFile=NULL;
delete[] m_strEncryptedLogDir;
m_strEncryptedLogDir=NULL;
delete[] m_strUser;
m_strUser=NULL;
delete[] m_strMixID;
m_strMixID=NULL;
delete[] m_strMixName;
m_strMixName=NULL;
clearTargetInterfaces();
clearListenerInterfaces();
#ifndef ONLY_LOCAL_PROXY
if(m_docMixInfo!=NULL)
m_docMixInfo=NULL;
clearVisibleAddresses();
//delete m_pSignKey;
//m_pSignKey=NULL;
//delete m_pOwnCertificate;
//m_pOwnCertificate=NULL;
delete m_pMultiSignature;
m_pMultiSignature = NULL;
delete m_OpCert;
m_OpCert=NULL;
delete m_pNextMixCertificate;
m_pNextMixCertificate=NULL;
delete m_pPrevMixCertificate;
m_pPrevMixCertificate=NULL;
delete m_pLogEncryptionCertificate;
m_pLogEncryptionCertificate=NULL;
if(m_docMixInfo!=NULL)
{
m_docMixInfo->release();
m_docMixInfo=NULL;
}
if(m_docMixXml!=NULL)
{
m_docMixXml->release();
m_docMixXml=NULL;
}
if(m_docOpTnCs!=NULL)
{
m_docOpTnCs->release();
m_docOpTnCs=NULL;
}
#ifdef COUNTRY_STATS
delete[] m_dbCountryStatsHost;
m_dbCountryStatsHost = NULL;
delete[] m_dbCountryStatsUser;
m_dbCountryStatsUser = NULL;
delete[] m_dbCountryStatsPasswd;
m_dbCountryStatsPasswd = NULL;
#endif
#ifdef DATA_RETENTION_LOG
delete[] m_strDataRetentionLogDir;
m_strDataRetentionLogDir=NULL;
#endif
#ifdef EXPORT_ASYM_PRIVATE_KEY
if(m_strImportKeyFile!=NULL)
delete[] m_strImportKeyFile;
m_strImportKeyFile=NULL;
if(m_strExportKeyFile!=NULL)
delete[] m_strExportKeyFile;
m_strExportKeyFile=NULL;
#endif
#endif //ONLY_LOCAL_PROXY
#ifdef SERVER_MONITORING
if(m_strMonitoringListenerHost != NULL)
{
delete[] m_strMonitoringListenerHost;
m_strMonitoringListenerHost = NULL;
}
#endif
delete [] mainOptionSetters;
mainOptionSetters = NULL;
delete [] generalOptionSetters;
generalOptionSetters = NULL;
delete certificateOptionSetters;
certificateOptionSetters = NULL;
#ifdef PAYMENT
delete [] accountingOptionSetters;
accountingOptionSetters = NULL;
#endif
delete [] networkOptionSetters;
networkOptionSetters = NULL;
}
This is the final cleanup, which deletes every resource (including any locks necessary to synchronise read/write to properties).
Definition at line 334 of file CACmdLnOptions.cpp.
References clean(), E_SUCCESS, and m_pcsReConfigure.
Referenced by setAccountingDatabase(), and ~CACmdLnOptions().
{
clean();
#ifndef ONLY_LOCAL_PROXY
delete m_pcsReConfigure;
m_pcsReConfigure=NULL;
#endif
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::clearListenerInterfaces | ( | ) | [private] |
Deletes all information about the listener interfaces.
Definition at line 364 of file CACmdLnOptions.cpp.
References E_SUCCESS, m_arListenerInterfaces, and m_cnListenerInterfaces.
Referenced by clean().
{
if(m_arListenerInterfaces!=NULL)
{
for(UINT32 i=0;i<m_cnListenerInterfaces;i++)
{
delete m_arListenerInterfaces[i];
m_arListenerInterfaces[i] = NULL;
}
delete[] m_arListenerInterfaces;
}
m_cnListenerInterfaces=0;
m_arListenerInterfaces=NULL;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::clearTargetInterfaces | ( | ) | [private] |
Deletes all information about the target interfaces.
Definition at line 346 of file CACmdLnOptions.cpp.
References CATargetInterface::cleanAddr(), E_SUCCESS, m_arTargetInterfaces, and m_cnTargets.
Referenced by clean(), and setNewValues().
{
if(m_arTargetInterfaces!=NULL)
{
for(UINT32 i=0;i<m_cnTargets;i++)
{
m_arTargetInterfaces[i].cleanAddr();
}
delete[] m_arTargetInterfaces;
m_arTargetInterfaces = NULL;
}
m_cnTargets=0;
m_arTargetInterfaces=NULL;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::clearVisibleAddresses | ( | ) | [private] |
Deletes all information about the visible addresses.
Definition at line 383 of file CACmdLnOptions.cpp.
References E_SUCCESS, m_arStrVisibleAddresses, and m_cnVisibleAddresses.
Referenced by clean(), and setTargetInterfaces().
{
if(m_arStrVisibleAddresses!=NULL)
{
for(UINT32 i=0;i<m_cnVisibleAddresses;i++)
{
delete[] m_arStrVisibleAddresses[i];
m_arStrVisibleAddresses[i] = NULL;
}
delete[] m_arStrVisibleAddresses;
}
m_cnVisibleAddresses=0;
m_arStrVisibleAddresses=NULL;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::createMixOnCDConfiguration | ( | const UINT8 * | strFileName | ) | [static] |
Writes a default configuration file into the file named by filename.
Builds a default Configuration.
| strFileName | filename of the file in which the default configuration is stored, if NULL stdout is used |
Definition at line 4848 of file CACmdLnOptions.cpp.
References buildDefaultConfig(), createDOMDocument(), E_SUCCESS, and saveToFile().
Referenced by parse().
{
XERCES_CPP_NAMESPACE::DOMDocument* doc = createDOMDocument();
//Neasty but cool...
bool bForLast=false;
if(strFileName!=NULL&&strncmp((char*)strFileName,"last",4)==0)
bForLast=true;
buildDefaultConfig(doc,bForLast);
saveToFile(doc, strFileName);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::createSockets | ( | bool | a_bPrintMessages, |
| CASocket ** | a_sockets, | ||
| UINT32 | a_socketsLen | ||
| ) |
Definition at line 3446 of file CACmdLnOptions.cpp.
References CASocket::create(), E_SPACE, E_SUCCESS, E_UNKNOWN, E_UNSPECIFIED, GET_NET_ERROR, GET_NET_ERROR_STR, CAListenerInterface::getAddr(), getListenerInterface(), getListenerInterfaceCount(), CASocketAddr::getType(), CAListenerInterface::isHidden(), CAListenerInterface::isVirtual(), CASocket::listen(), CAMsg::printMsg(), CASocket::setReuseAddr(), and CASocketAddr::toString().
Referenced by CAFirstMix::init(), and setListenerInterfaces().
{
if (a_socketsLen <= 0)
{
CAMsg::printMsg(LOG_CRIT,"Could not create any listener sockets as we have no space reserved for them. This seems to be an implementation bug.");
return E_SPACE;
}
UINT32 aktSocket;
UINT8 buff[255];
SINT32 ret = E_UNKNOWN;
UINT32 currentInterface;
CASocketAddr* pAddr;
UINT32* arrayVirtualPorts = new UINT32[a_socketsLen];
UINT32 iVirtualPortsLen = 0;
UINT32 iHiddenPortsLen = 0;
UINT32* arrayHiddenPorts = new UINT32[a_socketsLen];
aktSocket = 0;
for(currentInterface=0;currentInterface < getListenerInterfaceCount(); currentInterface++)
{
CAListenerInterface* pListener=NULL;
pListener=getListenerInterface(currentInterface+1);
if(pListener==NULL)
{
CAMsg::printMsg(LOG_CRIT,"Error: Listener interface %d is invalid.\n", currentInterface+1);
delete[] arrayVirtualPorts;
delete[] arrayHiddenPorts;
return E_UNKNOWN;
}
pAddr=pListener->getAddr();
pAddr->toString(buff,255);
if(pAddr->getType()==AF_INET)
{
if (pListener->isVirtual())
{
arrayVirtualPorts[iVirtualPortsLen] = ((CASocketAddrINet*)pAddr)->getPort();
iVirtualPortsLen++;
}
else if (pListener->isHidden())
{
arrayHiddenPorts[iHiddenPortsLen] = ((CASocketAddrINet*)pAddr)->getPort();
iHiddenPortsLen++;
}
}
if(pListener->isVirtual())
{
delete pListener;
pListener = NULL;
delete pAddr;
pAddr = NULL;
continue;
}
if (a_socketsLen < aktSocket )
{
CAMsg::printMsg(LOG_CRIT,
"Found %d listener sockets, but we have only reserved memory for %d sockets. This seems to be an implementation error in the code.\n",
(aktSocket + 1), a_socketsLen);
delete[] arrayVirtualPorts;
delete[] arrayHiddenPorts;
delete pAddr;
return E_SPACE;
}
ret = E_SUCCESS;
a_sockets[aktSocket] = new CASocket();
a_sockets[aktSocket]->create(pAddr->getType());
a_sockets[aktSocket]->setReuseAddr(true);
delete pListener;
pListener = NULL;
#ifndef _WIN32
//we have to be a temporary superuser if port <1024...
int old_uid=geteuid();
if(pAddr->getType()==AF_INET&&((CASocketAddrINet*)pAddr)->getPort()<1024)
{
if(seteuid(0)==-1) //changing to root
{
CAMsg::printMsg(LOG_CRIT,"Setuid failed! We might not be able to listen on interface %d (%s) as we cannot change to the root user.\n",
currentInterface+1, buff);
}
}
#endif
ret=a_sockets[aktSocket]->listen(*pAddr);
delete pAddr;
pAddr = NULL;
if(ret!=E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Socket error while listening on interface %d (%s). Reason: %s (%i)\n",currentInterface+1, buff,
GET_NET_ERROR_STR(GET_NET_ERROR), GET_NET_ERROR);
}
#ifndef _WIN32
seteuid(old_uid);
#endif
if(ret!=E_SUCCESS)
{
delete[] arrayVirtualPorts;
delete[] arrayHiddenPorts;
return E_UNKNOWN;
}
if (a_bMessages)
{
CAMsg::printMsg(LOG_DEBUG,"Listening on Interface: %s\n",buff);
}
aktSocket++;
} //END FOR
if (ret == E_UNKNOWN)
{
CAMsg::printMsg(LOG_CRIT,"Could not find any valid (non-virtual) listener interface!\n");
}
else if (ret == E_SUCCESS)
{
for (UINT32 iHiddenPort = 0; iHiddenPort < iHiddenPortsLen; iHiddenPort++)
{
bool bVirtualFound = false;
for (UINT32 iVirtualPort = 0; iVirtualPort < iVirtualPortsLen; iVirtualPort++)
{
if (arrayHiddenPorts[iHiddenPort] == arrayVirtualPorts[iVirtualPort])
{
bVirtualFound = true;
arrayVirtualPorts[iVirtualPort] = 0;
}
}
if (!bVirtualFound)
{
CAMsg::printMsg(LOG_CRIT,"No virtuel listener interface found for the hidden interface %d with port %d. Please remove the hidden interface, add the corresponding virtual interface or remove the 'hidden' attribute from the interface.\n", iHiddenPort, arrayHiddenPorts[iHiddenPort]);
ret = E_UNSPECIFIED;
break;
}
}
if (ret == E_SUCCESS)
{
for (UINT32 iVirtualPort = 0; iVirtualPort < iVirtualPortsLen; iVirtualPort++)
{
if (arrayVirtualPorts[iVirtualPort] != 0)
{
CAMsg::printMsg(LOG_CRIT,"No hidden listener interface found for the virtual interface %d with port %d. Please remove the virtual interface, add the corresponding hidden interface or remove the 'virtual' attribute from the interface.\n", iVirtualPort, arrayVirtualPorts[iVirtualPort]);
ret = E_UNSPECIFIED;
break;
}
}
}
}
if (ret == E_SUCCESS && a_bMessages)
{
CAMsg::printMsg(LOG_DEBUG,"Listening on all interfaces.\n");
}
delete[] arrayVirtualPorts;
delete[] arrayHiddenPorts;
arrayVirtualPorts = NULL;
return ret;
}
| SINT32 CACmdLnOptions::enableEncryptedLog | ( | bool | b | ) | [inline] |
Set to true if the encrpyted log could/should be used.
Definition at line 425 of file CACmdLnOptions.hpp.
References E_SUCCESS, and m_bIsEncryptedLogEnabled.
{
m_bIsEncryptedLogEnabled=b;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::getAiID | ( | UINT8 * | id, |
| UINT32 | len | ||
| ) |
Definition at line 1513 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strAiID.
Referenced by CAAccountingInstance::CAAccountingInstance().
| XERCES_CPP_NAMESPACE::DOMDocument ** CACmdLnOptions::getAllTermsAndConditionsTemplates | ( | ) |
Definition at line 1709 of file CACmdLnOptions.cpp.
References m_termsAndConditionsTemplates.
Referenced by CAMix::appendTermsAndConditionsExtension().
{
return m_termsAndConditionsTemplates;
}
| bool CACmdLnOptions::getAutoReconnect | ( | ) | [inline] |
Definition at line 518 of file CACmdLnOptions.hpp.
References m_bAutoReconnect.
{
return m_bAutoReconnect;
}
| CAXMLBI * CACmdLnOptions::getBI | ( | ) |
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!
| NULL | if BI was not set in the configuration file |
Definition at line 1455 of file CACmdLnOptions.cpp.
References m_pBI.
{
return m_pBI;
}
| SINT32 CACmdLnOptions::getCascadeName | ( | UINT8 * | name, |
| UINT32 | len | ||
| ) | const |
Definition at line 1565 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strCascadeName.
Referenced by CAFirstMix::initCountryStats(), and iplist_loopDoLogCountries().
{
if(m_strCascadeName==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen((char*)m_strCascadeName))
{
return E_UNKNOWN;
}
strcpy((char*)name,(char*)m_strCascadeName);
return E_SUCCESS;
}
| DOMElement* CACmdLnOptions::getCascadeXML | ( | ) | [inline] |
Definition at line 439 of file CACmdLnOptions.hpp.
References m_pCascadeXML.
{
return m_pCascadeXML;
}
| bool CACmdLnOptions::getCompressLogs | ( | ) | [inline] |
Definition at line 482 of file CACmdLnOptions.hpp.
References m_bCompressedLogs.
Referenced by initLogging().
{
return m_bCompressedLogs;
}
| SINT32 CACmdLnOptions::getCountryStatsDBConnectionLoginData | ( | char ** | db_host, |
| char ** | db_user, | ||
| char ** | db_passwd | ||
| ) |
Definition at line 5326 of file CACmdLnOptions.cpp.
References E_SUCCESS, m_dbCountryStatsHost, m_dbCountryStatsPasswd, and m_dbCountryStatsUser.
Referenced by CAFirstMix::init().
{
*db_host=*db_user=*db_passwd=NULL;
if(m_dbCountryStatsHost!=NULL)
{
*db_host=new char[strlen(m_dbCountryStatsHost)+1];
strcpy(*db_host,m_dbCountryStatsHost);
}
if(m_dbCountryStatsUser!=NULL)
{
*db_user=new char[strlen(m_dbCountryStatsUser)+1];
strcpy(*db_user,m_dbCountryStatsUser);
}
if(m_dbCountryStatsPasswd!=NULL)
{
*db_passwd=new char[strlen(m_dbCountryStatsPasswd)+1];
strcpy(*db_passwd,m_dbCountryStatsPasswd);
}
return E_SUCCESS;
}
| bool CACmdLnOptions::getDaemon | ( | ) |
Definition at line 1393 of file CACmdLnOptions.cpp.
References m_bDaemon.
Referenced by initLogging().
{
return m_bDaemon;
}
| SINT32 CACmdLnOptions::getDatabaseHost | ( | UINT8 * | host, |
| UINT32 | len | ||
| ) |
Definition at line 1460 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strDatabaseHost.
{
if(m_strDatabaseHost==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen((char *)m_strDatabaseHost))
{
return E_UNKNOWN;
}
strcpy((char*)host,(char *)m_strDatabaseHost);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::getDatabaseName | ( | UINT8 * | name, |
| UINT32 | len | ||
| ) |
Definition at line 1477 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strDatabaseName.
{
if(m_strDatabaseName==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen((char *)m_strDatabaseName))
{
return E_UNKNOWN;
}
strcpy((char*)name,(char *)m_strDatabaseName);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::getDatabasePassword | ( | UINT8 * | pass, |
| UINT32 | len | ||
| ) |
Definition at line 1501 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strDatabasePassword.
{
if(m_strDatabasePassword==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen((char *)m_strDatabasePassword))
{
return E_UNKNOWN;
}
strcpy((char*)pass,(char *)m_strDatabasePassword);
return E_SUCCESS;
}
Definition at line 1472 of file CACmdLnOptions.cpp.
References m_iDatabasePort.
Referenced by CAAccountingDBInterface::initDBConnection().
{
return m_iDatabasePort;
}
| SINT32 CACmdLnOptions::getDatabaseUsername | ( | UINT8 * | user, |
| UINT32 | len | ||
| ) |
Definition at line 1489 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strDatabaseUser.
{
if(m_strDatabaseUser==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen((char *)m_strDatabaseUser))
{
return E_UNKNOWN;
}
strcpy((char*)user,(char *)m_strDatabaseUser);
return E_SUCCESS;
}
| UINT32 CACmdLnOptions::getDelayChannelBucketGrow | ( | ) | [inline] |
Definition at line 568 of file CACmdLnOptions.hpp.
References m_u32DelayChannelBucketGrow.
Referenced by setNewValues().
{
return m_u32DelayChannelBucketGrow;
}
| UINT32 CACmdLnOptions::getDelayChannelBucketGrowIntervall | ( | ) | [inline] |
Definition at line 572 of file CACmdLnOptions.hpp.
References m_u32DelayChannelBucketGrowIntervall.
Referenced by setNewValues().
{
return m_u32DelayChannelBucketGrowIntervall;
}
| UINT32 CACmdLnOptions::getDelayChannelUnlimitTraffic | ( | ) | [inline] |
Definition at line 564 of file CACmdLnOptions.hpp.
References m_u32DelayChannelUnlimitTraffic.
Referenced by setNewValues().
{
return m_u32DelayChannelUnlimitTraffic;
}
| SINT32 CACmdLnOptions::getEncryptedLogDir | ( | UINT8 * | name, |
| UINT32 | len | ||
| ) |
Definition at line 1578 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strEncryptedLogDir.
{
if(m_strEncryptedLogDir==NULL||name==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen(m_strEncryptedLogDir))
return E_UNKNOWN;
strcpy((char*)name,m_strEncryptedLogDir);
return E_SUCCESS;
}
| CAListenerInterface ** CACmdLnOptions::getInfoServices | ( | UINT32 & | r_size | ) |
Definition at line 1559 of file CACmdLnOptions.cpp.
References m_addrInfoServices, and m_addrInfoServicesSize.
Referenced by CAInfoService::getPaymentInstance(), isAllowedToPassRestrictions(), and CAInfoService::sendHelo().
{
r_size = m_addrInfoServicesSize;
return m_addrInfoServices;
}
| UINT32 CACmdLnOptions::getKeepAliveRecvInterval | ( | ) | [inline] |
Definition at line 473 of file CACmdLnOptions.hpp.
References m_u32KeepAliveRecvInterval.
Referenced by CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
{
return m_u32KeepAliveRecvInterval;
}
| UINT32 CACmdLnOptions::getKeepAliveSendInterval | ( | ) | [inline] |
Definition at line 468 of file CACmdLnOptions.hpp.
References m_u32KeepAliveSendInterval.
Referenced by CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
{
return m_u32KeepAliveSendInterval;
}
| CAListenerInterface* CACmdLnOptions::getListenerInterface | ( | UINT32 | nr | ) | [inline] |
Definition at line 259 of file CACmdLnOptions.hpp.
References m_arListenerInterfaces, and m_cnListenerInterfaces.
Referenced by createSockets(), CALocalProxy::init(), CAMiddleMix::init(), CALastMix::init(), CAMix::initMixCascadeInfo(), and CAFirstMix::initOnce().
{
if(nr>0&&nr<=m_cnListenerInterfaces&&m_arListenerInterfaces[nr-1]!=NULL)
return new CAListenerInterface(*m_arListenerInterfaces[nr-1]);
return NULL;
};
| UINT32 CACmdLnOptions::getListenerInterfaceCount | ( | ) | [inline] |
Definition at line 258 of file CACmdLnOptions.hpp.
References m_cnListenerInterfaces.
Referenced by createSockets(), CAMiddleMix::init(), CALastMix::init(), CAMix::initMixCascadeInfo(), CAFirstMix::initOnce(), and setListenerInterfaces().
{return m_cnListenerInterfaces;}
| SINT32 CACmdLnOptions::getLogDir | ( | UINT8 * | name, |
| UINT32 | len | ||
| ) |
Definition at line 1589 of file CACmdLnOptions.cpp.
References E_SPACE, E_SUCCESS, E_UNKNOWN, and m_strLogDir.
Referenced by initLogging().
{
if(m_strLogDir==NULL||name==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen(m_strLogDir))
{
return E_SPACE;
}
strcpy((char*)name,m_strLogDir);
return E_SUCCESS;
}
| CACertificate* CACmdLnOptions::getLogEncryptionKey | ( | ) | [inline] |
Returns a certificate which contains a key which could be used for log encryption.
Definition at line 432 of file CACmdLnOptions.hpp.
References CACertificate::clone(), and m_pLogEncryptionCertificate.
Referenced by CAMsg::openEncryptedLog().
{
if(m_pLogEncryptionCertificate!=NULL)
return m_pLogEncryptionCertificate->clone();
return NULL;
}
| UINT32 CACmdLnOptions::getMaxLogFiles | ( | ) | [inline] |
Definition at line 493 of file CACmdLnOptions.hpp.
References m_maxLogFiles.
Referenced by CAMsg::rotateLog().
{
return m_maxLogFiles;
}
| SINT64 CACmdLnOptions::getMaxLogFileSize | ( | ) | [inline] |
Definition at line 488 of file CACmdLnOptions.hpp.
References m_maxLogFileSize.
{
return m_maxLogFileSize;
}
| UINT32 CACmdLnOptions::getMaxNrOfUsers | ( | ) | [inline] |
Definition at line 657 of file CACmdLnOptions.hpp.
References m_maxNrOfUsers.
Referenced by fm_loopAcceptUsers(), CAMix::initMixCascadeInfo(), and setNewValues().
{
return m_maxNrOfUsers;
}
| SINT32 CACmdLnOptions::getMaxOpenFiles | ( | ) | [inline] |
Definition at line 314 of file CACmdLnOptions.hpp.
References m_nrOfOpenFiles.
{
return m_nrOfOpenFiles;
}
| SINT32 CACmdLnOptions::getMixHost | ( | UINT8 * | host, |
| UINT32 | len | ||
| ) |
Definition at line 1418 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strTargetHost.
Referenced by CALocalProxy::init().
{
if(m_strTargetHost==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen(m_strTargetHost))
{
return E_UNKNOWN;
}
strcpy((char*)host,m_strTargetHost);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::getMixId | ( | UINT8 * | id, |
| UINT32 | len | ||
| ) |
Definition at line 1398 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and m_strMixID.
Referenced by CAFirstMix::doUserLogin_internal(), CAInfoService::getStatusXMLAsString(), CAMix::initMixCascadeInfo(), CAFirstMix::initMixParameters(), and CAMiddleMix::processKeyExchange().
{
if(len<24||m_strMixID==NULL) //we need 24 chars (including final \0)
return E_UNKNOWN;
strcpy((char*)id,m_strMixID);
return E_SUCCESS;
}
Definition at line 1412 of file CACmdLnOptions.cpp.
References m_iTargetPort.
{
return 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!
| docMixInfo | destination for the XML tree |
| E_SUCCESS | if it was successful |
| E_UNKNOWN | in case of an error |
Definition at line 1681 of file CACmdLnOptions.cpp.
References createDOMElement(), E_SUCCESS, E_UNKNOWN, getcurrentTimeMillis(), getDOMChildByName(), m_docMixInfo, print64(), CAMsg::printMsg(), setDOMElementValue(), and UNIVERSAL_NODE_LAST_UPDATE.
{
if(m_docMixInfo == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No mixinfo document initialized!\n");
return E_UNKNOWN;
}
docMixInfo=m_docMixInfo;
//insert (or update) the Timestamp
DOMElement* elemTimeStamp=NULL;
DOMElement* elemRoot=docMixInfo->getDocumentElement();
if(getDOMChildByName(elemRoot, UNIVERSAL_NODE_LAST_UPDATE, elemTimeStamp, false)!=E_SUCCESS)
{
elemTimeStamp=createDOMElement(docMixInfo, UNIVERSAL_NODE_LAST_UPDATE);
elemRoot->appendChild(elemTimeStamp);
}
UINT64 currentMillis;
getcurrentTimeMillis(currentMillis);
UINT8 tmpStrCurrentMillis[50];
print64(tmpStrCurrentMillis,currentMillis);
setDOMElementValue(elemTimeStamp,tmpStrCurrentMillis);
return E_SUCCESS;
}
| CAMultiSignature* CACmdLnOptions::getMultiSigner | ( | ) | [inline] |
Definition at line 322 of file CACmdLnOptions.hpp.
References m_pMultiSignature.
Referenced by CAMiddleMix::initOnce(), CALastMix::initOnce(), and CAFirstMix::initOnce().
{ return m_pMultiSignature; }
| CACertificate* CACmdLnOptions::getNextMixTestCertificate | ( | ) | [inline] |
Definition at line 393 of file CACmdLnOptions.hpp.
References CACertificate::clone(), and m_pNextMixCertificate.
Referenced by CAMiddleMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
{
if(m_pNextMixCertificate!=NULL)
return m_pNextMixCertificate->clone();
return NULL;
}
Definition at line 1705 of file CACmdLnOptions.cpp.
References m_nrOfTermsAndConditionsTemplates.
Referenced by CAMix::appendTermsAndConditionsExtension().
{
return m_nrOfTermsAndConditionsTemplates;
}
| SINT32 CACmdLnOptions::getOperatorSubjectKeyIdentifier | ( | UINT8 * | buffer, |
| UINT32 * | length | ||
| ) |
Returns a COPY of the public test certifcate for that mix.
| a | COPY of the mix test certifcate. Returns a COPY of the Operator Certificate of that mix. |
Definition at line 1547 of file CACmdLnOptions.cpp.
References E_UNKNOWN, CACertificate::getSubjectKeyIdentifier(), and m_OpCert.
Referenced by CAMix::appendTermsAndConditionsExtension(), CAInfoService::getOperatorTnCsAsStrings(), getTermsAndConditions(), and CAMix::termsAndConditionsInfoNode().
{
if(m_OpCert == NULL)
{
(*length) = 0;
return E_UNKNOWN;
}
return m_OpCert->getSubjectKeyIdentifier(buffer, length);
}
Definition at line 1525 of file CACmdLnOptions.cpp.
References m_iPaymentHardLimit.
Referenced by CAAccountingInstance::CAAccountingInstance().
{
return m_iPaymentHardLimit;
}
Definition at line 1540 of file CACmdLnOptions.cpp.
References m_iPaymentSettleInterval.
Referenced by CAAccountingSettleThread::mainLoop().
{
return m_iPaymentSettleInterval;
}
Definition at line 1535 of file CACmdLnOptions.cpp.
References m_iPaymentSoftLimit.
Referenced by CAAccountingInstance::CAAccountingInstance().
{
return m_iPaymentSoftLimit;
}
| SINT32 CACmdLnOptions::getPidFile | ( | UINT8 * | pidfile, |
| UINT32 | len | ||
| ) |
Definition at line 1614 of file CACmdLnOptions.cpp.
References E_SPACE, E_SUCCESS, E_UNKNOWN, and m_strPidFile.
{
if(m_strPidFile==NULL||pidfile==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen(m_strPidFile))
{
return E_SPACE;
}
strcpy((char*)pidfile,m_strPidFile);
return E_SUCCESS;
}
Definition at line 1530 of file CACmdLnOptions.cpp.
References m_iPrepaidInterval.
Referenced by CAAccountingInstance::cleanupTableEntry(), CAAccountingInstance::handleChallengeResponse_internal(), CAAccountingInstance::handleCostConfirmation_internal(), CAAccountingInstance::handleJapPacket_internal(), and CAAccountingInstance::sendCCRequest().
{
return m_iPrepaidInterval;
}
| CACertificate* CACmdLnOptions::getPrevMixTestCertificate | ( | ) | [inline] |
Definition at line 371 of file CACmdLnOptions.hpp.
References CACertificate::clone(), and m_pPrevMixCertificate.
Referenced by CAMiddleMix::processKeyExchange(), and CALastMix::processKeyExchange().
{
if(m_pPrevMixCertificate!=NULL)
return m_pPrevMixCertificate->clone();
return NULL;
}
| CAXMLPriceCert* CACmdLnOptions::getPriceCertificate | ( | ) | const [inline] |
Definition at line 353 of file CACmdLnOptions.hpp.
References m_pPriceCertificate.
{
if(m_pPriceCertificate != NULL)
{
return m_pPriceCertificate;
}
return NULL;
}
| SINT32 CACmdLnOptions::getSOCKSHost | ( | UINT8 * | host, |
| UINT32 | len | ||
| ) |
Definition at line 1436 of file CACmdLnOptions.cpp.
References E_UNKNOWN, and m_strSOCKSHost.
{
if(m_strSOCKSHost==NULL)
return E_UNKNOWN;
if(len<=(UINT32)strlen(m_strSOCKSHost))
{
return E_UNKNOWN;
}
strcpy((char*)host,m_strSOCKSHost);
return (SINT32)strlen(m_strSOCKSHost);
}
Definition at line 1431 of file CACmdLnOptions.cpp.
References m_iSOCKSPort.
{
return m_iSOCKSPort;
}
Definition at line 1407 of file CACmdLnOptions.cpp.
References m_iSOCKSServerPort.
Referenced by CALocalProxy::loop().
{
return m_iSOCKSServerPort;
}
| SINT32 CACmdLnOptions::getTargetInterface | ( | CATargetInterface & | oTargetInterface, |
| UINT32 | nr | ||
| ) | [inline] |
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!
| oTargetInterface | TargetInterface struct, which gets filles with the values of target interface nr |
| nr | the index of the target interface, for whcih information is request (starting with 1 for the first interface) |
| E_SUCCESS | if successful |
| E_UNKNOWN | if nr is out of range |
Definition at line 285 of file CACmdLnOptions.hpp.
References CATargetInterface::cloneInto(), E_UNKNOWN, m_arTargetInterfaces, and m_cnTargets.
Referenced by CAMiddleMix::init(), CAFirstMix::init(), CAMix::needAutoConfig(), setNewValues(), and CALastMix::setTargets().
{
if(nr>0&&nr<=m_cnTargets)
{
return m_arTargetInterfaces[nr-1].cloneInto(oTargetInterface);
}
else
return E_UNKNOWN;
};
| UINT32 CACmdLnOptions::getTargetInterfaceCount | ( | ) | [inline] |
Definition at line 271 of file CACmdLnOptions.hpp.
References m_cnTargets.
Referenced by CAMiddleMix::init(), CAFirstMix::init(), CAMix::needAutoConfig(), setNewValues(), and CALastMix::setTargets().
{return m_cnTargets;}
| XERCES_CPP_NAMESPACE::DOMElement * CACmdLnOptions::getTermsAndConditions | ( | ) |
Definition at line 1717 of file CACmdLnOptions.cpp.
References getOperatorSubjectKeyIdentifier(), m_docOpTnCs, OPTIONS_ATTRIBUTE_TNC_ID, setDOMElementAttribute(), and TMP_BUFF_SIZE.
Referenced by CAInfoService::getOperatorTnCsAsStrings().
{
//DOMElement *docElement = NULL;
if(m_docOpTnCs == NULL)
{
return NULL;
}
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
getOperatorSubjectKeyIdentifier(tmpBuff, &tmpLen);
setDOMElementAttribute(m_docOpTnCs->getDocumentElement(), OPTIONS_ATTRIBUTE_TNC_ID, tmpBuff);
return m_docOpTnCs->getDocumentElement();
//docElement = m_docOpTnCs->getDocumentElement();
//return (docElement == NULL) ? NULL : getElementsByTagName(docElement, OPTION_NODE_TNCS);
}
| CACertStore* CACmdLnOptions::getTrustedCertificateStore | ( | ) | [inline] |
Definition at line 409 of file CACmdLnOptions.hpp.
References m_pTrustedRootCertificates.
Referenced by CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
{
return m_pTrustedRootCertificates;
}
| SINT32 CACmdLnOptions::getUser | ( | UINT8 * | user, |
| UINT32 | len | ||
| ) |
| SINT32 CACmdLnOptions::getVisibleAddress | ( | UINT8 * | strAddressBuff, |
| UINT32 | len, | ||
| UINT32 | nr | ||
| ) |
Fills strAddressBuff with a outside visible adress.
| strAddressBuff | buffer for adress information (either hostname or IP string) |
| len | size of strAddressBuff |
| nr | the number of the adress we request information about (starting with 1 for the first address) |
| E_SUCCESS | if successful |
| E_SPACE | if buffer is to small for the requested address |
| E_UNKNOWN | if nr is out of range |
Definition at line 452 of file CACmdLnOptions.cpp.
References E_SPACE, E_SUCCESS, E_UNKNOWN, m_arStrVisibleAddresses, and m_cnVisibleAddresses.
Referenced by setTargetInterfaces().
{
if(strAddressBuff==NULL||nr==0||nr>m_cnVisibleAddresses)
{
return E_UNKNOWN;
}
if(strlen((char*)m_arStrVisibleAddresses[nr-1] )>=len)
{
return E_SPACE;
}
strcpy((char*)strAddressBuff,(char*)m_arStrVisibleAddresses[nr-1]);
return E_SUCCESS;
}
| UINT32 CACmdLnOptions::getVisibleAddressesCount | ( | ) | [inline] |
Definition at line 297 of file CACmdLnOptions.hpp.
References m_cnVisibleAddresses.
Referenced by setTargetInterfaces().
{return m_cnVisibleAddresses;}
| bool CACmdLnOptions::hasNextMixTestCertificate | ( | ) | [inline] |
Definition at line 388 of file CACmdLnOptions.hpp.
References m_pNextMixCertificate.
{
return m_pNextMixCertificate!=NULL;
}
| bool CACmdLnOptions::hasPrevMixTestCertificate | ( | ) | [inline] |
Definition at line 366 of file CACmdLnOptions.hpp.
References m_pPrevMixCertificate.
Referenced by processXmlConfiguration().
{
return m_pPrevMixCertificate!=NULL;
}
| void CACmdLnOptions::initAccountingOptionSetters | ( | ) | [private] |
Definition at line 266 of file CACmdLnOptions.cpp.
References ACCOUNTING_OPTIONS_NR, accountingOptionSetters, setAccountingDatabase(), setAccountingHardLimit(), setAccountingSoftLimit(), setPaymentInstance(), setPrepaidInterval(), setPriceCertificate(), and setSettleInterval().
Referenced by CACmdLnOptions().
{
accountingOptionSetters = new optionSetter_pt[ACCOUNTING_OPTIONS_NR];
int count = -1;
accountingOptionSetters[++count]=
&CACmdLnOptions::setPaymentInstance;
accountingOptionSetters[++count]=
&CACmdLnOptions::setPriceCertificate;
accountingOptionSetters[++count]=
&CACmdLnOptions::setAccountingSoftLimit;
accountingOptionSetters[++count]=
&CACmdLnOptions::setAccountingHardLimit;
accountingOptionSetters[++count]=
&CACmdLnOptions::setPrepaidInterval;
accountingOptionSetters[++count]=
&CACmdLnOptions::setSettleInterval;
accountingOptionSetters[++count]=
&CACmdLnOptions::setAccountingDatabase;
}
| void CACmdLnOptions::initCertificateOptionSetters | ( | ) | [private] |
Definition at line 254 of file CACmdLnOptions.cpp.
References certificateOptionSetters, m_nCertificateOptionsSetters, MAX_CERTIFICATE_OPTIONS_NR, setNextMixCertificate(), setOwnCertificate(), setOwnOperatorCertificate(), and setPrevMixCertificate().
Referenced by CACmdLnOptions().
{
certificateOptionSetters = new optionSetter_pt[MAX_CERTIFICATE_OPTIONS_NR];
m_nCertificateOptionsSetters = 0;
certificateOptionSetters[m_nCertificateOptionsSetters++]=&CACmdLnOptions::setOwnOperatorCertificate;
certificateOptionSetters[m_nCertificateOptionsSetters++]=&CACmdLnOptions::setOwnCertificate;
certificateOptionSetters[m_nCertificateOptionsSetters++]=&CACmdLnOptions::setNextMixCertificate;
certificateOptionSetters[m_nCertificateOptionsSetters++]=&CACmdLnOptions::setPrevMixCertificate;
}
| void CACmdLnOptions::initGeneralOptionSetters | ( | ) | [private] |
Definition at line 222 of file CACmdLnOptions.cpp.
References GENERAL_OPTIONS_NR, generalOptionSetters, setCascadeNameFromOptions(), setDaemonMode(), setDynamicMix(), setLoggingOptions(), setMaxUsers(), setMinCascadeLength(), setMixID(), setMixName(), setMixType(), setNrOfFileDescriptors(), setPaymentReminder(), and setUserID().
Referenced by CACmdLnOptions().
{
generalOptionSetters = new optionSetter_pt[GENERAL_OPTIONS_NR];
memset(generalOptionSetters,0,sizeof(optionSetter_pt)*GENERAL_OPTIONS_NR);
int count = -1;
generalOptionSetters[++count]=
&CACmdLnOptions::setDaemonMode;
generalOptionSetters[++count]=
&CACmdLnOptions::setNrOfFileDescriptors;
generalOptionSetters[++count]=
&CACmdLnOptions::setUserID;
generalOptionSetters[++count]=
&CACmdLnOptions::setLoggingOptions;
generalOptionSetters[++count]=
&CACmdLnOptions::setMixType;
generalOptionSetters[++count]=
&CACmdLnOptions::setMixName;
generalOptionSetters[++count]=
&CACmdLnOptions::setMixID;
generalOptionSetters[++count]=
&CACmdLnOptions::setDynamicMix;
generalOptionSetters[++count]=
&CACmdLnOptions::setMinCascadeLength;
generalOptionSetters[++count]=
&CACmdLnOptions::setCascadeNameFromOptions;
generalOptionSetters[++count]=
&CACmdLnOptions::setMaxUsers;
generalOptionSetters[++count]=
&CACmdLnOptions::setPaymentReminder;
}
Definition at line 2301 of file CACmdLnOptions.cpp.
References E_SUCCESS, getCompressLogs(), getDaemon(), getLogDir(), init(), isEncryptedLogEnabled(), isSyslogEnabled(), m_bLogConsole, m_strLogLevel, MSG_COMPRESSED_FILE, MSG_FILE, MSG_LOG, MSG_STDOUT, CAMsg::openEncryptedLog(), CAMsg::printMsg(), CAMsg::setLogLevel(), and CAMsg::setLogOptions().
Referenced by setLoggingOptions().
{
SINT32 ret = E_SUCCESS;
UINT8 buff[2000];
UINT32 iLogOptions = 0;
CAMsg::init();
#ifndef ONLY_LOCAL_PROXY
if(isSyslogEnabled())
{
iLogOptions |= MSG_LOG;
}
#endif
if(getLogDir((UINT8*)buff,2000)==E_SUCCESS)
{
if(getCompressLogs())
iLogOptions |= MSG_COMPRESSED_FILE;
else
iLogOptions |= MSG_FILE;
}
#ifndef ONLY_LOCAL_PROXY
if (m_bLogConsole || iLogOptions == 0)
{
iLogOptions |= MSG_STDOUT;
}
ret = CAMsg::setLogOptions(iLogOptions);
if(m_strLogLevel!=NULL)
{
if (strcmp(m_strLogLevel,"info") == 0)
{
CAMsg::setLogLevel(LOG_INFO);
}
else if (strcmp(m_strLogLevel,"warning") == 0)
{
CAMsg::setLogLevel(LOG_WARNING);
}
else if (strcmp(m_strLogLevel,"error") == 0)
{
CAMsg::setLogLevel(LOG_ERR);
}
else if (strcmp(m_strLogLevel,"critical") == 0)
{
CAMsg::setLogLevel(LOG_CRIT);
}
}
if(isEncryptedLogEnabled())
{
SINT32 retEncr;
if ((retEncr = CAMsg::openEncryptedLog()) != E_SUCCESS)
{
CAMsg::printMsg(LOG_ERR,"Could not open encrypted log - exiting!\n");
return retEncr;
}
}
#endif
if(getDaemon() && ret != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT, "We need a log file in daemon mode in order to get any messages! Exiting...\n");
return ret;
}
return E_SUCCESS;
}
| void CACmdLnOptions::initMainOptionSetters | ( | ) | [private] |
Definition at line 194 of file CACmdLnOptions.cpp.
References MAIN_OPTION_SETTERS_NR, mainOptionSetters, setAccountingOptions(), setCertificateOptions(), setGeneralOptions(), setMixDescription(), setNetworkOptions(), setRessourceOptions(), and setTermsAndConditions().
Referenced by CACmdLnOptions().
{
mainOptionSetters = new optionSetter_pt[MAIN_OPTION_SETTERS_NR];
memset(mainOptionSetters,0,sizeof(optionSetter_pt)*MAIN_OPTION_SETTERS_NR);
int count = -1;
mainOptionSetters[++count]=
&CACmdLnOptions::setGeneralOptions;
mainOptionSetters[++count]=
&CACmdLnOptions::setMixDescription;
mainOptionSetters[++count]=
&CACmdLnOptions::setCertificateOptions;
#ifdef PAYMENT
mainOptionSetters[++count]=
&CACmdLnOptions::setAccountingOptions;
#endif
mainOptionSetters[++count]=
&CACmdLnOptions::setNetworkOptions;
mainOptionSetters[++count]=
&CACmdLnOptions::setRessourceOptions;
mainOptionSetters[++count]=
&CACmdLnOptions::setTermsAndConditions;
#ifdef LOG_CRIME
mainOptionSetters[++count]=
&CACmdLnOptions::setCrimeDetectionOptions;
#endif
}
| void CACmdLnOptions::initMixDescriptionSetters | ( | ) | [private] |
| void CACmdLnOptions::initNetworkOptionSetters | ( | ) | [private] |
Definition at line 287 of file CACmdLnOptions.cpp.
References NETWORK_OPTIONS_NR, networkOptionSetters, setInfoServices(), setKeepAliveTraffic(), setListenerInterfaces(), setServerMonitoring(), and setTargetInterfaces().
Referenced by CACmdLnOptions().
{
networkOptionSetters = new optionSetter_pt[NETWORK_OPTIONS_NR];
int count = -1;
networkOptionSetters[++count]=
&CACmdLnOptions::setInfoServices;
networkOptionSetters[++count]=
&CACmdLnOptions::setListenerInterfaces;
networkOptionSetters[++count]=
&CACmdLnOptions::setTargetInterfaces;
networkOptionSetters[++count]=
&CACmdLnOptions::setServerMonitoring;
networkOptionSetters[++count]=
&CACmdLnOptions::setKeepAliveTraffic;
}
| void CACmdLnOptions::initTermsAndConditionsOptionSetters | ( | ) | [private] |
Definition at line 304 of file CACmdLnOptions.cpp.
References setTermsAndConditionsList(), setTermsAndConditionsTemplates(), TERMS_AND_CONDITIONS_OPTIONS_NR, and termsAndConditionsOptionSetters.
Referenced by CACmdLnOptions().
{
termsAndConditionsOptionSetters = new optionSetter_pt[TERMS_AND_CONDITIONS_OPTIONS_NR];
int count = -1;
termsAndConditionsOptionSetters[++count]=
&CACmdLnOptions::setTermsAndConditionsTemplates;
termsAndConditionsOptionSetters[++count]=
&CACmdLnOptions::setTermsAndConditionsList;
}
| 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.
Definition at line 1852 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, and CAMsg::printMsg().
Referenced by processXmlConfiguration(), setAccountingOptions(), setCertificateOptions(), setGeneralOptions(), setNetworkOptions(), and setTermsAndConditions().
{
SINT32 i = 0;
SINT32 ret = E_SUCCESS;
if( optionsSetters == NULL )
{
CAMsg::printMsg(LOG_CRIT,"Error parsing config file: OptionSetters not initialized!\n");
return E_UNKNOWN;
}
if( optionsSettersLength < 0)
{
CAMsg::printMsg(LOG_CRIT,"Error parsing config file: Negative number of option setters specified!\n");
return E_UNKNOWN;
}
/* Only warn when we have a null DOM Element */
if( optionsSource == NULL )
{
CAMsg::printMsg(LOG_INFO, "Found NULL DOM element. "
"NULL element handling is delegated to the specified setter method!\n");
}
for(i=0; i < optionsSettersLength; i++ )
{
if(optionsSetters[i]!=NULL)
{
ret = (this->*(optionsSetters[i]))(optionsSource);
if(ret != E_SUCCESS)
{
return ret;
}
}
}
return E_SUCCESS;
}
| bool CACmdLnOptions::isEncryptedLogEnabled | ( | ) | [inline] |
Returns if the encrpyted Log could/should be used.
Definition at line 415 of file CACmdLnOptions.hpp.
References m_bIsEncryptedLogEnabled.
Referenced by initLogging().
{
return m_bIsEncryptedLogEnabled;
}
| bool CACmdLnOptions::isFirstMix | ( | ) |
Definition at line 1641 of file CACmdLnOptions.cpp.
References m_bFirstMix.
Referenced by CACmdLnOptions(), CAInfoService::InfoLoop(), and CAInfoService::sendCascadeHelo().
{
return m_bFirstMix;
}
| bool CACmdLnOptions::isInfoServiceEnabled | ( | ) | [inline] |
Definition at line 477 of file CACmdLnOptions.hpp.
References m_addrInfoServicesSize.
{
return (m_addrInfoServicesSize>0);
}
| bool CACmdLnOptions::isLastMix | ( | ) |
Definition at line 1651 of file CACmdLnOptions.cpp.
References m_bLastMix.
Referenced by CAInfoService::InfoLoop(), processXmlConfiguration(), CAInfoService::sendCascadeHelo(), and setTargetInterfaces().
{
return m_bLastMix;
}
| bool CACmdLnOptions::isLocalProxy | ( | ) |
Definition at line 1656 of file CACmdLnOptions.cpp.
References m_bLocalProxy.
{
return m_bLocalProxy;
}
| bool CACmdLnOptions::isMiddleMix | ( | ) |
Definition at line 1646 of file CACmdLnOptions.cpp.
References m_bMiddleMix.
{
return m_bMiddleMix;
}
| bool CACmdLnOptions::isSock5sSupported | ( | ) | [inline] |
Definition at line 512 of file CACmdLnOptions.hpp.
References m_bSocksSupport.
{
return m_bSocksSupport;
}
| bool CACmdLnOptions::isSyslogEnabled | ( | ) | [inline] |
Definition at line 419 of file CACmdLnOptions.hpp.
References m_bSyslog.
Referenced by initLogging().
{
return m_bSyslog;
}
| SINT32 CACmdLnOptions::parse | ( | int | argc, |
| const char ** | arg | ||
| ) |
Definition at line 610 of file CACmdLnOptions.cpp.
References CASocket::create(), createMixOnCDConfiguration(), DEFAULT_CONFIG_FILE, DEFAULT_TARGET_PORT, E_FILE_OPEN, E_FILE_READ, E_SUCCESS, E_XML_PARSE, CAListenerInterface::getInstance(), m_arListenerInterfaces, m_bAutoReconnect, m_bCompressedLogs, m_bDaemon, m_bLocalProxy, m_cnListenerInterfaces, m_docMixXml, m_iSOCKSPort, m_iSOCKSServerPort, m_iTargetPort, m_strConfigFile, m_strLogDir, m_strPidFile, m_strSOCKSHost, m_strTargetHost, MIX_VERSION_INFO, MIX_VERSION_TESTING, MIX_VERSION_TESTING_TEXT, POPT_ARG_INT, POPT_ARG_NONE, POPT_ARG_STRING, POPT_AUTOHELP, POPT_ERROR_BADOPT, poptFreeContext(), poptGetContext(), poptGetNextOpt(), CAMsg::printMsg(), processXmlConfiguration(), RAW_TCP, RAW_UNIX, readXmlConfiguration(), and TMP_BUFF_SIZE.
{
int iDaemon=0;
char* target=NULL;
int iLocalProxy=0;
int SOCKSport=-1;
char* socks=NULL;
char* logdir=NULL;
int iCompressedLogs=0;
char* serverPort=NULL;
int iVersion=0;
char* configfile=NULL;
int iAutoReconnect=0;
char* strPidFile=NULL;
char* strCreateConf=NULL;
#ifdef EXPORT_ASYM_PRIVATE_KEY
char* strImportKey=NULL;
char* strExportKey=NULL;
#endif
//DOM_Document docMixXml;
poptOption theOptions[]=
{
{"localproxy",'j',POPT_ARG_NONE,&iLocalProxy,0,"act as local proxy",NULL},
{"daemon",'d',POPT_ARG_NONE,&iDaemon,0,"start as daemon [only for local proxy]",NULL},
{"next",'n',POPT_ARG_STRING,&target,0,"first mix of cascade [only for local proxy]","<ip:port>"},
{"autoreconnect",'a',POPT_ARG_NONE,&iAutoReconnect,0,"auto reconnects if connection to first mix was lost [only for local proxy]",NULL},
{"port",'p',POPT_ARG_STRING,&serverPort,0,"listening on [host:]port|path [only for local proxy]","<[host:]port|path>"},
{"socksport",'s',POPT_ARG_INT,&SOCKSport,0,"listening port for socks","<portnumber>"},
{"logdir",'l',POPT_ARG_STRING,&logdir,0,"directory where log files go to [only for local proxy]","<dir>"},
#ifdef COMPRESSED_LOGS
{"gzip",'z',POPT_ARG_NONE,&iCompressedLogs,0,"create gziped logs",NULL},
#endif
{"config",'c',POPT_ARG_STRING,&configfile,0,"config file to use [for a real Mix in a cascade]","<file>"},
{"version",'v',POPT_ARG_NONE,&iVersion,0,"show version",NULL},
{"pidfile",'r',POPT_ARG_STRING,&strPidFile,0,"file where the PID will be stored","<file>"},
{"createConf",0,POPT_ARG_STRING,&strCreateConf,0,"creates a generic configuration for MixOnCD","[<file>]"},
#ifdef EXPORT_ASYM_PRIVATE_KEY
{"exportKey",0,POPT_ARG_STRING,&strExportKey,0,"export private encryption key from file","<file>"},
{"importKey",0,POPT_ARG_STRING,&strImportKey,0,"import private encryption key to file","<file>"},
#endif
POPT_AUTOHELP
{NULL,0,0,
NULL,0,NULL,NULL}
};
poptContext ctx=poptGetContext(NULL,argc,argv,theOptions,0);
SINT32 ret=poptGetNextOpt(ctx);
while(ret==POPT_ERROR_BADOPT)
ret=poptGetNextOpt(ctx);
poptFreeContext(ctx);
if(iVersion!=0)
{
printf(MIX_VERSION_INFO);
for(UINT32 t=0;t<10000;t++)
{
CASocket* pSocket=new CASocket;
if(pSocket->create(false)!=E_SUCCESS)
{
printf("Max open sockets: %u\n",t);
exit(0);
}
}
printf("Max open sockets: >10000\n");
exit(0);
}
if (MIX_VERSION_TESTING)
{
CAMsg::printMsg(LOG_WARNING, MIX_VERSION_TESTING_TEXT);
}
#ifndef ONLY_LOCAL_PROXY
if(strCreateConf!=NULL)
{
createMixOnCDConfiguration((UINT8*)strCreateConf);
exit(0);
}
#endif
if(iLocalProxy!=0)
m_bLocalProxy=true;
if(m_bLocalProxy&&iAutoReconnect!=0)
m_bAutoReconnect=true;
/* LERNGRUPPE: Also try to use default config file for Mix Category 1 */
if(configfile == NULL)
{
configfile = (char*) malloc(sizeof(char) * (strlen(DEFAULT_CONFIG_FILE)+1));
strncpy(configfile, DEFAULT_CONFIG_FILE, (strlen(DEFAULT_CONFIG_FILE)+1));
#if defined (_WIN32) &&!defined(__CYGWIN__)
// R_OK is not defined in Windows POSIX implementation
#define R_OK 4
#endif
int err = access(configfile, R_OK);
if( err )
{
if(configfile != NULL)
{
free(configfile);
configfile = NULL;
}
}
}
/* END LERNGRUPPE */
if(configfile!=NULL)
{
#ifndef ONLY_LOCAL_PROXY
ret=readXmlConfiguration(m_docMixXml,(UINT8*)configfile);
if(ret==E_FILE_OPEN)
CAMsg::printMsg(LOG_CRIT,"Could not open config file: %s\n",configfile);
else if(ret==E_FILE_READ)
CAMsg::printMsg(LOG_CRIT,"Could not read config file: %s\n",configfile);
else if(ret==E_XML_PARSE)
CAMsg::printMsg(LOG_CRIT,"Could not parse config file: %s\n",configfile);
else
{
m_strConfigFile=new UINT8[strlen(configfile)+1];
memcpy(m_strConfigFile,configfile,strlen(configfile)+1);
}
#endif
free(configfile);
}
if(iDaemon!=0)
m_bDaemon=true;
if(target!=NULL)
{
if(target[0]=='/') //Unix Domain Sockaet
{
m_strTargetHost=new char[strlen(target)+1];
strcpy(m_strTargetHost,target);
}
else
{
char tmpHostname[TMP_BUFF_SIZE];
SINT32 tmpPort;
char* tmpStr1=strchr(target,':');
if(tmpStr1!=NULL)
{
memcpy(tmpHostname,target,tmpStr1-target);
tmpHostname[tmpStr1-target]=0;
tmpPort=(SINT32)atol(tmpStr1+1);
}
else
{//TODO what if not in right form ?
//try if it is a number --> use it as port
//and use 'localhost' as traget-host
tmpPort=(SINT32)atol(target);
if(tmpPort!=0) //we get it
{
strcpy(tmpHostname,"localhost");
}
else //we try to use it as host and use the default port
{
/* LERNGRUPPE moved the define to CACmdLnOption.hpp because we need it elsewhere too */
//#define DEFAULT_TARGET_PORT 6544
tmpPort=DEFAULT_TARGET_PORT;
strcpy(tmpHostname,target);
}
}
m_strTargetHost=new char[strlen(tmpHostname)+1];
strcpy(m_strTargetHost,tmpHostname);
m_iTargetPort=(UINT16)tmpPort;
}
free(target);
}
if(socks!=NULL)
{
char* tmpStr;
if((tmpStr=strchr(socks,':'))!=NULL)
{
m_strSOCKSHost=new char[tmpStr-socks+1];
(*tmpStr)=0;
strcpy(m_strSOCKSHost,socks);
m_iSOCKSPort=(UINT16)atol(tmpStr+1);
}
free(socks);
}
if(logdir!=NULL)
{
m_strLogDir=new char[strlen(logdir)+1];
strcpy(m_strLogDir,logdir);
free(logdir);
}
if(strPidFile!=NULL)
{
m_strPidFile=new char[strlen(strPidFile)+1];
strcpy(m_strPidFile,strPidFile);
free(strPidFile);
}
#ifdef EXPORT_ASYM_PRIVATE_KEY
if(strExportKey!=NULL)
{
m_strExportKeyFile=new UINT8[strlen(strExportKey)+1];
strcpy((char*)m_strExportKeyFile,strExportKey);
free(strExportKey);
}
if(strImportKey!=NULL)
{
m_strImportKeyFile=new UINT8[strlen(strImportKey)+1];
strcpy((char*)m_strImportKeyFile,strImportKey);
free(strImportKey);
}
#endif
if(iCompressedLogs!=0)
m_bCompressedLogs=true;
if(serverPort!=NULL&&m_bLocalProxy)
{
m_arListenerInterfaces=new CAListenerInterface*[1];
m_arListenerInterfaces[0]=NULL;
m_cnListenerInterfaces=0;
char* tmpStr;
if(serverPort[0]=='/') //Unix Domain Socket
{
m_arListenerInterfaces[0]=CAListenerInterface::getInstance(RAW_UNIX,(UINT8*)serverPort);
}
else //Internet Socket
{
char* strServerHost=NULL;
SINT32 iServerPort;
if((tmpStr=strchr(serverPort,':'))!=NULL) //host:port
{
strServerHost=new char[tmpStr-serverPort+1];
(*tmpStr)=0;
strcpy(strServerHost,serverPort);
iServerPort=(SINT32)atol(tmpStr+1);
}
else //port only ?
{
iServerPort=(SINT32)atol(serverPort);
}
m_arListenerInterfaces[0]=CAListenerInterface::getInstance(RAW_TCP,(UINT8*)strServerHost,(UINT16)iServerPort);
delete [] strServerHost;
strServerHost = NULL;
}
free(serverPort);
if(m_arListenerInterfaces[0]!=0)
m_cnListenerInterfaces=1;
}
m_iSOCKSServerPort=(UINT16)SOCKSport;
#ifndef ONLY_LOCAL_PROXY
if(!m_bLocalProxy)
{
ret=processXmlConfiguration(m_docMixXml);
#ifndef DYNAMIC_MIX
if(ret!=E_SUCCESS)
return ret;
}
#else
/* LERNGRUPPE: Let's try to recover and build a default configuration */
if(ret!=E_SUCCESS)
{
createDefaultConfiguration();
ret=processXmlConfiguration(m_docMixXml);
if(ret!=E_SUCCESS)
return ret;
}
}
#endif
/* Try to read InfoService configuration from external file infoservices.xml */
XERCES_CPP_NAMESPACE::DOMDocument* infoservices;
if( readXmlConfiguration(infoservices,(UINT8*)"infoservices.xml") == E_SUCCESS )
{
CAMsg::printMsg(LOG_DEBUG, "Will now get InfoServices from infoservices.xml (this overrides the InfoServices from the default config!)\n");
DOMElement* elemIs=infoservices->getDocumentElement();
parseInfoServices(elemIs);
}
#ifdef DYNAMIC_MIX
/* Ok, at this point we should make sure that we have a minimal configuration.
If not we try to fill up the missing parameters with default values*/
if( checkCertificates() != E_SUCCESS )
{
CAMsg::printMsg(LOG_CRIT, "I was not able to get a working certificate, please check the configuration! Exiting now\n");
exit(0);
}
UINT32 running = 0;
CAMsg::printMsg( LOG_INFO, "I will now test if I have enough information about InfoServices...\n");
if( checkInfoServices(&running) != E_SUCCESS )
{
CAMsg::printMsg(LOG_CRIT, "Problems with InfoServices\nI need at least %i running InfoServices, but i only know about %i at the moment.\n", MIN_INFOSERVICES, running);
exit(0);
}
CAMsg::printMsg( LOG_INFO, "InfoService information ok\n");
if( checkListenerInterfaces() != E_SUCCESS )
{
CAMsg::printMsg(LOG_CRIT, "I don't have any usefull ListenerInterfaces and I canot determine one. please check the configuration! Hints should have been given\n");
exit(0);
}
if( checkMixId() != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT, "ARGS, I don't have an unique ID, cannot create one! Exiting now\n");
exit(0);
}
#endif // DYNAMIC_MIX
#endif //ONLY_LOCAL_PROXY
return E_SUCCESS;
}
| 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.
| a_infoServiceNode | The InfoServices Element |
| E_SUCCESS |
Definition at line 4788 of file CACmdLnOptions.cpp.
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().
{
DOMElement* elemAllowReconfig;
getDOMChildByName(a_infoServiceNode, OPTIONS_NODE_ALLOW_AUTO_CONF, elemAllowReconfig, false);
DOMNodeList* isList = getElementsByTagName(a_infoServiceNode, OPTIONS_NODE_INFOSERVICE);
/* If there are no InfoServices in the file, keep the (hopefully) previously configured InfoServices */
if(isList->getLength() == 0)
{
return E_SUCCESS;
}
/* If there are already InfoServices, delete them */
if(m_addrInfoServices!=NULL)
{
for(UINT32 i=0;i<m_addrInfoServicesSize;i++)
{
delete m_addrInfoServices[i];
m_addrInfoServices[i] = NULL;
}
delete[] m_addrInfoServices;
}
m_addrInfoServicesSize=0;
m_addrInfoServices=NULL;
UINT32 nrListenerInterfaces;
m_addrInfoServices = new CAListenerInterface*[isList->getLength()];
CAListenerInterface** isListenerInterfaces;
for (UINT32 i = 0; i < isList->getLength(); i++)
{
//get ListenerInterfaces
DOMElement* elemListenerInterfaces;
getDOMChildByName(isList->item(i),CAListenerInterface::XML_ELEMENT_CONTAINER_NAME,elemListenerInterfaces,false);
isListenerInterfaces = CAListenerInterface::getInstance(elemListenerInterfaces, nrListenerInterfaces);
if (nrListenerInterfaces > 0)
{
m_addrInfoServices[m_addrInfoServicesSize] = isListenerInterfaces[0];
m_addrInfoServicesSize++;
for (UINT32 j = 1; j < nrListenerInterfaces; j++)
{
// the other interfaces are not needed...
delete isListenerInterfaces[j];
isListenerInterfaces[j] = NULL;
}
}
}
UINT8 tmpBuff[255];
UINT32 tmpLen=255;
if(getDOMElementValue(elemAllowReconfig,tmpBuff,&tmpLen)==E_SUCCESS)
{
m_bAcceptReconfiguration = (strcmp("True",(char*)tmpBuff) == 0);
}
return E_SUCCESS;
}
| 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!
| docConfig | the configuration as XML document |
| E_UNKNOWN | if an error occurs |
| E_SUCCESS | otherwise |
Definition at line 4632 of file CACmdLnOptions.cpp.
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 ret = E_SUCCESS;
if(docConfig==NULL)
{
return E_UNKNOWN;
}
DOMElement* elemRoot=docConfig->getDocumentElement();
/* Initialize Mixinfo DOM structure so that neccessary
* option can be appended to it.
*/
DOMElement* elemMix=createDOMElement(m_docMixInfo, MIXINFO_NODE_PARENT);
m_docMixInfo->appendChild(elemMix);
/* invoke all main option setters
* which then invoke their own specific
* option setters
*/
ret = invokeOptionSetters(mainOptionSetters, elemRoot, MAIN_OPTION_SETTERS_NR);
if(ret != E_SUCCESS)
{
return E_UNKNOWN;
}
//Set Software-Version...
DOMElement* elemSoftware=createDOMElement(m_docMixInfo, MIXINFO_NODE_SOFTWARE);
DOMElement* elemVersion=createDOMElement(m_docMixInfo, MIXINFO_NODE_VERSION);
setDOMElementValue(elemVersion,(UINT8*)MIX_VERSION);
elemSoftware->appendChild(elemVersion);
elemMix->appendChild(elemSoftware);
/* Add the payment reminder */
DOMElement* elemPaymentReminder=createDOMElement(m_docMixInfo, MIXINFO_NODE_PAYMENTREMINDER);
setDOMElementValue(elemPaymentReminder, m_PaymentReminderProbability);
elemMix->appendChild(elemPaymentReminder);
#ifdef COUNTRY_STATS
DOMElement* elemCountryStats=NULL;
getDOMChildByName(elemRoot,"CountryStatsDB",elemCountryStats,false);
UINT8 db_tmp_buff[4096];
UINT32 db_tmp_buff_len=4096;
if(getDOMElementAttribute(elemCountryStats,"host",db_tmp_buff,&db_tmp_buff_len)==E_SUCCESS)
{
m_dbCountryStatsHost=new char[db_tmp_buff_len+1];
memcpy(m_dbCountryStatsHost,db_tmp_buff,db_tmp_buff_len);
m_dbCountryStatsHost[db_tmp_buff_len]=0;
}
db_tmp_buff_len=4096;
if(getDOMElementAttribute(elemCountryStats,"user",db_tmp_buff,&db_tmp_buff_len)==E_SUCCESS)
{
m_dbCountryStatsUser=new char[db_tmp_buff_len+1];
memcpy(m_dbCountryStatsUser,db_tmp_buff,db_tmp_buff_len);
m_dbCountryStatsUser[db_tmp_buff_len]=0;
}
db_tmp_buff_len=4096;
if(getDOMElementAttribute(elemCountryStats,"passwd",db_tmp_buff,&db_tmp_buff_len)==E_SUCCESS)
{
m_dbCountryStatsPasswd=new char[db_tmp_buff_len+1];
memcpy(m_dbCountryStatsPasswd,db_tmp_buff,db_tmp_buff_len);
m_dbCountryStatsPasswd[db_tmp_buff_len]=0;
}
#endif
DOMElement* elemCascade;
SINT32 haveCascade = getDOMChildByName(elemRoot,"MixCascade",elemCascade,false);
#ifndef DYNAMIC_MIX
/* LERNGRUPPE: This is no error in the fully dynamic model */
if(isLastMix() && haveCascade != E_SUCCESS && !hasPrevMixTestCertificate() && !verifyMixCertificates())
{
CAMsg::printMsg(LOG_CRIT,"Error in configuration: You must either specify cascade info or the previous mix's certificate.\n");
return E_UNKNOWN;
}
#endif
if(isLastMix() && haveCascade == E_SUCCESS)
{
getDOMChildByName(elemRoot,"MixCascade",m_pCascadeXML,false);
DOMNodeList* nl = getElementsByTagName(m_pCascadeXML,"Mix");
UINT16 len = (UINT16)nl->getLength();
if(len == 0)
{
CAMsg::printMsg(LOG_CRIT,"Error in configuration: Empty cascade specified.\n");
return E_UNKNOWN;
}
}
#ifdef DATA_RETENTION_LOG
DOMElement* elemDataRetention=NULL;
getDOMChildByName(elemRoot,"DataRetention",elemDataRetention,false);
DOMElement* elemDataRetentionLogDir=NULL;
getDOMChildByName(elemDataRetention,"LogDir",elemDataRetentionLogDir,false);
UINT8 log_dir[4096];
UINT32 log_dir_len=4096;
if(getDOMElementValue(elemDataRetentionLogDir,log_dir,&log_dir_len)==E_SUCCESS)
{
m_strDataRetentionLogDir=new UINT8[log_dir_len+1];
memcpy(m_strDataRetentionLogDir,log_dir,log_dir_len);
m_strDataRetentionLogDir[log_dir_len]=0;
}
CAMsg::printMsg(LOG_CRIT,"Data retention log dir in config file: %s\n",log_dir);
this->m_pDataRetentionPublicEncryptionKey=new CAASymCipher();
DOMElement* elemDataRetentionPublicKey=NULL;
getDOMChildByName(elemDataRetention,"PublicEncryptionKey",elemDataRetentionPublicKey,false);
DOMElement* elemDataRetentionPublicRSAKey=NULL;
getDOMChildByName(elemDataRetentionPublicKey,"RSAKeyValue",elemDataRetentionPublicRSAKey,false);
m_pDataRetentionPublicEncryptionKey->setPublicKeyAsDOMNode(elemDataRetentionPublicRSAKey);
//Add info to MixInfo structure...
elemDataRetention=createDOMElement(m_docMixInfo, "DataRetention");
elemMix->appendChild(elemDataRetention);
DOMElement* elemLoggedElements=createDOMElement(m_docMixInfo,"LoggedElements");
elemDataRetention->appendChild(elemLoggedElements);
DOMElement* elemTemp=createDOMElement(m_docMixInfo,"InputTime");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"OutputTime");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"InputChannelID");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"OutputChannelID");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"InputSourceIPAddress");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"OutputSourceIPAddress");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"InputSourceIPPort");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"OutputSourceIPPort");
elemLoggedElements->appendChild(elemTemp);
setDOMElementValue(elemTemp,true);
elemTemp=createDOMElement(m_docMixInfo,"RetentionPeriod");
elemDataRetention->appendChild(elemTemp);
setDOMElementValue(elemTemp,(UINT8*)"P6M");
#endif //DATA_RETENTION_LOG
return E_SUCCESS;
}
| 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.
| docConfig | on return contains the parsed XMl document |
| configFile | file name of the XML config file |
| E_SUCCESS | if successful |
| E_FILE_OPEN | if error in opening the file |
| E_FILE_READ | if not the whole file could be read |
| E_XML_PARSE | if the file could not be parsed |
Definition at line 1743 of file CACmdLnOptions.cpp.
References E_FILE_OPEN, E_FILE_READ, filesize32(), and len.
Referenced by parse(), and threadReConfigure().
{
int handle;
handle=open((char*)configFile,O_BINARY|O_RDONLY);
if(handle==-1)
return E_FILE_OPEN;
SINT32 len=filesize32(handle);
UINT8* tmpChar=new UINT8[len];
int ret=read(handle,tmpChar,len);
close(handle);
if(ret!=len)
return E_FILE_READ;
SINT32 retVal = readXmlConfiguration(docConfig, tmpChar, len);
delete[] tmpChar;
tmpChar = NULL;
return retVal;
}
| 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.
| docConfig | on return contains the parsed XMl document |
| buf | a byte array containing the XML data |
| len | the length of the byte array |
| E_SUCCESS | if successful |
| E_XML_PARSE | if the data could not be parsed |
Definition at line 1770 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, parseDOMDocument(), and CAMsg::printMsg().
{
docConfig=parseDOMDocument(buf,len);
if(docConfig==NULL)
{
CAMsg::printMsg(LOG_CRIT, "Your configuration is not a valid XML document and therefore could not be parsed. Please repair the configuration structure or create a new configuration.\n");
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::reread | ( | CAMix * | pMix | ) |
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...
| E_SUCCESS | if successful |
| E_UNKNOWN | if an error occurs |
Definition at line 1345 of file CACmdLnOptions.cpp.
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().
{
if(m_bIsRunReConfigure)
return E_UNKNOWN;
m_bIsRunReConfigure=true;
m_threadReConfigure.setMainLoop(threadReConfigure);
t_CMNDLN_REREAD_PARAMS* param=new t_CMNDLN_REREAD_PARAMS;
param->pCmdLnOptions=this;
param->pMix=pMix;
m_threadReConfigure.start(param,true,false);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::saveToFile | ( | XERCES_CPP_NAMESPACE::DOMDocument * | p_doc, |
| const UINT8 * | p_strFileName | ||
| ) | [static] |
Saves the given XML Document to a file.
| p_doc | The XML Document to be saved |
| p_strFileName | The name of the file to be saved to |
| E_SUCCESS |
Definition at line 4999 of file CACmdLnOptions.cpp.
References DOM_Output::dumpToMem(), E_SUCCESS, and len.
Referenced by createMixOnCDConfiguration().
{
UINT32 len;
UINT8* buff = DOM_Output::dumpToMem(p_doc,&len);
if(p_strFileName!=NULL)
{
FILE *handle;
handle=fopen((const char*)p_strFileName, "w");
fwrite(buff,len,1,handle);
fflush(handle);
fclose(handle);
}
else
{
fwrite(buff,len,1,stdout);
fflush(stdout);
}
delete[] buff;
buff = NULL;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setAccountingDatabase | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3174 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, cleanup(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), CAAccountingDBInterface::init(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_bFirstMix, m_iDatabasePort, m_strDatabaseHost, m_strDatabaseName, m_strDatabasePassword, m_strDatabaseUser, OPTIONS_NODE_AI_DB, OPTIONS_NODE_AI_DB_HOST, OPTIONS_NODE_AI_DB_NAME, OPTIONS_NODE_AI_DB_PASSW, OPTIONS_NODE_AI_DB_PORT, OPTIONS_NODE_AI_DB_USER, CAMsg::printMsg(), strtrim(), and TMP_BUFF_SIZE.
Referenced by initAccountingOptionSetters().
{
DOMElement* elem = NULL;
DOMElement* elemDatabase = NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE, tmp = 0;
/* DDB is only configured for first payment mix */
if (!m_bFirstMix)
{
return E_SUCCESS;
}
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_AI_DB);
CAMsg::printMsg(LOG_DEBUG, "Parsing AI values.\n");
if (getDOMChildByName(elemAccounting, OPTIONS_NODE_AI_DB, elemDatabase, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_DB);
return E_UNKNOWN;
}
// get DB Hostname
if (getDOMChildByName(elemDatabase, OPTIONS_NODE_AI_DB_HOST, elem, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_DB_HOST);
return E_UNKNOWN;
}
if(getDOMElementValue(elem, tmpBuff, &tmpLen) != E_SUCCESS)
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_DB_HOST);
return E_UNKNOWN;
}
strtrim(tmpBuff);
m_strDatabaseHost = new UINT8[strlen((char*)tmpBuff)+1];
strcpy((char *)m_strDatabaseHost, (char *) tmpBuff);
// get Database Port
if (getDOMChildByName
(elemDatabase, OPTIONS_NODE_AI_DB_PORT, elem, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_DB_PORT);
return E_UNKNOWN;
}
if(getDOMElementValue(elem, &tmp) != E_SUCCESS)
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_DB_PORT);
return E_UNKNOWN;
}
m_iDatabasePort = tmp;
// get DB Name
if (getDOMChildByName
(elemDatabase, OPTIONS_NODE_AI_DB_NAME, elem, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_DB_NAME);
return E_UNKNOWN;
}
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
if(getDOMElementValue
(elem, tmpBuff, &tmpLen) != E_SUCCESS)
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_DB_NAME);
return E_UNKNOWN;
}
strtrim(tmpBuff);
m_strDatabaseName = new UINT8[strlen((char*)tmpBuff)+1];
strcpy((char *)m_strDatabaseName, (char *) tmpBuff);
// get DB Username
if (getDOMChildByName
(elemDatabase, OPTIONS_NODE_AI_DB_USER, elem, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_DB_USER);
return E_UNKNOWN;
}
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
if(getDOMElementValue
(elem, tmpBuff, &tmpLen) != E_SUCCESS)
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_DB_USER);
return E_UNKNOWN;
}
strtrim(tmpBuff);
m_strDatabaseUser = new UINT8[strlen((char*)tmpBuff)+1];
strcpy((char *)m_strDatabaseUser, (char *) tmpBuff);
//get DB password from xml
getDOMChildByName(elemDatabase, OPTIONS_NODE_AI_DB_PASSW, elem, false);
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
//read password from xml if given
if(getDOMElementValue(elem, tmpBuff, &tmpLen) != E_SUCCESS)
{
//read password from stdin:
UINT8 dbpass[500];
dbpass[0] = 0;
printf("Please enter password for postgresql user %s at %s: ",m_strDatabaseUser, m_strDatabaseHost);
scanf("%400[^\n]%*1[\n]",(char*)dbpass);
int len = strlen((char *)dbpass);
if(len>0)
{
m_strDatabasePassword = new UINT8[len+1];
strcpy((char *)m_strDatabasePassword, (char *)dbpass);
}
else
{
m_strDatabasePassword = new UINT8[1];
m_strDatabasePassword[0] = '\0';
}
}
else
{
strtrim(tmpBuff);
m_strDatabasePassword = new UINT8[strlen((char*)tmpBuff)+1];
strcpy((char *)m_strDatabasePassword, (char *) tmpBuff);
}
CAMsg::printMsg(LOG_DEBUG, "Accounting database information parsed successfully.\n");
// just for testing the connection to the database
if(CAAccountingDBInterface::init() != E_SUCCESS)
{
exit(EXIT_FAILURE);
}
CAAccountingDBInterface::cleanup();
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setAccountingHardLimit | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3057 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_iPaymentHardLimit, and OPTIONS_NODE_AI_HARD_LIMIT.
Referenced by initAccountingOptionSetters().
{
DOMElement* elemAIHardLimit = NULL;
UINT32 tmp = 0;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_AI_HARD_LIMIT);
if (getDOMChildByName
(elemAccounting, OPTIONS_NODE_AI_HARD_LIMIT, elemAIHardLimit, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_HARD_LIMIT);
return E_UNKNOWN;
}
if(getDOMElementValue(elemAIHardLimit, &tmp)==E_SUCCESS)
{
m_iPaymentHardLimit = tmp;
}
else
{
//or better set default values?
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_HARD_LIMIT);
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setAccountingOptions | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 2914 of file CACmdLnOptions.cpp.
References ACCOUNTING_OPTIONS_NR, accountingOptionSetters, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), invokeOptionSetters(), LOG_NODE_NOT_FOUND, and OPTIONS_NODE_ACCOUNTING.
Referenced by initMainOptionSetters().
{
// the accoutning options are added by Bastian Voigt
DOMElement* elemAccounting=NULL;
if (getDOMChildByName
(elemRoot, OPTIONS_NODE_ACCOUNTING, elemAccounting, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_ACCOUNTING);
return E_UNKNOWN;
}
return invokeOptionSetters
(accountingOptionSetters, elemAccounting, ACCOUNTING_OPTIONS_NR);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setAccountingSoftLimit | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3027 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_iPaymentSoftLimit, and OPTIONS_NODE_AI_SOFT_LIMIT.
Referenced by initAccountingOptionSetters().
{
DOMElement* elemAISoftLimit = NULL;
UINT32 tmp = 0;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_AI_SOFT_LIMIT);
if (getDOMChildByName
(elemAccounting, OPTIONS_NODE_AI_SOFT_LIMIT, elemAISoftLimit, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_AI_SOFT_LIMIT);
return E_UNKNOWN;
}
if(getDOMElementValue(elemAISoftLimit, &tmp)==E_SUCCESS)
{
m_iPaymentSoftLimit = tmp;
}
else
{
//or better set default values?
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_AI_SOFT_LIMIT);
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setCascadeName | ( | const UINT8 * | name | ) | [inline] |
Definition at line 447 of file CACmdLnOptions.hpp.
References E_SUCCESS, and m_strCascadeName.
Referenced by setCascadeNameFromOptions().
{
delete[] m_strCascadeName;
m_strCascadeName = new UINT8[strlen((const char*)name)+1];
strcpy((char*)m_strCascadeName,(const char*)name);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setCascadeNameFromOptions | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2110 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_strMixID, OPTIONS_NODE_CASCADE_NAME, setCascadeName(), and TMP_BUFF_SIZE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemCascadeName=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_CASCADE_NAME);
//getCascadeName
getDOMChildByName(elemGeneral, OPTIONS_NODE_CASCADE_NAME, elemCascadeName, false);
#ifdef DYNAMIC_MIX
bool bNeedCascadeNameFromMixID=false;
#endif
if(getDOMElementValue(elemCascadeName,tmpBuff,&tmpLen)==E_SUCCESS)
{
setCascadeName(tmpBuff);
}
#ifdef DYNAMIC_MIX
/* LERNGRUPPE: Dynamic Mixes must have a cascade name, as MiddleMixes may be reconfigured to be FirstMixes */
else
{
bNeedCascadeNameFromMixID=true;
setCascadeName(m_strMixID);
}
#endif
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setCertificateOptions | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 2524 of file CACmdLnOptions.cpp.
References certificateOptionSetters, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), invokeOptionSetters(), LOG_NODE_NOT_FOUND, m_nCertificateOptionsSetters, and OPTIONS_NODE_CERTIFICATE_LIST.
Referenced by initMainOptionSetters().
{
DOMElement* elemCertificates;
if (getDOMChildByName
(elemRoot, OPTIONS_NODE_CERTIFICATE_LIST, elemCertificates, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_CERTIFICATE_LIST);
return E_UNKNOWN;
}
return invokeOptionSetters(certificateOptionSetters, elemCertificates, m_nCertificateOptionsSetters);
}
| SINT32 CACmdLnOptions::setDaemonMode | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2233 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_bDaemon, OPTIONS_NODE_DAEMON, and TMP_BUFF_SIZE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemDaemonMode = NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_DAEMON);
//get Run as Daemon
getDOMChildByName(elemGeneral, OPTIONS_NODE_DAEMON, elemDaemonMode,false);
if(getDOMElementValue(elemDaemonMode, tmpBuff, &tmpLen) == E_SUCCESS &&
memcmp(tmpBuff,"True",4)==0)
{
m_bDaemon=true;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setDynamicMix | ( | DOMElement * | elemGeneral | ) | [private] |
determines whether this mix is a dynamic mix or not appears in <General></General> and is optional.
Definition at line 2066 of file CACmdLnOptions.cpp.
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().
{
// LERNGRUPPE
// get Dynamic flag
DOMElement* elemDynamic=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
m_bDynamic = false;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_DYNAMIC_MIX);
getDOMChildByName(elemGeneral, OPTIONS_NODE_DYNAMIC_MIX, elemDynamic, false);
if(elemDynamic != NULL)
{
if(getDOMElementValue(elemDynamic, tmpBuff, &tmpLen)==E_SUCCESS)
{
m_bDynamic = (strcmp("True",(char*)tmpBuff) == 0);
}
}
if(m_bDynamic)
{
CAMsg::printMsg( LOG_DEBUG, "I am a dynamic mix\n");
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setGeneralOptions | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 1893 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, GENERAL_OPTIONS_NR, generalOptionSetters, getDOMChildByName(), invokeOptionSetters(), LOG_NODE_NOT_FOUND, and OPTIONS_NODE_GENERAL.
Referenced by initMainOptionSetters().
{
DOMElement* elemGeneral=NULL;
if (getDOMChildByName(elemRoot, OPTIONS_NODE_GENERAL,
elemGeneral,false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_GENERAL);
return E_UNKNOWN;
}
return invokeOptionSetters
(generalOptionSetters, elemGeneral, GENERAL_OPTIONS_NR);
}
| SINT32 CACmdLnOptions::setInfoServices | ( | DOMElement * | elemNetwork | ) | [private] |
Definition at line 3333 of file CACmdLnOptions.cpp.
References ASSERT_NETWORK_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), CAListenerInterface::getInstance(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_addrInfoServices, m_addrInfoServicesSize, m_bAcceptReconfiguration, OPTIONS_NODE_ALLOW_AUTO_CONF, OPTIONS_NODE_INFOSERVICE, OPTIONS_NODE_INFOSERVICE_LIST, parseInfoServices(), and TMP_BUFF_SIZE.
Referenced by initNetworkOptionSetters().
{
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
DOMElement* elemInfoServiceContainer=NULL;
if(elemNetwork == NULL) return E_UNKNOWN;
ASSERT_NETWORK_OPTIONS_PARENT
(elemNetwork->getNodeName(), OPTIONS_NODE_INFOSERVICE_LIST);
getDOMChildByName
(elemNetwork, OPTIONS_NODE_INFOSERVICE_LIST, elemInfoServiceContainer,false);
if (elemInfoServiceContainer == NULL)
{
// old configuration version <= 0.61
DOMElement* elemInfoService=NULL;
DOMElement* elemAllowReconfig=NULL;
if (getDOMChildByName
(elemNetwork, OPTIONS_NODE_INFOSERVICE, elemInfoService, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_INFOSERVICE);
}
/* LERNGRUPPE: There might not be any InfoService configuration in the file, but in infoservices.xml, so check this */
if(elemInfoService != NULL)
{
getDOMChildByName
(elemInfoService, OPTIONS_NODE_ALLOW_AUTO_CONF, elemAllowReconfig, false);
CAListenerInterface* isListenerInterface = CAListenerInterface::getInstance(elemInfoService);
if (!isListenerInterface)
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_INFOSERVICE);
}
else
{
m_addrInfoServicesSize = 1;
m_addrInfoServices = new CAListenerInterface*[m_addrInfoServicesSize];
m_addrInfoServices[0] = isListenerInterface;
if(getDOMElementValue(elemAllowReconfig,tmpBuff,&tmpLen)==E_SUCCESS)
{
m_bAcceptReconfiguration = (strcmp("True",(char*)tmpBuff) == 0);
}
}
}
}
else
{
// Refactored
parseInfoServices(elemInfoServiceContainer);
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setKeepAliveTraffic | ( | DOMElement * | elemNetwork | ) | [private] |
Definition at line 4056 of file CACmdLnOptions.cpp.
References ASSERT_NETWORK_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), KEEP_ALIVE_TRAFFIC_RECV_WAIT_TIME, KEEP_ALIVE_TRAFFIC_SEND_WAIT_TIME, m_u32KeepAliveRecvInterval, m_u32KeepAliveSendInterval, OPTIONS_NODE_KEEP_ALIVE, OPTIONS_NODE_KEEP_ALIVE_RECV_IVAL, OPTIONS_NODE_KEEP_ALIVE_SEND_IVAL, and OPTIONS_NODE_SERVER_MONITORING.
Referenced by initNetworkOptionSetters().
{
DOMElement* elemKeepAlive = NULL;
DOMElement* elemKeepAliveSendInterval = NULL;
DOMElement* elemKeepAliveRecvInterval = NULL;
if(elemNetwork == NULL) return E_UNKNOWN;
ASSERT_NETWORK_OPTIONS_PARENT
(elemNetwork->getNodeName(), OPTIONS_NODE_SERVER_MONITORING);
getDOMChildByName(elemNetwork, OPTIONS_NODE_KEEP_ALIVE, elemKeepAlive, false);
getDOMChildByName(elemKeepAlive, OPTIONS_NODE_KEEP_ALIVE_SEND_IVAL, elemKeepAliveSendInterval, false);
getDOMChildByName(elemKeepAlive, OPTIONS_NODE_KEEP_ALIVE_RECV_IVAL, elemKeepAliveRecvInterval, false);
getDOMElementValue(elemKeepAliveSendInterval, m_u32KeepAliveSendInterval, KEEP_ALIVE_TRAFFIC_SEND_WAIT_TIME);
getDOMElementValue(elemKeepAliveRecvInterval, m_u32KeepAliveRecvInterval, KEEP_ALIVE_TRAFFIC_RECV_WAIT_TIME);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setListenerInterfaces | ( | DOMElement * | elemNetwork | ) | [private] |
Definition at line 3386 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), ASSERT_NETWORK_OPTIONS_PARENT, CASocket::close(), createSockets(), E_SPACE, E_SUCCESS, E_UNKNOWN, E_UNSPECIFIED, getDOMChildByName(), CAListenerInterface::getInstance(), getListenerInterfaceCount(), m_arListenerInterfaces, m_cnListenerInterfaces, OPTIONS_NODE_LISTENER_INTERFACES, CAMsg::printMsg(), and WITH_SUBTREE.
Referenced by initNetworkOptionSetters().
{
DOMElement* elemListenerInterfaces=NULL;
if(elemNetwork == NULL) return E_UNKNOWN;
ASSERT_NETWORK_OPTIONS_PARENT
(elemNetwork->getNodeName(), OPTIONS_NODE_LISTENER_INTERFACES);
getDOMChildByName
(elemNetwork, OPTIONS_NODE_LISTENER_INTERFACES, elemListenerInterfaces, false);
m_arListenerInterfaces = CAListenerInterface::getInstance(
elemListenerInterfaces, m_cnListenerInterfaces);
#ifndef DYNAMIC_MIX
/* LERNGRUPPE: ListenerInterfaces may be configured dynamically */
if (m_cnListenerInterfaces == 0)
{
CAMsg::printMsg(LOG_CRIT, "No listener interfaces found!\n");
return E_UNKNOWN;
}
#endif
if(elemListenerInterfaces != NULL)
{
// import listener interfaces element; this is needed for cascade auto configuration
// -- inserted by ronin <ronin2@web.de> 2004-08-16
appendMixInfo_internal(elemListenerInterfaces, WITH_SUBTREE);
}
UINT32 i;
SINT32 ret;
CASocket** arrSocketsIn=new CASocket*[getListenerInterfaceCount()];
for (i = 0; i < getListenerInterfaceCount(); i++)
{
arrSocketsIn[i] = NULL;
}
ret = createSockets(false, arrSocketsIn, getListenerInterfaceCount());
for(i=0;i<getListenerInterfaceCount();i++)
{
if (arrSocketsIn[i] != NULL)
{
arrSocketsIn[i]->close();
delete arrSocketsIn[i];
arrSocketsIn[i] = NULL;
}
}
delete[] arrSocketsIn;
arrSocketsIn=NULL;
if (ret != E_SUCCESS && ret != E_UNSPECIFIED && ret != E_SPACE)
{
CAMsg::printMsg(LOG_CRIT, "Could not listen on at least one of the specified interfaces. Please check if another running mix or server process is blocking the listen addresses, and if you have sufficient system rights.\n");
}
return ret;
}
| SINT32 CACmdLnOptions::setLogDir | ( | const UINT8 * | name, |
| UINT32 | len | ||
| ) |
Definition at line 1601 of file CACmdLnOptions.cpp.
References E_SUCCESS, len, and m_strLogDir.
{
if(m_strLogDir!=NULL)
{
delete[] m_strLogDir;
m_strLogDir = NULL;
}
m_strLogDir=new char[len+1];
memcpy(m_strLogDir,name,len);
m_strLogDir[len]=0;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setLoggingOptions | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2370 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), initLogging(), LOGGING_MAXFILES_DEFAULT, m_bIsEncryptedLogEnabled, m_bLogConsole, m_bSyslog, m_maxLogFiles, m_maxLogFileSize, m_pLogEncryptionCertificate, m_strEncryptedLogDir, m_strLogDir, m_strLogLevel, MIX_VERSION_INFO, MIX_VERSION_TESTING, MIX_VERSION_TESTING_TEXT, OPTIONS_ATTRIBUTE_LOGGING_MAXFILES, OPTIONS_ATTRIBUTE_LOGGING_MAXFILESIZE, OPTIONS_NODE_ENCRYPTED_LOG, OPTIONS_NODE_LOGGING, OPTIONS_NODE_LOGGING_CONSOLE, OPTIONS_NODE_LOGGING_FILE, OPTIONS_NODE_LOGGING_KEYINFO, OPTIONS_NODE_SYSLOG, OPTIONS_NODE_X509DATA, CAMsg::printMsg(), strtrim(), TMP_BUFF_SIZE, and toLower().
Referenced by initGeneralOptionSetters().
{
//get Logging
DOMElement* elemLogging=NULL;
DOMElement* elemEncLog=NULL;
DOMElement* elem=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
SINT32 maxLogFilesTemp = 0;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_LOGGING);
getDOMChildByName(elemGeneral, OPTIONS_NODE_LOGGING, elemLogging, false);
if(elemLogging != NULL)
{
if (getDOMElementAttribute(elemLogging, "level", tmpBuff, &tmpLen) == E_SUCCESS)
{
strtrim(tmpBuff);
toLower(tmpBuff);
m_strLogLevel = new char[strlen((char*)tmpBuff)+1];
strcpy(m_strLogLevel, (char*)tmpBuff);
}
else
{
m_strLogLevel = new char[strlen("debug")+1];
strcpy(m_strLogLevel, "debug");
}
getDOMChildByName(elemLogging, OPTIONS_NODE_LOGGING_FILE, elem, false);
tmpLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elem, tmpBuff, &tmpLen) == E_SUCCESS)
{
strtrim(tmpBuff);
m_strLogDir = new char[strlen((char*)tmpBuff)+1];
strcpy(m_strLogDir, (char*)tmpBuff);
getDOMElementAttribute
(elem, OPTIONS_ATTRIBUTE_LOGGING_MAXFILESIZE, m_maxLogFileSize);
//Set maximum number of logging files
//CAMsg::printMsg(LOG_ERR,"!!!!!!!!\n");
if((getDOMElementAttribute
(elem, OPTIONS_ATTRIBUTE_LOGGING_MAXFILES, &maxLogFilesTemp) != E_SUCCESS) ||
(maxLogFilesTemp == 0) )
{
m_maxLogFiles = LOGGING_MAXFILES_DEFAULT;
}
else
{
if(maxLogFilesTemp < 0)
{
//CAMsg::printMsg(LOG_ERR,"Negative number of log files specified.\n");
return E_UNKNOWN;
}
m_maxLogFiles = (UINT32) maxLogFilesTemp;
//CAMsg::printMsg(LOG_ERR,"Max log files are %u\n", m_maxLogFiles);
}
}
getDOMChildByName(elemLogging, OPTIONS_NODE_SYSLOG, elem, false);
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
if( (getDOMElementValue(elem, tmpBuff, &tmpLen) == E_SUCCESS) &&
(memcmp(tmpBuff,"True",4) == 0) )
{
m_bSyslog = true;
}
getDOMChildByName(elemLogging, OPTIONS_NODE_LOGGING_CONSOLE, elem, false);
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
if( (getDOMElementValue(elem, tmpBuff, &tmpLen) == E_SUCCESS) &&
(memcmp(tmpBuff,"True",4) == 0) )
{
m_bLogConsole = true;
}
//get Encrypted Log Info
if( getDOMChildByName
(elemLogging, OPTIONS_NODE_ENCRYPTED_LOG, elemEncLog,false) == E_SUCCESS )
{
m_bIsEncryptedLogEnabled = true;
getDOMChildByName(elemEncLog, OPTIONS_NODE_LOGGING_FILE, elem, false);
tmpLen = TMP_BUFF_SIZE;
memset(tmpBuff, 0, tmpLen);
if( getDOMElementValue(elem, tmpBuff, &tmpLen) == E_SUCCESS )
{
strtrim(tmpBuff);
m_strEncryptedLogDir = new char[strlen((char*)tmpBuff)+1];
strcpy(m_strEncryptedLogDir, (char*)tmpBuff);
}
DOMElement* elemKeyInfo;
DOMElement* elemX509Data;
if(getDOMChildByName
(elemEncLog, OPTIONS_NODE_LOGGING_KEYINFO, elemKeyInfo, false) == E_SUCCESS &&
getDOMChildByName
(elemKeyInfo, OPTIONS_NODE_X509DATA, elemX509Data, false) == E_SUCCESS )
{
m_pLogEncryptionCertificate =
CACertificate::decode(elemX509Data->getFirstChild(), CERT_X509CERTIFICATE);
}
}
else
{
m_bIsEncryptedLogEnabled=false;
}
}
SINT32 ret = initLogging();
if (ret == E_SUCCESS)
{
CAMsg::printMsg(LOG_INFO,MIX_VERSION_INFO);
if (MIX_VERSION_TESTING)
{
CAMsg::printMsg(LOG_WARNING, MIX_VERSION_TESTING_TEXT);
}
}
return ret;
}
| SINT32 CACmdLnOptions::setMaxUsers | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2254 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_maxNrOfUsers, and OPTIONS_NODE_MAX_USERS.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemMaxUsers=NULL;
UINT32 tmp = 0;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_MAX_USERS);
// get max users
getDOMChildByName(elemGeneral, OPTIONS_NODE_MAX_USERS, elemMaxUsers, false);
if(elemMaxUsers!=NULL)
{
if(getDOMElementValue(elemMaxUsers, &tmp)==E_SUCCESS)
{
m_maxNrOfUsers = tmp;
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setMinCascadeLength | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2094 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), OPTIONS_NODE_MIN_CASCADE_LENGTH, and WITH_SUBTREE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemMinCascadeLength = NULL;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_MIN_CASCADE_LENGTH);
//Inserting the min. cascade length if given...
getDOMChildByName
(elemGeneral, OPTIONS_NODE_MIN_CASCADE_LENGTH, elemMinCascadeLength, false);
if(elemMinCascadeLength != NULL)
{
appendMixInfo_internal(elemMinCascadeLength, WITH_SUBTREE);
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setMixCertificateVerification | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2792 of file CACmdLnOptions.cpp.
References ASSERT_CERTIFICATES_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_bVerifyMixCerts, m_pTrustedRootCertificates, OPTIONS_NODE_MIX_CERTIFICATE_VERIFICATION, CAMsg::printMsg(), and TMP_BUFF_SIZE.
{
DOMElement *elemMixVerify;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_MIX_CERTIFICATE_VERIFICATION);
getDOMChildByName(elemCertificates, OPTIONS_NODE_MIX_CERTIFICATE_VERIFICATION, elemMixVerify, false);
if(elemMixVerify != NULL)
{
if(getDOMElementValue(elemMixVerify, tmpBuff, &tmpLen) == E_SUCCESS &&
memcmp(tmpBuff,"True",4)==0)
{
m_bVerifyMixCerts = true;
m_pTrustedRootCertificates = new CACertStore();
CAMsg::printMsg(LOG_INFO, "Mix certificate verification is enabled.\n");
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setMixDescription | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 2498 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), OPTIONS_NODE_DESCRIPTION, and WITH_SUBTREE.
Referenced by initMainOptionSetters().
{
SINT32 ret = E_SUCCESS;
DOMElement* elemMixDescription = NULL;
if(elemRoot == NULL)
{
return E_UNKNOWN;
}
ret = getDOMChildByName
(elemRoot, OPTIONS_NODE_DESCRIPTION, elemMixDescription, false);
if(elemMixDescription != NULL )
{
DOMNode* tmpChild = elemMixDescription->getFirstChild();
while( (tmpChild != NULL) && (ret == E_SUCCESS) )
{
ret = appendMixInfo_internal(tmpChild, WITH_SUBTREE);
tmpChild=tmpChild->getNextSibling();
}
}
return ret;
}
| SINT32 CACmdLnOptions::setMixID | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2034 of file CACmdLnOptions.cpp.
References addMixIdToMixInfo(), ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_strMixID, OPTIONS_NODE_MIX_ID, OPTIONS_NODE_MIX_NAME, strtrim(), and TMP_BUFF_SIZE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemMixID=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
size_t mixID_strlen = 0;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_MIX_NAME);
getDOMChildByName(elemGeneral, OPTIONS_NODE_MIX_ID, elemMixID, false);
if(elemMixID != NULL)
{
if(getDOMElementValue(elemMixID,tmpBuff,&tmpLen) == E_SUCCESS)
{
strtrim(tmpBuff);
mixID_strlen = strlen((char*)tmpBuff)+1;
m_strMixID = new char[strlen((char*)tmpBuff)+1];
memset(m_strMixID, 0, mixID_strlen);
memcpy(m_strMixID, tmpBuff, mixID_strlen);
return addMixIdToMixInfo();
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setMixName | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 1957 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, createDOMElement(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), m_docMixInfo, m_strMixName, MIXINFO_NODE_MIX_NAME, OPTIONS_ATTRIBUTE_NAME_FOR_CASCADE, OPTIONS_NODE_MIX_NAME, OPTIONS_VALUE_MIX_NAME, OPTIONS_VALUE_OPERATOR_NAME, setDOMElementAttribute(), setDOMElementValue(), and TMP_BUFF_SIZE.
Referenced by initGeneralOptionSetters().
{
DOMElement *elemMixName = NULL, *elemMixInfoName = NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
UINT8 *typeValue = NULL; //(UINT8 *) OPTIONS_VALUE_NAMETYPE_DEFAULT;
//uncomment the above line to enable a default name type
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_MIX_NAME);
//Inserting the Name if given...
getDOMChildByName(elemGeneral, OPTIONS_NODE_MIX_NAME, elemMixName, false);
if(elemMixName != NULL)
{
if(getDOMElementValue(elemMixName, tmpBuff, &tmpLen) == E_SUCCESS)
{
m_strMixName = new char[tmpLen+1];
memset(m_strMixName, 0, tmpLen+1);
memcpy(m_strMixName, tmpBuff, tmpLen);
}
tmpLen = TMP_BUFF_SIZE;
getDOMElementAttribute(elemMixName, OPTIONS_ATTRIBUTE_NAME_FOR_CASCADE, tmpBuff, &tmpLen);
}
else
{
tmpLen = 0;
m_strMixName = NULL;
}
/* now append the values to the mix info
* conditions:
* - if name is set, m_strMixname points to it.
* - if name type is set then it is in tmpBuff.
*/
elemMixInfoName = createDOMElement(m_docMixInfo, MIXINFO_NODE_MIX_NAME);
/* if name is set */
if(m_strMixName != NULL)
{
setDOMElementValue(elemMixInfoName, (UINT8*) m_strMixName);
}
if( tmpLen != 0 ) /* if name type is set */
{
if( strncasecmp( ((char *)tmpBuff),
OPTIONS_VALUE_OPERATOR_NAME,
strlen(OPTIONS_VALUE_OPERATOR_NAME)) == 0 ) /* type is operator name*/
{
typeValue = (UINT8 *) OPTIONS_VALUE_OPERATOR_NAME;
}
else if( strncasecmp( ((char *)tmpBuff),
OPTIONS_VALUE_MIX_NAME,
strlen(OPTIONS_VALUE_MIX_NAME)) == 0 ) /* type is mix name*/
{
typeValue = (UINT8 *) OPTIONS_VALUE_MIX_NAME;
}
}
if(typeValue != NULL)
{
setDOMElementAttribute(elemMixInfoName,
OPTIONS_ATTRIBUTE_NAME_FOR_CASCADE, typeValue);
}
if(m_docMixInfo->getDocumentElement() != NULL)
{
m_docMixInfo->getDocumentElement()->appendChild(elemMixInfoName);
}
else
{
//Should never happen
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setMixType | ( | DOMElement * | elemGeneral | ) | [private] |
determines whether this mix is a first a middle or a last mix appears in <General></General> and must be set.
Definition at line 1912 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_bFirstMix, m_bLastMix, m_bMiddleMix, OPTIONS_NODE_MIX_TYPE, TMP_BUFF_SIZE, and WITH_SUBTREE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemMixType=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_MIX_TYPE);
//getMixType
if (getDOMChildByName(elemGeneral, OPTIONS_NODE_MIX_TYPE,
elemMixType,false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_MIX_TYPE);
return E_UNKNOWN;
}
if( getDOMElementValue(elemMixType,tmpBuff,&tmpLen) == E_SUCCESS )
{
if(memcmp(tmpBuff,"FirstMix",8) == 0)
{
m_bFirstMix = true;
}
else if (memcmp(tmpBuff,"MiddleMix",9) == 0)
{
m_bMiddleMix = true;
}
else if (memcmp(tmpBuff,"LastMix",7) == 0)
{
m_bLastMix = true;
}
if ( appendMixInfo_internal(elemMixType, WITH_SUBTREE) != E_SUCCESS )
{
return E_UNKNOWN;
}
}
else
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_MIX_TYPE);
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setNetworkOptions | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 3319 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, getDOMChildByName(), invokeOptionSetters(), LOG_NODE_NOT_FOUND, NETWORK_OPTIONS_NR, networkOptionSetters, and OPTIONS_NODE_NETWORK.
Referenced by initMainOptionSetters().
{
DOMElement* elemNetwork = NULL;
if (getDOMChildByName
(elemRoot, OPTIONS_NODE_NETWORK, elemNetwork, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_NETWORK);
return E_UNKNOWN;
}
return invokeOptionSetters
(networkOptionSetters, elemNetwork, NETWORK_OPTIONS_NR);
}
| 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!
| newOptions | CACmdLnOptions object from which the new values are copied |
| E_UNKNOWN | if an error occurs |
| E_SUCCESS | otherwise |
Definition at line 929 of file CACmdLnOptions.cpp.
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().
{
//Copy Targets
if(newOptions.getTargetInterfaceCount()>0)
{
clearTargetInterfaces();
m_cnTargets=newOptions.getTargetInterfaceCount();
m_arTargetInterfaces=new CATargetInterface[m_cnTargets];
for(UINT32 i=0;i<m_cnTargets;i++)
newOptions.getTargetInterface(m_arTargetInterfaces[i],i+1);
}
#if defined( DELAY_CHANNELS)||defined(DELAY_USERS)
//Copy ressources limitation
m_u32DelayChannelUnlimitTraffic=newOptions.getDelayChannelUnlimitTraffic();
m_u32DelayChannelBucketGrow=newOptions.getDelayChannelBucketGrow();
m_u32DelayChannelBucketGrowIntervall=newOptions.getDelayChannelBucketGrowIntervall();
#endif
#if defined( DELAY_CHANNELS_LATENCY)
//Copy ressources limitation
m_u32DelayChannelLatency=newOptions.getDelayChannelLatency();
#endif
if(newOptions.getMaxNrOfUsers()>0)
m_maxNrOfUsers=newOptions.getMaxNrOfUsers();
return E_SUCCESS;
}
| 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.
| doc | a DOM document containing XML data with the new options |
Definition at line 962 of file CACmdLnOptions.cpp.
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().
{
CAMsg::printMsg(LOG_DEBUG,"setNextMix() - start\n");
DOMElement* elemRoot = doc->getDocumentElement();
//getCertificates if given...
DOMElement* elemSig;
getDOMChildByName(elemRoot, OPTIONS_NODE_SIGNATURE, elemSig, false);
//Own Certiticate first
//nextMixCertificate if given
DOMElement* elemCert;
getDOMChildByName(elemSig, OPTIONS_NODE_X509DATA, elemCert,true);
if(elemSig!=NULL)
m_pNextMixCertificate = CACertificate::decode(elemCert->getFirstChild(),CERT_X509CERTIFICATE);
DOMElement* elemOptionsRoot = m_docMixXml->getDocumentElement();
DOMElement* elemOptionsCerts;
getDOMChildByName(elemOptionsRoot, OPTIONS_NODE_CERTIFICATE_LIST, elemOptionsCerts, false);
DOMElement* elemOptionsNextMixCert;
if(getDOMChildByName(elemOptionsRoot, OPTIONS_NODE_NEXT_MIX_CERTIFICATE, elemOptionsNextMixCert, false) != E_SUCCESS)
{
elemOptionsNextMixCert = createDOMElement(m_docMixXml, OPTIONS_NODE_NEXT_MIX_CERTIFICATE);
elemOptionsCerts->appendChild(elemOptionsNextMixCert);
elemOptionsNextMixCert->appendChild(m_docMixXml->importNode(elemCert->getFirstChild(),true));
}
else
{
if(elemOptionsNextMixCert->hasChildNodes())
{
elemOptionsNextMixCert->replaceChild(m_docMixXml->importNode(elemCert->getFirstChild(),true),
elemOptionsNextMixCert->getFirstChild());
}
else
{
elemOptionsNextMixCert->appendChild(m_docMixXml->importNode(elemCert->getFirstChild(),true));
}
}
CAMsg::printMsg(LOG_DEBUG,"setNextMix() - certificates done\n");
DOMElement* elemNextMix;
getDOMChildByName(elemRoot, OPTIONS_NODE_LISTENER_INTERFACE, elemNextMix,true);
DOMElement* elemOptionsNetwork;
DOMElement* elemOptionsNextMixInterface;
if(getDOMChildByName(elemOptionsRoot, OPTIONS_NODE_NETWORK, elemOptionsNetwork, false) != E_SUCCESS)
{
elemOptionsNetwork = createDOMElement(m_docMixXml, OPTIONS_NODE_NETWORK);
elemOptionsRoot->appendChild(elemOptionsNetwork);
}
if(getDOMChildByName(elemOptionsNetwork, OPTIONS_NODE_NEXT_MIX, elemOptionsNextMixInterface, false) != E_SUCCESS)
{
elemOptionsNextMixInterface = createDOMElement(m_docMixXml, OPTIONS_NODE_NEXT_MIX);
elemOptionsNetwork->appendChild(elemOptionsNextMixInterface);
}
else
{
while(elemOptionsNextMixInterface->hasChildNodes())
{
elemOptionsNextMixInterface->removeChild(elemOptionsNextMixInterface->getFirstChild());
}
}
DOMNode* interfaceData = elemNextMix->getFirstChild();
while(interfaceData != NULL)
{
elemOptionsNextMixInterface->appendChild(m_docMixXml->importNode(interfaceData,true));
interfaceData = interfaceData->getNextSibling();
}
CAMsg::printMsg(LOG_DEBUG,"setNextMix() - end\n");
return processXmlConfiguration(m_docMixXml);
}
| SINT32 CACmdLnOptions::setNextMixCertificate | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2816 of file CACmdLnOptions.cpp.
References ASSERT_CERTIFICATES_OPTIONS_PARENT, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), m_bVerifyMixCerts, m_pNextMixCertificate, OPTIONS_NODE_NEXT_MIX_CERTIFICATE, and CAMsg::printMsg().
Referenced by initCertificateOptionSetters().
{
DOMElement* elemNextCert = NULL;
if(!m_bVerifyMixCerts)
{
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_NEXT_MIX_CERTIFICATE);
//nextMixCertificate if given
getDOMChildByName(elemCertificates, OPTIONS_NODE_NEXT_MIX_CERTIFICATE, elemNextCert,false);
if(elemNextCert!=NULL)
{
m_pNextMixCertificate=
CACertificate::decode(elemNextCert->getFirstChild(),CERT_X509CERTIFICATE);
if(m_pNextMixCertificate == NULL)
{
CAMsg::printMsg(LOG_CRIT,"Could not decode the certificate of the next mix!\n");
return E_UNKNOWN;
}
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setNextMixTestCertificate | ( | CACertificate * | cert | ) | [inline] |
Definition at line 400 of file CACmdLnOptions.hpp.
References CACertificate::clone(), E_SUCCESS, E_UNKNOWN, and m_pNextMixCertificate.
Referenced by CAMiddleMix::processKeyExchange(), and CAFirstMix::processKeyExchange().
{
if(cert != NULL)
{
m_pNextMixCertificate = cert->clone();
return E_SUCCESS;
}
return E_UNKNOWN;
}
| SINT32 CACmdLnOptions::setNrOfFileDescriptors | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2190 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, GET_NET_ERROR, GET_NET_ERROR_STR, getDOMChildByName(), getDOMElementValue(), m_nrOfOpenFiles, OPTIONS_NODE_FD_NR, and CAMsg::printMsg().
Referenced by initGeneralOptionSetters().
{
DOMElement* elemNrFd=NULL;
UINT32 tmp = 0;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_FD_NR);
//get Number of File Descriptors to use
getDOMChildByName(elemGeneral, OPTIONS_NODE_FD_NR, elemNrFd, false);
if(getDOMElementValue(elemNrFd,&tmp) == E_SUCCESS)
{
m_nrOfOpenFiles=tmp;
}
#ifndef WIN32
struct rlimit coreLimit;
coreLimit.rlim_cur = coreLimit.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_CORE, &coreLimit) != 0)
{
CAMsg::printMsg(LOG_CRIT,"Could not set RLIMIT_CORE (max core file size) to unlimited size. -- Core dumps might not be generated!\n",m_nrOfOpenFiles);
}
if(m_nrOfOpenFiles>0)
{
struct rlimit lim;
// Set the new MAX open files limit
lim.rlim_cur = lim.rlim_max = m_nrOfOpenFiles;
if (setrlimit(RLIMIT_NOFILE, &lim) != 0)
{
CAMsg::printMsg(LOG_CRIT,"Could not set MAX open files to: %u Reason: %s (%i) \nYou might have insufficient user rights. If so, switch to a privileged user or do not set the number of file descriptors. -- Exiting!\n",
m_nrOfOpenFiles, GET_NET_ERROR_STR(GET_NET_ERROR), GET_NET_ERROR);
exit(EXIT_FAILURE);
}
}
#endif
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setOwnCertificate | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2539 of file CACmdLnOptions.cpp.
References CACertStore::add(), addMixIdToMixInfo(), CAMultiSignature::addSignature(), ASSERT_CERTIFICATES_OPTIONS_PARENT, CERT_PKCS12, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, CAMultiSignature::findSKI(), CACertificate::getAuthorityKeyIdentifier(), getDOMChildByName(), getElementsByTagName(), CACertStore::getNumber(), CACertificate::getRawSubjectKeyIdentifier(), CAMultiSignature::getSignatureCount(), CACertificate::getSubjectKeyIdentifier(), CAMultiSignature::getXORofSKIs(), LOG_NODE_NOT_FOUND, m_opCertList, m_pMultiSignature, m_strAiID, m_strCascadeName, m_strMixID, OPTIONS_NODE_OWN_CERTIFICATE, OPTIONS_NODE_X509_PKCS12, CAMsg::printMsg(), readPasswd(), CASignature::setSignKey(), SIGKEY_PKCS12, TMP_BUFF_SIZE, and CACertificate::verify().
Referenced by initCertificateOptionSetters().
{
DOMElement* elemOwnCert=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
UINT8 passwd[500];
passwd[0] = 0;
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_OWN_CERTIFICATE);
//Own Certiticate first
getDOMChildByName(elemCertificates, OPTIONS_NODE_OWN_CERTIFICATE, elemOwnCert, false);
if (elemOwnCert == NULL)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_OWN_CERTIFICATE);
return E_UNKNOWN;
}
/*m_pSignKey = new CASignature();
if(m_pSignKey->setSignKey
(elemOwnCert->getFirstChild(), SIGKEY_PKCS12) != E_SUCCESS)
{
//Maybe not an empty passwd
printf("I need a passwd for the SignKey: ");
fflush(stdout);
readPasswd(passwd, 500);
if(m_pSignKey->setSignKey
(elemOwnCert->getFirstChild(),
SIGKEY_PKCS12,(char*)passwd) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Could not read own signature key!\n");
delete m_pSignKey;
m_pSignKey=NULL;
}
}*/
/*m_pOwnCertificate =
CACertificate::decode(elemOwnCert->getFirstChild(), CERT_PKCS12, (char*)passwd);
if (m_pOwnCertificate == NULL)
{
CAMsg::printMsg(LOG_CRIT, "Could not decode mix certificate!\n");
return E_UNKNOWN;
}*/
// new
//m_ownCertsLength = 0;
//m_opCertsLength = 0;
//decode OpCerts
UINT32 opCertsLen = m_opCertList->getLength();
CACertificate** opCerts=new CACertificate*[opCertsLen];
for(UINT32 j=0; j<opCertsLen; j++)
{
DOMNode* a_opCert = m_opCertList->item(j);
opCerts[j] = CACertificate::decode(a_opCert,CERT_X509CERTIFICATE);
if(opCerts[j] == NULL)
{
CAMsg::printMsg(LOG_CRIT, "Error while decoding operator certificates!");
delete[] opCerts;
return E_UNKNOWN;
}
}
DOMNodeList* ownCertList = getElementsByTagName(elemOwnCert, OPTIONS_NODE_X509_PKCS12);
m_pMultiSignature = new CAMultiSignature();
for (UINT32 i=0; i<ownCertList->getLength(); i++)
{
DOMNode* a_cert = ownCertList->item(i);
CASignature* signature = new CASignature();
CACertStore* certs = new CACertStore();
//try to get signature key from ownCert
if(signature->setSignKey(a_cert, SIGKEY_PKCS12, (char*)passwd) != E_SUCCESS)
{
//Read password if necessary
printf("I need a password for the private Mix certificate nr. %d: ", i+1);
fflush(stdout);
readPasswd(passwd,500);
printf("\n");
if(signature->setSignKey(a_cert, SIGKEY_PKCS12, (char*)passwd) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Unable to load private Mix certificate nr. %d! Please check your password.\n", i+1);
delete signature;
delete[] opCerts;
signature = NULL;
return E_UNKNOWN;
}
}
//decode own certifciate
CACertificate* tmpCert = CACertificate::decode(a_cert, CERT_PKCS12, (char*)passwd);
if(tmpCert== NULL)
{
CAMsg::printMsg(LOG_CRIT, "Error while getting own certificate %d!\n", i+1);
delete[] opCerts;
return E_UNKNOWN;
}
//get SKI
UINT32 tmpSKIlen = 255;
UINT8 tmpSKI[255];
if(tmpCert->getSubjectKeyIdentifier(tmpSKI, &tmpSKIlen) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT, "Error while getting SKI of own certificate %d!\n", i+1);
delete[] opCerts;
return E_UNKNOWN;
}
//CAMsg::printMsg(LOG_DEBUG, "SKI of own cert %d is: %s\n", i+1, tmpSKI);
//get AKI
UINT32 tmpAKIlen = 255;
UINT8 tmpAKI[255];
if(tmpCert->getAuthorityKeyIdentifier(tmpAKI, &tmpAKIlen) != E_SUCCESS)
{
CAMsg::printMsg(LOG_WARNING, "Could not get AKI of own certificate. This is not a critical problem, but you have a very old mix certificate. Create a new one as soon as possible.\n");
}
else
{
//CAMsg::printMsg(LOG_DEBUG, "AKI of own cert %d is: %s\n", i+1, tmpAKI);
}
//try to find right opCert
for(UINT32 j=0; j<opCertsLen; j++)
{
if(tmpCert->verify(opCerts[j]) == E_SUCCESS)
{
//found right operator cert -> add it to store
// CAMsg::printMsg(LOG_DEBUG, "Found operator cert for sign key %d!\n", i+1);
certs->add(opCerts[j]);
break;
}
}
if(certs->getNumber() == 0)
{
CAMsg::printMsg(LOG_CRIT, "Could not find operator cert for sign key %d! Please check your configuration. Exiting...\n", i+1);
exit(EXIT_FAILURE);
}
//add own cert to store
certs->add(tmpCert);
//get Raw SKI
UINT32 tmpRawSKIlen = 255;
UINT8 tmpRawSKI[255];
if(tmpCert->getRawSubjectKeyIdentifier(tmpRawSKI, &tmpRawSKIlen) != E_SUCCESS)
{
delete[] opCerts;
return E_UNKNOWN;
}
if (certs->getNumber() < 2)
{
CAMsg::printMsg(LOG_CRIT, "We have less than two certificates (only %d), but we need at least one mix and one operator certificate. There must be something wrong with the cert store. Exiting...\n", certs->getNumber());
exit(EXIT_FAILURE);
}
CAMsg::printMsg(LOG_DEBUG, "Adding Sign-Key %d with %d certificate(s).\n", i+1, certs->getNumber());
m_pMultiSignature->addSignature(signature, certs, tmpRawSKI, tmpRawSKIlen);
}
if (m_pMultiSignature->getSignatureCount() == 0)
{
CAMsg::printMsg(LOG_CRIT, "Could not set a signature key for MultiCert!\n");
delete m_pMultiSignature;
m_pMultiSignature = NULL;
delete[] opCerts;
return E_UNKNOWN;
}
//end new
/*if ( (m_pOwnCertificate->getSubjectKeyIdentifier(tmpBuff, &tmpLen) != E_SUCCESS) &&
(m_strMixID == NULL))
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_MIX_ID);
return E_UNKNOWN;
}*/
//check Mix-ID
if(m_pMultiSignature->getXORofSKIs(tmpBuff, tmpLen) != E_SUCCESS)
{
delete[] opCerts;
return E_UNKNOWN;
}
if(m_strMixID != NULL )
{
if(strncmp(m_strMixID, (char*)tmpBuff, strlen((char*)tmpBuff) ) != 0)
{
CAMsg::printMsg(LOG_CRIT,"The configuration file seems inconsistent: it contains another Mix ID (%s) than calculated from the Mix certificate(s), which is %s. Please re-import you mix certificate in the configuration tool, or set the correct mix ID manually by editing the configuration file.\n", m_strMixID, tmpBuff);
delete[] opCerts;
return E_UNKNOWN;
}
}
else
{
m_strMixID=new char[strlen((char*)tmpBuff)+1];
m_strMixID[strlen((char*)tmpBuff)]= (char) 0;
strcpy(m_strMixID,(char*) tmpBuff);
delete[] opCerts;
return addMixIdToMixInfo();
}
#ifdef PAYMENT
if (m_strAiID != NULL && m_pMultiSignature->findSKI(m_strAiID) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT, "Your price certificate does not fit to your mix certificate(s). Please import the proper price certificate or mix certificate.\n");
}
#endif
#ifdef DYNAMIC_MIX
/* LERNGRUPPE: Dynamic Mixes must have a cascade name, as MiddleMixes may be reconfigured to be FirstMixes */
if(bNeedCascadeNameFromMixID)
{
m_strCascadeName = new char[strlen(m_strMixID) + 1];
memset(m_strCascadeName, 0, strlen(m_strMixID) + 1);
strncpy(m_strCascadeName, m_strMixID, strlen(m_strMixID)+1);
}
#endif
delete[] opCerts;
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setOwnOperatorCertificate | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2756 of file CACmdLnOptions.cpp.
References ASSERT_CERTIFICATES_OPTIONS_PARENT, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getElementsByTagName(), LOG_NODE_NOT_FOUND, m_OpCert, m_opCertList, OPTIONS_NODE_OWN_OPERATOR_CERTIFICATE, and OPTIONS_NODE_X509_CERTIFICATE.
Referenced by initCertificateOptionSetters().
{
DOMElement* elemOpCert = NULL;
DOMElement *opCertX509 = NULL;
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_OWN_OPERATOR_CERTIFICATE);
//then Operator Certificate
if (getDOMChildByName
(elemCertificates, OPTIONS_NODE_OWN_OPERATOR_CERTIFICATE,
elemOpCert, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_OWN_OPERATOR_CERTIFICATE);
return E_UNKNOWN;
}
if (elemOpCert != NULL)
{
m_opCertList = getElementsByTagName(elemOpCert, "X509Certificate");
getDOMChildByName(elemOpCert, OPTIONS_NODE_X509_CERTIFICATE, opCertX509, true);
if( opCertX509 != NULL)
{
m_OpCert = CACertificate::decode(opCertX509, CERT_X509CERTIFICATE);
}
else
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_X509_CERTIFICATE);
return E_UNKNOWN;
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setPaymentInstance | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3005 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), CAXMLBI::getInstance(), m_pBI, OPTIONS_NODE_PAYMENT_INSTANCE, and CAMsg::printMsg().
Referenced by initAccountingOptionSetters().
{
DOMElement* elemJPI = NULL;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_PAYMENT_INSTANCE);
CAMsg::printMsg(LOG_DEBUG, "Parsing JPI values.\n");
getDOMChildByName(elemAccounting, OPTIONS_NODE_PAYMENT_INSTANCE, elemJPI, false);
m_pBI = CAXMLBI::getInstance(elemJPI);
if (m_pBI == NULL)
{
CAMsg::printMsg(LOG_CRIT,"Could not instantiate payment instance interface. Did you really want to compile the mix with payment support?\n");
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setPaymentReminder | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2275 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), m_PaymentReminderProbability, and OPTIONS_NODE_PAYMENT_REMINDER.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemPaymentReminder=NULL;
m_PaymentReminderProbability = 0;
if(elemGeneral == NULL)
return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT (elemGeneral->getNodeName(), OPTIONS_NODE_PAYMENT_REMINDER);
// get payment reminder probabilty
getDOMChildByName(elemGeneral, OPTIONS_NODE_PAYMENT_REMINDER, elemPaymentReminder, false);
bool bEnabled=false;
getDOMElementAttribute(elemPaymentReminder, "enable", bEnabled);
if (!bEnabled)
{
m_PaymentReminderProbability = -1;
}
else
{
getDOMElementValue(elemPaymentReminder, &m_PaymentReminderProbability);
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setPrepaidInterval | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3087 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, createDOMElement(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), LOG_NODE_NOT_FOUND, m_docMixInfo, m_iPrepaidInterval, OPTIONS_DEFAULT_PREPAID_IVAL, OPTIONS_NODE_PREPAID_IVAL, OPTIONS_NODE_PREPAID_IVAL_KB, CAMsg::printMsg(), and setDOMElementValue().
Referenced by initAccountingOptionSetters().
{
DOMElement* elemPrepaidIval = NULL;
UINT32 tmp = 0;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_PREPAID_IVAL);
if (getDOMChildByName
(elemAccounting, OPTIONS_NODE_PREPAID_IVAL, elemPrepaidIval, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_PREPAID_IVAL);
if (getDOMChildByName
(elemAccounting, OPTIONS_NODE_PREPAID_IVAL_KB, elemPrepaidIval, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_PREPAID_IVAL_KB);
}
else
{
if(getDOMElementValue(elemPrepaidIval, &tmp)==E_SUCCESS)
{
m_iPrepaidInterval = tmp * 1000;
}
}
}
else if(getDOMElementValue(elemPrepaidIval, &tmp) == E_SUCCESS)
{
m_iPrepaidInterval = tmp;
}
else
{
CAMsg::printMsg(LOG_INFO,"Node \"%s\" is empty! Setting default...\n",
OPTIONS_NODE_PREPAID_IVAL);
m_iPrepaidInterval = OPTIONS_DEFAULT_PREPAID_IVAL;
}
if (m_iPrepaidInterval > OPTIONS_DEFAULT_PREPAID_IVAL )
{
CAMsg::printMsg(LOG_WARNING,"Prepaid interval is higher than %u! "
"No JAP will pay more in advance!\n", OPTIONS_DEFAULT_PREPAID_IVAL);
}
else if (m_iPrepaidInterval < 5000)
{
CAMsg::printMsg(LOG_WARNING,"Prepaid interval of %u is far too low! "
"Performance will be critical and clients will lose connection!\n", m_iPrepaidInterval);
}
//insert prepaid interval
DOMElement* elemInterval = createDOMElement(m_docMixInfo, OPTIONS_NODE_PREPAID_IVAL_KB);
setDOMElementValue(elemInterval, (m_iPrepaidInterval / 1000) );
//TODO: handle exceptional cases */
m_docMixInfo->getDocumentElement()->appendChild(elemInterval);
return E_SUCCESS;
}
| 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.
| doc | a DOM document containing XML data with the new options |
Definition at line 1194 of file CACmdLnOptions.cpp.
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().
{
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - start\n");
DOMElement* elemRoot = doc->getDocumentElement();
//getCertificates if given...
DOMElement* elemSig;
getDOMChildByName(elemRoot, OPTIONS_NODE_SIGNATURE, elemSig, false);
//Own Certiticate first
//nextMixCertificate if given
DOMElement* elemCert;
getDOMChildByName(elemSig, OPTIONS_NODE_X509DATA, elemCert, true);
if(elemCert!=NULL)
{
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - elem cert found in data from infoservice\n");
DOMElement* elemOptionsRoot = m_docMixXml->getDocumentElement();
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - got current options root element\n");
DOMElement* elemOptionsCerts;
getDOMChildByName
(elemOptionsRoot, OPTIONS_NODE_CERTIFICATE_LIST, elemOptionsCerts, false);
DOMElement* elemOptionsPrevMixCert;
if(getDOMChildByName
(elemOptionsRoot,OPTIONS_NODE_PREV_MIX_CERTIFICATE, elemOptionsPrevMixCert, false) != E_SUCCESS)
{
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - no prev cert set at the moment\n");
elemOptionsPrevMixCert =createDOMElement( m_docMixXml,"PrevMixCertificate");
elemOptionsCerts->appendChild(elemOptionsPrevMixCert);
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - try to import the one we got from infoservice\n");
getDOMChildByName
(elemCert, OPTIONS_NODE_X509_CERTIFICATE, elemCert, false);
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - Cert to be imported:\n");
UINT8 buff[8192];
UINT32 len=8192;
DOM_Output::dumpToMem(elemCert,buff,&len);
CAMsg::printMsg(LOG_DEBUG,(char*)buff);
elemOptionsPrevMixCert->appendChild(m_docMixXml->importNode(elemCert,true));
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - MixConf now:\n");
len=8192;
DOM_Output::dumpToMem(m_docMixXml,buff,&len);
buff[len]=0;
CAMsg::printMsg(LOG_DEBUG,(char*)buff);
}
else
{
if(elemOptionsPrevMixCert->hasChildNodes())
{
elemOptionsPrevMixCert->replaceChild(m_docMixXml->importNode(elemCert->getFirstChild(),true),
elemOptionsPrevMixCert->getFirstChild());
}
else
{
elemOptionsPrevMixCert->appendChild(m_docMixXml->importNode(elemCert->getFirstChild(),true));
}
}
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - end\n");
return processXmlConfiguration(m_docMixXml);
}
CAMsg::printMsg(LOG_DEBUG,"setPrevMix() - end with error\n");
return E_UNKNOWN;
}
| SINT32 CACmdLnOptions::setPrevMixCertificate | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2843 of file CACmdLnOptions.cpp.
References ASSERT_CERTIFICATES_OPTIONS_PARENT, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), m_bVerifyMixCerts, m_pPrevMixCertificate, and OPTIONS_NODE_PREV_MIX_CERTIFICATE.
Referenced by initCertificateOptionSetters().
{
//prevMixCertificate if given
DOMElement* elemPrevCert=NULL;
if(!m_bVerifyMixCerts)
{
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_PREV_MIX_CERTIFICATE);
getDOMChildByName(elemCertificates, OPTIONS_NODE_PREV_MIX_CERTIFICATE, elemPrevCert, false);
if(elemPrevCert!=NULL)
{
m_pPrevMixCertificate=
CACertificate::decode(elemPrevCert->getFirstChild(),CERT_X509CERTIFICATE);
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setPrevMixTestCertificate | ( | CACertificate * | cert | ) | [inline] |
Definition at line 378 of file CACmdLnOptions.hpp.
References CACertificate::clone(), E_SUCCESS, E_UNKNOWN, and m_pPrevMixCertificate.
Referenced by CAMiddleMix::processKeyExchange(), and CALastMix::processKeyExchange().
{
if(cert != NULL)
{
m_pPrevMixCertificate = cert->clone();
return E_SUCCESS;
}
return E_UNKNOWN;
}
| SINT32 CACmdLnOptions::setPriceCertificate | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 2931 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), ASSERT_ACCOUNTING_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, CAMultiSignature::findSKI(), CAXMLBI::getCertificate(), getDOMChildByName(), CAXMLPriceCert::getInstance(), CAXMLPriceCert::getSubjectKeyIdentifier(), LOG_NODE_NOT_FOUND, m_pBI, m_pMultiSignature, m_pPriceCertificate, m_strAiID, OPTIONS_NODE_PRICE_CERTIFICATE, CAMsg::printMsg(), CAMultiSignature::verifyXML(), and WITH_SUBTREE.
Referenced by initAccountingOptionSetters().
{
DOMElement* elemPriceCert = NULL;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_PRICE_CERTIFICATE);
//function in CAUtil, last param is "deep", needs to be set to include child elems
getDOMChildByName
(elemAccounting, OPTIONS_NODE_PRICE_CERTIFICATE, elemPriceCert, false);
if (elemPriceCert == NULL)
{
CAMsg::printMsg(LOG_CRIT, "Did you really want to compile the mix with payment support?\n");
LOG_NODE_NOT_FOUND(OPTIONS_NODE_PRICE_CERTIFICATE);
return E_UNKNOWN;
}
else
{
/*UINT8 digest[SHA_DIGEST_LENGTH];
UINT8* out=new UINT8[5000];
UINT32 outlen=5000;
DOM_Output::makeCanonical(elemPriceCert,out,&outlen);
out[outlen] = 0;
//#ifdef DEBUG
CAMsg::printMsg(LOG_DEBUG, "price cert (%u bytes) to be hashed: %s\n",outlen, out);
//#endif
SHA1(out,outlen,digest);
delete[] out;
out = NULL;
UINT32 len2 = 1024;
UINT8* tmpBuff2 = new UINT8[len2+1];
memset(tmpBuff2, 0, len2+1);
CABase64::encode(digest,SHA_DIGEST_LENGTH, tmpBuff2, &len2);
CAMsg::printMsg(LOG_CRIT,"hash: %s\n", tmpBuff2);
exit(0);*/
m_pPriceCertificate = CAXMLPriceCert::getInstance(elemPriceCert);
if (m_pPriceCertificate == NULL)
{
CAMsg::printMsg(LOG_CRIT, "Could not parse price certificate!");
return E_UNKNOWN;
}
m_strAiID = m_pPriceCertificate->getSubjectKeyIdentifier();
if (m_pMultiSignature != NULL && m_pMultiSignature->findSKI(m_strAiID) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Your price certificate does not fit to your mix certificate(s). Please import the proper price certificate or mix certificate.\n");
return E_UNKNOWN;
}
if (m_pBI == NULL)
{
CAMsg::printMsg(LOG_CRIT,"Could not verify price certificate, as no payment instance was found!\n");
return E_UNKNOWN;
}
if (CAMultiSignature::verifyXML(elemPriceCert, m_pBI->getCertificate()) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Signature of price certificate is invalid! It may be damaged, or maybe you are using the wrong payment instance certificate?\n");
return E_UNKNOWN;
}
}
//insert price certificate
return appendMixInfo_internal(elemPriceCert, WITH_SUBTREE);
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setRessourceOptions | ( | DOMElement * | elemRoot | ) | [private] |
reads the parameters for the ressource limitation for last mix/first mix
Definition at line 4079 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), m_u32DelayChannelBucketGrow, m_u32DelayChannelBucketGrowIntervall, m_u32DelayChannelUnlimitTraffic, OPTIONS_NODE_BYTES_PER_IVAL, OPTIONS_NODE_DELAY_IVAL, OPTIONS_NODE_LATENCY, OPTIONS_NODE_RESSOURCES, OPTIONS_NODE_UNLIMIT_TRAFFIC, and CAMsg::printMsg().
Referenced by initMainOptionSetters().
{
#if defined (DELAY_CHANNELS) ||defined(DELAY_USERS)||defined(DELAY_CHANNELS_LATENCY)
//this is at the moment:
//<Ressources>
//<UnlimitTraffic></UnlimitTraffic> #Number of bytes/packets without resource limitation
//<BytesPerIntervall></BytesPerIntervall> #upper limit of number of bytes/packets which are processed per channel/per user per time intervall
//<Intervall></Intervall> #duration of one intervall in ms
//<Latency></Latency> #minimum Latency per channel in ms
//</Ressources>
CAMsg::printMsg(LOG_INFO,"Loading Parameters for traffic shaping / resource limitation....\n");
UINT32 u32 = 0;
DOMElement *elemRessources=NULL;
DOMElement *elem = NULL;
if(elemRoot == NULL)
{
return E_UNKNOWN;
}
getDOMChildByName(elemRoot, OPTIONS_NODE_RESSOURCES, elemRessources,false);
if(elemRessources!=NULL)
{
#if defined (DELAY_CHANNELS) || defined(DELAY_USERS)
if( getDOMChildByName
(elemRessources, OPTIONS_NODE_UNLIMIT_TRAFFIC, elem, false) == E_SUCCESS &&
getDOMElementValue(elem, &u32) == E_SUCCESS )
{
m_u32DelayChannelUnlimitTraffic = u32;
}
if( getDOMChildByName
(elemRessources, OPTIONS_NODE_BYTES_PER_IVAL, elem, false) == E_SUCCESS &&
getDOMElementValue(elem, &u32) == E_SUCCESS)
{
m_u32DelayChannelBucketGrow = u32;
}
if( getDOMChildByName
(elemRessources, OPTIONS_NODE_DELAY_IVAL, elem, false) == E_SUCCESS &&
getDOMElementValue(elem, &u32) == E_SUCCESS)
{
m_u32DelayChannelBucketGrowIntervall = u32;
}
#endif
#if defined (DELAY_CHANNELS_LATENCY)
if( getDOMChildByName
(elemRessources, OPTIONS_NODE_LATENCY, elem, false) == E_SUCCESS &&
getDOMElementValue(elem, &u32) == E_SUCCESS)
{
m_u32DelayChannelLatency = u32;
}
#endif
}
#endif
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setServerMonitoring | ( | DOMElement * | elemNetwork | ) | [private] |
Definition at line 3993 of file CACmdLnOptions.cpp.
References appendMixInfo_internal(), ASSERT_NETWORK_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), OPTIONS_NODE_HOST, OPTIONS_NODE_PORT, OPTIONS_NODE_SERVER_MONITORING, CAMsg::printMsg(), TMP_BUFF_SIZE, and WITH_SUBTREE.
Referenced by initNetworkOptionSetters().
{
#ifdef SERVER_MONITORING
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
DOMElement* elemServerMonitoringRoot = NULL;
DOMElement* elemServerMonitoringHost = NULL;
DOMElement* elemServerMonitoringPort = NULL;
if(elemNetwork == NULL) return E_UNKNOWN;
ASSERT_NETWORK_OPTIONS_PARENT
(elemNetwork->getNodeName(), OPTIONS_NODE_SERVER_MONITORING);
m_strMonitoringListenerHost = NULL;
m_iMonitoringListenerPort = 0xFFFF;
if (getDOMChildByName
(elemNetwork, OPTIONS_NODE_SERVER_MONITORING, elemServerMonitoringRoot,false) == E_SUCCESS)
{
if(getDOMChildByName
(elemServerMonitoringRoot, OPTIONS_NODE_HOST, elemServerMonitoringHost, false) == E_SUCCESS)
{
if(getDOMElementValue(elemServerMonitoringHost,
(UINT8 *)tmpBuff,&tmpLen)==E_SUCCESS)
{
m_strMonitoringListenerHost = new char[tmpLen+1];
strncpy(m_strMonitoringListenerHost, (const char*) tmpBuff, tmpLen);
m_strMonitoringListenerHost[tmpLen] = 0;
}
}
if(getDOMChildByName
(elemServerMonitoringRoot, OPTIONS_NODE_PORT,
elemServerMonitoringPort, false) == E_SUCCESS)
{
UINT16 port = 0xFFFF;
if(getDOMElementValue(elemServerMonitoringPort, &port)==E_SUCCESS)
{
m_iMonitoringListenerPort = port;
}
}
/* only non-local ListnerInterfaces are showed in Mix status info */
if( (elemServerMonitoringRoot != NULL) &&
(m_strMonitoringListenerHost != NULL))
{
if( (strncmp("localhost", m_strMonitoringListenerHost, 9) != 0) &&
(strncmp("127.0.0.1", m_strMonitoringListenerHost, 9) != 0) )
{
appendMixInfo_internal(elemServerMonitoringRoot, WITH_SUBTREE);
}
}
}
else
{
CAMsg::printMsg(LOG_DEBUG, "Server Monitoring Config not found\n");
}
#endif /* SERVER_MONITORING */
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setSettleInterval | ( | DOMElement * | elemAccounting | ) | [private] |
Definition at line 3145 of file CACmdLnOptions.cpp.
References ASSERT_ACCOUNTING_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), LOG_NODE_EMPTY_OR_INVALID, LOG_NODE_NOT_FOUND, m_iPaymentSettleInterval, and OPTIONS_NODE_SETTLE_IVAL.
Referenced by initAccountingOptionSetters().
{
DOMElement* elemSettleIval = NULL;
UINT32 tmp = 0;
if(elemAccounting == NULL) return E_UNKNOWN;
ASSERT_ACCOUNTING_OPTIONS_PARENT
(elemAccounting->getNodeName(), OPTIONS_NODE_SETTLE_IVAL);
if (getDOMChildByName
(elemAccounting, OPTIONS_NODE_SETTLE_IVAL, elemSettleIval, false) != E_SUCCESS)
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_SETTLE_IVAL);
return E_UNKNOWN;
}
if(getDOMElementValue(elemSettleIval, &tmp)==E_SUCCESS)
{
m_iPaymentSettleInterval = tmp;
}
else
{
LOG_NODE_EMPTY_OR_INVALID(OPTIONS_NODE_SETTLE_IVAL);
return E_UNKNOWN;
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setTargetInterfaces | ( | DOMElement * | elemNetwork | ) | [private] |
Definition at line 3619 of file CACmdLnOptions.cpp.
References addVisibleAddresses(), ASSERT_NETWORK_OPTIONS_PARENT, CATargetInterface::cleanAddr(), clearVisibleAddresses(), CASocketAddr::clone(), CASocket::close(), CASocket::connect(), createDOMElement(), E_SUCCESS, E_UNKNOWN, GET_NET_ERROR, GET_NET_ERROR_STR, getDOMChildByName(), getDOMElementValue(), getElementsByTagName(), getVisibleAddress(), getVisibleAddressesCount(), isLastMix(), LAST_MIX_TO_PROXY_CONNECT_TIMEOUT, m_arTargetInterfaces, m_bSocksSupport, m_cnTargets, m_docMixInfo, OPTIONS_NODE_FILE, OPTIONS_NODE_HOST, OPTIONS_NODE_IP, OPTIONS_NODE_NETWORK_PROTOCOL, OPTIONS_NODE_NEXT_MIX, OPTIONS_NODE_PORT, OPTIONS_NODE_PROXY, OPTIONS_NODE_PROXY_LIST, OPTIONS_NODE_PROXY_TYPE, CAMsg::printMsg(), RAW_TCP, RAW_UNIX, CATargetInterface::set(), setDOMElementAttribute(), setDOMElementValue(), CASocket::setRecvBuff(), CASocket::setSendBuff(), SSL_TCP, SSL_UNIX, strtrim(), TARGET_HTTP_PROXY, TARGET_MIX, TARGET_SOCKS_PROXY, TARGET_UNKNOWN, TMP_BUFF_SIZE, CASocketAddr::toString(), and UNKNOWN_NETWORKTYPE.
Referenced by initNetworkOptionSetters().
{
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
DOMElement* elemNextMix = NULL;
DOMElement* elemProxies=NULL;
CATargetInterface* targetInterfaceNextMix = NULL;
//get TargetInterfaces
m_cnTargets=0;
if(elemNetwork == NULL) return E_UNKNOWN;
ASSERT_NETWORK_OPTIONS_PARENT
(elemNetwork->getNodeName(), OPTIONS_NODE_NEXT_MIX);
//NextMix --> only one!!
getDOMChildByName
(elemNetwork, OPTIONS_NODE_NEXT_MIX, elemNextMix, false);
if(elemNextMix != NULL)
{
NetworkType type=RAW_TCP;
CASocketAddr* addr = NULL;
DOMElement* elemType = NULL;
getDOMChildByName
(elemNextMix, OPTIONS_NODE_NETWORK_PROTOCOL, elemType, false);
bool bAddrIsSet = false;
if(getDOMElementValue(elemType, tmpBuff, &tmpLen) == E_SUCCESS)
{
strtrim(tmpBuff);
if(strcmp((char*)tmpBuff, "RAW/TCP") == 0)
{
type=RAW_TCP;
}
else if(strcmp((char*)tmpBuff, "RAW/UNIX") == 0)
{
type=RAW_UNIX;
}
else if(strcmp((char*)tmpBuff, "SSL/TCP") == 0)
{
type=SSL_TCP;
}
else if(strcmp((char*)tmpBuff, "SSL/UNIX") == 0)
{
type=SSL_UNIX;
}
if( (type == SSL_TCP) || (type == RAW_TCP) )
{
DOMElement* elemPort = NULL;
DOMElement* elemHost = NULL;
DOMElement* elemIP = NULL;
UINT8 buffHost[TMP_BUFF_SIZE];
UINT32 buffHostLen = TMP_BUFF_SIZE;
UINT16 port;
getDOMChildByName
(elemNextMix, OPTIONS_NODE_PORT, elemPort, false);
if(getDOMElementValue(elemPort,&port) == E_SUCCESS)
{
addr = new CASocketAddrINet;
//bool bAddrIsSet=false;
getDOMChildByName
(elemNextMix, OPTIONS_NODE_HOST, elemHost, false);
/* The rules for <Host> and <IP> are as follows:
* 1. if <Host> is given and not empty take the <Host> value for the address of the next mix; if not go to 2
* 2. if <IP> if given and not empty take <IP> value for the address of the next mix; if not goto 3.
* 3. this entry for the next mix is invalid!*/
if(elemHost != NULL)
{
if(getDOMElementValue(elemHost,buffHost,&buffHostLen)==E_SUCCESS &&
((CASocketAddrINet*)addr)->setAddr(buffHost,port)==E_SUCCESS)
{
bAddrIsSet = true;
}
}
if(!bAddrIsSet)//now try <IP>
{
getDOMChildByName(elemNextMix, OPTIONS_NODE_IP, elemIP, false);
if(elemIP == NULL || getDOMElementValue(elemIP,buffHost,&buffHostLen) == E_SUCCESS)
{
((CASocketAddrINet*)addr)->setAddr(buffHost,port);
bAddrIsSet = true;
}
}
CAMsg::printMsg(LOG_INFO, "Setting target interface: %s:%d\n", buffHost, port);
}
}
#ifdef HAVE_UNIX_DOMAIN_PROTOCOL
else if( (type == SSL_UNIX) || (type == RAW_UNIX) )
{
DOMElement* elemFile=NULL;
getDOMChildByName(elemNextMix, OPTIONS_NODE_FILE, elemFile, false);
tmpLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elemFile, tmpBuff, &tmpLen) == E_SUCCESS)
{
tmpBuff[tmpLen]=0;
strtrim(tmpBuff);
addr=new CASocketAddrUnix;
if(((CASocketAddrUnix*)addr)->setPath((char*)tmpBuff) == E_SUCCESS)
{
bAddrIsSet = true;
}
}
}
#endif
}
if(bAddrIsSet)
{
targetInterfaceNextMix=new CATargetInterface(TARGET_MIX,type,addr->clone());
m_cnTargets=1;
}
delete addr;
addr = NULL;
}
//Next Proxies and visible adresses
SINT32 ret;
UINT8 buff[255];
UINT32 buffLen = 255;
CASocket* tmpSocket;
clearVisibleAddresses();
getDOMChildByName(elemNetwork, OPTIONS_NODE_PROXY_LIST, elemProxies, false);
if(elemProxies != NULL)
{
DOMNodeList* nlTargetInterfaces=NULL;
nlTargetInterfaces=getElementsByTagName(elemProxies, OPTIONS_NODE_PROXY);
m_cnTargets+=nlTargetInterfaces->getLength();
if(nlTargetInterfaces->getLength()>0)
{
m_arTargetInterfaces=new CATargetInterface[m_cnTargets];
UINT32 aktInterface=0;
NetworkType type=UNKNOWN_NETWORKTYPE;
TargetType proxy_type=TARGET_UNKNOWN;
CASocketAddr* addr=NULL;
UINT16 port;
bool bHttpProxyFound = false;
for(UINT32 i=0; i < nlTargetInterfaces->getLength(); i++)
{
delete addr;
addr=NULL;
DOMNode* elemTargetInterface=NULL;
elemTargetInterface=nlTargetInterfaces->item(i);
DOMElement* elemType;
getDOMChildByName
(elemTargetInterface, OPTIONS_NODE_NETWORK_PROTOCOL, elemType,false);
tmpLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elemType,tmpBuff,&tmpLen)!=E_SUCCESS)
continue;
strtrim(tmpBuff);
if(strcmp((char*)tmpBuff,"RAW/TCP") == 0)
{
type=RAW_TCP;
}
else if(strcmp((char*)tmpBuff,"RAW/UNIX") == 0)
{
type=RAW_UNIX;
}
else if(strcmp((char*)tmpBuff,"SSL/TCP") == 0)
{
type=SSL_TCP;
}
else if(strcmp((char*)tmpBuff,"SSL/UNIX") == 0)
{
type=SSL_UNIX;
}
else
{
continue;
}
//ProxyType
elemType=NULL;
getDOMChildByName
(elemTargetInterface, OPTIONS_NODE_PROXY_TYPE, elemType, false);
tmpLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elemType,tmpBuff,&tmpLen)!=E_SUCCESS)
continue;
strtrim(tmpBuff);
if(strcmp((char*)tmpBuff,"SOCKS")==0)
{
proxy_type=TARGET_SOCKS_PROXY;
}
else if(strcmp((char*)tmpBuff,"HTTP")==0)
{
proxy_type=TARGET_HTTP_PROXY;
}
else
{
continue;
}
if( (type==SSL_TCP) || (type == RAW_TCP) )
{
DOMElement* elemPort;
DOMElement* elemHost;
getDOMChildByName
(elemTargetInterface, OPTIONS_NODE_PORT, elemPort, false);
if(getDOMElementValue(elemPort,&port)!=E_SUCCESS)
{
continue;
}
addr=new CASocketAddrINet;
getDOMChildByName
(elemTargetInterface, OPTIONS_NODE_HOST, elemHost, false);
if(elemHost != NULL)
{
UINT8 buffHost[TMP_BUFF_SIZE];
UINT32 buffHostLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elemHost, buffHost, &buffHostLen) != E_SUCCESS)
{
continue;
}
if(((CASocketAddrINet*)addr)->setAddr(buffHost, port) != E_SUCCESS)
{
continue;
}
}
else
{
continue;
}
}
else
#ifdef HAVE_UNIX_DOMAIN_PROTOCOL
{
DOMElement* elemFile;
getDOMChildByName
(elemTargetInterface, OPTIONS_NODE_FILE, elemFile, false);
tmpLen = TMP_BUFF_SIZE;
if(getDOMElementValue(elemFile, tmpBuff, &tmpLen) != E_SUCCESS)
{
continue;
}
tmpBuff[tmpLen]=0;
strtrim(tmpBuff);
addr=new CASocketAddrUnix;
if(((CASocketAddrUnix*)addr)->setPath((char*)tmpBuff) != E_SUCCESS)
{
continue;
}
}
#else
continue;
#endif
// check connection to proxy
tmpSocket = new CASocket;
tmpSocket->setRecvBuff(50000);
tmpSocket->setSendBuff(5000);
ret = tmpSocket->connect(*addr,LAST_MIX_TO_PROXY_CONNECT_TIMEOUT);
if (ret != E_SUCCESS)
{
if (addr->toString(buff, buffLen) != E_SUCCESS)
{
buff[0] = 0;
}
if (ret != E_UNKNOWN)
{
CAMsg::printMsg(LOG_WARNING, "Could not connect to proxy %s! Reason: %s (%i) Please check if the proxy is running.\n",
buff, GET_NET_ERROR_STR(GET_NET_ERROR), GET_NET_ERROR);
}
else
{
CAMsg::printMsg(LOG_WARNING, "Could not connect to proxy %s! Please check if the proxy is running.\n", buff);
}
}
if (ret == E_SUCCESS)
{
if (proxy_type == TARGET_HTTP_PROXY)
{
// TODO: we should not send an HTTP request to a non-existing address, for example to test:9999; if squid runs, we will get an HTTP error response
//if(tmpSocket->sendTimeOut(pMixPacket->payload.data,payLen,LAST_MIX_TO_PROXY_SEND_TIMEOUT)==SOCKET_ERROR) ...
// else ... tmpSocket->receive(pMixPacket->payload.data,PAYLOAD_SIZE);
// if we get no response or an invalid response, we set ret = E_UNKNOWN
bHttpProxyFound = true;
}
else if (proxy_type == TARGET_SOCKS_PROXY)
{
// TODO maybe there is also a possibility to check the response of the SOCKS proxy?
m_bSocksSupport = true;
}
}
tmpSocket->close();
delete tmpSocket;
if (ret == E_SUCCESS)
{
addVisibleAddresses(elemTargetInterface);
m_arTargetInterfaces[aktInterface].set(proxy_type,type,addr->clone());
aktInterface++;
}
delete addr;
addr=NULL;
}
if (!bHttpProxyFound)
{
CAMsg::printMsg(LOG_CRIT, "No valid HTTP proxy was specified! Please install and configure an HTTP proxy like Squid before starting the mix.\n");
for (UINT32 i = 0; i < aktInterface; i++)
{
m_arTargetInterfaces[aktInterface].cleanAddr();
}
return E_UNKNOWN;
}
m_cnTargets=aktInterface;
}
} //end if elemProxies!=null
//add NextMixInterface to the End of the List...
if(targetInterfaceNextMix != NULL)
{
if(m_arTargetInterfaces == NULL)
{
m_cnTargets=0;
m_arTargetInterfaces=new CATargetInterface[1];
}
m_arTargetInterfaces[m_cnTargets++].set(targetInterfaceNextMix);
delete targetInterfaceNextMix;
targetInterfaceNextMix = NULL;
}
else if(m_arTargetInterfaces == NULL)
{
CAMsg::printMsg(LOG_CRIT, "Neither proxy nor next mix target interfaces are specified!\n");
return E_UNKNOWN;
}
//Set Proxy Visible Addresses if Last Mix and given
if(isLastMix() && (m_docMixInfo != NULL) )
{
DOMElement* elemMix = m_docMixInfo->getDocumentElement();
if(elemMix != NULL)
{
DOMElement* elemProxies=createDOMElement(m_docMixInfo,"Proxies");
if (m_bSocksSupport)
{
setDOMElementAttribute(elemProxies, "socks5Support", (UINT8*)"true");
}
DOMElement* elemProxy=createDOMElement(m_docMixInfo,"Proxy");
DOMElement* elemVisAddresses=createDOMElement(m_docMixInfo,"VisibleAddresses");
elemMix->appendChild(elemProxies);
elemProxies->appendChild(elemProxy);
elemProxy->appendChild(elemVisAddresses);
for(UINT32 i=1;i<=getVisibleAddressesCount();i++)
{
UINT8 tmp[255];
UINT32 tmplen=255;
if(getVisibleAddress(tmp,tmplen,i)==E_SUCCESS)
{
DOMElement* elemVisAddress=createDOMElement(m_docMixInfo,"VisibleAddress");
DOMElement* elemHost=createDOMElement(m_docMixInfo,"Host");
elemVisAddress->appendChild(elemHost);
setDOMElementValue(elemHost,tmp);
elemVisAddresses->appendChild(elemVisAddress);
}
}
}
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setTermsAndConditions | ( | DOMElement * | elemRoot | ) | [private] |
Definition at line 4139 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, getDOMChildByName(), invokeOptionSetters(), OPTIONS_NODE_TNCS_OPTS, CAMsg::printMsg(), TERMS_AND_CONDITIONS_OPTIONS_NR, and termsAndConditionsOptionSetters.
Referenced by initMainOptionSetters().
{
SINT32 ret = E_SUCCESS;
DOMElement *elemTnCs = NULL;
if(elemRoot == NULL)
{
return E_UNKNOWN;
}
ret = getDOMChildByName(elemRoot, OPTIONS_NODE_TNCS_OPTS, elemTnCs, true);
if(elemTnCs != NULL)
{
return invokeOptionSetters
(termsAndConditionsOptionSetters, elemTnCs, TERMS_AND_CONDITIONS_OPTIONS_NR);
}
else
{
CAMsg::printMsg(LOG_WARNING,"No Terms & Conditions for Operator specified!\n");
return E_SUCCESS;
}
}
| SINT32 CACmdLnOptions::setTermsAndConditionsList | ( | DOMElement * | elemTnCs | ) | [private] |
Definition at line 4257 of file CACmdLnOptions.cpp.
References createDOMDocument(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementAttribute(), getElementsByTagName(), integrateDOMNode(), m_docOpTnCs, OPTIONS_ATTRIBUTE_TNC_DATE, OPTIONS_ATTRIBUTE_TNC_DEFAULT_LANG_DEFINED, OPTIONS_ATTRIBUTE_TNC_LOCALE, OPTIONS_ATTRIBUTE_TNC_TEMPLATE_REFID, OPTIONS_NODE_TNCS, OPTIONS_NODE_TNCS_OPERATOR, OPTIONS_NODE_TNCS_TRANSLATION, OPTIONS_NODE_TNCS_TRANSLATION_IMPORTS, CAMsg::printMsg(), TMP_BUFF_SIZE, TMP_DATE_SIZE, TMP_LOCALE_SIZE, and WITH_SUBTREE.
Referenced by initTermsAndConditionsOptionSetters().
{
if(elemTnCs == NULL)
{
CAMsg::printMsg(LOG_CRIT,"Terms And Conditions root element is null!\n");
return E_UNKNOWN;
}
DOMElement *elemTnCsList = NULL;
getDOMChildByName(elemTnCs, OPTIONS_NODE_TNCS, elemTnCsList);
if(elemTnCsList == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No definitions for Terms And Conditions found!\n");
return E_UNKNOWN;
}
UINT32 attrCheckLen = TMP_BUFF_SIZE;
UINT8 attrCheck[TMP_BUFF_SIZE];
memset(attrCheck, 0, attrCheckLen);
UINT32 localeLen = TMP_LOCALE_SIZE;
UINT8 locale[TMP_LOCALE_SIZE];
memset(locale, 0, localeLen);
UINT32 dateLen = TMP_DATE_SIZE;
UINT8 date[TMP_DATE_SIZE];
memset(date, 0, dateLen);
if( (getDOMElementAttribute(elemTnCsList, OPTIONS_ATTRIBUTE_TNC_DATE, date, &dateLen) != E_SUCCESS) ||
(strlen((char *)date) != ((TMP_DATE_SIZE) - 1) ) )
{
CAMsg::printMsg(LOG_CRIT,"Attribute '%s' is not properly set for the global definition of Terms And Conditions!\n",
OPTIONS_ATTRIBUTE_TNC_DATE);
return E_UNKNOWN;
}
m_docOpTnCs = createDOMDocument();
DOMElement *currentTnCEntry = NULL;
DOMNodeList *tncDefEntryList = getElementsByTagName(elemTnCsList, OPTIONS_NODE_TNCS_TRANSLATION);
if(tncDefEntryList->getLength() < 1)
{
CAMsg::printMsg(LOG_CRIT,"No Terms And Conditions entries found!\n");
return E_UNKNOWN;
}
DOMElement *tncTranslationImports = NULL;
DOMElement *tncOperatorNode = NULL;
getDOMChildByName(elemTnCsList, OPTIONS_NODE_TNCS_TRANSLATION_IMPORTS, tncTranslationImports, false);
if(tncTranslationImports != NULL)
{
getDOMChildByName(tncTranslationImports, OPTIONS_NODE_TNCS_OPERATOR, tncOperatorNode, false);
}
bool defaultLangValue = false;
bool defaultLangFound = false;
bool operatorImportNodeFound = (tncOperatorNode != NULL);
/* validity check for every definition: are all necessary attributes set (referenceId, locale), length ok
* and is there EXACTLY ONE default language specified?
*/
for (XMLSize_t j = 0; j < tncDefEntryList->getLength(); j++)
{
attrCheckLen = TMP_BUFF_SIZE;
localeLen = TMP_LOCALE_SIZE;
defaultLangValue = false;
currentTnCEntry = (DOMElement *) tncDefEntryList->item(j);
if( (getDOMElementAttribute(currentTnCEntry, OPTIONS_ATTRIBUTE_TNC_TEMPLATE_REFID, attrCheck, &attrCheckLen) != E_SUCCESS) ||
(strlen((char *)attrCheck) < 1) )
{
CAMsg::printMsg(LOG_CRIT,"Attribute '%s' is not proper set for definition %u of Terms And Conditions!\n",
OPTIONS_ATTRIBUTE_TNC_TEMPLATE_REFID, (j+1));
return E_UNKNOWN;
}
else if( (getDOMElementAttribute(currentTnCEntry, OPTIONS_ATTRIBUTE_TNC_LOCALE, locale, &localeLen) != E_SUCCESS) ||
(strlen((char *)locale) != ((TMP_LOCALE_SIZE) - 1) ) )
{
CAMsg::printMsg(LOG_CRIT,"Attribute '%s' is not proper set for definition %u of Terms And Conditions!\n",
OPTIONS_ATTRIBUTE_TNC_LOCALE, (j+1));
return E_UNKNOWN;
}
if(!operatorImportNodeFound)
{
tncOperatorNode = NULL;
getDOMChildByName(currentTnCEntry, OPTIONS_NODE_TNCS_OPERATOR, tncOperatorNode, false);
if(tncOperatorNode == NULL)
{
CAMsg::printMsg(LOG_CRIT,"No Node '%s' defined for the translation [%s]. Either define it in '%s' or"
" in this %s.\n", OPTIONS_NODE_TNCS_OPERATOR, locale, OPTIONS_NODE_TNCS_TRANSLATION_IMPORTS,
OPTIONS_NODE_TNCS_TRANSLATION);
return E_UNKNOWN;
}
}
//setDOMElementAttribute(currentTnCEntry, OPTIONS_ATTRIBUTE_TNC_DATE, date);
getDOMElementAttribute(currentTnCEntry,
OPTIONS_ATTRIBUTE_TNC_DEFAULT_LANG_DEFINED, defaultLangValue);
if(defaultLangValue && defaultLangFound)
{
CAMsg::printMsg(LOG_CRIT,"exactly ONE default language must be specified for the Terms And Conditions!\n");
return E_UNKNOWN;
}
//import nodes global for all translations
if(tncTranslationImports != NULL)
{
if(integrateDOMNode(tncTranslationImports, currentTnCEntry, true, false) != E_SUCCESS)
{
CAMsg::printMsg(LOG_CRIT,"Integrating imports failed!\n");
return E_UNKNOWN;
}
}
defaultLangFound = (defaultLangFound || defaultLangValue);
}
if(!defaultLangFound)
{
CAMsg::printMsg(LOG_CRIT,"There is no default language specified for the Terms And Conditions!\n");
return E_UNKNOWN;
}
if(tncTranslationImports != NULL)
{
elemTnCsList->removeChild(tncTranslationImports);
}
m_docOpTnCs->appendChild(m_docOpTnCs->importNode(elemTnCsList, WITH_SUBTREE));
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setTermsAndConditionsTemplates | ( | DOMElement * | elemTnCs | ) | [private] |
Definition at line 4162 of file CACmdLnOptions.cpp.
References E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), getElementsByTagName(), getTermsAndConditionsTemplateRefId(), len, m_nrOfTermsAndConditionsTemplates, m_termsAndConditionsTemplates, OPTIONS_NODE_TNCS_TEMPLATE, OPTIONS_NODE_TNCS_TEMPLATES, parseDOMDocument(), CAMsg::printMsg(), TEMPLATE_REFID_MAXLEN, and TMP_BUFF_SIZE.
Referenced by initTermsAndConditionsOptionSetters().
{
if(elemTnCs == NULL)
{
CAMsg::printMsg(LOG_CRIT,"Terms And Conditions root element is null!\n");
return E_UNKNOWN;
}
DOMElement *elemTnCsTemplates = NULL;
DOMNodeList *templateList = NULL;
bool nothingFound = true;
getDOMChildByName(elemTnCs, OPTIONS_NODE_TNCS_TEMPLATES, elemTnCsTemplates);
UINT8** loadedTemplateRefIds = NULL;
bool templateError = false;
if(elemTnCsTemplates != NULL)
{
templateList = getElementsByTagName(elemTnCsTemplates, OPTIONS_NODE_TNCS_TEMPLATE);
if(templateList->getLength() > 0)
{
nothingFound = false;
m_nrOfTermsAndConditionsTemplates = templateList->getLength();
m_termsAndConditionsTemplates = new XERCES_CPP_NAMESPACE::DOMDocument*[m_nrOfTermsAndConditionsTemplates];
loadedTemplateRefIds = new UINT8*[m_nrOfTermsAndConditionsTemplates];
memset(loadedTemplateRefIds, 0, (sizeof(UINT8*)*m_nrOfTermsAndConditionsTemplates) );
UINT8 currentTemplateURL[TMP_BUFF_SIZE];
UINT32 len = TMP_BUFF_SIZE;
memset(currentTemplateURL, 0, len);
for (XMLSize_t i = 0; i < templateList->getLength(); i++)
{
getDOMElementValue(templateList->item(i), currentTemplateURL, &len);
m_termsAndConditionsTemplates[i] = parseDOMDocument(currentTemplateURL);
if(m_termsAndConditionsTemplates[i] == NULL)
{
CAMsg::printMsg(LOG_WARNING, "Cannot load Terms And Conditions template '%s'.\n",
currentTemplateURL);
return E_UNKNOWN;
}
UINT8* refId = getTermsAndConditionsTemplateRefId(m_termsAndConditionsTemplates[i]->getDocumentElement());
if(refId != NULL)
{
loadedTemplateRefIds[i] = refId;
for(XMLSize_t j = 0; j < i; j++)
{
if(strncmp((char *)refId, (char *) loadedTemplateRefIds[j], TEMPLATE_REFID_MAXLEN) == 0 )
{
templateError = true;
CAMsg::printMsg(LOG_ERR, "duplicate Terms And Conditions template '%s'.\n",refId);
break;
}
}
}
else
{
templateError = true;
CAMsg::printMsg(LOG_ERR, "Terms And Conditions template with invalid refid found.\n");
break;
}
if(!templateError)
{
CAMsg::printMsg(LOG_INFO, "loaded Terms And Conditions template '%s'.\n",refId);
}
else
{
break;
}
len = TMP_BUFF_SIZE;
}
}
if(loadedTemplateRefIds != NULL)
{
for(XMLSize_t j = 0; j < m_nrOfTermsAndConditionsTemplates; j++)
{
delete [] loadedTemplateRefIds[j];
loadedTemplateRefIds[j] = NULL;
}
delete [] loadedTemplateRefIds;
loadedTemplateRefIds = NULL;
}
if(templateError)
{
return E_UNKNOWN;
}
}
if(nothingFound)
{
CAMsg::printMsg(LOG_INFO,"No Terms And Conditions templates found.\n");
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setTrustedRootCertificates | ( | DOMElement * | elemCertificates | ) | [private] |
Definition at line 2865 of file CACmdLnOptions.cpp.
References CACertStore::add(), ASSERT_CERTIFICATES_OPTIONS_PARENT, CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getElementsByTagName(), CACertStore::getNumber(), LOG_NODE_NOT_FOUND, m_bVerifyMixCerts, m_pTrustedRootCertificates, OPTIONS_NODE_TRUSTED_ROOT_CERTIFICATES, OPTIONS_NODE_X509_CERTIFICATE, and CAMsg::printMsg().
{
DOMElement* elemTrustedCerts=NULL;
DOMNodeList* trustedCerts=NULL;
CACertificate* cert;
if(m_bVerifyMixCerts)
{
if(elemCertificates == NULL) return E_UNKNOWN;
ASSERT_CERTIFICATES_OPTIONS_PARENT
(elemCertificates->getNodeName(), OPTIONS_NODE_TRUSTED_ROOT_CERTIFICATES);
getDOMChildByName(elemCertificates, OPTIONS_NODE_TRUSTED_ROOT_CERTIFICATES, elemTrustedCerts, false);
if(elemTrustedCerts!=NULL)
{
trustedCerts = getElementsByTagName(elemTrustedCerts, OPTIONS_NODE_X509_CERTIFICATE);
for(UINT32 i=0; i<trustedCerts->getLength(); i++)
{
cert = CACertificate::decode(trustedCerts->item(i), CERT_X509CERTIFICATE);
if(cert != NULL)
{
m_pTrustedRootCertificates->add(cert);
}
else
{
CAMsg::printMsg(LOG_WARNING, "Root certificate could not be decoded\n");
}
}
}
else
{
LOG_NODE_NOT_FOUND(OPTIONS_NODE_TRUSTED_ROOT_CERTIFICATES);
return E_UNKNOWN;
}
if(m_pTrustedRootCertificates->getNumber() == 0)
{
CAMsg::printMsg(LOG_CRIT, "No trusted root certificates found.\n");
return E_UNKNOWN;
}
CAMsg::printMsg(LOG_INFO, "Loaded %d trusted root certificates.\n", m_pTrustedRootCertificates->getNumber());
}
return E_SUCCESS;
}
| SINT32 CACmdLnOptions::setUserID | ( | DOMElement * | elemGeneral | ) | [private] |
Definition at line 2141 of file CACmdLnOptions.cpp.
References ASSERT_GENERAL_OPTIONS_PARENT, E_SUCCESS, E_UNKNOWN, GET_NET_ERROR, GET_NET_ERROR_STR, getDOMChildByName(), getDOMElementValue(), getUser(), m_strUser, OPTIONS_NODE_USER_ID, CAMsg::printMsg(), and TMP_BUFF_SIZE.
Referenced by initGeneralOptionSetters().
{
DOMElement* elemUID=NULL;
UINT8 tmpBuff[TMP_BUFF_SIZE];
UINT32 tmpLen = TMP_BUFF_SIZE;
if(elemGeneral == NULL) return E_UNKNOWN;
ASSERT_GENERAL_OPTIONS_PARENT
(elemGeneral->getNodeName(), OPTIONS_NODE_USER_ID);
//get Username to run as...
getDOMChildByName(elemGeneral, OPTIONS_NODE_USER_ID, elemUID,false);
if(getDOMElementValue(elemUID,tmpBuff,&tmpLen)==E_SUCCESS)
{
m_strUser=new char[tmpLen+1];
memcpy(m_strUser,tmpBuff,tmpLen);
m_strUser[tmpLen]=0;
}
#ifndef WIN32
UINT8 buff[255];
if(getUser(buff,255)==E_SUCCESS) //switching user
{
struct passwd* pwd=getpwnam((char*)buff);
if(pwd==NULL || (setegid(pwd->pw_gid)==-1) || (seteuid(pwd->pw_uid)==-1) )
{
if (pwd==NULL)
{
CAMsg::printMsg(LOG_ERR,
"Could not switch to effective user '%s'! Reason: User '%s' does not exist on this system. Create this user first.\n",
buff, buff);
}
else
{
CAMsg::printMsg(LOG_ERR,"Could not switch to effective user '%s'! Reason: %s (%i)\n",
buff, GET_NET_ERROR_STR(GET_NET_ERROR), GET_NET_ERROR);
}
}
else
CAMsg::printMsg(LOG_INFO,"Switched to effective user '%s'!\n",buff);
}
if(geteuid()==0)
CAMsg::printMsg(LOG_WARNING,"Mix is running as root/superuser!\n");
#endif
return E_SUCCESS;
}
| bool CACmdLnOptions::verifyMixCertificates | ( | ) | [inline] |
Definition at line 703 of file CACmdLnOptions.hpp.
References m_bVerifyMixCerts.
Referenced by CAMiddleMix::processKeyExchange(), CAFirstMix::processKeyExchange(), and processXmlConfiguration().
{return m_bVerifyMixCerts;}
| THREAD_RETURN threadReConfigure | ( | void * | param | ) | [friend] |
Thread that does the actual reconfigure work.
Only one is running at the same time.
| param | pointer to a t_CMNDLN_REREAD_PARAMS stuct containing a CACmdLnOptions object pointer and a CMix object pointer. |
Definition at line 1362 of file CACmdLnOptions.cpp.
Referenced by reread().
{
CACmdLnOptions* pOptions=((t_CMNDLN_REREAD_PARAMS*)param)->pCmdLnOptions;
CAMix* pMix=((t_CMNDLN_REREAD_PARAMS*)param)->pMix;
//pOptions->m_pcsReConfigure->lock();
CAMsg::printMsg(LOG_DEBUG,"ReConfiguration of the Mix is under way....\n");
CACmdLnOptions otmpOptions;
XERCES_CPP_NAMESPACE::DOMDocument* docConfig=NULL;
if(otmpOptions.readXmlConfiguration(docConfig,pOptions->m_strConfigFile)!=E_SUCCESS)
{
CAMsg::printMsg(LOG_DEBUG,"Could not re-read the config file!\n");
goto REREAD_FINISH;
}
CAMsg::printMsg(LOG_DEBUG,"Re-readed config file -- start processing config file!\n");
if(otmpOptions.processXmlConfiguration(docConfig)!=E_SUCCESS)
{
CAMsg::printMsg(LOG_DEBUG,"Re-readed config file -- could not process configuration!\n");
goto REREAD_FINISH;
}
pOptions->setNewValues(otmpOptions);
if(pMix!=NULL)
pMix->reconfigure();
REREAD_FINISH:
CAMsg::printMsg(LOG_DEBUG,"ReConfiguration of the Mix finished!\n");
//pOptions->m_pcsReConfigure->unlock();
pOptions->m_bIsRunReConfigure=false;
THREAD_RETURN_SUCCESS;
}
Definition at line 858 of file CACmdLnOptions.hpp.
Referenced by clean(), initAccountingOptionSetters(), and setAccountingOptions().
Definition at line 862 of file CACmdLnOptions.hpp.
Referenced by clean(), initCertificateOptionSetters(), and setCertificateOptions().
Definition at line 861 of file CACmdLnOptions.hpp.
Referenced by clean(), initGeneralOptionSetters(), and setGeneralOptions().
Definition at line 729 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getInfoServices(), parseInfoServices(), and setInfoServices().
UINT32 CACmdLnOptions::m_addrInfoServicesSize [private] |
Definition at line 730 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getInfoServices(), isInfoServiceEnabled(), parseInfoServices(), and setInfoServices().
Definition at line 795 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clearListenerInterfaces(), getListenerInterface(), parse(), and setListenerInterfaces().
UINT8** CACmdLnOptions::m_arStrVisibleAddresses [private] |
Definition at line 797 of file CACmdLnOptions.hpp.
Referenced by addVisibleAddresses(), CACmdLnOptions(), clearVisibleAddresses(), and getVisibleAddress().
Definition at line 793 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clearTargetInterfaces(), getTargetInterface(), setNewValues(), and setTargetInterfaces().
bool CACmdLnOptions::m_bAcceptReconfiguration [private] |
Definition at line 760 of file CACmdLnOptions.hpp.
Referenced by acceptReconfiguration(), CACmdLnOptions(), parseInfoServices(), and setInfoServices().
bool CACmdLnOptions::m_bAutoReconnect [private] |
Definition at line 772 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getAutoReconnect(), and parse().
bool CACmdLnOptions::m_bCompressedLogs [private] |
Definition at line 779 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getCompressLogs(), and parse().
bool CACmdLnOptions::m_bDaemon [private] |
Definition at line 719 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDaemon(), parse(), and setDaemonMode().
bool CACmdLnOptions::m_bDynamic [private] |
Definition at line 713 of file CACmdLnOptions.hpp.
Referenced by setDynamicMix().
bool CACmdLnOptions::m_bFirstMix [private] |
Definition at line 771 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isFirstMix(), setAccountingDatabase(), and setMixType().
bool CACmdLnOptions::m_bIsEncryptedLogEnabled [private] |
Definition at line 791 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), enableEncryptedLog(), isEncryptedLogEnabled(), and setLoggingOptions().
bool CACmdLnOptions::m_bIsRunReConfigure [private] |
Definition at line 726 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), reread(), and threadReConfigure().
bool CACmdLnOptions::m_bLastMix [private] |
Definition at line 771 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isLastMix(), and setMixType().
bool CACmdLnOptions::m_bLocalProxy [private] |
Definition at line 771 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isLocalProxy(), and parse().
bool CACmdLnOptions::m_bLogConsole [private] |
Definition at line 782 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), initLogging(), and setLoggingOptions().
bool CACmdLnOptions::m_bMiddleMix [private] |
Definition at line 771 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isMiddleMix(), and setMixType().
bool CACmdLnOptions::m_bSocksSupport [private] |
Definition at line 780 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isSock5sSupported(), and setTargetInterfaces().
bool CACmdLnOptions::m_bSyslog [private] |
Definition at line 781 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), isSyslogEnabled(), and setLoggingOptions().
bool CACmdLnOptions::m_bVerifyMixCerts [private] |
Definition at line 747 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), setMixCertificateVerification(), setNextMixCertificate(), setPrevMixCertificate(), setTrustedRootCertificates(), and verifyMixCertificates().
UINT32 CACmdLnOptions::m_cnListenerInterfaces [private] |
Definition at line 796 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clearListenerInterfaces(), getListenerInterface(), getListenerInterfaceCount(), parse(), and setListenerInterfaces().
UINT32 CACmdLnOptions::m_cnTargets [private] |
Definition at line 794 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clearTargetInterfaces(), getTargetInterface(), getTargetInterfaceCount(), setNewValues(), and setTargetInterfaces().
UINT32 CACmdLnOptions::m_cnVisibleAddresses [private] |
Definition at line 798 of file CACmdLnOptions.hpp.
Referenced by addVisibleAddresses(), CACmdLnOptions(), clearVisibleAddresses(), getVisibleAddress(), and getVisibleAddressesCount().
char* CACmdLnOptions::m_dbCountryStatsHost [private] |
Definition at line 881 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getCountryStatsDBConnectionLoginData(), and processXmlConfiguration().
char* CACmdLnOptions::m_dbCountryStatsPasswd [private] |
Definition at line 883 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getCountryStatsDBConnectionLoginData(), and processXmlConfiguration().
char* CACmdLnOptions::m_dbCountryStatsUser [private] |
Definition at line 882 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getCountryStatsDBConnectionLoginData(), and processXmlConfiguration().
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docMixInfo [private] |
Definition at line 761 of file CACmdLnOptions.hpp.
Referenced by addMixIdToMixInfo(), appendMixInfo_internal(), CACmdLnOptions(), clean(), getMixXml(), processXmlConfiguration(), setMixName(), setPrepaidInterval(), and setTargetInterfaces().
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docMixXml [private] |
Definition at line 762 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), parse(), setNextMix(), and setPrevMix().
XERCES_CPP_NAMESPACE::DOMDocument* CACmdLnOptions::m_docOpTnCs [private] |
Definition at line 763 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getTermsAndConditions(), and setTermsAndConditionsList().
UINT16 CACmdLnOptions::m_iDatabasePort [private] |
Definition at line 853 of file CACmdLnOptions.hpp.
Referenced by getDatabasePort(), and setAccountingDatabase().
UINT32 CACmdLnOptions::m_iPaymentHardLimit [private] |
Definition at line 854 of file CACmdLnOptions.hpp.
Referenced by getPaymentHardLimit(), and setAccountingHardLimit().
Definition at line 857 of file CACmdLnOptions.hpp.
Referenced by getPaymentSettleInterval(), and setSettleInterval().
UINT32 CACmdLnOptions::m_iPaymentSoftLimit [private] |
Definition at line 855 of file CACmdLnOptions.hpp.
Referenced by getPaymentSoftLimit(), and setAccountingSoftLimit().
UINT32 CACmdLnOptions::m_iPrepaidInterval [private] |
Definition at line 856 of file CACmdLnOptions.hpp.
Referenced by getPrepaidInterval(), and setPrepaidInterval().
UINT16 CACmdLnOptions::m_iSOCKSPort [private] |
Definition at line 724 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getSOCKSPort(), and parse().
UINT16 CACmdLnOptions::m_iSOCKSServerPort [private] |
Definition at line 720 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getSOCKSServerPort(), and parse().
UINT16 CACmdLnOptions::m_iTargetPort [private] |
Definition at line 721 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getMixPort(), and parse().
UINT32 CACmdLnOptions::m_maxLogFiles [private] |
Definition at line 777 of file CACmdLnOptions.hpp.
Referenced by getMaxLogFiles(), and setLoggingOptions().
SINT64 CACmdLnOptions::m_maxLogFileSize [private] |
Definition at line 776 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getMaxLogFileSize(), and setLoggingOptions().
UINT32 CACmdLnOptions::m_maxNrOfUsers [private] |
Definition at line 754 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getMaxNrOfUsers(), setMaxUsers(), and setNewValues().
Definition at line 918 of file CACmdLnOptions.hpp.
Referenced by initCertificateOptionSetters(), and setCertificateOptions().
SINT32 CACmdLnOptions::m_nrOfOpenFiles [private] |
Definition at line 785 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getMaxOpenFiles(), and setNrOfFileDescriptors().
Definition at line 702 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getNumberOfTermsAndConditionsTemplates(), and setTermsAndConditionsTemplates().
CACertificate* CACmdLnOptions::m_OpCert [private] |
Definition at line 741 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getOperatorSubjectKeyIdentifier(), and setOwnOperatorCertificate().
DOMNodeList* CACmdLnOptions::m_opCertList [private] |
Definition at line 744 of file CACmdLnOptions.hpp.
Referenced by setOwnCertificate(), and setOwnOperatorCertificate().
Definition at line 756 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), processXmlConfiguration(), and setPaymentReminder().
CAXMLBI* CACmdLnOptions::m_pBI [private] |
Definition at line 847 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getBI(), setPaymentInstance(), and setPriceCertificate().
DOMElement* CACmdLnOptions::m_pCascadeXML [private] |
Definition at line 759 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getCascadeXML(), and processXmlConfiguration().
CAMutex* CACmdLnOptions::m_pcsReConfigure [private] |
Definition at line 727 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), and cleanup().
bool CACmdLnOptions::m_perfTestEnabled [private] |
Definition at line 768 of file CACmdLnOptions.hpp.
Definition at line 752 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getLogEncryptionKey(), and setLoggingOptions().
Definition at line 734 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getMultiSigner(), setOwnCertificate(), and setPriceCertificate().
Definition at line 751 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getNextMixTestCertificate(), hasNextMixTestCertificate(), setNextMix(), setNextMixCertificate(), and setNextMixTestCertificate().
Definition at line 750 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getPrevMixTestCertificate(), hasPrevMixTestCertificate(), setPrevMixCertificate(), and setPrevMixTestCertificate().
Definition at line 738 of file CACmdLnOptions.hpp.
Referenced by getPriceCertificate(), and setPriceCertificate().
Definition at line 748 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getTrustedCertificateStore(), setMixCertificateVerification(), and setTrustedRootCertificates().
UINT8* CACmdLnOptions::m_strAiID [private] |
Definition at line 852 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getAiID(), setOwnCertificate(), and setPriceCertificate().
UINT8* CACmdLnOptions::m_strCascadeName [private] |
Definition at line 773 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getCascadeName(), setCascadeName(), and setOwnCertificate().
UINT8* CACmdLnOptions::m_strConfigFile [private] |
Definition at line 718 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), parse(), and threadReConfigure().
UINT8* CACmdLnOptions::m_strDatabaseHost [private] |
Definition at line 848 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDatabaseHost(), and setAccountingDatabase().
UINT8* CACmdLnOptions::m_strDatabaseName [private] |
Definition at line 849 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDatabaseName(), and setAccountingDatabase().
UINT8* CACmdLnOptions::m_strDatabasePassword [private] |
Definition at line 851 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDatabasePassword(), and setAccountingDatabase().
UINT8* CACmdLnOptions::m_strDatabaseUser [private] |
Definition at line 850 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDatabaseUsername(), and setAccountingDatabase().
char* CACmdLnOptions::m_strEncryptedLogDir [private] |
Definition at line 778 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getEncryptedLogDir(), and setLoggingOptions().
char* CACmdLnOptions::m_strLogDir [private] |
Definition at line 774 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getLogDir(), parse(), setLogDir(), and setLoggingOptions().
char* CACmdLnOptions::m_strLogLevel [private] |
Definition at line 775 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), initLogging(), and setLoggingOptions().
char* CACmdLnOptions::m_strMixID [private] |
Definition at line 788 of file CACmdLnOptions.hpp.
Referenced by addMixIdToMixInfo(), CACmdLnOptions(), clean(), getMixId(), setCascadeNameFromOptions(), setMixID(), and setOwnCertificate().
char* CACmdLnOptions::m_strMixName [private] |
Definition at line 789 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), and setMixName().
char* CACmdLnOptions::m_strPidFile [private] |
Definition at line 784 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getPidFile(), and parse().
char* CACmdLnOptions::m_strSOCKSHost [private] |
Definition at line 723 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getSOCKSHost(), and parse().
char* CACmdLnOptions::m_strTargetHost [private] |
Definition at line 722 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getMixHost(), and parse().
char* CACmdLnOptions::m_strUser [private] |
Definition at line 783 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), clean(), getUser(), and setUserID().
| XERCES_CPP_NAMESPACE::DOMDocument** CACmdLnOptions::m_termsAndConditionsTemplates |
Definition at line 701 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getAllTermsAndConditionsTemplates(), and setTermsAndConditionsTemplates().
CAThread CACmdLnOptions::m_threadReConfigure [private] |
Definition at line 728 of file CACmdLnOptions.hpp.
Referenced by reread().
Definition at line 835 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDelayChannelBucketGrow(), setNewValues(), and setRessourceOptions().
Definition at line 836 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDelayChannelBucketGrowIntervall(), setNewValues(), and setRessourceOptions().
Definition at line 834 of file CACmdLnOptions.hpp.
Referenced by CACmdLnOptions(), getDelayChannelUnlimitTraffic(), setNewValues(), and setRessourceOptions().
Definition at line 766 of file CACmdLnOptions.hpp.
Referenced by getKeepAliveRecvInterval(), and setKeepAliveTraffic().
Definition at line 765 of file CACmdLnOptions.hpp.
Referenced by getKeepAliveSendInterval(), and setKeepAliveTraffic().
optionSetter_pt* CACmdLnOptions::mainOptionSetters [private] |
Definition at line 860 of file CACmdLnOptions.hpp.
Referenced by clean(), initMainOptionSetters(), and processXmlConfiguration().
Definition at line 863 of file CACmdLnOptions.hpp.
Referenced by clean(), initNetworkOptionSetters(), and setNetworkOptions().
Definition at line 864 of file CACmdLnOptions.hpp.
Referenced by initTermsAndConditionsOptionSetters(), and setTermsAndConditions().
1.7.6.1