Mixes for Privacy and Anonymity in the Internet
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CAChain Class Reference

Public Member Functions

 CAChain (UINT8 *a_chainId)
 
 ~CAChain (void)
 
UINT8getChainId ()
 
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 ()
 
UINT8getPrintableChainId ()
 
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

UINT8m_chainId
 
SINT32 m_lastAccessTime
 
CASocketm_socket
 
CAQueuem_upstreamSendQueue
 
t_channelEntrym_firstChannel
 
t_socketGroupEntrym_firstSocketGroup
 
bool m_connectionError
 
bool m_downstreamClosed
 
bool m_upstreamClosed
 
bool m_firstDownstreamPacket
 
bool m_unknownChainId
 

Constructor & Destructor Documentation

◆ CAChain()

CAChain::CAChain ( UINT8 a_chainId)

◆ ~CAChain()

CAChain::~CAChain ( void  )

Member Function Documentation

◆ addChannel()

void CAChain::addChannel ( t_lastMixBChannelListEntry a_channel,
bool  a_fastResponse 
)

◆ addDataToUpstreamQueue()

void CAChain::addDataToUpstreamQueue ( UINT8 a_buffer,
UINT32  a_size 
)

◆ addToSocketGroup()

void CAChain::addToSocketGroup ( CASocketGroupEpoll a_socketGroup)

◆ closeChainInternal()

void CAChain::closeChainInternal ( )
private

◆ closeDownstream()

void CAChain::closeDownstream ( )

References closeChainInternal().

Referenced by processDownstream().

◆ closeUpstream()

void CAChain::closeUpstream ( )

References closeChainInternal().

Referenced by CALastMixB::loop().

◆ forceImmediateResponsesInternal()

void CAChain::forceImmediateResponsesInternal ( )
private

◆ getChainId()

UINT8 * CAChain::getChainId ( )

◆ getPrintableChainId()

UINT8 * CAChain::getPrintableChainId ( )

◆ isSignaledInSocketGroup()

bool CAChain::isSignaledInSocketGroup ( CASocketGroupEpoll a_socketGroup)

◆ 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.

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(), CASymCipher::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().

◆ removeFromAllSocketGroupsInternal()

void CAChain::removeFromAllSocketGroupsInternal ( )
private

◆ removeFromSocketGroup()

void CAChain::removeFromSocketGroup ( CASocketGroupEpoll a_socketGroup)

◆ sendUpstreamData()

UINT32 CAChain::sendUpstreamData ( UINT32  a_maxLength,
CASocketGroupEpoll a_removedSocketGroup 
)

◆ sendUpstreamDataInternal()

UINT32 CAChain::sendUpstreamDataInternal ( UINT32  a_maxLength)
private

◆ setSocket()

void CAChain::setSocket ( CASocket a_socket)

References m_socket.

Referenced by getChainId(), and CALastMixB::loop().

◆ signalConnectionError()

void CAChain::signalConnectionError ( )

◆ signalUnknownChain()

void CAChain::signalUnknownChain ( )

Member Data Documentation

◆ m_chainId

UINT8* CAChain::m_chainId
private

◆ m_connectionError

bool CAChain::m_connectionError
private

◆ m_downstreamClosed

bool CAChain::m_downstreamClosed
private

◆ m_firstChannel

t_channelEntry* CAChain::m_firstChannel
private

◆ m_firstDownstreamPacket

bool CAChain::m_firstDownstreamPacket
private

◆ m_firstSocketGroup

t_socketGroupEntry* CAChain::m_firstSocketGroup
private

◆ m_lastAccessTime

SINT32 CAChain::m_lastAccessTime
private

◆ m_socket

CASocket* CAChain::m_socket
private

◆ m_unknownChainId

bool CAChain::m_unknownChainId
private

◆ m_upstreamClosed

bool CAChain::m_upstreamClosed
private

◆ m_upstreamSendQueue

CAQueue* CAChain::m_upstreamSendQueue
private