58 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
72 #ifndef ONLY_LOCAL_PROXY
97 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
130 #ifdef SERVER_MONITORING
131 m_strMonitoringListenerHost = NULL;
132 m_iMonitoringListenerPort = 0xFFFF;
136 m_logPayload =
false;
137 m_arCrimeRegExpsURL=NULL;
138 m_nCrimeRegExpsURL=0;
139 m_arCrimeRegExpsPayload=NULL;
140 m_nCrimeRegExpsPayload=0;
141 m_nrOfSurveillanceIPs = 0;
142 m_surveillanceIPs = NULL;
143 m_nrOfSurveillanceAccounts = 0;
144 m_surveillanceAccounts = NULL;
147 #ifdef DATA_RETENTION_LOG
148 m_strDataRetentionLogDir=NULL;
151 #ifdef EXPORT_ASYM_PRIVATE_KEY
152 m_strImportKeyFile=NULL;
153 m_strExportKeyFile=NULL;
157 m_strLastCascadeProposal = NULL;
160 #if defined(DELAY_CHANNELS) && defined(DELAY_USERS)
173 #elif defined(DELAY_CHANNELS)
177 #elif defined (DELAY_USERS)
183 #if defined(DELAY_CHANNELS_LATENCY)
187 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
200 initCrimeDetectionOptionSetters();
212 #ifndef ONLY_LOCAL_PROXY
227 void CACmdLnOptions::initCrimeDetectionOptionSetters()
229 crimeDetectionOptionSetters =
new optionSetter_pt[CRIME_DETECTION_OPTIONS_NR];
232 crimeDetectionOptionSetters[++count]=
233 &CACmdLnOptions::setCrimeURLRegExp;
234 crimeDetectionOptionSetters[++count]=
235 &CACmdLnOptions::setCrimePayloadRegExp;
236 crimeDetectionOptionSetters[++count]=
237 &CACmdLnOptions::setCrimeSurveillanceAccounts;
238 crimeDetectionOptionSetters[++count]=
239 &CACmdLnOptions::setCrimeSurveillanceIP;
250 #ifndef ONLY_LOCAL_PROXY
293 #ifndef ONLY_LOCAL_PROXY
310 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
354 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
367 #ifndef ONLY_LOCAL_PROXY
408 #ifdef DATA_RETENTION_LOG
409 delete[] m_strDataRetentionLogDir;
410 m_strDataRetentionLogDir=NULL;
413 #ifdef EXPORT_ASYM_PRIVATE_KEY
414 if(m_strImportKeyFile!=NULL)
415 delete[] m_strImportKeyFile;
416 m_strImportKeyFile=NULL;
417 if(m_strExportKeyFile!=NULL)
418 delete[] m_strExportKeyFile;
419 m_strExportKeyFile=NULL;
426 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
433 #ifdef SERVER_MONITORING
434 if(m_strMonitoringListenerHost != NULL)
436 delete[] m_strMonitoringListenerHost;
437 m_strMonitoringListenerHost = NULL;
466 int iCompressedLogs=0;
467 char* serverPort=NULL;
469 int iCryptoBenchmark = 0;
470 int iSkipProxyCheck = 0;
471 char *configfile = NULL;
472 int iAutoReconnect=0;
473 char* strPidFile=NULL;
474 char* strCreateConf=NULL;
475 char* strCredential = NULL;
476 #ifdef EXPORT_ASYM_PRIVATE_KEY
477 char* strImportKey=NULL;
478 char* strExportKey=NULL;
483 {
"localproxy",
'j',
POPT_ARG_NONE,&iLocalProxy,0,
"act as local proxy",NULL},
484 {
"daemon",
'd',
POPT_ARG_NONE,&iDaemon,0,
"start as daemon [only for local proxy]",NULL},
485 {
"next",
'n',
POPT_ARG_STRING,&target,0,
"first mix of cascade [only for local proxy]",
"<ip:port>"},
486 {
"autoreconnect",
'a',
POPT_ARG_NONE,&iAutoReconnect,0,
"auto reconnects if connection to first mix was lost [only for local proxy]",NULL},
487 {
"port",
'p',
POPT_ARG_STRING,&serverPort,0,
"listening on [host:]port|path [only for local proxy]",
"<[host:]port|path>"},
488 {
"socksport",
's',
POPT_ARG_INT,&SOCKSport,0,
"listening port for socks",
"<portnumber>"},
489 {
"logdir",
'l',
POPT_ARG_STRING,&logdir,0,
"directory where log files go to [only for local proxy]",
"<dir>"},
490 #ifdef COMPRESSED_LOGS
491 {
"gzip",
'z',
POPT_ARG_NONE,&iCompressedLogs,0,
"create gziped logs",NULL},
493 {
"config",
'c',
POPT_ARG_STRING,&configfile,0,
"config file to use [for a real Mix in a cascade]",
"<file>"},
494 {
"version",
'v',
POPT_ARG_NONE,&iVersion,0,
"show version",NULL},
495 {
"pidfile",
'r',
POPT_ARG_STRING,&strPidFile,0,
"file where the PID will be stored",
"<file>"},
496 {
"createConf",0,
POPT_ARG_STRING,&strCreateConf,0,
"creates a generic configuration for MixOnCD",
"[<file>]"},
497 {
"credential",0,
POPT_ARG_STRING,&strCredential,0,
"credential for connetion to cascade [only for local proxy]",
"<credential>"},
498 {
"cryptobenchmark",0,
POPT_ARG_NONE,&iCryptoBenchmark,0,
"do a benchamrk of the cryptographic functions",NULL},
499 {
"skip-proxy-check", 0,
POPT_ARG_NONE, &iSkipProxyCheck, 0,
"skip the proxy check (e.g if the proxies are started intentionally after the last mix)", NULL },
500 #ifdef EXPORT_ASYM_PRIVATE_KEY
501 {
"exportKey",0,
POPT_ARG_STRING,&strExportKey,0,
"export private encryption key to file",
"<file>"},
502 {
"importKey",0,
POPT_ARG_STRING,&strImportKey,0,
"import private encryption key from file",
"<file>"},
516 for(
UINT32 t=0;t<10000;t++)
521 printf(
"Max open sockets: %u\n",t);
525 printf(
"Max open sockets: >10000\n");
529 #ifdef MIX_VERSION_TESTING
533 #ifndef ONLY_LOCAL_PROXY
534 if(strCreateConf!=NULL)
546 if(configfile == NULL)
551 #if defined (_WIN32) &&!defined(__CYGWIN__)
556 int err = access(configfile, R_OK);
559 if(configfile != NULL)
571 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
574 CAMsg::printMsg(LOG_CRIT,
"Could not open config file: %s\n",configfile);
576 CAMsg::printMsg(LOG_CRIT,
"Could not read config file: %s\n",configfile);
578 CAMsg::printMsg(LOG_CRIT,
"Could not parse config file: %s\n",configfile);
600 char* tmpStr1=strchr(target,
':');
603 memcpy(tmpHostname,target,tmpStr1-target);
604 tmpHostname[tmpStr1-target]=0;
605 tmpPort=(
SINT32)atol(tmpStr1+1);
611 tmpPort=(
SINT32)atol(target);
614 strcpy(tmpHostname,
"localhost");
621 strcpy(tmpHostname,target);
633 if((tmpStr=strchr(socks,
':'))!=NULL)
655 if(strCredential!=NULL)
662 #ifdef EXPORT_ASYM_PRIVATE_KEY
663 if(strExportKey!=NULL)
665 m_strExportKeyFile=
new UINT8[strlen(strExportKey)+1];
666 strcpy((
char*)m_strExportKeyFile,strExportKey);
669 if(strImportKey!=NULL)
671 m_strImportKeyFile=
new UINT8[strlen(strImportKey)+1];
672 strcpy((
char*)m_strImportKeyFile,strImportKey);
676 if(iCompressedLogs!=0)
685 if(serverPort[0]==
'/')
691 char* strServerHost=NULL;
693 if((tmpStr=strchr(serverPort,
':'))!=NULL)
695 strServerHost=
new char[tmpStr-serverPort+1];
697 strcpy(strServerHost,serverPort);
698 iServerPort=(
SINT32)atol(tmpStr+1);
702 iServerPort=(
SINT32)atol(serverPort);
705 delete [] strServerHost;
706 strServerHost = NULL;
714 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
726 createDefaultConfiguration();
734 #if !defined ONLY_LOCAL_PROXY
737 XERCES_CPP_NAMESPACE::DOMDocument* infoservices;
738 if( readXmlConfiguration(infoservices,(
UINT8*)
"infoservices.xml") ==
E_SUCCESS )
740 CAMsg::printMsg(LOG_DEBUG,
"Will now get InfoServices from infoservices.xml (this overrides the InfoServices from the default config!)\n");
741 DOMElement* elemIs=infoservices->getDocumentElement();
742 parseInfoServices(elemIs);
752 CAMsg::printMsg(LOG_CRIT,
"I was not able to get a working certificate, please check the configuration! Exiting now\n");
756 CAMsg::printMsg( LOG_INFO,
"I will now test if I have enough information about InfoServices...\n");
757 if( checkInfoServices(&running) !=
E_SUCCESS )
760 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);
764 if( checkListenerInterfaces() !=
E_SUCCESS )
766 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");
771 CAMsg::printMsg(LOG_CRIT,
"ARGS, I don't have an unique ID, cannot create one! Exiting now\n");
779 #ifndef ONLY_LOCAL_PROXY
804 #if defined( DELAY_CHANNELS)||defined(DELAY_USERS)
810 #if defined( DELAY_CHANNELS_LATENCY)
812 m_u32DelayChannelLatency=newOptions.getDelayChannelLatency();
822 #ifndef ONLY_LOCAL_PROXY
832 DOMElement* elemRoot = doc->getDocumentElement();
839 DOMElement* elemCert;
844 DOMElement* elemOptionsRoot =
m_docMixXml->getDocumentElement();
845 DOMElement* elemOptionsCerts;
847 DOMElement* elemOptionsNextMixCert;
852 elemOptionsCerts->appendChild(elemOptionsNextMixCert);
853 elemOptionsNextMixCert->appendChild(
m_docMixXml->importNode(elemCert->getFirstChild(),
true));
857 if(elemOptionsNextMixCert->hasChildNodes())
859 elemOptionsNextMixCert->replaceChild(
m_docMixXml->importNode(elemCert->getFirstChild(),
true),
860 elemOptionsNextMixCert->getFirstChild());
864 elemOptionsNextMixCert->appendChild(
m_docMixXml->importNode(elemCert->getFirstChild(),
true));
868 DOMElement* elemNextMix;
871 DOMElement* elemOptionsNetwork;
872 DOMElement* elemOptionsNextMixInterface;
877 elemOptionsRoot->appendChild(elemOptionsNetwork);
883 elemOptionsNetwork->appendChild(elemOptionsNextMixInterface);
887 while(elemOptionsNextMixInterface->hasChildNodes())
889 elemOptionsNextMixInterface->removeChild(elemOptionsNextMixInterface->getFirstChild());
893 DOMNode* interfaceData = elemNextMix->getFirstChild();
894 while(interfaceData != NULL)
896 elemOptionsNextMixInterface->appendChild(
m_docMixXml->importNode(interfaceData,
true));
897 interfaceData = interfaceData->getNextSibling();
910 DOM_Element elemRoot = doc.getDocumentElement();
914 DOM_Element elemCert;
919 DOM_Node elemNextMix;
920 DOM_Element elemListeners;
924 UINT32 len = nlListenerInterfaces.getLength();
925 bool foundNonHiddenInterface =
false;
928 elemNextMix=nlListenerInterfaces.item(i);
934 foundNonHiddenInterface =
true;
938 if(!foundNonHiddenInterface)
940 CAMsg::printMsg(LOG_ERR,
"NEXT MIX HAS NO REAL LISTENERINTERFACES!\n");
948 TargetInterface* targetInterfaceNextMix=NULL;
949 if(elemNextMix!=NULL)
953 DOM_Element elemType;
960 if(strcmp((
char*)tmpBuff,
"RAW/TCP")==0)
962 else if(strcmp((
char*)tmpBuff,
"RAW/UNIX")==0)
964 else if(strcmp((
char*)tmpBuff,
"SSL/TCP")==0)
966 else if(strcmp((
char*)tmpBuff,
"SSL/UNIX")==0)
972 DOM_Element elemPort;
973 DOM_Element elemHost;
982 bool bAddrIsSet=
false;
1003 CAMsg::printMsg(LOG_INFO,
"Setting target interface: %s:%d\n", buffHost, port);
1006 #ifdef HAVE_UNIX_DOMAIN_PROTOCOL
1009 DOM_Element elemFile;
1023 targetInterfaceNextMix=
new TargetInterface;
1024 targetInterfaceNextMix->target_type=
TARGET_MIX;
1025 targetInterfaceNextMix->net_type=
type;
1026 targetInterfaceNextMix->addr=addr->
clone();
1028 if(targetInterfaceNextMix!=NULL)
1038 delete targetInterfaceNextMix;
1039 targetInterfaceNextMix = NULL;
1054 #ifndef ONLY_LOCAL_PROXY
1064 DOMElement* elemRoot = doc->getDocumentElement();
1067 DOMElement* elemSig;
1071 DOMElement* elemCert;
1075 CAMsg::printMsg(LOG_DEBUG,
"setPrevMix() - elem cert found in data from infoservice\n");
1076 DOMElement* elemOptionsRoot =
m_docMixXml->getDocumentElement();
1077 CAMsg::printMsg(LOG_DEBUG,
"setPrevMix() - got current options root element\n");
1078 DOMElement* elemOptionsCerts;
1081 DOMElement* elemOptionsPrevMixCert;
1086 CAMsg::printMsg(LOG_DEBUG,
"setPrevMix() - no prev cert set at the moment\n");
1088 elemOptionsCerts->appendChild(elemOptionsPrevMixCert);
1089 CAMsg::printMsg(LOG_DEBUG,
"setPrevMix() - try to import the one we got from infoservice\n");
1099 elemOptionsPrevMixCert->appendChild(
m_docMixXml->importNode(elemCert,
true));
1108 if(elemOptionsPrevMixCert->hasChildNodes())
1110 elemOptionsPrevMixCert->replaceChild(
m_docMixXml->importNode(elemCert->getFirstChild(),
true),
1111 elemOptionsPrevMixCert->getFirstChild());
1115 elemOptionsPrevMixCert->appendChild(
m_docMixXml->importNode(elemCert->getFirstChild(),
true));
1131 DOM_Element elemRoot = doc.getDocumentElement();
1132 DOM_Element elemSig;
1134 DOM_Element elemCert;
1148 #ifndef ONLY_LOCAL_PROXY
1150 SINT32 CACmdLnOptions::resetNextMix()
1157 DOM_Element elemOptionsRoot =
m_docMixXml.getDocumentElement();
1158 DOM_Element elemOptionsCerts;
1160 DOM_Element elemTmp;
1165 elemOptionsCerts.removeChild(elemTmp);
1170 elemOptionsCerts.removeChild(elemTmp);
1176 SINT32 CACmdLnOptions::resetPrevMix()
1183 DOM_Element elemOptionsRoot =
m_docMixXml.getDocumentElement();
1184 DOM_Element elemOptionsCerts;
1186 DOM_Element elemTmp;
1191 elemOptionsCerts.removeChild(elemTmp);
1196 elemOptionsCerts.removeChild(elemTmp);
1204 #ifndef ONLY_LOCAL_PROXY
1234 CAMsg::printMsg(LOG_DEBUG,
"ReConfiguration of the Mix is under way....\n");
1236 XERCES_CPP_NAMESPACE::DOMDocument* docConfig=NULL;
1242 CAMsg::printMsg(LOG_DEBUG,
"Re-readed config file -- start processing config file!\n");
1245 CAMsg::printMsg(LOG_DEBUG,
"Re-readed config file -- could not process configuration!\n");
1297 #ifndef ONLY_LOCAL_PROXY
1414 #ifndef ONLY_LOCAL_PROXY
1525 #ifdef SERVER_MONITORING
1526 char *CACmdLnOptions::getMonitoringListenerHost()
1528 return m_strMonitoringListenerHost;
1531 UINT16 CACmdLnOptions::getMonitoringListenerPort()
1533 return m_iMonitoringListenerPort;
1546 #ifndef ONLY_LOCAL_PROXY
1559 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
1591 #if!defined ONLY_LOCAL_PROXY
1605 CAMsg::printMsg(LOG_CRIT,
"We need a log file in daemon mode in order to get any messages! Exiting...\n");
1613 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
1622 DOMElement* elemCredential = NULL;
1626 if (elemGeneral == NULL)
1638 DOMElement* elemMixType=NULL;
1661 DOMElement* elemRoot=
m_docMixInfo->getDocumentElement();
1662 DOMElement* elemChannelSymmetricChipher=NULL;
1663 getDOMChildByName(elemRoot,
"ChannelSymmetricChipher",elemChannelSymmetricChipher,
false);
1664 if (elemChannelSymmetricChipher == NULL)
1667 elemRoot->appendChild(elemChannelSymmetricChipher);
1682 #ifndef ONLY_LOCAL_PROXY
1707 memset(tmpBuff, 0, tmpLen);
1720 DOMElement* elemMaxUsers=NULL;
1723 if(elemGeneral == NULL)
return E_UNKNOWN;
1729 if(elemMaxUsers!=NULL)
1741 DOMElement* elemPaymentReminder=NULL;
1744 if(elemGeneral == NULL)
1750 bool bEnabled=
false;
1773 DOMElement* elemAccounting=NULL;
1790 DOMElement* elemPriceCert = NULL;
1792 if(elemAccounting == NULL)
return E_UNKNOWN;
1799 if (elemPriceCert == NULL)
1801 CAMsg::printMsg(LOG_CRIT,
"Did you really want to compile the mix with payment support?\n");
1836 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");
1842 CAMsg::printMsg(LOG_CRIT,
"Could not verify price certificate, as no payment instance was found!\n");
1849 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");
1864 DOMElement* elemJPI = NULL;
1866 if(elemAccounting == NULL)
return E_UNKNOWN;
1873 m_pBI = CAXMLBI::getInstance(elemJPI);
1876 CAMsg::printMsg(LOG_CRIT,
"Could not instantiate payment instance interface. Did you really want to compile the mix with payment support?\n");
1886 DOMElement* elemAISoftLimit = NULL;
1889 if(elemAccounting == NULL)
return E_UNKNOWN;
1916 DOMElement* elemAIHardLimit = NULL;
1919 if(elemAccounting == NULL)
return E_UNKNOWN;
1946 DOMElement* elemPrepaidIval = NULL;
1949 if(elemAccounting == NULL)
return E_UNKNOWN;
1977 CAMsg::printMsg(LOG_INFO,
"Node \"%s\" is empty! Setting default...\n",
1989 "Performance will be critical and clients will lose connection!\n",
m_iPrepaidInterval);
1996 m_docMixInfo->getDocumentElement()->appendChild(elemInterval);
2004 DOMElement* elemSettleIval = NULL;
2007 if(elemAccounting == NULL)
return E_UNKNOWN;
2033 DOMElement* elem = NULL;
2034 DOMElement* elemDatabase = NULL;
2044 if(elemAccounting == NULL)
return E_UNKNOWN;
2095 memset(tmpBuff, 0, tmpLen);
2116 memset(tmpBuff, 0, tmpLen);
2132 memset(tmpBuff, 0, tmpLen);
2141 scanf(
"%400[^\n]%*1[\n]",(
char*)dbpass);
2142 int len = strlen((
char *)dbpass);
2160 CAMsg::printMsg(LOG_DEBUG,
"Accounting database information parsed successfully.\n");
2186 DOMElement *elemTnCs = NULL;
2188 if(elemRoot == NULL)
2194 if(elemTnCs != NULL)
2201 CAMsg::printMsg(LOG_WARNING,
"No Terms & Conditions for Operator specified!\n");
2208 if(elemTnCs == NULL)
2210 CAMsg::printMsg(LOG_CRIT,
"Terms And Conditions root element is null!\n");
2213 DOMElement *elemTnCsTemplates = NULL;
2214 DOMNodeList *templateList = NULL;
2215 bool nothingFound =
true;
2218 UINT8** loadedTemplateRefIds = NULL;
2219 bool templateError =
false;
2221 if(elemTnCsTemplates != NULL)
2224 if(templateList->getLength() > 0)
2226 nothingFound =
false;
2234 memset(currentTemplateURL, 0,
len);
2236 for (
UINT32 i = 0; i < templateList->getLength(); i++)
2242 CAMsg::printMsg(LOG_WARNING,
"Cannot load Terms And Conditions template '%s'.\n",
2243 currentTemplateURL);
2249 loadedTemplateRefIds[i] = refId;
2250 for(
UINT32 j = 0; j < i; j++)
2254 templateError =
true;
2255 CAMsg::printMsg(LOG_ERR,
"duplicate Terms And Conditions template '%s'.\n",refId);
2262 templateError =
true;
2263 CAMsg::printMsg(LOG_ERR,
"Terms And Conditions template with invalid refid found.\n");
2269 CAMsg::printMsg(LOG_INFO,
"loaded Terms And Conditions template '%s'.\n",refId);
2278 if(loadedTemplateRefIds != NULL)
2282 delete [] loadedTemplateRefIds[j];
2283 loadedTemplateRefIds[j] = NULL;
2285 delete [] loadedTemplateRefIds;
2286 loadedTemplateRefIds = NULL;
2296 CAMsg::printMsg(LOG_INFO,
"No Terms And Conditions templates found.\n");
2303 if(elemTnCs == NULL)
2305 CAMsg::printMsg(LOG_CRIT,
"Terms And Conditions root element is null!\n");
2308 DOMElement *elemTnCsList = NULL;
2311 if(elemTnCsList == NULL)
2313 CAMsg::printMsg(LOG_CRIT,
"No definitions for Terms And Conditions found!\n");
2319 memset(attrCheck, 0, attrCheckLen);
2323 memset(locale, 0, localeLen);
2327 memset(date, 0, dateLen);
2332 CAMsg::printMsg(LOG_CRIT,
"Attribute '%s' is not properly set for the global definition of Terms And Conditions!\n",
2339 DOMElement *currentTnCEntry = NULL;
2342 if(tncDefEntryList->getLength() < 1)
2348 DOMElement *tncTranslationImports = NULL;
2349 DOMElement *tncOperatorNode = NULL;
2351 if(tncTranslationImports != NULL)
2355 bool defaultLangValue =
false;
2356 bool defaultLangFound =
false;
2357 bool operatorImportNodeFound = (tncOperatorNode != NULL);
2362 for (
UINT32 j = 0; j < tncDefEntryList->getLength(); j++)
2366 defaultLangValue =
false;
2367 currentTnCEntry = (DOMElement *) tncDefEntryList->item(j);
2370 (strlen((
char *)attrCheck) < 1) )
2372 CAMsg::printMsg(LOG_CRIT,
"Attribute '%s' is not proper set for definition %u of Terms And Conditions!\n",
2379 CAMsg::printMsg(LOG_CRIT,
"Attribute '%s' is not proper set for definition %u of Terms And Conditions!\n",
2384 if(!operatorImportNodeFound)
2386 tncOperatorNode = NULL;
2388 if(tncOperatorNode == NULL)
2390 CAMsg::printMsg(LOG_CRIT,
"No Node '%s' defined for the translation [%s]. Either define it in '%s' or"
2401 if(defaultLangValue && defaultLangFound)
2403 CAMsg::printMsg(LOG_CRIT,
"exactly ONE default language must be specified for the Terms And Conditions!\n");
2408 if(tncTranslationImports != NULL)
2416 defaultLangFound = (defaultLangFound || defaultLangValue);
2419 if(!defaultLangFound)
2421 CAMsg::printMsg(LOG_CRIT,
"There is no default language specified for the Terms And Conditions!\n");
2424 if(tncTranslationImports != NULL)
2426 elemTnCsList->removeChild(tncTranslationImports);
2437 SINT32 CACmdLnOptions::setCrimeDetectionOptions(DOMElement *elemRoot)
2439 DOMElement* elemCrimeDetection = NULL;
2449 if(elemCrimeDetection != NULL)
2454 m_logPayload =
false;
2457 (crimeDetectionOptionSetters, elemCrimeDetection, CRIME_DETECTION_OPTIONS_NR);
2462 SINT32 CACmdLnOptions::setCrimeURLRegExp(DOMElement *elemCrimeDetection)
2465 if(elemCrimeDetection == NULL)
return E_UNKNOWN;
2470 &m_arCrimeRegExpsURL, &m_nCrimeRegExpsURL);
2495 SINT32 CACmdLnOptions::setCrimePayloadRegExp(DOMElement *elemCrimeDetection)
2498 if(elemCrimeDetection == NULL)
return E_UNKNOWN;
2503 &m_arCrimeRegExpsPayload, &m_nCrimeRegExpsPayload);
2534 SINT32 CACmdLnOptions::setCrimeSurveillanceIP(DOMElement *elemCrimeDetection)
2536 if(elemCrimeDetection == NULL)
return E_UNKNOWN;
2542 m_nrOfSurveillanceIPs = (
UINT32) surveillanceIPNodes->getLength();
2544 if (m_nrOfSurveillanceIPs == 0)
2551 for (
UINT32 i = 0; i < m_nrOfSurveillanceIPs; i++)
2554 DOMNode* pelemCurrentIP=surveillanceIPNodes->item(i);
2557 m_surveillanceIPs[i].setAddr(ipBuff);
2561 m_surveillanceIPs[i].setNetmask(ipBuff);
2564 m_surveillanceIPs[i].toString(ipBuff,&ipBuffSize);
2570 delete[] m_surveillanceIPs;
2571 m_surveillanceIPs = NULL;
2572 m_nrOfSurveillanceIPs = 0;
2582 SINT32 CACmdLnOptions::setCrimeSurveillanceAccounts(DOMElement *elemCrimeDetection)
2585 if(elemCrimeDetection == NULL)
return E_UNKNOWN;
2594 m_nrOfSurveillanceAccounts = (
UINT32) surveillanceIPNodes->getLength();
2596 if (m_nrOfSurveillanceAccounts == 0)
2603 m_surveillanceAccounts =
new UINT64[m_nrOfSurveillanceAccounts];
2604 for (
UINT32 i = 0; i < m_nrOfSurveillanceAccounts; i++)
2606 node = surveillanceIPNodes->item(i);
2609 m_surveillanceAccounts[i] = accountNumber;
2610 CAMsg::printMsg(LOG_INFO,
"Found surveillance account %llu.\n", accountNumber);
2614 CAMsg::printMsg(LOG_INFO,
"Could not read surveillance account number!\n");
2615 delete[] m_surveillanceAccounts;
2616 m_surveillanceAccounts = NULL;
2617 m_nrOfSurveillanceAccounts = 0;
2628 tre_regex_t **regExContainer,
UINT32* regExNr)
2630 if( (rootElement == NULL) || (childElementName == NULL) ||
2631 (regExNr == NULL) || (regExContainer == NULL) )
2638 DOMNodeList *nlRegExp =
2641 if(nlRegExp != NULL)
2643 (*regExContainer) =
new tre_regex_t[nlRegExp->getLength()];
2645 for(
UINT32 i = 0; i < nlRegExp->getLength(); i++)
2647 DOMNode *tmpChild = nlRegExp->item(i);
2654 if(tre_regcomp( &((*regExContainer)[(*regExNr)]),
2655 ((
char*) buffRegExp),
2656 REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0 )
2658 CAMsg::printMsg(LOG_CRIT,
"Could not compile regexp: %s\n",buffRegExp);
2675 #ifndef ONLY_LOCAL_PROXY
2688 bool bForLast=
false;
2689 if(strFileName!=NULL&&strncmp((
char*)strFileName,
"last",4)==0)
2706 doc->appendChild(elemRoot);
2709 elemRoot->appendChild(elemGeneral);
2719 elemGeneral->appendChild(elemTmp);
2729 elemGeneral->appendChild(elemTmp);
2732 elemGeneral->appendChild(elemTmp);
2736 elemGeneral->appendChild(elemTmp);
2740 elemGeneral->appendChild(elemTmp);
2743 elemGeneral->appendChild(elemTmp);
2746 elemGeneral->appendChild(elemTmp);
2748 elemGeneral->appendChild(elemLogging);
2751 elemLogging->appendChild(elemTmp);
2753 elemRoot->appendChild(elemNet);
2757 elemNet->appendChild(elemISs);
2760 elemISs->appendChild(elemTmp);
2763 elemISs->appendChild(elemIS);
2765 elemIS->appendChild(elemISListeners);
2767 elemISListeners->appendChild(elemISLi);
2770 elemISLi->appendChild(elemTmp);
2773 elemISLi->appendChild(elemTmp);
2776 elemISs->appendChild(elemTmp);
2794 elemProxies->appendChild(elemProxy);
2797 elemProxy->appendChild(elemTmp);
2800 elemProxy->appendChild(elemTmp);
2803 elemProxy->appendChild(elemTmp);
2806 elemProxy->appendChild(elemTmp);
2807 elemNet->appendChild(elemProxies);
2810 elemRoot->appendChild(elemCerts);
2812 elemCerts->appendChild(elemOwnCert);
2813 DOMElement* tmpElemSigKey=NULL;
2815 elemOwnCert->appendChild(tmpElemSigKey);
2817 DOMElement* elemTmpCert=NULL;
2818 pCert->
encode(elemTmpCert,doc);
2819 elemOwnCert->appendChild(elemTmpCert);
2840 if(p_strFileName!=NULL)
2843 handle=fopen((
const char*)p_strFileName,
"w");
2844 fwrite(buff,
len,1,handle);
2850 fwrite(buff,
len,1,stdout);
2868 SINT32 CACmdLnOptions::createDefaultConfiguration()
2889 SINT32 CACmdLnOptions::addListenerInterface(DOM_Element a_elem)
2892 if(pListener == NULL)
2923 SINT32 CACmdLnOptions::resetNetworkConfiguration()
2925 DOM_Element elemRoot =
m_docMixInfo.getDocumentElement();
2926 if(elemRoot != NULL)
2928 DOM_Element elemListeners;
2930 if(elemListeners != NULL)
2932 elemRoot.removeChild( elemListeners );
2945 SINT32 CACmdLnOptions::checkListenerInterfaces()
2951 CADynaNetworking *dyn =
new CADynaNetworking();
2953 for(
UINT32 i = 1; i <= interfaces; i++ )
2964 if( pListener == NULL )
2971 if( dyn->verifyConnectivity() !=
E_SUCCESS )
2973 CAMsg::printMsg( LOG_CRIT,
"Your mix is not reachable from the internet.\n Please make sure that your open port %i in your firewall and forward this port to this machine.\n",
DEFAULT_TARGET_PORT);
2990 SINT32 CACmdLnOptions::checkInfoServices(
UINT32 *r_runningInfoServices)
2993 *r_runningInfoServices = 0;
3004 (*r_runningInfoServices)++;
3018 SINT32 CACmdLnOptions::checkCertificates()
3032 SINT32 CACmdLnOptions::checkMixId()
3036 if( m_pOwnCertificate->getSubjectKeyIdentifier( ski, &
len ) !=
E_SUCCESS )
3040 if( strcmp( (
const char*)
m_strMixID, (
const char*)ski ) != 0 )
3056 if( socketAddresses == NULL )
3058 CAMsg::printMsg( LOG_ERR,
"Unable to get a list of InfoServices from the options, check your configuration!\n");
3063 UINT32 i = (index+1) % nrAddresses;
3075 CAMsg::printMsg( LOG_DEBUG,
"getRandomInfoService: Chose InfoService server %s:%i\n", buf, r_address->
getPort());
3086 if(i == index)
break;
3087 i = (i+1) % nrAddresses;
3099 UINT32 result = (
UINT32) (a_max * (rand() / (RAND_MAX + 1.0)));
3115 CAMsg::printMsg( LOG_ERR,
"Trying to reconfigure a dynamic mix to LastMix, that is evil!\n");
3121 CAMsg::printMsg( LOG_DEBUG,
"Reconfiguring a FirstMix to MiddleMix.\n");
3124 DOM_Element elemRoot =
m_docMixInfo.getDocumentElement();
3125 if(elemRoot != NULL)
3127 DOM_Element elemMixType;
3129 if(elemMixType != NULL)
3137 CAMsg::printMsg( LOG_DEBUG,
"Reconfiguring a MiddleMix to FirstMix.\n");
3140 DOM_Element elemRoot =
m_docMixInfo.getDocumentElement();
3141 if(elemRoot != NULL)
3143 DOM_Element elemMixType;
3145 if(elemMixType != NULL)
3153 CAMsg::printMsg( LOG_ERR,
"Error reconfiguring the mix, some strange combination of existing and new type happened\n");
3161 #ifdef COUNTRY_STATS
3164 *db_host=*db_user=*db_passwd=NULL;
3184 #ifdef DATA_RETENTION_LOG
3187 if(strLogDir==NULL||m_strDataRetentionLogDir==NULL)
3189 if(
len<=(
UINT32)strlen((
char*)m_strDataRetentionLogDir))
3193 strcpy((
char*)strLogDir,(
char*)m_strDataRetentionLogDir);
3200 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
3215 DOMElement* elemTimeStamp=NULL;
3216 DOMElement* elemRoot=docMixInfo->getDocumentElement();
3220 elemRoot->appendChild(elemTimeStamp);
3224 UINT8 tmpStrCurrentMillis[50];
3225 print64(tmpStrCurrentMillis,currentMillis);
3260 handle=open((
char*)configFile,
O_BINARY|O_RDONLY);
3265 int ret=read(handle,tmpChar,
len);
3289 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");
3309 DOMElement* elemRoot=docConfig->getDocumentElement();
3331 elemSoftware->appendChild(elemVersion);
3332 elemMix->appendChild(elemSoftware);
3338 elemMix->appendChild(elemPaymentReminder);
3340 #ifdef COUNTRY_STATS
3341 DOMElement* elemCountryStats=NULL;
3343 UINT8 db_tmp_buff[4096];
3344 UINT32 db_tmp_buff_len=4096;
3351 db_tmp_buff_len=4096;
3358 db_tmp_buff_len=4096;
3367 DOMElement* elemCascade;
3374 CAMsg::printMsg(LOG_CRIT,
"Error in configuration: You must either specify cascade info or the previous mix's certificate.\n");
3378 #ifndef ONLY_LOCAL_PROXY
3387 CAMsg::printMsg(LOG_CRIT,
"Error in configuration: Empty cascade specified.\n");
3392 #ifdef DATA_RETENTION_LOG
3393 DOMElement* elemDataRetention=NULL;
3395 DOMElement* elemDataRetentionLogDir=NULL;
3397 UINT8 log_dir[4096];
3401 m_strDataRetentionLogDir=
new UINT8[log_dir_len+1];
3402 memcpy(m_strDataRetentionLogDir,log_dir,log_dir_len);
3403 m_strDataRetentionLogDir[log_dir_len]=0;
3405 CAMsg::printMsg(LOG_CRIT,
"Data retention log dir in config file: %s\n",log_dir);
3407 this->m_pDataRetentionPublicEncryptionKey=
new CAASymCipher();
3408 DOMElement* elemDataRetentionPublicKey=NULL;
3409 getDOMChildByName(elemDataRetention,
"PublicEncryptionKey",elemDataRetentionPublicKey,
false);
3410 DOMElement* elemDataRetentionPublicRSAKey=NULL;
3411 getDOMChildByName(elemDataRetentionPublicKey,
"RSAKeyValue",elemDataRetentionPublicRSAKey,
false);
3412 m_pDataRetentionPublicEncryptionKey->setPublicKeyAsDOMNode(elemDataRetentionPublicRSAKey);
3416 elemMix->appendChild(elemDataRetention);
3418 elemDataRetention->appendChild(elemLoggedElements);
3420 elemLoggedElements->appendChild(elemTemp);
3423 elemLoggedElements->appendChild(elemTemp);
3426 elemLoggedElements->appendChild(elemTemp);
3429 elemLoggedElements->appendChild(elemTemp);
3432 elemLoggedElements->appendChild(elemTemp);
3435 elemLoggedElements->appendChild(elemTemp);
3438 elemLoggedElements->appendChild(elemTemp);
3441 elemLoggedElements->appendChild(elemTemp);
3444 elemDataRetention->appendChild(elemTemp);
3461 if( optionsSetters == NULL )
3463 CAMsg::printMsg(LOG_CRIT,
"Error parsing config file: OptionSetters not initialized!\n");
3467 if( optionsSettersLength < 0)
3469 CAMsg::printMsg(LOG_CRIT,
"Error parsing config file: Negative number of option setters specified!\n");
3474 if( optionsSource == NULL )
3477 "NULL element handling is delegated to the specified setter method!\n");
3480 for(i=0; i < optionsSettersLength; i++ )
3482 if(optionsSetters[i]!=NULL)
3484 ret = (this->*(optionsSetters[i]))(optionsSource);
3520 &CACmdLnOptions::setCrimeDetectionOptions;
3551 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
3555 #if !defined ONLY_LOCAL_PROXY
3621 DOMElement* elemNextMix = NULL;
3622 DOMElement* elemProxies=NULL;
3627 if(elemNetwork == NULL)
return E_UNKNOWN;
3632 if(elemNextMix != NULL)
3636 DOMElement* elemType = NULL;
3639 bool bAddrIsSet =
false;
3644 if(strcmp((
char*)tmpBuff,
"RAW/TCP") == 0)
3648 else if(strcmp((
char*)tmpBuff,
"RAW/UNIX") == 0)
3652 else if(strcmp((
char*)tmpBuff,
"SSL/TCP") == 0)
3656 else if(strcmp((
char*)tmpBuff,
"SSL/UNIX") == 0)
3663 DOMElement* elemPort = NULL;
3664 DOMElement* elemHost = NULL;
3665 DOMElement* elemIP = NULL;
3681 if(elemHost != NULL)
3698 CAMsg::printMsg(LOG_INFO,
"Setting target interface: %s:%d\n", buffHost, port);
3701 #ifdef HAVE_UNIX_DOMAIN_PROTOCOL
3704 DOMElement* elemFile=NULL;
3739 if(elemProxies != NULL)
3741 DOMNodeList* nlTargetInterfaces=NULL;
3745 if(nlTargetInterfaces->getLength()>0)
3753 bool bHttpProxyFound =
false;
3754 for(
UINT32 i=0; i < nlTargetInterfaces->getLength(); i++)
3758 DOMNode* elemTargetInterface=NULL;
3759 elemTargetInterface=nlTargetInterfaces->item(i);
3760 DOMElement* elemType;
3766 if(strcmp((
char*)tmpBuff,
"RAW/TCP") == 0)
3770 else if(strcmp((
char*)tmpBuff,
"RAW/UNIX") == 0)
3774 else if(strcmp((
char*)tmpBuff,
"SSL/TCP") == 0)
3778 else if(strcmp((
char*)tmpBuff,
"SSL/UNIX") == 0)
3793 if(strcmp((
char*)tmpBuff,
"SOCKS")==0)
3797 else if(strcmp((
char*)tmpBuff,
"HTTP")==0)
3801 else if (strcmp((
char*)tmpBuff,
"VPN") == 0)
3812 DOMElement* elemPort;
3813 DOMElement* elemHost;
3823 if(elemHost != NULL)
3842 #ifdef HAVE_UNIX_DOMAIN_PROTOCOL
3844 DOMElement* elemFile;
3886 CAMsg::printMsg(LOG_WARNING,
"Could not connect to proxy %s! Reason: %s (%i) Please check if the proxy is running.\n",
3891 CAMsg::printMsg(LOG_WARNING,
"Could not connect to proxy %s! Please check if the proxy is running.\n", buff);
3904 bHttpProxyFound =
true;
3917 if (tmpSocket != NULL)
3939 CAMsg::printMsg(LOG_CRIT,
"No valid HTTP or VPN proxy was specified! Please install and configure an HTTP or VPN proxy like Squid or the ANONVPN proxy before starting the mix.\n");
3940 for (
UINT32 i = 0; i < aktInterface; i++)
3953 if(targetInterfaceNextMix != NULL)
3961 delete targetInterfaceNextMix;
3962 targetInterfaceNextMix = NULL;
3966 CAMsg::printMsg(LOG_CRIT,
"Neither proxy nor next mix target interfaces are specified!\n");
3973 DOMElement* elemMix =
m_docMixInfo->getDocumentElement();
3987 elemMix->appendChild(elemProxies);
3988 elemProxies->appendChild(elemProxy);
3989 elemProxy->appendChild(elemVisAddresses);
3998 elemVisAddress->appendChild(elemHost);
4000 elemVisAddresses->appendChild(elemVisAddress);
4046 DOMNode* elemVisAdresses=NULL;
4048 DOMNode* elemVisAddress=NULL;
4050 while(elemVisAddress!=NULL)
4054 DOMElement* elemHost=NULL;
4075 elemVisAddress=elemVisAddress->getNextSibling();
4100 DOMElement* elemMixDescription = NULL;
4101 if(elemRoot == NULL)
4108 if(elemMixDescription != NULL )
4110 DOMNode* tmpChild = elemMixDescription->getFirstChild();
4111 while( (tmpChild != NULL) && (ret ==
E_SUCCESS) )
4114 tmpChild=tmpChild->getNextSibling();
4127 DOMElement* elemCertificates;
4144 DOMElement* elemNetwork = NULL;
4158 DOMElement* elemOwnCert=NULL;
4165 if(elemCertificates == NULL)
return E_UNKNOWN;
4171 if (elemOwnCert == NULL)
4211 for(
UINT32 j=0; j<opCertsLen; j++)
4215 if(opCerts[j] == NULL)
4217 CAMsg::printMsg(LOG_CRIT,
"Error while decoding operator certificates!");
4226 for (
UINT32 i=0; i<ownCertList->getLength(); i++)
4228 DOMNode* a_cert = ownCertList->item(i);
4236 printf(
"I need a password for the private Mix certificate nr. %d: ", i+1);
4242 CAMsg::printMsg(LOG_CRIT,
"Unable to load private Mix certificate nr. %d! Please check your password.\n", i+1);
4254 CAMsg::printMsg(LOG_CRIT,
"Error while getting own certificate %d!\n", i+1);
4266 CAMsg::printMsg(LOG_CRIT,
"Error while getting SKI of own certificate %d!\n", i+1);
4279 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");
4286 for(
UINT32 j=0; j<opCertsLen; j++)
4292 certs->
add(opCerts[j]);
4296 for(
UINT32 j=0; j<opCertsLen; j++)
4305 CAMsg::printMsg(LOG_CRIT,
"Could not find operator cert for sign key %d! Please check your configuration. Exiting...\n", i+1);
4309 certs->
add(tmpCert);
4311 UINT32 tmpRawSKIlen = 255;
4312 UINT8 tmpRawSKI[255];
4322 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());
4332 CAMsg::printMsg(LOG_CRIT,
"Could not set a signature key for MultiCert!\n");
4352 if(strncmp(
m_strMixID, (
char*)tmpBuff, strlen((
char*)tmpBuff) ) != 0)
4354 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);
4360 m_strMixID=
new char[strlen((
char*)tmpBuff)+1];
4361 m_strMixID[strlen((
char*)tmpBuff)]= (char) 0;
4369 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");
4375 if(bNeedCascadeNameFromMixID)
4391 DOMElement* elemMixType=NULL;
4395 if(elemGeneral == NULL)
return E_UNKNOWN;
4409 if(memcmp(tmpBuff,
"FirstMix",8) == 0)
4413 else if (memcmp(tmpBuff,
"MiddleMix",9) == 0)
4417 else if (memcmp(tmpBuff,
"LastMix",7) == 0)
4436 DOMElement *elemMixName = NULL, *elemMixInfoName = NULL;
4439 UINT8 *typeValue = NULL;
4442 if(elemGeneral == NULL)
return E_UNKNOWN;
4448 if(elemMixName != NULL)
4480 if( strncasecmp( ((
char *)tmpBuff),
4486 else if( strncasecmp( ((
char *)tmpBuff),
4493 if(typeValue != NULL)
4501 m_docMixInfo->getDocumentElement()->appendChild(elemMixInfoName);
4513 DOMElement* elemMixID=NULL;
4516 size_t mixID_strlen = 0;
4518 if(elemGeneral == NULL)
return E_UNKNOWN;
4523 if(elemMixID != NULL)
4528 mixID_strlen = strlen((
char*)tmpBuff)+1;
4529 m_strMixID =
new char[strlen((
char*)tmpBuff)+1];
4541 DOMElement* elemCascadeName=NULL;
4545 if(elemGeneral == NULL)
return E_UNKNOWN;
4553 bool bNeedCascadeNameFromMixID=
false;
4563 bNeedCascadeNameFromMixID=
true;
4572 DOMElement* elemUID=NULL;
4576 if(elemGeneral == NULL)
return E_UNKNOWN;
4594 struct passwd* pwd=getpwnam((
char*)buff);
4595 if(pwd==NULL || (setegid(pwd->pw_gid)==-1) || (seteuid(pwd->pw_uid)==-1) )
4600 "Could not switch to effective user '%s'! Reason: User '%s' does not exist on this system. Create this user first.\n",
4605 CAMsg::printMsg(LOG_ERR,
"Could not switch to effective user '%s'! Reason: %s (%i)\n",
4621 DOMElement* elemNrFd=NULL;
4624 if(elemGeneral == NULL)
return E_UNKNOWN;
4638 struct rlimit coreLimit;
4639 coreLimit.rlim_cur = coreLimit.rlim_max = RLIM_INFINITY;
4640 if (setrlimit(RLIMIT_CORE, &coreLimit) != 0)
4642 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);
4650 if (setrlimit(RLIMIT_NOFILE, &lim) != 0)
4652 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",
4664 DOMElement* elemDaemonMode = NULL;
4668 if(elemGeneral == NULL)
return E_UNKNOWN;
4676 memcmp(tmpBuff,
"True",4)==0)
4685 DOMElement* elemNextCert = NULL;
4689 if(elemCertificates == NULL)
return E_UNKNOWN;
4695 if(elemNextCert!=NULL)
4701 CAMsg::printMsg(LOG_CRIT,
"Could not decode the certificate of the next mix!\n");
4713 DOMElement* elemPrevCert=NULL;
4717 if(elemCertificates == NULL)
return E_UNKNOWN;
4722 if(elemPrevCert!=NULL)
4734 DOMElement* elemTrustedCerts=NULL;
4735 DOMNodeList* trustedCerts=NULL;
4740 if(elemCertificates == NULL)
return E_UNKNOWN;
4745 if(elemTrustedCerts!=NULL)
4749 for(
UINT32 i=0; i<trustedCerts->getLength(); i++)
4758 CAMsg::printMsg(LOG_WARNING,
"Root certificate could not be decoded\n");
4780 DOMElement* elemKeepAlive = NULL;
4781 DOMElement* elemKeepAliveSendInterval = NULL;
4782 DOMElement* elemKeepAliveRecvInterval = NULL;
4784 if(elemNetwork == NULL)
return E_UNKNOWN;
4804 DOMNode *importedNode = NULL;
4805 DOMNode *appendedNode = NULL;
4823 importedNode =
m_docMixInfo->importNode(a_node, with_subtree);
4825 if(importedNode != NULL)
4828 if (importedNode->getNodeType() == DOMNode::ELEMENT_NODE)
4831 for (
UINT32 i = 0; i < nodesMail->getLength (); i++)
4833 nodesMail->item(i)->getParentNode()->removeChild(nodesMail->item(i));
4837 appendedNode =
m_docMixInfo->getDocumentElement()->appendChild(importedNode);
4838 if( appendedNode != NULL )
4843 CAMsg::printMsg(LOG_CRIT,
"Could not append Node \"%s\" to Mixinfo!\n", a_node->getNodeName());
4862 DOMElement* elemListenerInterfaces=NULL;
4864 if(elemNetwork == NULL)
return E_UNKNOWN;
4881 if(elemListenerInterfaces != NULL)
4893 arrSocketsIn[i] = NULL;
4900 if (arrSocketsIn[i] != NULL)
4902 arrSocketsIn[i]->
close();
4903 delete arrSocketsIn[i];
4904 arrSocketsIn[i] = NULL;
4907 delete[] arrSocketsIn;
4913 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");
4921 DOMElement* elemOpCert = NULL;
4922 DOMElement *opCertX509 = NULL;
4924 if(elemCertificates == NULL)
return E_UNKNOWN;
4937 if (elemOpCert != NULL)
4942 if( opCertX509 != NULL)
4957 DOMElement *elemMixVerify;
4961 if(elemCertificates == NULL)
return E_UNKNOWN;
4966 if(elemMixVerify != NULL)
4969 memcmp(tmpBuff,
"True",4)==0)
4973 CAMsg::printMsg(LOG_INFO,
"Mix certificate verification is enabled.\n");
4982 DOMElement* elemLogging=NULL;
4983 DOMElement* elemEncLog=NULL;
4984 DOMElement* elem=NULL;
4989 SINT32 maxLogFilesTemp = 0;
4990 if(elemGeneral == NULL)
return E_UNKNOWN;
4995 if(elemLogging != NULL)
5025 (maxLogFilesTemp == 0) )
5031 if(maxLogFilesTemp < 0)
5042 memset(tmpBuff, 0, tmpLen);
5044 (memcmp(tmpBuff,
"True",4) == 0) )
5051 memset(tmpBuff, 0, tmpLen);
5053 (memcmp(tmpBuff,
"True",4) == 0) )
5066 memset(tmpBuff, 0, tmpLen);
5073 DOMElement* elemKeyInfo;
5074 DOMElement* elemX509Data;
5095 #ifdef MIX_VERSION_TESTING
5108 DOMElement* elemGeneral=NULL;
5120 #ifdef NO_ENCRYPTION
5123 #ifdef SYM_CHANNEL_CIPHER_CTR
5135 if (a_socketsLen <= 0)
5137 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.");
5148 UINT32 iVirtualPortsLen = 0;
5149 UINT32 iHiddenPortsLen = 0;
5158 if (pListener == NULL)
5160 CAMsg::printMsg(LOG_CRIT,
"Error: Listener interface %d is invalid.\n", currentInterface + 1);
5162 delete[] arrayVirtualPorts;
5163 delete[] arrayHiddenPorts;
5171 if (pAddr->
getType() == AF_INET)
5175 arrayVirtualPorts[iVirtualPortsLen] = ((
CASocketAddrINet*)pAddr)->getPort();
5194 if (a_socketsLen < aktSocket)
5197 "Found %d listener sockets, but we have only reserved memory for %d sockets. This seems to be an implementation error in the code.\n",
5198 (aktSocket + 1), a_socketsLen);
5200 delete[] arrayVirtualPorts;
5201 delete[] arrayHiddenPorts;
5208 a_sockets[aktSocket] =
new CASocket();
5220 old_uid = geteuid();
5221 if (seteuid(0) == -1)
5223 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",
5224 currentInterface + 1, buff);
5228 ret = a_sockets[aktSocket]->
listen(*pAddr);
5234 CAMsg::printMsg(LOG_CRIT,
"Socket error while listening on interface %d (%s). Reason: %s (%i)\n", currentInterface + 1, buff,
5246 delete[] arrayVirtualPorts;
5247 delete[] arrayHiddenPorts;
5260 CAMsg::printMsg(LOG_CRIT,
"Could not find any valid (non-virtual) listener interface!\n");
5304 delete[] arrayVirtualPorts;
5305 delete[] arrayHiddenPorts;
5306 arrayVirtualPorts = NULL;
5320 DOMElement* elemDynamic=NULL;
5325 if(elemGeneral == NULL)
return E_UNKNOWN;
5330 if(elemDynamic != NULL)
5334 m_bDynamic = (strcmp(
"True",(
char*)tmpBuff) == 0);
5349 DOMElement* elemInfoServiceContainer=NULL;
5351 if(elemNetwork == NULL)
return E_UNKNOWN;
5357 if (elemInfoServiceContainer == NULL)
5360 DOMElement* elemInfoService=NULL;
5361 DOMElement* elemAllowReconfig=NULL;
5368 if(elemInfoService != NULL)
5373 if (!isListenerInterface)
5400 #ifdef SERVER_MONITORING
5405 DOMElement* elemServerMonitoringRoot = NULL;
5406 DOMElement* elemServerMonitoringHost = NULL;
5407 DOMElement* elemServerMonitoringPort = NULL;
5409 if(elemNetwork == NULL)
return E_UNKNOWN;
5413 m_strMonitoringListenerHost = NULL;
5414 m_iMonitoringListenerPort = 0xFFFF;
5425 m_strMonitoringListenerHost =
new char[tmpLen+1];
5426 strncpy(m_strMonitoringListenerHost, (
const char*) tmpBuff, tmpLen);
5427 m_strMonitoringListenerHost[tmpLen] = 0;
5432 elemServerMonitoringPort,
false) ==
E_SUCCESS)
5437 m_iMonitoringListenerPort = port;
5442 if( (elemServerMonitoringRoot != NULL) &&
5443 (m_strMonitoringListenerHost != NULL))
5445 if( (strncmp(
"localhost", m_strMonitoringListenerHost, 9) != 0) &&
5446 (strncmp(
"127.0.0.1", m_strMonitoringListenerHost, 9) != 0) )
5469 DOMElement* elemAllowReconfig;
5473 if(isList->getLength() == 0)
5491 UINT32 nrListenerInterfaces;
5494 for (
UINT32 i = 0; i < isList->getLength(); i++)
5497 DOMElement* elemListenerInterfaces;
5500 if (nrListenerInterfaces > 0)
5505 for (
UINT32 j = 1; j < nrListenerInterfaces; j++)
5508 delete isListenerInterfaces[j];
5509 isListenerInterfaces[j] = NULL;
5512 delete isListenerInterfaces;
5526 DOMElement* elemMinCascadeLength = NULL;
5527 if(elemGeneral == NULL)
return E_UNKNOWN;
5533 if(elemMinCascadeLength != NULL)
5547 #if defined (DELAY_CHANNELS) ||defined(DELAY_USERS)||defined(DELAY_CHANNELS_LATENCY)
5556 CAMsg::printMsg(LOG_INFO,
"Loading Parameters for traffic shaping / resource limitation....\n");
5558 DOMElement *elemRessources=NULL;
5559 DOMElement *elem = NULL;
5561 if(elemRoot == NULL)
5567 if(elemRessources!=NULL)
5569 #if defined (DELAY_CHANNELS) || defined(DELAY_USERS)
5589 #if defined (DELAY_CHANNELS_LATENCY)
5594 m_u32DelayChannelLatency = u32;
#define CERT_X509CERTIFICATE
THREAD_RETURN threadReConfigure(void *param)
Thread that does the actual reconfigure work.
#define OPTIONS_VALUE_OPERATOR_NAME
#define OPTIONS_NODE_PROXY
#define OPTIONS_NODE_DELAY_IVAL
#define OPTIONS_NODE_CRIME_SURVEILLANCE_IP_NETMASK
#define OPTIONS_NODE_VISIBLE_ADDRESS
#define OPTIONS_ATTRIBUTE_LOGGING_MAXFILES
#define OPTIONS_NODE_TNCS_OPTS
#define OPTIONS_NODE_CRIME_DETECTION
#define OPTIONS_NODE_ALLOW_AUTO_CONF
#define OPTIONS_NODE_DESCRIPTION
#define OPTIONS_NODE_KEEP_ALIVE_SEND_IVAL
#define OPTIONS_NODE_PREV_OPERATOR_CERTIFICATE
#define OPTIONS_NODE_MIX_ID
#define OPTIONS_NODE_CERTIFICATE_LIST
#define OPTIONS_NODE_PROXY_LIST
#define DEFAULT_TARGET_PORT
#define OPTIONS_NODE_PRICE_CERTIFICATE
#define OPTIONS_NODE_DAEMON
#define OPTIONS_NODE_TNCS_OPERATOR
#define ASSERT_GENERAL_OPTIONS_PARENT(Parentname, Childname)
#define OPTIONS_NODE_PROXY_TYPE
#define OPTIONS_NODE_LOGGING_FILE
#define OPTIONS_NODE_ENCRYPTED_LOG
#define MIXINFO_NODE_MIX_NAME
#define MIXINFO_NODE_SOFTWARE
#define OPTIONS_NODE_AI_DB_PORT
#define OPTIONS_NODE_AI_DB_PASSW
#define TERMS_AND_CONDITIONS_OPTIONS_NR
#define OPTIONS_NODE_CREDENTIAL
#define OPTIONS_NODE_GENERAL
#define DEFAULT_CONFIG_FILE
#define OPTIONS_NODE_USER_ID
#define OPTIONS_NODE_SETTLE_IVAL
SINT32(CACmdLnOptions::* optionSetter_pt)(DOMElement *)
#define OPTIONS_NODE_NETWORK
#define LOG_NODE_EMPTY_OR_INVALID(Nodename)
#define OPTIONS_NODE_KEEP_ALIVE
#define OPTIONS_NODE_PORT
#define ASSERT_PARENT_NODE_NAME(Parentname, NameToMatch, Childname)
#define OPTIONS_NODE_FILE
#define OPTIONS_NODE_CRIME_REGEXP_URL
#define MIXINFO_NODE_PARENT
#define OPTIONS_ATTRIBUTE_TNC_ID
#define ASSERT_CRIME_DETECTION_OPTIONS_PARENT(Parentname, Childname)
#define OPTIONS_NODE_SYSLOG
#define OPTIONS_NODE_NEXT_MIX
#define MIXINFO_NODE_VERSION
#define OPTIONS_ATTRIBUTE_NAME_FOR_CASCADE
#define GENERAL_OPTIONS_NR
#define OPTIONS_NODE_AI_SOFT_LIMIT
#define OPTIONS_NODE_AI_DB_USER
#define OPTIONS_VALUE_MIX_NAME
#define OPTIONS_NODE_TNCS_TEMPLATES
#define OPTIONS_NODE_VISIBLE_ADDRESS_LIST
#define OPTIONS_NODE_PREV_MIX_CERTIFICATE
#define OPTIONS_NODE_CRIME_SURVEILLANCE_ACCOUNT
#define OPTIONS_NODE_OWN_CERTIFICATE
#define OPTIONS_NODE_CRIME_SURVEILLANCE_IP
#define OPTIONS_NODE_PAYMENT_INSTANCE
#define OPTIONS_NODE_AI_HARD_LIMIT
#define OPTIONS_NODE_LOGGING_KEYINFO
#define NETWORK_OPTIONS_NR
#define OPTIONS_NODE_TNCS
#define MAX_CERTIFICATE_OPTIONS_NR
#define OPTIONS_NODE_MAX_USERS
#define OPTIONS_NODE_HOST
#define OPTIONS_NODE_BYTES_PER_IVAL
#define OPTIONS_NODE_MIX_TYPE
#define OPTIONS_NODE_FD_NR
#define ACCOUNTING_OPTIONS_NR
#define OPTIONS_NODE_KEEP_ALIVE_RECV_IVAL
#define OPTIONS_NODE_RESSOURCES
#define OPTIONS_NODE_TRUSTED_ROOT_CERTIFICATES
#define MAIN_OPTION_SETTERS_NR
#define ASSERT_ACCOUNTING_OPTIONS_PARENT(Parentname, Childname)
#define OPTIONS_NODE_AI_DB_HOST
#define ASSERT_NETWORK_OPTIONS_PARENT(Parentname, Childname)
#define OPTIONS_NODE_CRIME_REGEXP_PAYLOAD
#define OPTIONS_NODE_NEXT_MIX_CERTIFICATE
#define OPTIONS_NODE_PREPAID_IVAL
#define OPTIONS_NODE_ACCOUNTING
#define LOG_NODE_NOT_FOUND(Nodename)
#define OPTIONS_NODE_X509_PKCS12
#define OPTIONS_NODE_LOGGING_CONSOLE
#define OPTIONS_NODE_LOGGING
#define LOGGING_MAXFILES_DEFAULT
#define OPTIONS_NODE_PREPAID_IVAL_KB
#define OPTIONS_NODE_TNCS_TRANSLATION_IMPORTS
#define OPTIONS_NODE_INFOSERVICE
#define OPTIONS_NODE_LATENCY
#define OPTIONS_ATTRIBUTE_TNC_DATE
#define OPTIONS_NODE_CASCADE_NAME
#define MIXINFO_NODE_PAYMENTREMINDER
#define OPTIONS_NODE_UNLIMIT_TRAFFIC
#define OPTIONS_NODE_INFOSERVICE_LIST
#define OPTIONS_NODE_OWN_OPERATOR_CERTIFICATE
#define OPTIONS_NODE_NETWORK_PROTOCOL
#define OPTIONS_NODE_LISTENER_INTERFACE_LIST
#define OPTIONS_NODE_SERVER_MONITORING
#define OPTIONS_NODE_TNCS_TEMPLATE
#define OPTIONS_NODE_X509_CERTIFICATE
#define OPTIONS_NODE_NEXT_OPERATOR_CERTIFICATE
#define OPTIONS_NODE_MIX_CERTIFICATE_VERIFICATION
#define OPTIONS_NODE_MIX_NAME
#define OPTIONS_ATTRIBUTE_LOGGING_MAXFILESIZE
#define OPTIONS_NODE_AI_DB_NAME
#define OPTIONS_NODE_AI_DB
#define OPTIONS_NODE_DYNAMIC_MIX
#define OPTIONS_NODE_PAYMENT_REMINDER
#define OPTIONS_NODE_MIN_CASCADE_LENGTH
#define OPTIONS_NODE_LISTENER_INTERFACE
SINT32 setRegExpressions(DOMElement *rootElement, const char *const childElementName, tre_regex_t **regExContainer, UINT32 *regExNr)
#define OPTIONS_ATTRIBUTE_TNC_LOCALE
#define MIXINFO_ATTRIBUTE_MIX_ID
#define OPTIONS_ATTRIBUTE_TNC_DEFAULT_LANG_DEFINED
#define OPTIONS_ATTRIBUTE_TNC_TEMPLATE_REFID
#define ASSERT_CERTIFICATES_OPTIONS_PARENT(Parentname, Childname)
#define OPTIONS_NODE_TNCS_TRANSLATION
#define OPTIONS_NODE_X509DATA
#define OPTIONS_NODE_LISTENER_INTERFACES
#define OPTIONS_DEFAULT_PREPAID_IVAL
#define OPTIONS_NODE_SIGNATURE
#define OPTIONS_ATTRIBUTE_LOG_PAYLOAD
#define MSG_COMPRESSED_FILE
SYMCHANNELCIPHER_ALGORITHM
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value)
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
SINT32 getDOMElementValue(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
Returns the content of the text node(s) under elem as null-terminated C String.
SINT32 setDOMElementValue(DOMElement *pElem, SINT32 value)
SINT32 readPasswd(UINT8 *buff, UINT32 len)
Read a passwd (i.e.
UINT32 strtrim(UINT8 *s)
Removes leading and ending whitespaces (chars<=32) from a zero terminated string.
bool equals(const XMLCh *const e1, const char *const e2)
UINT8 * getTermsAndConditionsTemplateRefId(DOMNode *tcTemplateRoot)
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument(const UINT8 *const buff, UINT32 len)
Parses a buffer containing an XML document and returns this document.
DOMNodeList * getElementsByTagName(DOMElement *pElem, const char *const name)
SINT32 getRandom(UINT32 *val)
Gets 32 random bits.
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument()
Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in...
DOMElement * createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const name)
Creates a new DOMElement with the given name which belongs to the DOMDocument owernDoc.
SINT32 getDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
UINT32 toLower(UINT8 *a_string)
SINT32 getDOMElementAttribute(const DOMNode *const elem, const char *attrName, UINT8 *value, UINT32 *len)
SINT32 integrateDOMNode(const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace)
integrates the source node in the destination Node.
void setZero64(UINT64 &op1)
SINT32 filesize32(int handle)
void print64(UINT8 *buff, UINT64 num)
#define TEMPLATE_REFID_MAXLEN
#define UNIVERSAL_NODE_LAST_UPDATE
#define KEEP_ALIVE_TRAFFIC_RECV_WAIT_TIME
#define DELAY_USERS_BUCKET_GROW
#define KEEP_ALIVE_TRAFFIC_SEND_WAIT_TIME
#define GET_NET_ERROR_STR(x)
#define LAST_MIX_TO_PROXY_CONNECT_TIMEOUT
#define DELAY_CHANNEL_LATENCY
#define THREAD_RETURN_SUCCESS
#define DEFAULT_INFOSERVICE
#define MIX_VERSION_TESTING_TEXT
#define DELAY_USERS_BUCKET_GROW_INTERVALL
#define DELAY_USERS_TRAFFIC
SINT32 add(CACertificate *cert)
Adds a COPY of a given certifcate to this CertStore.
SINT32 encode(UINT8 *buff, UINT32 *bufflen, UINT32 type) const
SINT32 getAuthorityKeyIdentifier(UINT8 *r_aki, UINT32 *r_akiLen) const
SINT32 verify(const CACertificate *a_cert) const
SINT32 getSubjectKeyIdentifier(UINT8 *r_ski, UINT32 *r_skiLen)
LERNGRUPPE Accessor method for the subjectKeyIdentifier (SKI) extension stored in this certificate.
SINT32 getRawSubjectKeyIdentifier(UINT8 *r_ski, UINT32 *r_skiLen)
static CACertificate * decode(const UINT8 *const buff, UINT32 bufflen, UINT32 type, const char *const passwd=NULL)
Extracts a certificate from an encoded (DER,XML) form.
UINT8 * m_strAccessControlCredential
SINT32 getAiID(UINT8 *id, UINT32 len)
SINT32 setPrevMixCertificate(DOMElement *elemCertificates)
SINT32 setMixName(DOMElement *elemGeneral)
SINT32 getDatabaseName(UINT8 *name, UINT32 len)
UINT32 getListenerInterfaceCount()
UINT8 * m_strDatabaseName
friend THREAD_RETURN threadReConfigure(void *param)
Thread that does the actual reconfigure work.
SINT32 getCredential(UINT8 *name, UINT32 len)
SINT32 processXmlConfiguration(XERCES_CPP_NAMESPACE::DOMDocument *docConfig)
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixXml
bool m_bAcceptReconfiguration
CACertificate * m_pLogEncryptionCertificate
UINT32 m_nCertificateOptionsSetters
UINT32 m_addrInfoServicesSize
SINT32 createSockets(bool a_bPrintMessages, CASocket **a_sockets, UINT32 a_socketsLen)
SINT32 setNextMix(XERCES_CPP_NAMESPACE::DOMDocument *pDoc)
Modifies the next mix settings (target interface and certificate) according to the specified options ...
UINT32 getDelayChannelBucketGrow()
SINT32 getDatabasePassword(UINT8 *pass, UINT32 len)
SINT32 setGeneralOptions(DOMElement *elemRoot)
SINT32 setAccountingOptions(DOMElement *elemRoot)
optionSetter_pt * mainOptionSetters
SINT32 setMaxUsers(DOMElement *elemGeneral)
UINT8 * m_strDatabasePassword
SINT32 parse(int argc, const char **arg)
SINT32 setKeepAliveTraffic(DOMElement *elemNetwork)
SINT32 getMixHost(UINT8 *host, UINT32 len)
SINT32 getMixId(UINT8 *id, UINT32 len)
SINT32 setAccessControlCredential(DOMElement *elemGeneral)
DOMElement * getTermsAndConditions()
SINT32 setMixDescription(DOMElement *elemRoot)
XERCES_CPP_NAMESPACE::DOMDocument ** m_termsAndConditionsTemplates
void clean()
Deletes all resssource allocated by objects of this class EXPECT the locks necessary to controll acce...
DOMNodeList * m_opCertList
SYMCHANNELCIPHER_ALGORITHM m_algSymChannelCipher
SINT32 setMixType(DOMElement *elemGeneral)
determines whether this mix is a first a middle or a last mix appears in <General></General> and must...
SINT32 reread(CAMix *pMix)
Rereads the configuration file (if one was given on startup) and reconfigures the mix according to th...
CACertificate * m_pPrevMixCertificate
optionSetter_pt * generalOptionSetters
void initAccountingOptionSetters()
XERCES_CPP_NAMESPACE::DOMDocument * m_docOpTnCs
bool hasPrevMixTestCertificate()
optionSetter_pt * certificateOptionSetters
UINT32 getDelayChannelBucketGrowIntervall()
SINT32 setTrustedRootCertificates(DOMElement *elemCertificates)
SINT32 setCertificateOptions(DOMElement *elemRoot)
UINT8 * m_strDatabaseUser
SINT32 getCascadeName(UINT8 *name, UINT32 len) const
CAThread m_threadReConfigure
SINT32 parseInfoServices(DOMElement *a_infoServiceNode)
**
bool isEncryptedLogEnabled()
Returns if the encrpyted Log could/should be used.
void initNetworkOptionSetters()
SINT32 setTermsAndConditionsList(DOMElement *elemTnCs)
char * m_strEncryptedLogDir
SINT32 setTermsAndConditionsTemplates(DOMElement *elemTnCs)
static SINT32 buildDefaultConfig(XERCES_CPP_NAMESPACE::DOMDocument *a_doc, bool bForLastMix)
Creates a default mix configuration.
SINT32 setLogDir(const UINT8 *name, UINT32 len)
char * m_dbCountryStatsHost
SINT32 setDaemonMode(DOMElement *elemGeneral)
void initTermsAndConditionsOptionSetters()
SINT32 setDynamicMix(DOMElement *elemGeneral)
determines whether this mix is a dynamic mix or not appears in <General></General> and is optional.
UINT32 getNumberOfTermsAndConditionsTemplates()
Get the XML describing the Mix.
CAListenerInterface ** m_arListenerInterfaces
SINT32 setPrevMix(XERCES_CPP_NAMESPACE::DOMDocument *pDoc)
Modifies the next mix settings (target interface and certificate) according to the specified options ...
SINT32 clearVisibleAddresses()
CAXMLPriceCert * m_pPriceCertificate
SINT32 setNetworkOptions(DOMElement *elemRoot)
SINT32 setSettleInterval(DOMElement *elemAccounting)
SINT32 setNewValues(CACmdLnOptions &newOptions)
Copies options from newOptions.
SINT32 setTermsAndConditions(DOMElement *elemRoot)
static SINT32 createMixOnCDConfiguration(const UINT8 *strFileName)
Writes a default configuration file into the file named by filename.
SINT32 getPidFile(UINT8 *pidfile, UINT32 len)
SINT32 readXmlConfiguration(XERCES_CPP_NAMESPACE::DOMDocument *&docConfig, const UINT8 *const configFileName)
Tries to read the XML configuration file configFile and parses (but not process) it.
UINT32 m_cnListenerInterfaces
SINT32 setServerMonitoring(DOMElement *elemNetwork)
SINT32 getSOCKSHost(UINT8 *host, UINT32 len)
SINT32 setNrOfFileDescriptors(DOMElement *elemGeneral)
UINT8 * m_strDatabaseHost
char * m_dbCountryStatsPasswd
SINT32 getUser(UINT8 *user, UINT32 len)
CACertStore * m_pTrustedRootCertificates
void initGeneralOptionSetters()
SINT32 setAccountingSoftLimit(DOMElement *elemAccounting)
optionSetter_pt * m_arpTermsAndConditionsOptionSetters
SINT32 setOwnCertificate(DOMElement *elemCertificates)
UINT32 getDelayChannelUnlimitTraffic()
void initCertificateOptionSetters()
UINT32 m_iPaymentSettleInterval
UINT32 m_u32KeepAliveRecvInterval
UINT32 getPaymentSettleInterval()
UINT32 m_u32DelayChannelBucketGrow
SINT32 setMixCertificateVerification(DOMElement *elemCertificates)
UINT32 m_iPaymentSoftLimit
UINT32 m_u32DelayChannelBucketGrowIntervall
SINT32 setAccountingDatabase(DOMElement *elemAccounting)
SINT32 getCountryStatsDBConnectionLoginData(char **db_host, char **db_user, char **db_passwd)
SINT32 getDatabaseHost(UINT8 *host, UINT32 len)
void initMainOptionSetters()
UINT32 getPrepaidInterval()
SINT32 setCascadeNameFromOptions(DOMElement *elemGeneral)
SINT32 getEncryptedLogDir(UINT8 *name, UINT32 len)
SINT32 addVisibleAddresses(DOMNode *nodeProxy)
** Add all the visible addresses to the list of visible addresses found in the XML description of the...
SINT32 getOperatorSubjectKeyIdentifier(UINT8 *buffer, UINT32 *length)
Returns a COPY of the public test certifcate for that mix.
SINT32 getLogDir(UINT8 *name, UINT32 len)
CAListenerInterface * getListenerInterface(UINT32 nr)
UINT32 m_iPaymentHardLimit
SINT32 m_PaymentReminderProbability
UINT32 m_iPrepaidInterval
SINT32 setInfoServices(DOMElement *elemNetwork)
CAMutex * m_pcsReConfigure
SINT32 setMixID(DOMElement *elemGeneral)
SINT32 clearListenerInterfaces()
SINT32 appendMixInfo_internal(DOMNode *a_node, bool with_subtree)
SINT32 setLoggingOptions(DOMElement *elemGeneral)
CATargetInterface * m_arTargetInterfaces
UINT16 m_iSOCKSServerPort
SINT32 setAccountingHardLimit(DOMElement *elemAccounting)
CAListenerInterface ** m_addrInfoServices
XERCES_CPP_NAMESPACE::DOMDocument ** getAllTermsAndConditionsTemplates()
SINT32 setTargetInterfaces(DOMElement *elemNetwork)
This method sets the proxy or next mix settings.
SINT32 getDatabaseUsername(UINT8 *user, UINT32 len)
UINT8 ** m_arStrVisibleAddresses
SINT32 setPriceCertificate(DOMElement *elemAccounting)
SINT32 setPaymentReminder(DOMElement *elemGeneral)
SINT32 setNextMixCertificate(DOMElement *elemCertificates)
UINT32 getPaymentHardLimit()
UINT32 m_nrOfTermsAndConditionsTemplates
UINT16 getSOCKSServerPort()
SYMCHANNELCIPHER_ALGORITHM getSymChannelCipherAlgorithm() const
SINT32 setRessourceOptions(DOMElement *elemRoot)
UINT32 getPaymentSoftLimit()
CAMultiSignature * m_pMultiSignature
DOMElement * m_pCascadeXML
optionSetter_pt * accountingOptionSetters
UINT32 m_u32KeepAliveSendInterval
SINT32 setSymChannelCipherAlgorithm(SYMCHANNELCIPHER_ALGORITHM cipherAlgorithm)
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixInfo
optionSetter_pt * networkOptionSetters
SINT32 addMixIdToMixInfo()
Just add the id of the Mix to the MixInfo Document.
SINT32 setCascadeName(const UINT8 *name)
static SINT32 saveToFile(XERCES_CPP_NAMESPACE::DOMDocument *a_doc, const UINT8 *a_strFileName)
Saves the given XML Document to a file.
UINT32 m_u32DelayChannelUnlimitTraffic
bool getCompressLogs()
ONLY_LOCAL_PROXY or first mix.
SINT32 invokeOptionSetters(const optionSetter_pt *optionsSetters, DOMElement *target, SINT32 optionsSettersLength)
framework-function for calling predefined option setter functions.
bool m_bIsEncryptedLogEnabled
CAXMLBI * getBI()
Returns an CAXMLBI object, which describes the BI this AI uses.
UINT32 getTargetInterfaceCount()
SINT32 setPrepaidInterval(DOMElement *elemAccounting)
SINT32 getAccessControlCredential(UINT8 *outbuff, UINT32 *outbuffsize)
SINT32 setPaymentInstance(DOMElement *elemAccounting)
bool verifyMixCertificates()
UINT32 m_cnVisibleAddresses
SINT32 setUserID(DOMElement *elemGeneral)
SINT32 setListenerInterfaces(DOMElement *elemNetwork)
SINT32 getMixXml(XERCES_CPP_NAMESPACE::DOMDocument *&docMixInfo)
Returns the XML tree describing the Mix .
SINT32 setMinCascadeLength(DOMElement *elemGeneral)
SINT32 getVisibleAddress(UINT8 *strAddressBuff, UINT32 len, UINT32 nr)
Fills strAddressBuff with a outside visible adress.
SINT32 setOwnOperatorCertificate(DOMElement *elemCertificates)
SINT32 clearTargetInterfaces()
UINT32 getVisibleAddressesCount()
bool m_bLocalProxy
ONLY_LOCAL_PROXY or first.
CAListenerInterface ** getInfoServices(UINT32 &r_size)
SINT32 getTargetInterface(CATargetInterface &oTargetInterface, UINT32 nr)
Fills a TargetInterface struct with the values which belongs to the target interface nr.
char * m_dbCountryStatsUser
CACertificate * m_pNextMixCertificate
static const char * XML_ELEMENT_CONTAINER_NAME
CASocketAddr * getAddr() const
static const char * XML_ELEMENT_NAME
static CAListenerInterface * getInstance(const DOMNode *node)
virtual SINT32 reconfigure()
static SINT32 openEncryptedLog()
Open a log, where the logged messages are store encrypted.
static SINT32 setLogOptions(UINT32 options)
static SINT32 setLogLevel(UINT32 a_logLevel)
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
UINT32 getSignatureCount()
SINT32 addSignature(CASignature *a_signature, CACertStore *a_certs, UINT8 *a_ski, UINT32 a_skiLen)
SINT32 getXORofSKIs(UINT8 *out, UINT32 outlen)
static SINT32 verifyXML(const UINT8 *const in, UINT32 inlen, CACertificate *a_cert)
SINT32 findSKI(const UINT8 *a_strSKI)
SINT32 getVerifyKey(CACertificate **)
Get the public key as XML encoded X509 certificate.
SINT32 generateSignKey(UINT32 size)
SINT32 setSignKey(const UINT8 *buff, UINT32 len, UINT32 type, const char *passwd=NULL)
SINT32 getSignKey(DOMElement *&node, XERCES_CPP_NAMESPACE::DOMDocument *doc)
Gets the secret sign key as XML encode PKCS#12 struct.
This is an abstract class for representing a socket address used in CASocket, CADatagramSocket and CA...
virtual SINT32 getType() const =0
The type (family) of socket for which this address is useful.
virtual CASocketAddr * clone() const =0
Creates a copy of the Address.
virtual SINT32 toString(UINT8 *buff, UINT32 bufflen) const =0
Returns a string which describes this address in a human readable form.
This class represents a socket address for Internet (IP) connections.
SINT32 getHostName(UINT8 *buff, UINT32 len) const
Returns the hostname for this address.
UINT16 getPort() const
Returns the port value of the address.
This is a class for Unix Domain Protocol Sockat Addresses.
CASocketAddr * clone() const
Creates a new copy of this address.
virtual SINT32 listen(const CASocketAddr &psa)
Starts listening on address psa.
virtual SINT32 setSendTimeOut(UINT32 msTimeOut)
virtual SINT32 setRecvBuff(UINT32 r)
virtual SINT32 setReuseAddr(bool b)
virtual SINT32 setSendBuff(SINT32 r)
Returns < 0 on error, otherwise the new sendbuffersize (which may be less than r)
virtual SINT32 connect(const CASocketAddr &psa)
static const UINT8 *const getAlgorithmName(SYMCHANNELCIPHER_ALGORITHM alg)
SINT32 set(TargetType target_t, NetworkType net_t, CASocketAddr *p_addr)
SINT32 start(void *param, bool bDaemon=false, bool bSilent=false)
Starts the execution of the main function of this thread.
SINT32 setMainLoop(THREAD_MAIN_TYP fnc)
Sets the main function which will be executed within this thread.
static SINT32 dumpToMem(const DOMNode *node, UINT8 *buff, UINT32 *size)
Dumps the node and all childs into buff.
#define POPT_ERROR_BADOPT
int poptGetNextOpt(poptContext con)
void poptFreeContext(poptContext con)
poptContext poptGetContext(const char *name, int argc, const char **argv, const struct poptOption *options, int flags)
CACmdLnOptions * pCmdLnOptions