Mixe for Privacy and Anonymity in the Internet
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
CAAbstractControlChannel Class Reference

The base of each control channel. More...

#include <CAAbstractControlChannel.hpp>

Inheritance diagram for CAAbstractControlChannel:
[legend]
Collaboration diagram for CAAbstractControlChannel:
[legend]

List of all members.

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.
SINT32 sendXMLMessage (const UINT8 *msgXML, UINT32 msgLen) const
 Call to send a XML message via this control channel.
UINT32 getID () const
 Returns the id of this control channel.

Protected Member Functions

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

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 ( UINT8  id,
bool  bIsEncrypted 
) [inline]

Definition at line 44 of file CAAbstractControlChannel.hpp.

References m_bIsEncrypted, m_ID, and m_pDispatcher.

      {
        m_bIsEncrypted=bIsEncrypted;
        m_ID=id;
        m_pDispatcher=NULL;
      }

Definition at line 51 of file CAAbstractControlChannel.hpp.

      {
      }

Member Function Documentation

Returns the id of this control channel.

Return values:
idof control channel

Definition at line 112 of file CAAbstractControlChannel.hpp.

References m_ID.

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

      {
        return m_ID;
      }
virtual SINT32 CAAbstractControlChannel::proccessMessage ( const UINT8 msg,
UINT32  msglen 
) [protected, pure 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().

virtual SINT32 CAAbstractControlChannel::proccessMessageComplete ( ) [protected, pure virtual]

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

Implemented in CASyncControlChannel.

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.

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().

      {
        UINT32 tlen=0xFFFF;
        UINT8* tmpB=new UINT8[tlen];
        if(DOM_Output::dumpToMem(pDocMsg,tmpB,&tlen)!=E_SUCCESS || tlen>0xFFFF)
          {
            delete[]tmpB;
            return E_SPACE;
          }
        SINT32 ret=sendXMLMessage(tmpB,tlen);
        delete[] tmpB;
        return ret;
      }

Here is the call graph for this function:

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.

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

      {
        //CAMsg::printMsg(LOG_DEBUG,"Will send xml msg over control channel\n");
        if(msgLen>0xFFFF)
          {
            return E_SPACE;
          }
        UINT32 tmpBLen=msgLen+2+16; //2for msg len and 16 for auth tag
        UINT8* tmpB=new UINT8[tmpBLen];
        if(m_bIsEncrypted)
          {
            m_pDispatcher->encryptMessage(msgXML,msgLen,tmpB+2,&tmpBLen);
          }
        else
          {
            memcpy(tmpB+2,msgXML,msgLen);
            tmpBLen=msgLen;
          }
        tmpB[0]=(UINT8)(msgLen>>8);
        tmpB[1]=(UINT8)(msgLen&0xFF);
        SINT32 ret=m_pDispatcher->sendMessages(m_ID,tmpB,tmpBLen+2);
        delete[] tmpB;
        return ret;
      }

Here is the call graph for this function:

Sets the Dispatcher.

Definition at line 130 of file CAAbstractControlChannel.hpp.

References E_SUCCESS, and m_pDispatcher.

Referenced by CAControlChannelDispatcher::registerControlChannel().

      {
        m_pDispatcher=pDispatcher;
        return E_SUCCESS;
      }

Friends And Related Function Documentation

friend class CAControlChannelDispatcher [friend]

Definition at line 136 of file CAAbstractControlChannel.hpp.


Member Data Documentation

Definition at line 139 of file CAAbstractControlChannel.hpp.

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


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