Mixe for Privacy and Anonymity in the Internet
|
#include <CAMsg.hpp>
Public Member Functions | |
~CAMsg () | |
Static Public Member Functions | |
static SINT32 | init () |
static SINT32 | cleanup () |
static SINT32 | setLogOptions (UINT32 options) |
static SINT32 | setLogLevel (UINT32 a_logLevel) |
static const char *const | getLogLevelStr () |
static SINT32 | setMaxLogFileSize (UINT64 size) |
static SINT32 | printMsg (UINT32 typ, const char *format,...) |
Writes a given message to the log. More... | |
static SINT32 | openEncryptedLog () |
Open a log, where the logged messages are store encrypted. More... | |
static SINT32 | closeEncryptedLog () |
Private Member Functions | |
CAMsg () | |
SINT32 | openLog (UINT32 type) |
SINT32 | closeLog () |
SINT32 | rotateLog () |
char * | createLogFileMessage (UINT32 opt) |
char * | createLogDirMessage (UINT32 opt) |
Private Attributes | |
SINT64 | m_maxLogFileSize |
UINT32 | m_NrOfWrites |
UINT32 | m_uLogType |
UINT32 | m_logLevel |
UINT32 | m_lastLogFileNumber |
bool | m_alreadyOpened |
int | m_hFileEncrypted |
int | m_hFileInfo |
char * | m_strMsgBuff |
char * | m_strLogFile |
char * | m_strLogDir |
CAMutex * | m_pcsPrint |
t_LogEncCipher * | m_pCipher |
Static Private Attributes | |
static CAMsg * | pMsg =NULL |
static const char *const | ms_arStrLogLevels [5] = { "CRITICAL","ERROR","WARNING","INFO","DEBUG" } |
static const char *const | m_strMsgTypes [6] ={", error ] ",", critical] ",", info ] ",", debug ] ",", special ] ",", warning ] "} |
|
private |
Definition at line 49 of file CAMsg.cpp.
References m_alreadyOpened, m_hFileEncrypted, m_hFileInfo, m_lastLogFileNumber, m_logLevel, m_maxLogFileSize, m_pCipher, m_pcsPrint, m_strLogFile, m_strMsgBuff, m_uLogType, MAX_MSG_SIZE, MSG_STDOUT, setZero64(), and STRMSGTYPES_SIZE.
Referenced by init().
CAMsg::~CAMsg | ( | ) |
Definition at line 68 of file CAMsg.cpp.
References closeEncryptedLog(), closeLog(), m_pcsPrint, m_strLogFile, and m_strMsgBuff.
|
inlinestatic |
Definition at line 77 of file CAMsg.hpp.
References closeLog(), E_SUCCESS, and pMsg.
Referenced by CALibProxytest::cleanup(), and main().
|
static |
|
private |
Definition at line 397 of file CAMsg.cpp.
References E_SUCCESS, m_hFileInfo, m_uLogType, MSG_COMPRESSED_FILE, MSG_FILE, MSG_LOG, and pMsg.
Referenced by cleanup(), printMsg(), setLogOptions(), and ~CAMsg().
|
private |
Definition at line 104 of file CAMsg.cpp.
References m_strLogDir, MSG_COMPRESSED_FILE, MSG_FILE, and pMsg.
Referenced by setLogOptions().
|
private |
Definition at line 82 of file CAMsg.cpp.
References m_strLogFile, MSG_COMPRESSED_FILE, MSG_FILE, and pMsg.
Referenced by setLogOptions().
|
static |
Definition at line 143 of file CAMsg.cpp.
References m_uLogType, ms_arStrLogLevels, and pMsg.
Referenced by main().
|
inlinestatic |
Definition at line 69 of file CAMsg.hpp.
References CAMsg(), E_SUCCESS, and pMsg.
Referenced by CALibProxytest::init(), CACmdLnOptions::initLogging(), and main().
|
static |
Open a log, where the logged messages are store encrypted.
The file format is as follows: NEWLINE "----Start of EncryptionKey----" NEWLINE 128 random bytes (BASE64 encoded of RSA encrpyted block) which are used as sym key (16 bytes starting form 50. byte) and IV (next 16 bytes) NEWLINE "-----End of EncryptionKey-----" NEWLINE encrpyted messages
The message is encrypted using AES-128-OFB.
Definition at line 520 of file CAMsg.cpp.
References E_SUCCESS, E_UNKNOWN, CABase64::encode(), CAASymCipher::encrypt(), FILENAME_ENCRYPTEDLOG, CACmdLnOptions::getLogEncryptionKey(), CALibProxytest::getOptions(), getRandom(), S_LOGENCCIPHER::iv, S_LOGENCCIPHER::iv_off, m_hFileEncrypted, m_pCipher, myfilewrite, O_BINARY, O_LARGEFILE, S_LOGENCCIPHER::oKey, pMsg, S_IREAD, S_IWRITE, and CAASymCipher::setPublicKey().
Referenced by CACmdLnOptions::initLogging().
Definition at line 445 of file CAMsg.cpp.
References E_FILE_OPEN, E_SUCCESS, E_UNKNOWN, FILENAME_INFOLOG, FILENAME_INFOLOG_GZ, GET_NET_ERROR, CALibProxytest::getOptions(), m_alreadyOpened, m_hFileInfo, m_NrOfWrites, m_strLogDir, m_strLogFile, MSG_COMPRESSED_FILE, MSG_FILE, MSG_LOG, O_LARGEFILE, rotateLog(), S_IREAD, S_IWRITE, SET_NET_ERROR, setMaxLogFileSize(), and type.
Referenced by printMsg(), and setLogOptions().
Writes a given message to the log.
type | type of the log message (debug,info warning, error) |
format | format string as in printf() |
<return>E_SUCCESS, if log messages was successful written</return> <return>E_UNKNOWN, in case of some error</return>
Definition at line 251 of file CAMsg.cpp.
References closeLog(), E_SUCCESS, E_UNKNOWN, filesize64(), isGreater64(), isZero64(), S_LOGENCCIPHER::iv, S_LOGENCCIPHER::iv_off, CAMutex::lock(), LOG_ENCRYPTED, m_hFileEncrypted, m_hFileInfo, m_logLevel, m_maxLogFileSize, m_NrOfWrites, m_pCipher, m_pcsPrint, m_strMsgBuff, m_strMsgTypes, m_uLogType, MAX_MSG_SIZE, MSG_COMPRESSED_FILE, MSG_FILE, MSG_LOG, MSG_NOLOG, MSG_STDOUT, myfilewrite, S_LOGENCCIPHER::oKey, openLog(), pMsg, STRMSGTYPES_SIZE, type, and CAMutex::unlock().
Referenced by CAAccountingDBInterface::__checkCountAllQuery(), CAAccountingDBInterface::__clearAccountStatus(), CAAccountingInstance::__commitSettlementToDatabase(), CAAccountingDBInterface::__deleteCC(), CAAccountingDBInterface::__getAccountStatus(), CAAccountingDBInterface::__getCostConfirmation(), CAAccountingDBInterface::__getPrepaidAmount(), CAAccountingDBInterface::__getUnsettledCostConfirmations(), CAAccountingInstance::__handleSettleResult(), CAAccountingInstance::__newSettlementTransaction(), CAAccountingDBInterface::__storeAccountStatus(), CAAccountingDBInterface::__storeCostConfirmation(), CAAccountingDBInterface::__storePrepaidAmount(), CASocket::accept(), CAFirstMixA::accountTrafficDownstream(), CAFirstMixA::accountTrafficUpstream(), CASocketGroupEpoll::add(), CAQueue::add(), CAFirstMixChannelList::addChannel(), CACmdLnOptions::addMixIdToMixInfo(), CAThreadPool::addRequest(), TermsAndConditions::addTranslation(), CACmdLnOptions::appendMixInfo_internal(), CACryptoBenchmark::benchmarkThread(), CAAccountingControlChannel::CAAccountingControlChannel(), CAAccountingInstance::CAAccountingInstance(), CAAccountingSettleThread::CAAccountingSettleThread(), CAReplayControlChannel::CAReplayControlChannel(), CAReplayCtrlChannelMsgProc::CAReplayCtrlChannelMsgProc(), CAAccountingInstance::cascadeMatchesCC(), CAMix::checkCompatibility(), CAAccountingDBInterface::checkConnectionStatus(), checkSizesOfTypes(), CAFirstMixA::checkUserConnections(), CAFirstMix::clean(), CALastMix::clean(), CAMiddleMix::clean(), CAAccountingDBInterface::cleanup(), CALibProxytest::cleanup(), cleanup(), CAAccountingInstance::cleanupTableEntry(), CATempIPBlockList::cleanupThreadMainLoop(), CASocket::close(), CAFirstMixA::closeConnection(), CASocket::connect(), CAFirstMix::connectToNextMix(), CAMiddleMix::connectToNextMix(), CASocket::create(), CASymChannelCipherFactory::createCipher(), CACmdLnOptions::createSockets(), CACryptoBenchmark::doBenchmark(), CATLSClientSocket::doTLSConnect(), CAFirstMix::doUserLogin_internal(), CAAccountingInstance::finishLoginProcess(), CAFirstMixA::finishPacket(), CAAccountingDBInterface::getConnection(), CACmdLnOptions::getMixXml(), CAAccountingInstance::getNrOfUsers(), CAInfoService::getPaymentInstance(), CAAccountingInstance::getPrepaidBytes(), CACertificate::getRawSubjectKeyIdentifier(), CACertificate::getSubjectKeyIdentifier(), CASignature::getVerifyKey(), CAAccountingInstance::handleAccountCertificate_internal(), CAAccountingInstance::handleChallengeResponse_internal(), CAAccountingInstance::handleCostConfirmation_internal(), CAAccountingInstance::handleJapPacket_internal(), CAFirstMix::handleTermsAndConditionsExtension(), CAFirstMix::handleTermsAndConditionsLogin(), CAInfoService::InfoLoop(), CAAccountingDBInterface::init(), CAFirstMix::init(), CALastMix::init(), CALocalProxy::init(), CAMiddleMix::init(), CAAccountingBIInterface::initBIConnection(), CAFirstMix::initCountryStats(), CAAccountingDBInterface::initDBConnection(), CACmdLnOptions::initLogging(), CAMix::initMixCascadeInfo(), CAFirstMix::initOnce(), CALastMix::initOnce(), CALocalProxy::initOnce(), CAMiddleMix::initOnce(), CAMix::initOnce(), CAIPList::insertIP(), integrateDOMNode(), CACmdLnOptions::invokeOptionSetters(), iplist_loopDoLogCountries(), isAllowedToPassRestrictions(), CACertificate::isValid(), CAThread::join(), CASocket::listen(), logMemoryUsage(), CALocalProxy::loop(), CAMiddleMix::loop(), CAFirstMixA::loop(), CALastMixA::loop(), CAFirstMixB::loop(), CALastMixB::loop(), main(), CAAccountingSettleThread::mainLoop(), CAAccountingInstance::makeInitialCCRequest(), CADatabase::measurePerformance(), CAReplayDatabase::measurePerformance(), CADatabase::nextClock(), CAReplayDatabase::nextClock(), CAFirstMixA::notifyAllUserChannels(), CACmdLnOptions::parse(), CAHttpClient::parseHTTPHeader(), CASocket::peek(), CAFirstMixChannelList::popTimeoutEntry_internal(), CAAccountingInstance::prepareCCRequest(), CAReplayCtrlChannelMsgProc::proccessGotTimestamp(), CASyncControlChannel::proccessMessage(), CASyncControlChannel::proccessMessageComplete(), CAChain::processDownstream(), CAAccountingInstance::processJapMessage(), CALastMix::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALocalProxy::processKeyExchange(), CAAccountingInstance::processThread(), CACmdLnOptions::processXmlConfiguration(), CAAccountingControlChannel::processXMLMessage(), CAReplayControlChannel::processXMLMessage(), CAReplayCtrlChannelMsgProc::propagateCurrentReplayTimestamp(), CACmdLnOptions::readXmlConfiguration(), CAMuxSocket::receive(), CASocket::receive(), CATLSClientSocket::receive(), CAFirstMix::reconfigure(), CALastMix::reconfigure(), CALastMixB::reconfigureMix(), CAAccountingDBInterface::releaseConnection(), CAThreadList::removeAll(), CALastMixChannelList::removeChannel(), CACertificate::removeColons(), CAFirstMixChannelList::removeFromTimeoutList(), CAIPList::removeIP(), CAAccountingInstance::returnKickout(), CAAccountingInstance::returnPrepareKickout(), CASocketGroup::select(), CASocket::send(), CATLSClientSocket::send(), CAMuxSocket::send(), CAAccountingInstance::sendAILoginConfirmation(), CAInfoService::sendCascadeHelo(), CAAccountingInstance::sendCCRequest(), CASocket::sendFully(), CASocket::sendFullyTimeOut(), CAHttpClient::sendGetRequest(), CAAccountingInstance::sendInitialCCRequest(), CAControlChannelDispatcher::sendMessages(), CAInfoService::sendMixHelo(), CAHttpClient::sendPostRequest(), CAInfoService::sendStatus(), CASocket::sendTimeOut(), CAFirstMixA::sendToUsers(), CACmdLnOptions::setAccountingDatabase(), CAMuxSocket::setCipher(), CAFirstMixChannelList::setDelayParameters(), CACmdLnOptions::setDynamicMix(), CASocket::setKeepAlive(), CASymCipherOFB::setKeys(), CAFirstMixChannelList::setKickoutForced_internal(), CACmdLnOptions::setListenerInterfaces(), CACmdLnOptions::setLoggingOptions(), setLogOptions(), CACmdLnOptions::setMixCertificateVerification(), CACmdLnOptions::setNextMix(), CACmdLnOptions::setNextMixCertificate(), CACmdLnOptions::setNrOfFileDescriptors(), CACmdLnOptions::setOwnCertificate(), CACmdLnOptions::setPaymentInstance(), CAAccountingBIInterface::setPIServerConfiguration(), CACmdLnOptions::setPrepaidInterval(), CACmdLnOptions::setPrevMix(), CACmdLnOptions::setPriceCertificate(), CACmdLnOptions::setRessourceOptions(), CACmdLnOptions::setServerMonitoring(), CASignature::setSignKey(), CACmdLnOptions::setTargetInterfaces(), CALastMix::setTargets(), CACmdLnOptions::setTermsAndConditions(), CACmdLnOptions::setTermsAndConditionsList(), CACmdLnOptions::setTermsAndConditionsTemplates(), CAAccountingBIInterface::settle(), CAAccountingBIInterface::settleAll(), CAAccountingInstance::settlementTransaction(), CACmdLnOptions::setTrustedRootCertificates(), CACmdLnOptions::setUserID(), CAXMLErrorMessage::setValues(), CASignature::setVerifyKey(), CAThreadList::showAll(), CAFirstMixA::shutDown(), signal_interrupt(), signal_segv(), signal_term(), CAMultiSignature::signXML(), SIGUSR1_handler(), SIGUSR2_handler(), CAInfoService::start(), CALocalProxy::start(), CAMix::start(), CAThread::start(), CAAccountingBIInterface::terminateBIConnection(), CAFirstMix::updateCountryStats(), CACertificate::verify(), CACertStore::verifyMixCert(), CAMultiSignature::verifyXML(), CAThreadList::waitAndRemoveAll(), CAAccountingControlChannel::~CAAccountingControlChannel(), CAAccountingInstance::~CAAccountingInstance(), CAChain::~CAChain(), CAReplayCtrlChannelMsgProc::~CAReplayCtrlChannelMsgProc(), and CATempIPBlockList::~CATempIPBlockList().
|
private |
Definition at line 422 of file CAMsg.cpp.
References E_SUCCESS, CACmdLnOptions::getMaxLogFiles(), CALibProxytest::getOptions(), m_lastLogFileNumber, m_strLogFile, m_uLogType, MSG_COMPRESSED_FILE, MSG_FILE, and pMsg.
Referenced by openLog().
Definition at line 127 of file CAMsg.cpp.
References E_SUCCESS, E_UNKNOWN, m_logLevel, and pMsg.
Referenced by CACmdLnOptions::initLogging().
Definition at line 161 of file CAMsg.cpp.
References closeLog(), createLogDirMessage(), createLogFileMessage(), E_FILE_OPEN, E_SUCCESS, GET_NET_ERROR, GET_NET_ERROR_STR, m_uLogType, MSG_COMPRESSED_FILE, MSG_FILE, MSG_LOG, openLog(), pMsg, and printMsg().
Referenced by CACmdLnOptions::initLogging().
|
private |
|
private |
Definition at line 119 of file CAMsg.hpp.
Referenced by CAMsg(), closeEncryptedLog(), openEncryptedLog(), and printMsg().
|
private |
Definition at line 120 of file CAMsg.hpp.
Referenced by CAMsg(), closeLog(), openLog(), and printMsg().
|
private |
Definition at line 117 of file CAMsg.hpp.
Referenced by CAMsg(), and rotateLog().
|
private |
Definition at line 116 of file CAMsg.hpp.
Referenced by CAMsg(), printMsg(), and setLogLevel().
|
private |
Definition at line 108 of file CAMsg.hpp.
Referenced by CAMsg(), printMsg(), and setMaxLogFileSize().
|
private |
Definition at line 109 of file CAMsg.hpp.
Referenced by openLog(), and printMsg().
|
private |
Definition at line 129 of file CAMsg.hpp.
Referenced by CAMsg(), closeEncryptedLog(), openEncryptedLog(), and printMsg().
|
private |
Definition at line 125 of file CAMsg.hpp.
Referenced by CAMsg(), printMsg(), and ~CAMsg().
|
private |
Definition at line 123 of file CAMsg.hpp.
Referenced by createLogDirMessage(), and openLog().
|
private |
Definition at line 122 of file CAMsg.hpp.
Referenced by CAMsg(), createLogFileMessage(), openLog(), rotateLog(), and ~CAMsg().
|
private |
Definition at line 121 of file CAMsg.hpp.
Referenced by CAMsg(), printMsg(), and ~CAMsg().
|
staticprivate |
Definition at line 124 of file CAMsg.hpp.
Referenced by printMsg().
|
private |
Definition at line 115 of file CAMsg.hpp.
Referenced by CAMsg(), closeLog(), getLogLevelStr(), printMsg(), rotateLog(), and setLogOptions().
|
staticprivate |
Definition at line 66 of file CAMsg.hpp.
Referenced by getLogLevelStr().
|
staticprivate |
Definition at line 65 of file CAMsg.hpp.
Referenced by cleanup(), closeEncryptedLog(), closeLog(), createLogDirMessage(), createLogFileMessage(), getLogLevelStr(), init(), openEncryptedLog(), printMsg(), rotateLog(), setLogLevel(), setLogOptions(), and setMaxLogFileSize().