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

List of all members.

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 SINT32 setMaxLogFileSize (UINT64 size)
static SINT32 printMsg (UINT32 typ, const char *format,...)
static SINT32 openEncryptedLog ()
 Open a log, where the logged messages are store encrypted.
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
CAMutexm_pcsPrint
t_LogEncCipherm_pCipher

Static Private Attributes

static CAMsgpMsg = NULL
static const char *const m_strMsgTypes [6] = {", error ] ",", critical] ",", info ] ",", debug ] ",", special ] ",", warning ] "}

Constructor & Destructor Documentation

CAMsg::CAMsg ( ) [private]

Member Function Documentation

static SINT32 CAMsg::cleanup ( ) [static]

References closeLog(), E_SUCCESS, and pMsg.

Referenced by main().

References E_SUCCESS, m_hFileEncrypted, m_pCipher, and pMsg.

Referenced by ~CAMsg().

SINT32 CAMsg::closeLog ( ) [private]
char * CAMsg::createLogDirMessage ( UINT32  opt) [private]

References m_strLogDir, MSG_COMPRESSED_FILE, MSG_FILE, and pMsg.

Referenced by setLogOptions().

char * CAMsg::createLogFileMessage ( UINT32  opt) [private]

References m_strLogFile, MSG_COMPRESSED_FILE, MSG_FILE, and pMsg.

Referenced by setLogOptions().

static SINT32 CAMsg::init ( ) [static]

References CAMsg(), E_SUCCESS, and pMsg.

Referenced by main().

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.

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, S_LOGENCCIPHER::oKey, pMsg, and CAASymCipher::setPublicKey().

Referenced by CACmdLnOptions::initLogging().

