Yate
SignallingDumper Class Reference

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 SignallingDumpercreate (DebugEnabler *dbg, const char *filename, Type type, bool network=false, bool create=true, bool append=false)
 
static SignallingDumpercreate (Stream *stream, Type type, bool network=false, bool writeHeader=true)
 

Detailed Description

A generic data dumper.

This class is a generic data dumper with libpcap compatibility

Member Enumeration Documentation

◆ Type

enum Type

Type of dumper output

Constructor & Destructor Documentation

◆ SignallingDumper()

SignallingDumper ( Type type = Hexa,
bool network = false )

Constructor

Parameters
typeType of the output desired
networkTrue if we are the network side of the link

References network(), and type().

Referenced by create(), and create().

◆ ~SignallingDumper()

Destructor, closes the output

Member Function Documentation

◆ active()

bool active ( ) const

Check if the dumper is active

Returns
True if the object will actually send data to something

◆ create() [1/2]

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

Parameters
dbgDebugEnabler requesting the operation (used for debug message on failure)
filenameThe file name to use
typeThe dumper type
networkTrue to create a network side dumper
createTrue to create the file if doesn't exist
appendAppend to an existing file. If false and the file already exists, it will be truncated
Returns
SignallingDumper pointer on success, 0 on failure

References create(), network(), SignallingDumper(), and type().

Referenced by create().

◆ create() [2/2]

static SignallingDumper * create ( Stream * stream,
Type type,
bool network = false,
bool writeHeader = true )
static

Create a dumper from an already existing stream

Parameters
streamStream to use for output, will be owned by dumper
typeThe dumper type
networkTrue to create a network side dumper
writeHeaderTrue to write the header (if any) at start of stream
Returns
SignallingDumper pointer on success, 0 on failure

References network(), SignallingDumper(), and type().

◆ dump() [1/2]

bool dump ( const DataBlock & data,
bool sent = false,
int link = 0 )
inline

Dump the provided data

Parameters
dataBuffer to dump
sentTrue if data is being sent, false if is being received
linkLink number (relevant to MTP2 only)
Returns
True if the data was dumped successfully

References DataBlock::data(), dump(), and DataBlock::length().

◆ dump() [2/2]

bool dump ( void * buf,
unsigned int len,
bool sent = false,
int link = 0 )

Dump the provided data

Parameters
bufPointer to buffer to dump
lenLength of the data
sentTrue if data is being sent, false if is being received
linkLink number (relevant to MTP2 only)
Returns
True if the data was dumped successfully

Referenced by dump().

◆ network()

bool network ( ) const
inline

Get the network side flag

Returns
True if we are the network side

Referenced by create(), create(), and SignallingDumper().

◆ setStream()

void setStream ( Stream * stream = 0,
bool writeHeader = true )

Set a new output stream

Parameters
streamNew stream for output, NULL to terminate
writeHeaderTrue to write the header (if any) at start of stream

◆ terminate()

void terminate ( )

Terminate the dump session, close the output

◆ type()

Type type ( ) const
inline

Get the type of the dumper

Returns
Type of the dumper object

Referenced by create(), create(), and SignallingDumper().


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