Mixe for Privacy and Anonymity in the Internet
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CAAbstractControlChannel Class Referenceabstract

The base of each control channel. More...

#include <CAAbstractControlChannel.hpp>

Inheritance diagram for CAAbstractControlChannel:
Collaboration diagram for CAAbstractControlChannel:

Public Member Functions

 CAAbstractControlChannel (UINT8 id, bool bIsEncrypted)
 
virtual ~CAAbstractControlChannel ()
 
SINT32 sendXMLMessage (const XERCES_CPP_NAMESPACE::DOMDocument *pDocMsg) const
 Call to send a XML message via this control channel. More...
 
SINT32 sendXMLMessage (const UINT8 *msgXML, UINT32 msgLen) const
 Call to send a XML message via this control channel. More...
 
UINT32 getID () const
 Returns the id of this control channel. More...
 

Protected Member Functions

virtual SINT32 proccessMessage (const UINT8 *msg, UINT32 msglen)=0
 Processes some bytes of a message we got from the communication channel. More...
 
virtual SINT32 proccessMessageComplete ()=0
 Called if a whole messages was received, which should be delivered to the final recipient. More...
 
SINT32 setDispatcher (CAControlChannelDispatcher *pDispatcher)
 Sets the Dispatcher. More...
 

Protected Attributes

CAControlChannelDispatcherm_pDispatcher
 
bool m_bIsEncrypted
 
UINT32 m_ID
 

Friends

class CAControlChannelDispatcher
 

Detailed Description

The base of each control channel.

Controls channels should be derived from CASyncControlChannel or CAASyncControlChannel

Definition at line 41 of file CAAbstractControlChannel.hpp.

Constructor & Destructor Documentation

◆ CAAbstractControlChannel()

CAAbstractControlChannel::CAAbstractControlChannel ( UINT8  id,
bool  bIsEncrypted 
)
inline

Definition at line 44 of file CAAbstractControlChannel.hpp.

45  {
46  m_bIsEncrypted=bIsEncrypted;
47  m_ID=id;
48  m_pDispatcher=NULL;
49  }
CAControlChannelDispatcher * m_pDispatcher

References m_bIsEncrypted, m_ID, and m_pDispatcher.

◆ ~CAAbstractControlChannel()

virtual CAAbstractControlChannel::~CAAbstractControlChannel ( )
inlinevirtual

Definition at line 51 of file CAAbstractControlChannel.hpp.

52  {
53  }

Member Function Documentation

◆ getID()

UINT32 CAAbstractControlChannel::getID ( ) const
inline

Returns the id of this control channel.

Return values
idof control channel

Definition at line 112 of file CAAbstractControlChannel.hpp.

113  {
114  return m_ID;
115  }

References m_ID.

Referenced by CAControlChannelDispatcher::registerControlChannel(), and CAReplayCtrlChannelMsgProc::~CAReplayCtrlChannelMsgProc().

Here is the caller graph for this function:

◆ proccessMessage()

virtual SINT32 CAAbstractControlChannel::proccessMessage ( const UINT8 msg,
UINT32  msglen 
)
protectedpure virtual

Processes some bytes of a message we got from the communication channel.

We reassemble this fragments in a buffer. If all parts are received we call proccessMessagesComplete()

Implemented in CASyncControlChannel.

Referenced by CAControlChannelDispatcher::proccessMixPacket().

Here is the caller graph for this function:

◆ proccessMessageComplete()

virtual SINT32 CAAbstractControlChannel::proccessMessageComplete ( )
protectedpure virtual

Called if a whole messages was received, which should be delivered to the final recipient.

Implemented in CASyncControlChannel.

◆ sendXMLMessage() [1/2]

SINT32 CAAbstractControlChannel::sendXMLMessage ( const UINT8 msgXML,
UINT32  msgLen 
) const
inline

Call to send a XML message via this control channel.

Parameters
msgXMLbuffer which holds the serialized XML message
msgLensize of msgXML
Return values
E_SPACE,ifthe serialized XML message is bigger than 0xFFFF bytes
E_SUCCESS,ifthe message that successful send
E_UNKNOWN,incase of an error

Definition at line 84 of file CAAbstractControlChannel.hpp.