SINT32 CAMsg::openLog ( UINT32  type) [private]
SINT32 CAMsg::printMsg ( UINT32  typ,
const char *  format,
  ... 
) [static]

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_STDOUT, S_LOGENCCIPHER::oKey, openLog(), pMsg, STRMSGTYPES_SIZE, 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(), CAQueue::add(), CAFirstMixChannelList::addChannel(), CACmdLnOptions::addMixIdToMixInfo(), CAThreadPool::addRequest(), TermsAndConditions::addTranslation(), CACmdLnOptions::appendMixInfo_internal(), CAMix::appendTermsAndConditionsExtension(), CAAccountingControlChannel::CAAccountingControlChannel(), CAAccountingInstance::CAAccountingInstance(), CAAccountingSettleThread::CAAccountingSettleThread(), CAReplayControlChannel::CAReplayControlChannel(), CAReplayCtrlChannelMsgProc::CAReplayCtrlChannelMsgProc(), CAAccountingInstance::cascadeMatchesCC(), CAMix::checkCompatibility(), CAAccountingDBInterface::checkConnectionStatus(), checkSizesOfBaseTypes(), CALastMix::clean(), CAFirstMix::clean(), CALibProxytest::cleanup(), cleanup(), CAAccountingDBInterface::cleanup(), CAAccountingInstance::cleanupTableEntry(), CATempIPBlockList::cleanupThreadMainLoop(), CASocket::close(), CAFirstMixA::closeConnection(), CASocket::connect(), CAMiddleMix::connectToNextMix(), CAFirstMix::connectToNextMix(), CASocket::create(), CACmdLnOptions::createSockets(), CATLSClientSocket::doTLSConnect(), CAFirstMix::doUserLogin_internal(), CAAccountingInstance::finishLoginProcess(), fm_loopAcceptUsers(), fm_loopReadFromMix(), fm_loopSendToMix(), CAAccountingDBInterface::getConnection(), CAXMLPriceCert::getInstance(), 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(), CALocalProxy::init(), CAMiddleMix::init(), CALastMix::init(), CAAccountingDBInterface::init(), CAFirstMix::init(), CAAccountingBIInterface::initBIConnection(), CAFirstMix::initCountryStats(), CAAccountingDBInterface::initDBConnection(), CACmdLnOptions::initLogging(), CAMix::initMixCascadeInfo(), CALocalProxy::initOnce(), CAMiddleMix::initOnce(), CALastMix::initOnce(), CAMix::initOnce(), CAFirstMix::initOnce(), CAIPList::insertIP(), integrateDOMNode(), CACmdLnOptions::invokeOptionSetters(), iplist_loopDoLogCountries(), isAllowedToPassRestrictions(), CACertificate::isValid(), CAThread::join(), CASocket::listen(), lm_loopLog(), lm_loopReadFromMix(), lm_loopSendToMix(), logMemoryUsage(), CALastMixA::loop(), CAFirstMixB::loop(), CAFirstMixA::loop(), CALastMixB::loop(), CALocalProxy::loop(), CAMiddleMix::loop(), main(), CAAccountingSettleThread::mainLoop(), CAAccountingInstance::makeInitialCCRequest(), CADatabase::measurePerformance(), CAReplayDatabase::measurePerformance(), mm_loopReadFromMixAfter(), mm_loopReadFromMixBefore(), mm_loopSendToMixAfter(), mm_loopSendToMixBefore(), CADatabase::nextClock(), CAReplayDatabase::nextClock(), CACmdLnOptions::parse(), CAHttpClient::parseHTTPHeader(), CAFirstMixChannelList::popTimeoutEntry_internal(), CAAccountingInstance::prepareCCRequest(), CAReplayCtrlChannelMsgProc::proccessGotTimestamp(), CASyncControlChannel::proccessMessage(), CASyncControlChannel::proccessMessageComplete(), CAChain::processDownstream(), CAAccountingInstance::processJapMessage(), CALocalProxy::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), CAFirstMix::processKeyExchange(), CAAccountingInstance::processThread(), CACmdLnOptions::processXmlConfiguration(), CAReplayControlChannel::processXMLMessage(), CAAccountingControlChannel::processXMLMessage(), CAReplayCtrlChannelMsgProc::propagateCurrentReplayTimestamp(), CACmdLnOptions::readXmlConfiguration(), CATLSClientSocket::receive(), CASocket::receive(), CAMuxSocket::receive(), CALastMix::reconfigure(), CAFirstMix::reconfigure(), CALastMixB::reconfigureMix(), Hashtable::rehash(), CAAccountingDBInterface::releaseConnection(), CACertificate::removeColons(), CAFirstMixChannelList::removeFromTimeoutList(), CAIPList::removeIP(), CAAccountingInstance::returnKickout(), CAAccountingInstance::returnPrepareKickout(), CASocketGroup::select(), CATLSClientSocket::send(), CASocket::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(), CACmdLnOptions::setAccountingDatabase(), CAFirstMixChannelList::setDelayParameters(), CACmdLnOptions::setDynamicMix(), CASocket::setKeepAlive(), 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(), CAXMLBI::setValues(), CAXMLErrorMessage::setValues(), CAXMLPriceCert::setValues(), CASignature::setVerifyKey(), CAFirstMixA::shutDown(), signal_interrupt(), signal_segv(), signal_term(), CAMultiSignature::signXML(), SIGUSR1_handler(), SIGUSR2_handler(), CALocalProxy::start(), CAMix::start(), CAInfoService::start(), CAThread::start(), CAAccountingBIInterface::terminateBIConnection(), threadReConfigure(), CAXMLPriceCert::toXmlElement(), CAFirstMix::updateCountryStats(), CACertificate::verify(), CACertStore::verifyMixCert(), CAMultiSignature::verifyXML(), CAAccountingControlChannel::~CAAccountingControlChannel(), CAAccountingInstance::~CAAccountingInstance(), CAChain::~CAChain(), CAReplayCtrlChannelMsgProc::~CAReplayCtrlChannelMsgProc(), and CATempIPBlockList::~CATempIPBlockList().

SINT32 CAMsg::rotateLog ( ) [private]
SINT32 CAMsg::setLogLevel ( UINT32  a_logLevel) [static]
SINT32 CAMsg::setLogOptions ( UINT32  options) [static]
static SINT32 CAMsg::setMaxLogFileSize ( UINT64  size) [static]

References E_SUCCESS, E_UNKNOWN, m_maxLogFileSize, pMsg, and set64().

Referenced by openLog().


Member Data Documentation

bool CAMsg::m_alreadyOpened [private]

Referenced by CAMsg(), and openLog().

int CAMsg::m_hFileEncrypted [private]
int CAMsg::m_hFileInfo [private]

Referenced by CAMsg(), closeLog(), openLog(), and printMsg().

Referenced by CAMsg(), and rotateLog().

Referenced by CAMsg(), printMsg(), and setLogLevel().

Referenced by CAMsg(), printMsg(), and setMaxLogFileSize().

Referenced by openLog(), and printMsg().

Referenced by CAMsg(), printMsg(), and ~CAMsg().

char* CAMsg::m_strLogDir [private]

Referenced by createLogDirMessage(), and openLog().

char* CAMsg::m_strLogFile [private]
char* CAMsg::m_strMsgBuff [private]

Referenced by CAMsg(), printMsg(), and ~CAMsg().

const char *const CAMsg::m_strMsgTypes = {", error ] ",", critical] ",", info ] ",", debug ] ",", special ] ",", warning ] "} [static, private]

Referenced by printMsg().

CAMsg * CAMsg::pMsg = NULL [static, private]