reSIProcate/stack  9694
Public Types | Public Member Functions | Static Public Attributes | Private Attributes
resip::Compression Class Reference

#include <Compression.hxx>

Collaboration diagram for resip::Compression:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Algorithm { NONE, DEFLATE }

Public Member Functions

 Compression (Algorithm algorithm=DEFLATE, int stateMemorySize=8192, int cyclesPerBit=64, int decompressionMemorySize=8192, Data sigcompId=Data::Empty)
 ~Compression ()
bool isEnabled ()
Algorithm getAlgorithm () const
osc::StateHandler & getStateHandler ()
void addCompressorsToStack (osc::Stack *)
const DatagetSigcompId ()

Static Public Attributes

static Compression Disabled
 Represents a compression configuration object with compression disabled.

Private Attributes

Algorithm mAlgorithm
osc::StateHandler * mStateHandler
Data mSigcompId

Detailed Description

Definition at line 13 of file Compression.hxx.


Member Enumeration Documentation

Enumerator:
NONE 
DEFLATE 

Definition at line 16 of file Compression.hxx.


Constructor & Destructor Documentation

resip::Compression::Compression ( Algorithm  algorithm = DEFLATE,
int  stateMemorySize = 8192,
int  cyclesPerBit = 64,
int  decompressionMemorySize = 8192,
Data  sigcompId = Data::Empty 
)

Definition at line 19 of file Compression.cxx.

References DebugLog, resip::Data::Empty, resip::Random::getVersion4UuidUrn(), mAlgorithm, mSigcompId, mStateHandler, and NONE.

  : mAlgorithm(algorithm), mStateHandler(0), mSigcompId(sigcompId)
{
#ifdef USE_SIGCOMP
  if (algorithm != NONE)
  {
    mStateHandler = new osc::StateHandler(stateMemorySize,
                                          cyclesPerBit,
                                          decompressionMemorySize);
    mStateHandler->useSipDictionary();

    if (sigcompId == Data::Empty)
    {
      mSigcompId = "<";
      mSigcompId += Random::getVersion4UuidUrn();
      mSigcompId += ">";
    }
  }
  DebugLog (<< "Set SigcompId to " << mSigcompId);
#else
  mAlgorithm = NONE;
  DebugLog (<< "COMPRESSION SUPPORT NOT COMPILED IN");
#endif
  DebugLog (<< "Compression configuration object created; algorithm = "
            << static_cast<int>(mAlgorithm) );
}

Here is the call graph for this function:

resip::Compression::~Compression ( )

Definition at line 50 of file Compression.cxx.

{
#ifdef USE_SIGCOMP
  delete mStateHandler;
#endif
}

Member Function Documentation

void resip::Compression::addCompressorsToStack ( osc::Stack *  stack)

Definition at line 58 of file Compression.cxx.

References DebugLog, and WarningLog.

Referenced by resip::ConnectionBase::ConnectionBase(), resip::TransportSelector::TransportSelector(), and resip::UdpTransport::UdpTransport().

{
#ifdef USE_SIGCOMP
  switch(getAlgorithm())
  {
    case DEFLATE:
      DebugLog (<< "Adding Deflate Compressor");
      stack->addCompressor(new osc::DeflateCompressor(getStateHandler()));
      break;

    default:
      WarningLog (<< "Invalid compressor specified! Using deflate Compressor");
      stack->addCompressor(new osc::DeflateCompressor(getStateHandler()));

    case NONE:
      DebugLog (<< "Compression disabled: not adding any compressors");
      break;

  }
#else
   DebugLog (<< "Compression not compiled in: not adding any compressors");
#endif
}
Algorithm resip::Compression::getAlgorithm ( ) const [inline]

Definition at line 31 of file Compression.hxx.

References mAlgorithm.

{ return mAlgorithm; }
const Data& resip::Compression::getSigcompId ( ) [inline]

Definition at line 36 of file Compression.hxx.

References mSigcompId.

Referenced by resip::TransportSelector::transmit().

{return mSigcompId;}
osc::StateHandler& resip::Compression::getStateHandler ( ) [inline]
bool resip::Compression::isEnabled ( ) [inline]

Member Data Documentation

Represents a compression configuration object with compression disabled.

Definition at line 40 of file Compression.hxx.

Definition at line 43 of file Compression.hxx.

Referenced by Compression(), getAlgorithm(), and isEnabled().

Definition at line 49 of file Compression.hxx.

Referenced by Compression(), and getSigcompId().

osc::StateHandler* resip::Compression::mStateHandler [private]

Definition at line 44 of file Compression.hxx.

Referenced by Compression(), and getStateHandler().


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