Mixe for Privacy and Anonymity in the Internet
|
#include <CAMiddleMix.hpp>
Public Member Functions | |
CAMiddleMix () | |
virtual | ~CAMiddleMix () |
tMixType | getType () const |
Public Member Functions inherited from CAMixWithReplayDB | |
CAMixWithReplayDB () | |
CADatabase * | getReplayDB () const |
Public Member Functions inherited from CAMix | |
CAMix () | |
virtual | ~CAMix () |
SINT32 | start () |
virtual SINT32 | reconfigure () |
virtual void | shutDown () |
virtual bool | isShutDown () |
SINT32 | getMixCascadeInfo (XERCES_CPP_NAMESPACE::DOMDocument *&docMixCascadeInfo) |
Returns the Mix-Cascade info which should be send to the InfoService. More... | |
bool | acceptsReconfiguration () |
CAControlChannelDispatcher * | getDownstreamControlChannelDispatcher () const |
CAControlChannelDispatcher * | getUpstreamControlChannelDispatcher () const |
UINT32 | getLastConnectionTime () |
bool | isConnected () |
Protected Attributes | |
CAMuxSocket * | m_pMuxIn |
CAMuxSocket * | m_pMuxOut |
CAQueue * | m_pQueueSendToMixBefore |
CAQueue * | m_pQueueSendToMixAfter |
UINT32 | m_u32KeepAliveRecvInterval2 |
UINT32 | m_u32KeepAliveSendInterval2 |
Protected Attributes inherited from CAMixWithReplayDB | |
CADatabase * | m_pReplayDB |
CAReplayCtrlChannelMsgProc * | m_pReplayMsgProc |
Protected Attributes inherited from CAMix | |
volatile bool | m_bLoop |
bool | m_bReconfiguring |
volatile bool | m_bShutDown |
CAMultiSignature * | m_pMultiSignature |
CAInfoService * | m_pInfoService |
UINT32 | m_u32KeepAliveRecvInterval |
UINT32 | m_u32KeepAliveSendInterval |
bool | m_acceptReconfiguration |
volatile bool | m_bConnected |
volatile UINT32 | m_lLastConnectionTime |
XERCES_CPP_NAMESPACE::DOMDocument * | m_docMixCascadeInfo |
CAControlChannelDispatcher * | m_pMuxOutControlChannelDispatcher |
CAControlChannelDispatcher * | m_pMuxInControlChannelDispatcher |
Private Member Functions | |
SINT32 | loop () |
Processes Upstream-MixPackets. More... | |
SINT32 | init () |
SINT32 | initOnce () |
SINT32 | clean () |
SINT32 | connectToNextMix (CASocketAddr *a_pAddrNext) |
SINT32 | putMixPacketIntoQueueSendToMixBefore (tPoolEntry *pPoolEntry) |
virtual SINT32 | initMixCascadeInfo (DOMElement *) |
This method is not applicable to middle mixes; it does nothing. More... | |
virtual SINT32 | processKeyExchange () |
Processes key exchange with Mix n+1 and Mix n-1. More... | |
int | accessSharedMemory (int semId, tPoolEntry *destination, tPoolEntry *source) |
Private Attributes | |
CAASymCipher * | m_pRSA |
volatile bool | m_bRun |
CAMiddleMixChannelList * | m_pMiddleMixChannelList |
const char * | upstreamMemoryPreName ="upstreamshmempre" |
const char * | upstreamMemoryPostName ="upstreamshmempost" |
const char * | downstreamMemoryPreName ="downstreamshmempre" |
const char * | downstreamMemoryPostName ="downstreamshmempost" |
void * | upstreamPreBuffer |
void * | upstreamPostBuffer |
void * | downstreamPreBuffer |
void * | downstreamPostBuffer |
int | upstreamSemPreId |
int | upstreamSemPostId |
int | downstreamSemPreId |
int | downstreamSemPostId |
bool | m_bShMemConfigured |
Friends | |
THREAD_RETURN | mm_loopSendToMixBefore (void *) |
DOWNSTREAM (to Client) Take the packets from the Queue and write them to the Socket. More... | |
THREAD_RETURN | mm_loopSendToMixAfter (void *) |
UPSTREAM (to WEB) Take the packets from the Queue and write them to the Socket. More... | |
THREAD_RETURN | mm_loopReadFromMixBefore (void *) |
THREAD_RETURN | mm_loopReadFromMixAfter (void *) |
Additional Inherited Members | |
Public Types inherited from CAMix | |
enum | tMixType { FIRST_MIX , MIDDLE_MIX , LAST_MIX , JAP } |
Public Attributes inherited from CAMixWithReplayDB | |
UINT64 | m_u64ReferenceTime |
Static Public Attributes inherited from CAMix | |
static const UINT32 | TIMEOUT_MIX_CONNECTION_ESTABLISHEMENT = 60000 |
Protected Member Functions inherited from CAMix | |
SINT32 | checkCompatibility (DOMNode *a_parent, const char *a_mixPosition) |
SINT32 | appendCompatibilityInfo (DOMNode *a_parent) |
SINT32 | addMixInfo (DOMNode *a_element, bool a_bForceFirstNode) |
SINT32 | signXML (DOMNode *a_element) |
Definition at line 39 of file CAMiddleMix.hpp.
|
inline |
Definition at line 47 of file CAMiddleMix.hpp.
References m_bShMemConfigured, CAMix::m_pInfoService, m_pMiddleMixChannelList, CAMix::m_pMultiSignature, m_pMuxIn, m_pMuxOut, m_pQueueSendToMixAfter, m_pQueueSendToMixBefore, m_pRSA, upstreamPostBuffer, and upstreamPreBuffer.
|
inlinevirtual |
Definition at line 66 of file CAMiddleMix.hpp.
References clean().
|
private |
|
privatevirtual |
New SGX
Implements CAMix.
Definition at line 1526 of file CAMiddleMix.cpp.
References CAMuxSocket::close(), downstreamMemoryPostName, downstreamMemoryPreName, downstreamSemPostId, downstreamSemPreId, E_SUCCESS, CAMix::m_bShutDown, m_pMiddleMixChannelList, m_pMuxIn, m_pMuxOut, m_pQueueSendToMixAfter, m_pQueueSendToMixBefore, CAMixWithReplayDB::m_pReplayMsgProc, m_pRSA, CAMsg::printMsg(), upstreamMemoryPostName, upstreamMemoryPreName, upstreamSemPostId, and upstreamSemPreId.
Referenced by ~CAMiddleMix().
|
private |
Definition at line 1428 of file CAMiddleMix.cpp.
References CAMuxSocket::connect(), E_SUCCESS, E_UNKNOWN, ERR_INTERN_CONNREFUSED, ERR_INTERN_TIMEDOUT, GET_NET_ERROR, GET_NET_ERROR_STR, m_pMuxOut, CAMsg::printMsg(), RETRIES, RETRYTIME, sSleep(), and CASocketAddr::toString().
Referenced by init().
|
inlinevirtual |
|
privatevirtual |
Connect to next mix
Implements CAMix.
Definition at line 649 of file CAMiddleMix.cpp.
References CAMuxSocket::accept(), CATargetInterface::cleanAddr(), connectToNextMix(), CASocket::create(), downstreamMemoryPostName, downstreamMemoryPreName, downstreamPostBuffer, downstreamPreBuffer, downstreamSemPostId, downstreamSemPreId, E_SUCCESS, E_UNKNOWN, ev_net_nextConnected, ev_net_prevConnected, ev_net_prevConnectionClosed, FM_PACKET_STATS_LOG_INTERVALL, CAASymCipher::generateKeyPair(), CAListenerInterface::getAddr(), CATargetInterface::getAddr(), CAMuxSocket::getCASocket(), CACmdLnOptions::getListenerInterface(), CACmdLnOptions::getListenerInterfaceCount(), CALibProxytest::getOptions(), CACmdLnOptions::getTargetInterface(), CACmdLnOptions::getTargetInterfaceCount(), CATargetInterface::getTargetType(), CASocketAddr::getType(), CAListenerInterface::isVirtual(), m_bShMemConfigured, m_pMiddleMixChannelList, m_pMuxIn, CAMix::m_pMuxInControlChannelDispatcher, m_pMuxOut, m_pQueueSendToMixAfter, m_pQueueSendToMixBefore, CAMixWithReplayDB::m_pReplayDB, CAMixWithReplayDB::m_pReplayMsgProc, m_pRSA, CAMixWithReplayDB::m_u64ReferenceTime, MIXPACKET_SIZE, MONITORING_FIRE_NET_EVENT, OFB, CAMsg::printMsg(), processKeyExchange(), readFile(), REPLAY_TIMESTAMP_PROPAGATION_INTERVALL, saveFile(), CASocket::setKeepAlive(), CAASymCipher::setPublicKeyAsXML(), CASocket::setRecvBuff(), CASocket::setSendBuff(), CADatabase::start(), CAReplayCtrlChannelMsgProc::startTimeStampPorpagation(), TARGET_MIX, CASocketAddr::toString(), upstreamMemoryPostName, upstreamMemoryPreName, upstreamPostBuffer, upstreamPreBuffer, upstreamSemPostId, and upstreamSemPreId.
|
inlineprivatevirtual |
This method is not applicable to middle mixes; it does nothing.
d | ignored |
E_SUCCESS | in any case |
Reimplemented from CAMix.
Definition at line 96 of file CAMiddleMix.hpp.
References E_SUCCESS.
|
privatevirtual |
Reimplemented from CAMix.
Definition at line 51 of file CAMiddleMix.cpp.
References E_SUCCESS, E_UNKNOWN, CACmdLnOptions::getMultiSigner(), CALibProxytest::getOptions(), CAMix::m_pMultiSignature, and CAMsg::printMsg().
|
privatevirtual |
Processes Upstream-MixPackets.
Implements CAMix.
Definition at line 1485 of file CAMiddleMix.cpp.
References CAMuxSocket::close(), E_UNKNOWN, CAThread::join(), m_bRun, m_pMuxIn, m_pMuxOut, mm_loopReadFromMixAfter, mm_loopReadFromMixBefore, mm_loopSendToMixAfter, mm_loopSendToMixBefore, CAMsg::printMsg(), CAMuxSocket::setCrypt(), CAThread::setMainLoop(), and CAThread::start().
|
privatevirtual |
Processes key exchange with Mix n+1 and Mix n-1.
E_SUCCESS | if KeyExchange with Mix n+1 and Mix n-1 was succesful |
E_UNKNOWN | otherwise |
Getting the KeepAlive Traffice...
Getting and calculating the KeepAlive Traffice...
Implements CAMix.
Definition at line 84 of file CAMiddleMix.cpp.
References CAMix::addMixInfo(), CAMix::appendCompatibilityInfo(), CAMix::checkCompatibility(), createDOMDocument(), createDOMElement(), CABase64::decode(), decodeXMLEncryptedKey(), DOM_Output::dumpToMem(), E_SUCCESS, E_UNKNOWN, CABase64::encode(), encodeXMLEncryptedKey(), equals(), ev_net_keyExchangeNextFailed, ev_net_keyExchangeNextSuccessful, ev_net_keyExchangePrevFailed, ev_net_keyExchangePrevSuccessful, GET_NET_ERROR, GET_NET_ERROR_STR, CAMuxSocket::getCASocket(), getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), CACmdLnOptions::getKeepAliveRecvInterval(), CACmdLnOptions::getKeepAliveSendInterval(), CACmdLnOptions::getMixId(), CACmdLnOptions::getNextMixTestCertificate(), CALibProxytest::getOptions(), CACmdLnOptions::getPrevMixTestCertificate(), CAASymCipher::getPublicKeyAsDOMElement(), getRandom(), CACmdLnOptions::getTrustedCertificateStore(), len, CAMix::m_pMultiSignature, m_pMuxIn, m_pMuxOut, m_pRSA, CAMix::m_u32KeepAliveRecvInterval, m_u32KeepAliveRecvInterval2, CAMix::m_u32KeepAliveSendInterval, m_u32KeepAliveSendInterval2, max, MONITORING_FIRE_NET_EVENT, parseDOMDocument(), CAMsg::printMsg(), CAMuxSocket::receiveFully(), CASocket::send(), setDOMElementAttribute(), setDOMElementValue(), CACmdLnOptions::setNextMixTestCertificate(), CACmdLnOptions::setPrevMixTestCertificate(), CAASymCipher::setPublicKeyAsDOMNode(), CAMuxSocket::setReceiveKey(), CAMuxSocket::setSendKey(), CAMix::signXML(), CAMultiSignature::signXML(), CAMix::TIMEOUT_MIX_CONNECTION_ESTABLISHEMENT, CACertStore::verifyMixCert(), and CAMultiSignature::verifyXML().
Referenced by init().
|
private |
Definition at line 1421 of file CAMiddleMix.cpp.
References CAQueue::add(), E_SUCCESS, and m_pQueueSendToMixBefore.
|
friend |
SGX MIX locksem(downstreamSemPreId, SN_EMPTY); memcpy(downstreamPreBuffer,pPoolEntry, sizeof(tPoolEntry)); unlocksem(downstreamSemPreId, SN_FULL);
locksem(downstreamSemPostId, SN_FULL); memcpy(pPoolEntry,downstreamPostBuffer, sizeof(tPoolEntry)); unlocksem(downstreamSemPostId, SN_EMPTY); getRandom(pMixPacket->data,DATA_SIZE);
SGX MIX locksem(pMix->downstreamSemPreId, SN_EMPTY); memcpy(pMix->downstreamPreBuffer,pPoolEntry, sizeof(tPoolEntry)); unlocksem(pMix->downstreamSemPreId, SN_FULL);
locksem(pMix->downstreamSemPostId, SN_FULL); memcpy(pPoolEntry,pMix->downstreamPostBuffer, sizeof(tPoolEntry)); unlocksem(pMix->downstreamSemPostId, SN_EMPTY);
Definition at line 1254 of file CAMiddleMix.cpp.
Referenced by loop().
|
friend |
Definition at line 1045 of file CAMiddleMix.cpp.
Referenced by loop().
|
friend |
UPSTREAM (to WEB) Take the packets from the Queue and write them to the Socket.
Definition at line 920 of file CAMiddleMix.cpp.
Referenced by loop().
|
friend |
DOWNSTREAM (to Client) Take the packets from the Queue and write them to the Socket.
Definition at line 981 of file CAMiddleMix.cpp.
Referenced by loop().
|
private |
Definition at line 120 of file CAMiddleMix.hpp.
|
private |
Definition at line 119 of file CAMiddleMix.hpp.
|
private |
Definition at line 125 of file CAMiddleMix.hpp.
Referenced by init().
|
private |
Definition at line 124 of file CAMiddleMix.hpp.
Referenced by init().
|
private |
Definition at line 129 of file CAMiddleMix.hpp.
|
private |
Definition at line 129 of file CAMiddleMix.hpp.
|
private |
Definition at line 110 of file CAMiddleMix.hpp.
Referenced by loop().
|
private |
Definition at line 130 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), and init().
|
private |
Definition at line 111 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), and init().
|
protected |
Definition at line 104 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), init(), loop(), and processKeyExchange().
|
protected |
Definition at line 105 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), connectToNextMix(), init(), loop(), and processKeyExchange().
|
protected |
Definition at line 136 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), and init().
|
protected |
Definition at line 135 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), init(), and putMixPacketIntoQueueSendToMixBefore().
|
private |
Definition at line 107 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), clean(), init(), and processKeyExchange().
|
protected |
Definition at line 138 of file CAMiddleMix.hpp.
Referenced by processKeyExchange().
|
protected |
Definition at line 139 of file CAMiddleMix.hpp.
Referenced by processKeyExchange().
|
private |
Definition at line 118 of file CAMiddleMix.hpp.
|
private |
Definition at line 117 of file CAMiddleMix.hpp.
|
private |
Definition at line 123 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), and init().
|
private |
Definition at line 122 of file CAMiddleMix.hpp.
Referenced by CAMiddleMix(), and init().
|
private |
Definition at line 128 of file CAMiddleMix.hpp.
|
private |
Definition at line 128 of file CAMiddleMix.hpp.