reSIProcate/repro  9694
Defines | Functions
AbstractDb.cxx File Reference
#include <cassert>
#include "rutil/Data.hxx"
#include "rutil/DataStream.hxx"
#include "rutil/ParseBuffer.hxx"
#include "resip/stack/Symbols.hxx"
#include "rutil/Logger.hxx"
#include "repro/UserStore.hxx"
#include "repro/AbstractDb.hxx"
Include dependency graph for AbstractDb.cxx:

Go to the source code of this file.

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::REPRO

Functions

static void encodeString (oDataStream &s, const Data &data)
static void decodeString (iDataStream &s, Data &data)

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::REPRO

Definition at line 18 of file AbstractDb.cxx.


Function Documentation

static void decodeString ( iDataStream s,
Data data 
) [static]

Definition at line 31 of file AbstractDb.cxx.

{
   data.clear();

   if(s.eof()) return;

   short len;
   s.read((char*)(&len), sizeof(len));
   if(s.eof()) return;

   // [TODO] This is probably OK for now, but we can do better than this.
   if (len > 8192)
   {
      ErrLog( << "Tried to decode a database record that was much larger (>8k) than expected.  Returning an empty Data instead." );
      return;
   }

   s.read(data.getBuf(len), len);
}
static void encodeString ( oDataStream s,
const Data data 
) [static]

Definition at line 22 of file AbstractDb.cxx.

{
   short len = (short)data.size();
   s.write( (char*)(&len) , sizeof( len ) );
   s.write( data.data(), len );
}