85  {
86  //CAMsg::printMsg(LOG_DEBUG,"Will send xml msg over control channel\n");
87  if(msgLen>0xFFFF)
88  {
89  return E_SPACE;
90  }
91  UINT32 tmpBLen=msgLen+2+16; //2for msg len and 16 for auth tag
92  UINT8* tmpB=new UINT8[tmpBLen];
93  if(m_bIsEncrypted)
94  {
95  m_pDispatcher->encryptMessage(msgXML,msgLen,tmpB+2,&tmpBLen);
96  }
97  else
98  {
99  memcpy(tmpB+2,msgXML,msgLen);
100  tmpBLen=msgLen;
101  }
102  tmpB[0]=(UINT8)(msgLen>>8);
103  tmpB[1]=(UINT8)(msgLen&0xFF);
104  SINT32 ret=m_pDispatcher->sendMessages(m_ID,tmpB,tmpBLen+2);
105  delete[] tmpB;
106  return ret;
107  }
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
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.
#define E_SPACE
Definition: errorcodes.hpp:7

References E_SPACE, CAControlChannelDispatcher::encryptMessage(), m_bIsEncrypted, m_ID, m_pDispatcher, and CAControlChannelDispatcher::sendMessages().

Here is the call graph for this function:

◆ sendXMLMessage() [2/2]

SINT32 CAAbstractControlChannel::sendXMLMessage ( const XERCES_CPP_NAMESPACE::DOMDocument *  pDocMsg) const
inline

Call to send a XML message via this control channel.

Note that this message can not be bigger than 64 KBytes.

Parameters
docMsgXML document to sent over this control channel
Return values
E_SPACE,ifthe serialized XML message is bigger than 0xFFFF bytes
E_SUCCESS,ifthe message that successful send
E_UNKNOWN,incase of an error

Definition at line 62 of file CAAbstractControlChannel.hpp.

63  {
64  UINT32 tlen=0xFFFF;
65  UINT8* tmpB=new UINT8[tlen];
66  if(DOM_Output::dumpToMem(pDocMsg,tmpB,&tlen)!=E_SUCCESS || tlen>0xFFFF)
67  {
68  delete[]tmpB;
69  return E_SPACE;
70  }
71  SINT32 ret=sendXMLMessage(tmpB,tlen);
72  delete[] tmpB;
73  return ret;
74  }
SINT32 sendXMLMessage(const XERCES_CPP_NAMESPACE::DOMDocument *pDocMsg) const
Call to send a XML message via this control channel.
static SINT32 dumpToMem(const DOMNode *node, UINT8 *buff, UINT32 *size)
Dumps the node and all childs into buff.
Definition: DOM_Output.hpp:161
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2

References DOM_Output::dumpToMem(), E_SPACE, and E_SUCCESS.

Referenced by CAAccountingInstance::finishLoginProcess(), CAFirstMixChannelList::forceKickout(), CAAccountingInstance::handleAccountCertificate_internal(), CAAccountingInstance::handleChallengeResponse_internal(), CAAccountingInstance::handleCostConfirmation_internal(), CAAccountingInstance::handleJapPacket_internal(), CAReplayCtrlChannelMsgProc::proccessGetTimestamp(), CAReplayCtrlChannelMsgProc::proccessGotTimestamp(), CAAccountingInstance::processJapMessageLoginHelper(), CAReplayCtrlChannelMsgProc::propagateCurrentReplayTimestamp(), CAAccountingInstance::returnPrepareKickout(), CAAccountingInstance::sendAILoginConfirmation(), CAAccountingInstance::sendCCRequest(), CAReplayCtrlChannelMsgProc::sendGetTimestamp(), and CAAccountingInstance::sendInitialCCRequest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDispatcher()

SINT32 CAAbstractControlChannel::setDispatcher ( CAControlChannelDispatcher pDispatcher)
inlineprotected

Sets the Dispatcher.

Definition at line 130 of file CAAbstractControlChannel.hpp.

131  {
132  m_pDispatcher=pDispatcher;
133  return E_SUCCESS;
134  }

References E_SUCCESS, and m_pDispatcher.

Referenced by CAControlChannelDispatcher::registerControlChannel().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CAControlChannelDispatcher

friend class CAControlChannelDispatcher
friend

Definition at line 136 of file CAAbstractControlChannel.hpp.

Member Data Documentation

◆ m_bIsEncrypted

bool CAAbstractControlChannel::m_bIsEncrypted
protected

◆ m_ID

UINT32 CAAbstractControlChannel::m_ID
protected

Definition at line 139 of file CAAbstractControlChannel.hpp.

Referenced by CAAbstractControlChannel(), getID(), and sendXMLMessage().

◆ m_pDispatcher

CAControlChannelDispatcher* CAAbstractControlChannel::m_pDispatcher
protected

The documentation for this class was generated from the following file: