Mixe for Privacy and Anonymity in the Internet
|
#include <CAChain.hpp>
Public Member Functions | |
CAChain (UINT8 *a_chainId) | |
~CAChain (void) | |
UINT8 * | getChainId () |
void | setSocket (CASocket *a_socket) |
void | addChannel (t_lastMixBChannelListEntry *a_channel, bool a_fastResponse) |
void | addDataToUpstreamQueue (UINT8 *a_buffer, UINT32 a_size) |
void | signalConnectionError () |
void | signalUnknownChain () |
void | closeUpstream () |
void | closeDownstream () |
UINT8 * | getPrintableChainId () |
void | addToSocketGroup (CASocketGroupEpoll *a_socketGroup) |
void | removeFromSocketGroup (CASocketGroupEpoll *a_socketGroup) |
bool | isSignaledInSocketGroup (CASocketGroupEpoll *a_socketGroup) |
UINT32 | sendUpstreamData (UINT32 a_maxLength, CASocketGroupEpoll *a_removedSocketGroup) |
SINT32 | processDownstream (CASocketGroupEpoll *a_signalingGroup, MIXPACKET *a_downstreamPacket, UINT32 *a_processedBytes) |
Returns: 0, if a packet was created. More... | |
Private Member Functions | |
void | closeChainInternal () |
void | forceImmediateResponsesInternal () |
void | removeFromAllSocketGroupsInternal () |
UINT32 | sendUpstreamDataInternal (UINT32 a_maxLength) |
Private Attributes | |
UINT8 * | m_chainId |
SINT32 | m_lastAccessTime |
CASocket * | m_socket |
CAQueue * | m_upstreamSendQueue |
t_channelEntry * | m_firstChannel |
t_socketGroupEntry * | m_firstSocketGroup |
bool | m_connectionError |
bool | m_downstreamClosed |
bool | m_upstreamClosed |
bool | m_firstDownstreamPacket |
bool | m_unknownChainId |
Definition at line 64 of file CAChain.hpp.
CAChain::CAChain | ( | UINT8 * | a_chainId | ) |
Definition at line 40 of file CAChain.cpp.
References DATA_SIZE, getcurrentTimeMicros(), m_chainId, m_connectionError, m_downstreamClosed, m_firstChannel, m_firstDownstreamPacket, m_firstSocketGroup, m_lastAccessTime, m_socket, m_unknownChainId, m_upstreamClosed, and m_upstreamSendQueue.
CAChain::~CAChain | ( | void | ) |
Definition at line 68 of file CAChain.cpp.
References t_lastMixBChannelListEntry::associatedChannelList, chainId, t_channelEntry::channel, t_lastMixBChannelListEntry::channelCipher, CAQueue::clean(), CASocket::close(), diff64(), t_lastMixBChannelListEntry::firstResponseDeadline, getcurrentTimeMicros(), getPrintableChainId(), m_chainId, m_firstChannel, m_socket, m_upstreamSendQueue, t_channelEntry::nextChannel, t_deadlineEntry::nextDeadline, CAMsg::printMsg(), removeFromAllSocketGroupsInternal(), and CALastMixBChannelList::removeFromTable().
void CAChain::addChannel | ( | t_lastMixBChannelListEntry * | a_channel, |
bool | a_fastResponse | ||
) |
Definition at line 485 of file CAChain.cpp.
References t_channelEntry::channel, CHANNEL_DOWNSTREAM_PACKETS, CHANNEL_TIMEOUT, t_deadlineEntry::deadline, t_lastMixBChannelListEntry::firstResponseDeadline, forceImmediateResponsesInternal(), getcurrentTime(), m_downstreamClosed, m_firstChannel, m_lastAccessTime, m_upstreamClosed, t_channelEntry::nextChannel, t_deadlineEntry::nextDeadline, t_lastMixBChannelListEntry::remainingDownstreamPackets, and signalConnectionError().
Referenced by CALastMixB::loop().
Definition at line 444 of file CAChain.cpp.
References CAQueue::add(), m_upstreamClosed, and m_upstreamSendQueue.
Referenced by CALastMixB::loop().
void CAChain::addToSocketGroup | ( | CASocketGroupEpoll * | a_socketGroup | ) |
Definition at line 372 of file CAChain.cpp.
References CASocketGroup::add(), m_firstSocketGroup, m_socket, t_socketGroupEntry::nextSocketGroup, and t_socketGroupEntry::socketGroup.
Referenced by CALastMixB::loop().
|
private |
Definition at line 567 of file CAChain.cpp.
References CAQueue::clean(), CASocket::close(), forceImmediateResponsesInternal(), m_downstreamClosed, m_socket, m_upstreamClosed, m_upstreamSendQueue, and removeFromAllSocketGroupsInternal().
Referenced by closeDownstream(), closeUpstream(), processDownstream(), signalConnectionError(), and signalUnknownChain().
void CAChain::closeDownstream | ( | ) |
Definition at line 460 of file CAChain.cpp.
References closeChainInternal().
Referenced by processDownstream().
void CAChain::closeUpstream | ( | ) |
Definition at line 455 of file CAChain.cpp.
References closeChainInternal().
Referenced by CALastMixB::loop().
|
private |
Definition at line 581 of file CAChain.cpp.
References t_channelEntry::channel, t_deadlineEntry::deadline, t_lastMixBChannelListEntry::firstResponseDeadline, getcurrentTime(), m_firstChannel, t_channelEntry::nextChannel, and t_deadlineEntry::nextDeadline.
Referenced by addChannel(), and closeChainInternal().
UINT8 * CAChain::getChainId | ( | ) |
Definition at line 123 of file CAChain.cpp.
References m_chainId.
Referenced by CAChainTable::getEntryInternal(), and CALastMixB::loop().
UINT8 * CAChain::getPrintableChainId | ( | ) |
Definition at line 479 of file CAChain.cpp.
References bytes2hex(), CHAIN_ID_LENGTH, m_chainId, and strtrim().
Referenced by processDownstream(), and ~CAChain().
bool CAChain::isSignaledInSocketGroup | ( | CASocketGroupEpoll * | a_socketGroup | ) |
Definition at line 356 of file CAChain.cpp.
References CASocketGroupEpoll::isSignaled(), and m_socket.
Referenced by CALastMixB::loop(), and processDownstream().
SINT32 CAChain::processDownstream | ( | CASocketGroupEpoll * | a_signalingGroup, |
MIXPACKET * | a_downstreamPacket, | ||
UINT32 * | a_processedBytes | ||
) |
Returns: 0, if a packet was created.
1, if currently nothing can be done. 2, if a packet was created and the chain can be removed from the chaintable. 3, if no packet was created, but the chain can be removed from the chaintable.
Definition at line 146 of file CAChain.cpp.
References t_lastMixBChannelListEntry::associatedChannelList, CHAIN_ID_LENGTH, CHAIN_TIMEOUT, CHAINFLAG_CONNECTION_ERROR, CHAINFLAG_STREAM_CLOSED, CHAINFLAG_UNKNOWN_CHAIN, chainId, t_first_downstream_chain_cell::chainId, t_channelEntry::channel, t_MixPacket::channel, CHANNEL_CLOSE, CHANNEL_DATA, t_lastMixBChannelListEntry::channelCipher, t_lastMixBChannelListEntry::channelId, closeChainInternal(), closeDownstream(), CASymChannelCipher::crypt2(), t_MixPacket::data, t_first_downstream_chain_cell::data, t_sequel_downstream_chain_cell::data, DATA_SIZE, t_deadlineEntry::deadline, DEADLINE_TIMEOUT, t_downstream_chain_cell::firstCell, t_lastMixBChannelListEntry::firstResponseDeadline, t_MixPacket::flags, getcurrentTime(), getPrintableChainId(), getRandom(), isSignaledInSocketGroup(), t_downstream_chain_cell::lengthAndFlags, m_chainId, m_connectionError, m_downstreamClosed, m_firstChannel, m_firstDownstreamPacket, m_lastAccessTime, m_socket, m_unknownChainId, m_upstreamClosed, MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD, MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD, min, t_channelEntry::nextChannel, t_deadlineEntry::nextDeadline, CAMsg::printMsg(), CASocket::receive(), t_lastMixBChannelListEntry::remainingDownstreamPackets, CALastMixBChannelList::removeFromTable(), t_downstream_chain_cell::sequelCell, and signalConnectionError().
Referenced by CALastMixB::loop().
|
private |
Definition at line 605 of file CAChain.cpp.
References m_firstSocketGroup, m_socket, t_socketGroupEntry::nextSocketGroup, CASocketGroupEpoll::remove(), and t_socketGroupEntry::socketGroup.
Referenced by closeChainInternal(), and ~CAChain().
void CAChain::removeFromSocketGroup | ( | CASocketGroupEpoll * | a_socketGroup | ) |
Definition at line 406 of file CAChain.cpp.
References m_firstSocketGroup, m_socket, t_socketGroupEntry::nextSocketGroup, CASocketGroup::remove(), and t_socketGroupEntry::socketGroup.
Referenced by sendUpstreamData().
UINT32 CAChain::sendUpstreamData | ( | UINT32 | a_maxLength, |
CASocketGroupEpoll * | a_removedSocketGroup | ||
) |
Definition at line 431 of file CAChain.cpp.
References CAQueue::isEmpty(), m_upstreamSendQueue, removeFromSocketGroup(), and sendUpstreamDataInternal().
Referenced by CALastMixB::loop().
Definition at line 616 of file CAChain.cpp.
References E_SUCCESS, m_socket, m_upstreamClosed, m_upstreamSendQueue, CAQueue::peek(), CAQueue::remove(), CASocket::send(), and signalConnectionError().
Referenced by sendUpstreamData().
void CAChain::setSocket | ( | CASocket * | a_socket | ) |
Definition at line 134 of file CAChain.cpp.
References m_socket.
Referenced by CALastMixB::loop().
void CAChain::signalConnectionError | ( | ) |
Definition at line 465 of file CAChain.cpp.
References closeChainInternal(), and m_connectionError.
Referenced by addChannel(), CALastMixB::loop(), processDownstream(), and sendUpstreamDataInternal().
void CAChain::signalUnknownChain | ( | ) |
Definition at line 471 of file CAChain.cpp.
References closeChainInternal(), m_firstDownstreamPacket, and m_unknownChainId.
Referenced by CALastMixB::loop().
|
private |
Definition at line 100 of file CAChain.hpp.
Referenced by CAChain(), getChainId(), getPrintableChainId(), processDownstream(), and ~CAChain().
|
private |
Definition at line 106 of file CAChain.hpp.
Referenced by CAChain(), processDownstream(), and signalConnectionError().
|
private |
Definition at line 107 of file CAChain.hpp.
Referenced by addChannel(), CAChain(), closeChainInternal(), and processDownstream().
|
private |
Definition at line 104 of file CAChain.hpp.
Referenced by addChannel(), CAChain(), forceImmediateResponsesInternal(), processDownstream(), and ~CAChain().
|
private |
Definition at line 109 of file CAChain.hpp.
Referenced by CAChain(), processDownstream(), and signalUnknownChain().
|
private |
Definition at line 105 of file CAChain.hpp.
Referenced by addToSocketGroup(), CAChain(), removeFromAllSocketGroupsInternal(), and removeFromSocketGroup().
|
private |
Definition at line 101 of file CAChain.hpp.
Referenced by addChannel(), CAChain(), and processDownstream().
|
private |
Definition at line 102 of file CAChain.hpp.
Referenced by addToSocketGroup(), CAChain(), closeChainInternal(), isSignaledInSocketGroup(), processDownstream(), removeFromAllSocketGroupsInternal(), removeFromSocketGroup(), sendUpstreamDataInternal(), setSocket(), and ~CAChain().
|
private |
Definition at line 110 of file CAChain.hpp.
Referenced by CAChain(), processDownstream(), and signalUnknownChain().
|
private |
Definition at line 108 of file CAChain.hpp.
Referenced by addChannel(), addDataToUpstreamQueue(), CAChain(), closeChainInternal(), processDownstream(), and sendUpstreamDataInternal().
|
private |
Definition at line 103 of file CAChain.hpp.
Referenced by addDataToUpstreamQueue(), CAChain(), closeChainInternal(), sendUpstreamData(), sendUpstreamDataInternal(), and ~CAChain().