29 #ifdef REPLAY_DETECTION
41 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc - constructor - this=%p\n",
this);
53 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc - constructor - registering downstream replay control channel\n",
this);
63 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc - constructor - registering upstream replay control channel\n",
this);
73 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc::~CAReplayCtrlChannelMsgProc()\n");
125 pglobalOptions->getMixId(buff,255);
126 if(strMixID==NULL||strncmp((
char*)strMixID,(
char*)buff,255)==0)
134 DOMElement* elemReplayTimestamp=NULL;
147 doc->appendChild(elemGet);
164 pglobalOptions->getMixId(buff,255);
173 DOMElement* elemReplayTimestamp=NULL;
192 while(pReplayMsgProc->
m_bRun)
194 if(propagationInterval==0)
200 propagationInterval--;
246 pglobalOptions->getMixId(buff,255);
252 elemMix->appendChild(elemReplay);
255 elemReplay->appendChild(elemReplayOffset);
258 elemReplay->appendChild(elemReplayBase);
269 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc::proccessGotTimestamp() \n");
277 elemMix->appendChild(elemReplay);
280 elemReplay->appendChild(elemReplayOffset);
281 doc->appendChild(elemMix);
296 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc::proccessGotTimestamp() - MixID: %s\n",strMixID);
297 CAMsg::printMsg(LOG_DEBUG,
"CAReplayCtrlChannelMsgProc::proccessGotTimestamp() - LastTimestamp DIFF: %d\n",time(NULL)-
pMix->m_u64LastTimestampReceived);
305 pMix->setMixParameters(params);
307 pMix->m_u64LastTimestampReceived=time(NULL);
315 if(strMixID==NULL||strlen((
const char*)strMixID)>400)
321 doc->appendChild(elemGet);
THREAD_RETURN rp_loopPropagateTimestamp(void *param)
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value)
SINT32 setDOMElementValue(DOMElement *pElem, SINT32 value)
SINT32 sSleep(UINT32 sec)
Sleeps sec Seconds.
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument()
Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in...
DOMElement * createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const name)
Creates a new DOMElement with the given name which belongs to the DOMDocument owernDoc.
SINT32 getDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
#define THREAD_RETURN_SUCCESS
SINT32 sendXMLMessage(const XERCES_CPP_NAMESPACE::DOMDocument *pDocMsg) const
Call to send a XML message via this control channel.
UINT32 getID() const
Returns the id of this control channel.
This class "dispatches" messages which it receives via proccessMixPacket() to the associated control ...
SINT32 removeControlChannel(UINT32 id)
SINT32 registerControlChannel(CAAbstractControlChannel *pControlChannel)
Registers a control channel for receiving messages.
CAControlChannelDispatcher * getDownstreamControlChannelDispatcher() const
virtual tMixType getType() const =0
CAControlChannelDispatcher * getUpstreamControlChannelDispatcher() const
This class (interface) adds the functionality used by last and middle mixes to detecte replays.
UINT64 m_u64ReferenceTime
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
A Control channel for the exchange of the current replay detection timestamps.
CAThread * m_pThreadTimestampPropagation
SINT32 proccessGotTimestamp(const CAReplayControlChannel *pReceiver, const UINT8 *strMixID, const UINT32 offset) const
Proccesses a received replay timestamp rt from mix strMixID.
SINT32 initTimestampsMessageTemplate()
We initialise the template used to generate the idividual responses to gettimestamps requests accordi...
UINT32 m_u32PropagationInterval
CAReplayControlChannel * m_pDownstreamReplayControlChannel
SINT32 stopTimeStampPorpagation()
Stops the timestamp propagation.
const CAMixWithReplayDB * m_pMix
SINT32 propagateCurrentReplayTimestamp()
Propagates downstream the current replay timestamp.
CAReplayCtrlChannelMsgProc(const CAMixWithReplayDB *pMix)
Initialises the replay control channel messages processor with the necessary information.
friend THREAD_RETURN rp_loopPropagateTimestamp(void *param)
~CAReplayCtrlChannelMsgProc()
SINT32 proccessGetTimestamp(const CAReplayControlChannel *pReceiver, const UINT8 *strMixID) const
Proccesses a getTimeStamps request on a reply control channel.
XERCES_CPP_NAMESPACE::DOMDocument * m_docTemplate
CAReplayControlChannel * m_pUpstreamReplayControlChannel
SINT32 sendGetTimestamp(const UINT8 *strMixID)
Sends upstram a request for the replay timestamp for the given mix.
SINT32 startTimeStampPorpagation(UINT32 minutesPropagationIntervall)
Sends the current replay timestamp periodically on the downstream replay control channel.
SINT32 start(void *param, bool bDaemon=false, bool bSilent=false)
Starts the execution of the main function of this thread.
SINT32 setMainLoop(THREAD_MAIN_TYP fnc)
Sets the main function which will be executed within this thread.
SINT32 join()
Waits for the main function to finish execution.