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

A Control channel for the exchange of the current replay detection timestamps. More...

#include <CAReplayControlChannel.hpp>

Inheritance diagram for CAReplayControlChannel:
Collaboration diagram for CAReplayControlChannel:

Public Member Functions

 CAReplayControlChannel (const CAReplayCtrlChannelMsgProc *pProcessor)
 
virtual ~CAReplayControlChannel (void)
 
virtual SINT32 processXMLMessage (const XERCES_CPP_NAMESPACE::DOMDocument *doc)
 Reads incoming replay timestamps or timestamp requests and delegates them to the associated CAReplayCtrlChannelMsgProc. More...
 
- Public Member Functions inherited from CASyncControlChannel
 CASyncControlChannel (UINT8 id, bool bIsEncrypted)
 Constructor for a synchronized (e.g. More...
 
virtual ~CASyncControlChannel ()
 
- Public Member Functions inherited from CAAbstractControlChannel
 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...
 

Private Attributes

const CAReplayCtrlChannelMsgProcm_pProcessor
 

Additional Inherited Members

- Protected Member Functions inherited from CASyncControlChannel
SINT32 proccessMessage (const UINT8 *msg, UINT32 msglen)
 Processes some bytes of a message we got from the communication channel. More...
 
SINT32 proccessMessageComplete ()
 Parses the bytes in m_MsgBuff and calls processXMLMessage() More...
 
- Protected Member Functions inherited from CAAbstractControlChannel
SINT32 setDispatcher (CAControlChannelDispatcher *pDispatcher)
 Sets the Dispatcher. More...
 
- Protected Attributes inherited from CASyncControlChannel
UINT8m_MsgBuff
 buffer for assembling the parts of the message More...
 
UINT32 m_aktIndex
 how much bytes have we received already? More...
 
UINT32 m_MsgBytesLeft
 how much bytes we need until all bytes are received? More...
 
- Protected Attributes inherited from CAAbstractControlChannel
CAControlChannelDispatcherm_pDispatcher
 
bool m_bIsEncrypted
 
UINT32 m_ID
 

Detailed Description

A Control channel for the exchange of the current replay detection timestamps.

Definition at line 36 of file CAReplayControlChannel.hpp.

Constructor & Destructor Documentation

◆ CAReplayControlChannel()

CAReplayControlChannel::CAReplayControlChannel ( const CAReplayCtrlChannelMsgProc pProcessor)

Definition at line 33 of file CAReplayControlChannel.cpp.

35  {
36  #ifdef DEBUG
37  CAMsg::printMsg(LOG_DEBUG,"CAReplayControlChannel - constructor - pProcessor=%p\n",pProcessor);
38  #endif
39  m_pProcessor=pProcessor;
40  }
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
Definition: CAMsg.cpp:251
const CAReplayCtrlChannelMsgProc * m_pProcessor
CASyncControlChannel(UINT8 id, bool bIsEncrypted)
Constructor for a synchronized (e.g.
#define REPLAY_CONTROL_CHANNEL_ID

References m_pProcessor, and CAMsg::printMsg().

Here is the call graph for this function:

◆ ~CAReplayControlChannel()

CAReplayControlChannel::~CAReplayControlChannel ( void  )
virtual

Definition at line 42 of file CAReplayControlChannel.cpp.

43  {
44  //@todo: delete m_MsgBuff of superclass CASyncControlChannel
45  }

Member Function Documentation

◆ processXMLMessage()

SINT32 CAReplayControlChannel::processXMLMessage ( const XERCES_CPP_NAMESPACE::DOMDocument *  doc)
virtual

Reads incoming replay timestamps or timestamp requests and delegates them to the associated CAReplayCtrlChannelMsgProc.

See also
CAReplayCtrlChannelMsgProc

Implements CASyncControlChannel.

Definition at line 47 of file CAReplayControlChannel.cpp.

48  {
49  #ifdef DEBUG
50  CAMsg::printMsg(LOG_DEBUG,"CAReplayControlChannel::processXMLMessage()\n");
51  #endif
52  DOMElement* elemRoot=doc->getDocumentElement();
53  if(elemRoot==NULL)
54  return E_UNKNOWN;
55 
56  if(equals(elemRoot->getNodeName(),"GetTimestamp"))
57  {
58  UINT8 buff[255];
59  UINT32 bufflen=255;
60  if(getDOMElementAttribute(elemRoot,"id",buff,&bufflen)!=E_SUCCESS)
61  return E_UNKNOWN;
62  buff[bufflen]=0;
64  }
65  else if(equals(elemRoot->getNodeName(),"Mix"))
66  {
67  #ifdef DEBUG
68  CAMsg::printMsg(LOG_DEBUG,"CAReplayControlChannel::processXMLMessage() - got a timestamp\n");
69  #endif
70  UINT8 buff[255];
71  UINT32 bufflen=255;
72  if(getDOMElementAttribute(elemRoot,"id",buff,&bufflen)!=E_SUCCESS)
73  return E_UNKNOWN;
74  buff[bufflen]=0;
75  DOMElement *child;
76  getDOMChildByName(elemRoot,"Replay",child,false);
77  DOMElement *elemReplayTimestamp;
78  getDOMChildByName(child,"ReplayOffset",elemReplayTimestamp,false);
79  UINT32 offset=0;
80  if( getDOMElementValue(elemReplayTimestamp,offset,0)!=E_SUCCESS)
81  return E_UNKNOWN;
82  #ifdef DEBUG
83  CAMsg::printMsg(LOG_DEBUG,"CAReplayControlChannel::processXMLMessage() - call m_pProcessor->proccessGotTimestamp() - m_pProcessor=%p\n",m_pProcessor);
84  #endif
85  m_pProcessor->proccessGotTimestamp(this,buff,offset);
86  }
87  return E_SUCCESS;
88  }
SINT32 getDOMElementValue(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
Returns the content of the text node(s) under elem as null-terminated C String.
Definition: CAUtil.cpp:746
bool equals(const XMLCh *const e1, const char *const e2)
Definition: CAUtil.cpp:645
SINT32 getDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
Definition: CAUtil.cpp:458
SINT32 getDOMElementAttribute(const DOMNode *const elem, const char *attrName, UINT8 *value, UINT32 *len)
Definition: CAUtil.cpp:780
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
SINT32 proccessGotTimestamp(const CAReplayControlChannel *pReceiver, const UINT8 *strMixID, const UINT32 offset) const
Proccesses a received replay timestamp rt from mix strMixID.
SINT32 proccessGetTimestamp(const CAReplayControlChannel *pReceiver, const UINT8 *strMixID) const
Proccesses a getTimeStamps request on a reply control channel.
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2
#define E_UNKNOWN
Definition: errorcodes.hpp:3

References E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), m_pProcessor, CAMsg::printMsg(), CAReplayCtrlChannelMsgProc::proccessGetTimestamp(), and CAReplayCtrlChannelMsgProc::proccessGotTimestamp().

Here is the call graph for this function:

Member Data Documentation

◆ m_pProcessor

const CAReplayCtrlChannelMsgProc* CAReplayControlChannel::m_pProcessor
private

Definition at line 50 of file CAReplayControlChannel.hpp.

Referenced by CAReplayControlChannel(), and processXMLMessage().


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