# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLNET::CMessageRecorder Class Reference

Message recorder. More...

#include <message_recorder.h>

List of all members.

Public Methods

 CMessageRecorder ()
 Constructor. More...

 ~CMessageRecorder ()
 Destructor. More...

bool startRecord (const std::string &filename, bool recordall=true)
 Start recording. More...

void recordNext (sint64 updatecounter, TNetworkEvent event, TSockId sockid, CMessage &message)
 Add a record. More...

void stopRecord ()
 Stop recording. More...

bool startReplay (const std::string &filename)
 Start replaying. More...

void replayNextDataAvailable (sint64 updatecounter)
 Push the received blocks for this counter into the receive queue. More...

TNetworkEvent checkNextOne (sint64 updatecounter)
 Returns the event type if the counter of the next event is updatecounter, and skip it; otherwise return Error. More...

TNetworkEvent replayConnectionAttempt (const CInetAddress &addr)
 Get the first stored connection attempt corresponding to addr. More...

void stopReplay ()
 Stop playback. More...


Public Attributes

std::queue< NLNET::TMessageRecordReceivedMessages
 Receive queue (corresponding to one update count). Use empty(), front(), pop(). More...


Protected Methods

bool loadNext (TMessageRecord &record)
 Load the next record from the file (throws EStreamOverflow). More...

bool getNext (TMessageRecord &record, sint64 updatecounter)
 Get the next record (from the preloaded records, or from the file). More...


Private Attributes

std::fstream _File
std::string _Filename
std::deque< TMessageRecord_PreloadedRecords
std::deque< TMessageRecord_ConnectionAttempts
bool _RecordAll


Detailed Description

Message recorder.

The service performs sends normally. They are intercepted and the recorder plays the receives back. No communication with other hosts. Warning: it works only with messages as plain text.

Author:
Olivier Cado , Nevrax France
Date:
2001

Definition at line 116 of file message_recorder.h.


Constructor & Destructor Documentation

NLNET::CMessageRecorder::CMessageRecorder  
 

Constructor.

Definition at line 79 of file message_recorder.cpp.

References nlerror.

NLNET::CMessageRecorder::~CMessageRecorder  
 

Destructor.

Definition at line 90 of file message_recorder.cpp.

References _Filename, nldebug, stopRecord, and stopReplay.


Member Function Documentation

TNetworkEvent NLNET::CMessageRecorder::checkNextOne sint64    updatecounter
 

Returns the event type if the counter of the next event is updatecounter, and skip it; otherwise return Error.

Definition at line 308 of file message_recorder.cpp.

References NLNET::EventToString, getNext, nldebug, and NLNET::TNetworkEvent.

bool NLNET::CMessageRecorder::getNext TMessageRecord   record,
sint64    updatecounter
[protected]
 

Get the next record (from the preloaded records, or from the file).

Definition at line 230 of file message_recorder.cpp.

References _PreloadedRecords, loadNext, and nlassert.

Referenced by checkNextOne, and replayNextDataAvailable.

bool NLNET::CMessageRecorder::loadNext TMessageRecord   record [protected]
 

Load the next record from the file (throws EStreamOverflow).

Definition at line 198 of file message_recorder.cpp.

References _File, _Filename, nlassert, nldebug, and nlstop.

Referenced by getNext, and replayConnectionAttempt.

void NLNET::CMessageRecorder::recordNext sint64    updatecounter,
TNetworkEvent    event,
TSockId    sockid,
CMessage   message
 

Add a record.

Definition at line 141 of file message_recorder.cpp.

References _File, _Filename, nlassert, nldebug, NLNET::Sending, NLNET::TNetworkEvent, and NLNET::TSockId.

TNetworkEvent NLNET::CMessageRecorder::replayConnectionAttempt const CInetAddress   addr
 

Get the first stored connection attempt corresponding to addr.

Definition at line 326 of file message_recorder.cpp.

References _ConnectionAttempts, _PreloadedRecords, addr, NLNET::Connecting, NLNET::ConnFailing, loadNext, nldebug, nlstop, and NLNET::TNetworkEvent.

void NLNET::CMessageRecorder::replayNextDataAvailable sint64    updatecounter
 

Push the received blocks for this counter into the receive queue.

Definition at line 276 of file message_recorder.cpp.

References _ConnectionAttempts, NLNET::Accepting, NLNET::Connecting, NLNET::ConnFailing, NLNET::Disconnecting, getNext, nlstop, ReceivedMessages, NLNET::Receiving, and NLNET::Sending.

bool NLNET::CMessageRecorder::startRecord const std::string &    filename,
bool    recordall = true
 

Start recording.

Definition at line 104 of file message_recorder.cpp.

References _File, _Filename, _RecordAll, nldebug, and nlwarning.

bool NLNET::CMessageRecorder::startReplay const std::string &    filename
 

Start replaying.

Definition at line 178 of file message_recorder.cpp.

References _File, _Filename, nldebug, and nlerror.

void NLNET::CMessageRecorder::stopRecord  
 

Stop recording.

Definition at line 168 of file message_recorder.cpp.

References _File, and _Filename.

Referenced by ~CMessageRecorder.

void NLNET::CMessageRecorder::stopReplay  
 

Stop playback.

Definition at line 404 of file message_recorder.cpp.

References _File, and _Filename.

Referenced by ~CMessageRecorder.


Member Data Documentation

std::deque<TMessageRecord> NLNET::CMessageRecorder::_ConnectionAttempts [private]
 

Definition at line 176 of file message_recorder.h.

Referenced by replayConnectionAttempt, and replayNextDataAvailable.

std::fstream NLNET::CMessageRecorder::_File [private]
 

Definition at line 167 of file message_recorder.h.

Referenced by loadNext, recordNext, startRecord, startReplay, stopRecord, and stopReplay.

std::string NLNET::CMessageRecorder::_Filename [private]
 

Definition at line 170 of file message_recorder.h.

Referenced by loadNext, recordNext, startRecord, startReplay, stopRecord, stopReplay, and ~CMessageRecorder.

std::deque<TMessageRecord> NLNET::CMessageRecorder::_PreloadedRecords [private]
 

Definition at line 173 of file message_recorder.h.

Referenced by getNext, and replayConnectionAttempt.

bool NLNET::CMessageRecorder::_RecordAll [private]
 

Definition at line 179 of file message_recorder.h.

Referenced by startRecord.

std::queue<NLNET::TMessageRecord> NLNET::CMessageRecorder::ReceivedMessages
 

Receive queue (corresponding to one update count). Use empty(), front(), pop().

Definition at line 154 of file message_recorder.h.

Referenced by replayNextDataAvailable.


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