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

This class "dispatches" messages which it receives via proccessMixPacket() to the associated control channel. More...

Public Member Functions

 CAControlChannelDispatcher (CAQueue *pSendQueue, UINT8 *keyRecv, UINT8 *keySent)
 Constructs a new dispatcher. More...
 
 ~CAControlChannelDispatcher ()
 
void deleteAllControlChannels (void)
 Deregisters all control channels and calls delete on every registered control channel object. More...
 
SINT32 registerControlChannel (CAAbstractControlChannel *pControlChannel)
 Registers a control channel for receiving messages. More...
 
SINT32 removeControlChannel (UINT32 id)
 
bool proccessMixPacket (const MIXPACKET *pPacket)
 
SINT32 sendMessages (UINT32 id, const UINT8 *msg, UINT32 msglen)
 
SINT32 encryptMessage (const UINT8 *in, UINT32 inlen, UINT8 *out, UINT32 *outlen)
 Encrypts a control channel message. More...
 
SINT32 decryptMessage (const UINT8 *in, UINT32 inlen, UINT8 *out, UINT32 *outlen)
 Decrypts a control channel message, which has to be of form: cipher text auth tag - 16 bytes. More...
 
bool isKeySet ()
 Temp workaorund function - to be removed soon... More...
 

Private Attributes

CAQueuem_pSendQueue
 
MIXPACKETm_pMixPacket
 
CAAbstractControlChannel ** m_arControlChannels
 
tQueueEntrym_pQueueEntry
 
CAMutexm_pcsSendMsg
 
CAMutexm_pcsRegisterChannel
 
CAMutexm_pcsEnc
 
CAMutexm_pcsDec
 
gcm_ctx_64k * m_pGCMCtxEnc
 
gcm_ctx_64k * m_pGCMCtxDec
 
UINT32 m_nEncMsgCounter
 
UINT32m_pEncMsgIV
 
UINT32 m_nDecMsgCounter
 
UINT8m_pDecMsgIV
 

Detailed Description

This class "dispatches" messages which it receives via proccessMixPacket() to the associated control channel.

Constructor & Destructor Documentation

◆ CAControlChannelDispatcher()

CAControlChannelDispatcher::CAControlChannelDispatcher ( CAQueue pSendQueue,
UINT8 keyRecv,
UINT8 keySent 
)

Constructs a new dispatcher.

Parameters
pSendQueuesend queue in which the mix packets will be puted, if a control channel sends a message

References m_arControlChannels, m_nDecMsgCounter, m_nEncMsgCounter, m_pcsDec, m_pcsEnc, m_pcsRegisterChannel, m_pcsSendMsg, m_pDecMsgIV, m_pEncMsgIV, m_pGCMCtxDec, m_pGCMCtxEnc, m_pMixPacket, m_pQueueEntry, m_pSendQueue, and t_queue_entry::packet.

◆ ~CAControlChannelDispatcher()

CAControlChannelDispatcher::~CAControlChannelDispatcher ( )

Member Function Documentation

◆ decryptMessage()

SINT32 CAControlChannelDispatcher::decryptMessage ( const UINT8 in,
UINT32  inlen,
UINT8 out,
UINT32 outlen 
)

Decrypts a control channel message, which has to be of form: cipher text auth tag - 16 bytes.

References E_SUCCESS, CAMutex::lock(), m_nDecMsgCounter, m_pcsDec, m_pDecMsgIV, m_pGCMCtxDec, and CAMutex::unlock().

Referenced by CASyncControlChannel::proccessMessage().

◆ deleteAllControlChannels()

void CAControlChannelDispatcher::deleteAllControlChannels ( void  )

Deregisters all control channels and calls delete on every registered control channel object.

References CAMutex::lock(), m_arControlChannels, m_pcsRegisterChannel, and CAMutex::unlock().

Referenced by CAFirstMixChannelList::remove().

◆ encryptMessage()

SINT32 CAControlChannelDispatcher::encryptMessage ( const UINT8 in,
UINT32  inlen,
UINT8 out,
UINT32 outlen 
)

Encrypts a control channel message.

The output format is: cipher text auth tag - 16 bytes

References E_SUCCESS, CAMutex::lock(), m_nEncMsgCounter, m_pcsEnc, m_pEncMsgIV, m_pGCMCtxEnc, and CAMutex::unlock().

Referenced by CAAbstractControlChannel::sendXMLMessage().

◆ isKeySet()

bool CAControlChannelDispatcher::isKeySet ( )

Temp workaorund function - to be removed soon...

References m_pGCMCtxEnc.

Referenced by CASyncControlChannel::proccessMessage().

◆ proccessMixPacket()

bool CAControlChannelDispatcher::proccessMixPacket ( const MIXPACKET pPacket)

◆ registerControlChannel()

SINT32 CAControlChannelDispatcher::registerControlChannel ( CAAbstractControlChannel pControlChannel)

◆ removeControlChannel()

SINT32 CAControlChannelDispatcher::removeControlChannel ( UINT32  id)

◆ sendMessages()

SINT32 CAControlChannelDispatcher::sendMessages ( UINT32  id,
const UINT8 msg,
UINT32  msglen 
)

Member Data Documentation

◆ m_arControlChannels

CAAbstractControlChannel** CAControlChannelDispatcher::m_arControlChannels
private

◆ m_nDecMsgCounter

UINT32 CAControlChannelDispatcher::m_nDecMsgCounter
private

◆ m_nEncMsgCounter

UINT32 CAControlChannelDispatcher::m_nEncMsgCounter
private

◆ m_pcsDec

CAMutex* CAControlChannelDispatcher::m_pcsDec
private

◆ m_pcsEnc

CAMutex* CAControlChannelDispatcher::m_pcsEnc
private

◆ m_pcsRegisterChannel

CAMutex* CAControlChannelDispatcher::m_pcsRegisterChannel
private

◆ m_pcsSendMsg

CAMutex* CAControlChannelDispatcher::m_pcsSendMsg
private

◆ m_pDecMsgIV

UINT8* CAControlChannelDispatcher::m_pDecMsgIV
private

◆ m_pEncMsgIV

UINT32* CAControlChannelDispatcher::m_pEncMsgIV
private

◆ m_pGCMCtxDec

gcm_ctx_64k* CAControlChannelDispatcher::m_pGCMCtxDec
private

◆ m_pGCMCtxEnc

gcm_ctx_64k* CAControlChannelDispatcher::m_pGCMCtxEnc
private

◆ m_pMixPacket

MIXPACKET* CAControlChannelDispatcher::m_pMixPacket
private

◆ m_pQueueEntry

tQueueEntry* CAControlChannelDispatcher::m_pQueueEntry
private

◆ m_pSendQueue

CAQueue* CAControlChannelDispatcher::m_pSendQueue
private