A generic data dumper. More...
#include <yatesig.h>
Public Types | |
enum | Type { Raw, Hexa, Hdlc, Q921, Q931, Mtp2, Mtp3, Sccp } |
Public Member Functions | |
SignallingDumper (Type type=Hexa, bool network=false) | |
~SignallingDumper () | |
Type | type () const |
bool | network () const |
bool | active () const |
void | terminate () |
void | setStream (Stream *stream=0, bool writeHeader=true) |
bool | dump (void *buf, unsigned int len, bool sent=false, int link=0) |
bool | dump (const DataBlock &data, bool sent=false, int link=0) |
Static Public Member Functions | |
static SignallingDumper * | create (DebugEnabler *dbg, const char *filename, Type type, bool network=false, bool create=true, bool append=false) |
static SignallingDumper * | create (Stream *stream, Type type, bool network=false, bool writeHeader=true) |
A generic data dumper.
This class is a generic data dumper with libpcap compatibility
enum Type |
Type of dumper output
SignallingDumper | ( | Type | type = Hexa , |
|
bool | network = false | |||
) |
Constructor
type | Type of the output desired | |
network | True if we are the network side of the link |
~SignallingDumper | ( | ) |
Destructor, closes the output
bool active | ( | ) | const |
Check if the dumper is active
static SignallingDumper* create | ( | Stream * | stream, | |
Type | type, | |||
bool | network = false , |
|||
bool | writeHeader = true | |||
) | [static] |
Create a dumper from an already existing stream
stream | Stream to use for output, will be owned by dumper | |
type | The dumper type | |
network | True to create a network side dumper | |
writeHeader | True to write the header (if any) at start of stream |
static SignallingDumper* create | ( | DebugEnabler * | dbg, | |
const char * | filename, | |||
Type | type, | |||
bool | network = false , |
|||
bool | create = true , |
|||
bool | append = false | |||
) | [static] |
Create a file to dump data in it. The file is opened/created in write only, binary mode
dbg | DebugEnabler requesting the operation (used for debug message on failure) | |
filename | The file name to use | |
type | The dumper type | |
network | True to create a network side dumper | |
create | True to create the file if doesn't exist | |
append | Append to an existing file. If false and the file already exists, it will be truncated |
bool dump | ( | const DataBlock & | data, | |
bool | sent = false , |
|||
int | link = 0 | |||
) | [inline] |
Dump the provided data
data | Buffer to dump | |
sent | True if data is being sent, false if is being received | |
link | Link number (relevant to MTP2 only) |
References DataBlock::data(), SignallingDumper::dump(), and DataBlock::length().
Referenced by SignallingDumper::dump().
bool dump | ( | void * | buf, | |
unsigned int | len, | |||
bool | sent = false , |
|||
int | link = 0 | |||
) |
Dump the provided data
buf | Pointer to buffer to dump | |
len | Length of the data | |
sent | True if data is being sent, false if is being received | |
link | Link number (relevant to MTP2 only) |
bool network | ( | ) | const [inline] |
Get the network side flag
void setStream | ( | Stream * | stream = 0 , |
|
bool | writeHeader = true | |||
) |
Set a new output stream
stream | New stream for output, NULL to terminate | |
writeHeader | True to write the header (if any) at start of stream |
void terminate | ( | ) |
Terminate the dump session, close the output
Type type | ( | ) | const [inline] |
Get the type of the dumper