|
reSIProcate/repro
9694
|
#include <AbstractDb.hxx>

Classes | |
| class | AclRecord |
| class | ConfigRecord |
| class | FilterRecord |
| class | RouteRecord |
| class | SiloRecord |
| class | StaticRegRecord |
| class | UserRecord |
Public Types | |
| typedef resip::Data | Key |
| typedef std::vector< RouteRecord > | RouteRecordList |
| typedef std::vector< AclRecord > | AclRecordList |
| typedef std::vector< ConfigRecord > | ConfigRecordList |
| typedef std::vector < StaticRegRecord > | StaticRegRecordList |
| typedef std::vector< FilterRecord > | FilterRecordList |
| typedef std::vector< SiloRecord > | SiloRecordList |
Public Member Functions | |
| AbstractDb () | |
| virtual | ~AbstractDb () |
| virtual bool | isSane ()=0 |
| virtual bool | addUser (const Key &key, const UserRecord &rec) |
| virtual void | eraseUser (const Key &key) |
| virtual UserRecord | getUser (const Key &key) const |
| virtual resip::Data | getUserAuthInfo (const Key &key) const |
| virtual Key | firstUserKey () |
| virtual Key | nextUserKey () |
| virtual bool | addRoute (const Key &key, const RouteRecord &rec) |
| virtual void | eraseRoute (const Key &key) |
| virtual RouteRecord | getRoute (const Key &key) const |
| virtual RouteRecordList | getAllRoutes () |
| virtual Key | firstRouteKey () |
| virtual Key | nextRouteKey () |
| virtual bool | addAcl (const Key &key, const AclRecord &rec) |
| virtual void | eraseAcl (const Key &key) |
| virtual AclRecordList | getAllAcls () |
| virtual AclRecord | getAcl (const Key &key) const |
| virtual Key | firstAclKey () |
| virtual Key | nextAclKey () |
| virtual bool | addConfig (const Key &key, const ConfigRecord &rec) |
| virtual void | eraseConfig (const Key &key) |
| virtual ConfigRecordList | getAllConfigs () |
| virtual ConfigRecord | getConfig (const Key &key) const |
| virtual Key | firstConfigKey () |
| virtual Key | nextConfigKey () |
| virtual bool | addStaticReg (const Key &key, const StaticRegRecord &rec) |
| virtual void | eraseStaticReg (const Key &key) |
| virtual StaticRegRecordList | getAllStaticRegs () |
| virtual StaticRegRecord | getStaticReg (const Key &key) const |
| virtual Key | firstStaticRegKey () |
| virtual Key | nextStaticRegKey () |
| virtual bool | addFilter (const Key &key, const FilterRecord &rec) |
| virtual void | eraseFilter (const Key &key) |
| virtual FilterRecord | getFilter (const Key &key) const |
| virtual FilterRecordList | getAllFilters () |
| virtual Key | firstFilterKey () |
| virtual Key | nextFilterKey () |
| virtual bool | addToSilo (const Key &key, const SiloRecord &rec) |
| virtual bool | getSiloRecords (const Key &skey, SiloRecordList &recordList) |
| virtual void | eraseSiloRecord (const Key &key) |
| virtual void | cleanupExpiredSiloRecords (UInt64 now, unsigned long expirationTime) |
Protected Types | |
| enum | Table { UserTable = 0, RouteTable, AclTable, ConfigTable, StaticRegTable, FilterTable, SiloTable, MaxTable } |
Protected Member Functions | |
| virtual int | getSecondaryKey (const Table table, const Key &key, const resip::Data &data, void **secondaryKey, unsigned int *secondaryKeyLen) |
| virtual bool | dbWriteRecord (const Table table, const resip::Data &key, const resip::Data &data)=0 |
| virtual bool | dbReadRecord (const Table table, const resip::Data &key, resip::Data &data) const =0 |
| return false if not found | |
| virtual void | dbEraseRecord (const Table table, const resip::Data &key, bool isSecondaryKey=false)=0 |
| virtual resip::Data | dbFirstKey (const Table table) |
| virtual resip::Data | dbNextKey (const Table table, bool first=false)=0 |
| virtual bool | dbFirstRecord (const Table table, const resip::Data &key, resip::Data &data, bool forUpdate) |
| virtual bool | dbNextRecord (const Table table, const resip::Data &key, resip::Data &data, bool forUpdate, bool first=false)=0 |
| virtual bool | dbBeginTransaction (const Table table)=0 |
| virtual bool | dbCommitTransaction (const Table table)=0 |
| virtual bool | dbRollbackTransaction (const Table table)=0 |
| virtual void | encodeUser (const UserRecord &rec, resip::Data &buffer) |
| virtual void | encodeRoute (const RouteRecord &rec, resip::Data &buffer) |
| virtual void | encodeFilter (const FilterRecord &rec, resip::Data &buffer) |
| virtual void | decodeSiloRecord (resip::Data &data, SiloRecord &rec) |
Definition at line 17 of file AbstractDb.hxx.
| typedef std::vector<AclRecord> repro::AbstractDb::AclRecordList |
Definition at line 99 of file AbstractDb.hxx.
| typedef std::vector<ConfigRecord> repro::AbstractDb::ConfigRecordList |
Definition at line 100 of file AbstractDb.hxx.
| typedef std::vector<FilterRecord> repro::AbstractDb::FilterRecordList |
Definition at line 102 of file AbstractDb.hxx.
| typedef resip::Data repro::AbstractDb::Key |
Definition at line 97 of file AbstractDb.hxx.
| typedef std::vector<RouteRecord> repro::AbstractDb::RouteRecordList |
Definition at line 98 of file AbstractDb.hxx.
| typedef std::vector<SiloRecord> repro::AbstractDb::SiloRecordList |
Definition at line 103 of file AbstractDb.hxx.
| typedef std::vector<StaticRegRecord> repro::AbstractDb::StaticRegRecordList |
Definition at line 101 of file AbstractDb.hxx.
enum repro::AbstractDb::Table [protected] |
Definition at line 162 of file AbstractDb.hxx.
{
UserTable=0,
RouteTable,
AclTable,
ConfigTable,
StaticRegTable,
FilterTable,
SiloTable,
MaxTable // This one MUST be last
} Table;
| AbstractDb::AbstractDb | ( | ) |
Definition at line 52 of file AbstractDb.cxx.
{
}
| AbstractDb::~AbstractDb | ( | ) | [virtual] |
Definition at line 57 of file AbstractDb.cxx.
{
}
Definition at line 333 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
{
oDataStream s(data);
short version=1;
assert( sizeof( version) == 2 );
s.write( (char*)(&version) , sizeof(version) );
encodeString( s, rec.mTlsPeerName );
encodeString( s, rec.mAddress );
s.write( (char*)(&rec.mMask) , sizeof( rec.mMask ) );
s.write( (char*)(&rec.mPort) , sizeof( rec.mPort ) );
s.write( (char*)(&rec.mFamily) , sizeof( rec.mFamily ) );
s.write( (char*)(&rec.mTransport) , sizeof( rec.mTransport ) );
s.flush();
}
return dbWriteRecord( AclTable, key, data );
}
| bool AbstractDb::addConfig | ( | const Key & | key, |
| const ConfigRecord & | rec | ||
| ) | [virtual] |
Definition at line 442 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
{
oDataStream s(data);
short version=1;
assert( sizeof( version) == 2 );
s.write( (char*)(&version) , sizeof(version) );
encodeString( s, rec.mDomain );
s.write( (char*)(&rec.mTlsPort) , sizeof( rec.mTlsPort ) );
assert( sizeof(rec.mTlsPort) == 2 );
s.flush();
}
return dbWriteRecord( ConfigTable, key, data );
}
| bool AbstractDb::addFilter | ( | const Key & | key, |
| const FilterRecord & | rec | ||
| ) | [virtual] |
Definition at line 674 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
encodeFilter(rec, data);
return dbWriteRecord(FilterTable, key, data);
}
| bool AbstractDb::addRoute | ( | const Key & | key, |
| const RouteRecord & | rec | ||
| ) | [virtual] |
Definition at line 239 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
encodeRoute(rec, data);
return dbWriteRecord( RouteTable, key, data );
}
| bool AbstractDb::addStaticReg | ( | const Key & | key, |
| const StaticRegRecord & | rec | ||
| ) | [virtual] |
Definition at line 546 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
{
oDataStream s(data);
short version=1;
assert( sizeof( version) == 2 );
s.write( (char*)(&version) , sizeof(version) );
encodeString( s, rec.mAor );
encodeString( s, rec.mContact );
encodeString( s, rec.mPath );
s.flush();
}
return dbWriteRecord( StaticRegTable, key, data );
}
| bool AbstractDb::addToSilo | ( | const Key & | key, |
| const SiloRecord & | rec | ||
| ) | [virtual] |
Definition at line 771 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
{
oDataStream s(data);
short version=1;
assert(sizeof( version) == 2);
s.write((char*)(&version) , sizeof(version));
encodeString(s, rec.mDestUri);
encodeString(s, rec.mSourceUri);
s.write((char*)(&rec.mOriginalSentTime), sizeof (rec.mOriginalSentTime));
assert(sizeof(rec.mOriginalSentTime) == 8);
encodeString(s, rec.mTid);
encodeString(s, rec.mMimeType);
encodeString(s, rec.mMessageBody);
s.flush();
}
return dbWriteRecord(SiloTable, key, data);
}
| bool AbstractDb::addUser | ( | const Key & | key, |
| const UserRecord & | rec | ||
| ) | [virtual] |
Reimplemented in repro::MySqlDb.
Definition at line 133 of file AbstractDb.cxx.
{
assert( !key.empty() );
Data data;
encodeUser(rec, data);
return dbWriteRecord(UserTable,key,data);
}
| void AbstractDb::cleanupExpiredSiloRecords | ( | UInt64 | now, |
| unsigned long | expirationTime | ||
| ) | [virtual] |
Definition at line 853 of file AbstractDb.cxx.
{
AbstractDb::Key key = dbFirstKey(SiloTable); // Iterate on primary key
// Iterate through all silo records - retrieve Original send time embedded into the
// primary key and see if the record has expired.
Data originalSendTimeData;
UInt64 originalSendTime;
while(!key.empty())
{
ParseBuffer pb(key);
const char* anchor = pb.position();
pb.skipToChar(':');
pb.data(originalSendTimeData, anchor);
originalSendTime = originalSendTimeData.convertUInt64();
if((unsigned long)(now - originalSendTime) > expirationTime)
{
eraseSiloRecord(key);
}
key = dbNextKey(SiloTable);
}
}
| virtual bool repro::AbstractDb::dbBeginTransaction | ( | const Table | table | ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual bool repro::AbstractDb::dbCommitTransaction | ( | const Table | table | ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual void repro::AbstractDb::dbEraseRecord | ( | const Table | table, |
| const resip::Data & | key, | ||
| bool | isSecondaryKey = false |
||
| ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
Definition at line 63 of file AbstractDb.cxx.
{
return dbNextKey(table,true/*first*/);
}
| bool AbstractDb::dbFirstRecord | ( | const Table | table, |
| const resip::Data & | key, | ||
| resip::Data & | data, | ||
| bool | forUpdate | ||
| ) | [protected, virtual] |
Definition at line 70 of file AbstractDb.cxx.
{
return dbNextRecord(table, key, data, forUpdate, true/*first*/);
}
| virtual resip::Data repro::AbstractDb::dbNextKey | ( | const Table | table, |
| bool | first = false |
||
| ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual bool repro::AbstractDb::dbNextRecord | ( | const Table | table, |
| const resip::Data & | key, | ||
| resip::Data & | data, | ||
| bool | forUpdate, | ||
| bool | first = false |
||
| ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual bool repro::AbstractDb::dbReadRecord | ( | const Table | table, |
| const resip::Data & | key, | ||
| resip::Data & | data | ||
| ) | const [protected, pure virtual] |
return false if not found
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual bool repro::AbstractDb::dbRollbackTransaction | ( | const Table | table | ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| virtual bool repro::AbstractDb::dbWriteRecord | ( | const Table | table, |
| const resip::Data & | key, | ||
| const resip::Data & | data | ||
| ) | [protected, pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| void AbstractDb::decodeSiloRecord | ( | resip::Data & | data, |
| SiloRecord & | rec | ||
| ) | [protected, virtual] |
Definition at line 797 of file AbstractDb.cxx.
{
iDataStream s(data);
short version;
assert(sizeof(version) == 2);
s.read((char*)(&version), sizeof(version));
if (version == 1)
{
decodeString(s, rec.mDestUri);
decodeString(s, rec.mSourceUri);
s.read((char*)(&rec.mOriginalSentTime), sizeof(rec.mOriginalSentTime));
assert(sizeof(rec.mOriginalSentTime) == 8);
decodeString(s, rec.mTid);
decodeString(s, rec.mMimeType);
decodeString(s, rec.mMessageBody);
}
else
{
// unknown version
ErrLog( <<"Data in silo database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
}
| void AbstractDb::encodeFilter | ( | const FilterRecord & | rec, |
| resip::Data & | buffer | ||
| ) | [protected, virtual] |
Definition at line 649 of file AbstractDb.cxx.
{
oDataStream s(data);
short version=1;
assert(sizeof( version) == 2);
s.write((char*)(&version) , sizeof(version));
encodeString(s, rec.mCondition1Header);
encodeString(s, rec.mCondition1Regex);
encodeString(s, rec.mCondition2Header);
encodeString(s, rec.mCondition2Regex);
encodeString(s, rec.mMethod);
encodeString(s, rec.mEvent);
s.write((char*)(&rec.mAction), sizeof (rec.mAction));
assert(sizeof(rec.mAction) == 2);
encodeString(s, rec.mActionData);
s.write((char*)(&rec.mOrder), sizeof(rec.mOrder));
assert(sizeof(rec.mOrder) == 2);
s.flush();
}
| void AbstractDb::encodeRoute | ( | const RouteRecord & | rec, |
| resip::Data & | buffer | ||
| ) | [protected, virtual] |
cj! TODO - add the extra local use only flag
Definition at line 217 of file AbstractDb.cxx.
{
oDataStream s(data);
short version=1;
assert( sizeof( version) == 2 );
s.write( (char*)(&version) , sizeof(version) );
encodeString( s, rec.mMethod );
encodeString( s, rec.mEvent );
encodeString( s, rec.mMatchingPattern );
encodeString( s, rec.mRewriteExpression );
s.write( (char*)(&rec.mOrder) , sizeof( rec.mOrder ) );
assert( sizeof( rec.mOrder) == 2 );
//!cj! TODO - add the extra local use only flag
s.flush();
}
| void AbstractDb::encodeUser | ( | const UserRecord & | rec, |
| resip::Data & | buffer | ||
| ) | [protected, virtual] |
Definition at line 114 of file AbstractDb.cxx.
{
oDataStream s(data);
short version=2;
assert( sizeof( version) == 2 );
s.write( (char*)(&version) , sizeof(version) );
encodeString( s, rec.user );
encodeString( s, rec.domain);
encodeString( s, rec.realm);
encodeString( s, rec.passwordHash);
encodeString( s, rec.name);
encodeString( s, rec.email);
encodeString( s, rec.forwardAddress);
s.flush();
}
| void AbstractDb::eraseAcl | ( | const Key & | key | ) | [virtual] |
Definition at line 361 of file AbstractDb.cxx.
{
dbEraseRecord (AclTable, key);
}
| void AbstractDb::eraseConfig | ( | const Key & | key | ) | [virtual] |
Definition at line 467 of file AbstractDb.cxx.
{
dbEraseRecord (ConfigTable, key);
}
| void AbstractDb::eraseFilter | ( | const Key & | key | ) | [virtual] |
Definition at line 686 of file AbstractDb.cxx.
{
dbEraseRecord(FilterTable, key);
}
| void AbstractDb::eraseRoute | ( | const Key & | key | ) | [virtual] |
Definition at line 252 of file AbstractDb.cxx.
{
dbEraseRecord (RouteTable, key);
}
| void AbstractDb::eraseSiloRecord | ( | const Key & | key | ) | [virtual] |
Definition at line 847 of file AbstractDb.cxx.
{
dbEraseRecord(SiloTable, key);
}
| void AbstractDb::eraseStaticReg | ( | const Key & | key | ) | [virtual] |
Definition at line 571 of file AbstractDb.cxx.
{
dbEraseRecord (StaticRegTable, key);
}
| void AbstractDb::eraseUser | ( | const Key & | key | ) | [virtual] |
Reimplemented in repro::MySqlDb.
Definition at line 145 of file AbstractDb.cxx.
{
dbEraseRecord( UserTable, key);
}
| AbstractDb::Key AbstractDb::firstAclKey | ( | ) | [virtual] |
Definition at line 428 of file AbstractDb.cxx.
{
return dbFirstKey(AclTable);
}
| AbstractDb::Key AbstractDb::firstConfigKey | ( | ) | [virtual] |
Definition at line 532 of file AbstractDb.cxx.
{
return dbFirstKey(ConfigTable);
}
| AbstractDb::Key AbstractDb::firstFilterKey | ( | ) | [virtual] |
Definition at line 758 of file AbstractDb.cxx.
{
return dbFirstKey(FilterTable);
}
| AbstractDb::Key AbstractDb::firstRouteKey | ( | ) | [virtual] |
Definition at line 319 of file AbstractDb.cxx.
{
return dbFirstKey(RouteTable);
}
| AbstractDb::Key AbstractDb::firstStaticRegKey | ( | ) | [virtual] |
Definition at line 635 of file AbstractDb.cxx.
{
return dbFirstKey(StaticRegTable);
}
| AbstractDb::Key AbstractDb::firstUserKey | ( | ) | [virtual] |
Reimplemented in repro::MySqlDb.
Definition at line 203 of file AbstractDb.cxx.
{
return dbFirstKey(UserTable);
}
| AbstractDb::AclRecord AbstractDb::getAcl | ( | const Key & | key | ) | const [virtual] |
Definition at line 368 of file AbstractDb.cxx.
{
AbstractDb::AclRecord rec;
Data data;
bool stat = dbReadRecord( AclTable, key, data );
if ( !stat )
{
return rec;
}
if ( data.empty() )
{
return rec;
}
iDataStream s(data);
short version;
assert( sizeof(version) == 2 );
s.read( (char*)(&version), sizeof(version) );
if ( version == 1 )
{
decodeString(s, rec.mTlsPeerName);
decodeString(s, rec.mAddress);
s.read( (char*)(&rec.mMask), sizeof(rec.mMask) );
s.read( (char*)(&rec.mPort), sizeof(rec.mPort) );
s.read( (char*)(&rec.mFamily), sizeof(rec.mFamily) );
s.read( (char*)(&rec.mTransport), sizeof(rec.mTransport) );
}
else
{
// unknown version
ErrLog( <<"Data in ACL database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
| AbstractDb::AclRecordList AbstractDb::getAllAcls | ( | ) | [virtual] |
Definition at line 409 of file AbstractDb.cxx.
{
AbstractDb::AclRecordList ret;
AbstractDb::Key key = firstAclKey();
while ( !key.empty() )
{
AbstractDb::AclRecord rec = getAcl(key);
ret.push_back(rec);
key = nextAclKey();
}
return ret;
}
| AbstractDb::ConfigRecordList AbstractDb::getAllConfigs | ( | ) | [virtual] |
Definition at line 513 of file AbstractDb.cxx.
{
AbstractDb::ConfigRecordList ret;
AbstractDb::Key key = firstConfigKey();
while ( !key.empty() )
{
AbstractDb::ConfigRecord rec = getConfig(key);
ret.push_back(rec);
key = nextConfigKey();
}
return ret;
}
| AbstractDb::FilterRecordList AbstractDb::getAllFilters | ( | ) | [virtual] |
Definition at line 739 of file AbstractDb.cxx.
{
AbstractDb::FilterRecordList ret;
AbstractDb::Key key = firstFilterKey();
while ( !key.empty() )
{
AbstractDb::FilterRecord rec = getFilter(key);
ret.push_back(rec);
key = nextFilterKey();
}
return ret;
}
| AbstractDb::RouteRecordList AbstractDb::getAllRoutes | ( | ) | [virtual] |
Definition at line 300 of file AbstractDb.cxx.
{
AbstractDb::RouteRecordList ret;
AbstractDb::Key key = firstRouteKey();
while ( !key.empty() )
{
AbstractDb::RouteRecord rec = getRoute(key);
ret.push_back(rec);
key = nextRouteKey();
}
return ret;
}
| AbstractDb::StaticRegRecordList AbstractDb::getAllStaticRegs | ( | ) | [virtual] |
Definition at line 616 of file AbstractDb.cxx.
{
AbstractDb::StaticRegRecordList ret;
AbstractDb::Key key = firstStaticRegKey();
while ( !key.empty() )
{
AbstractDb::StaticRegRecord rec = getStaticReg(key);
ret.push_back(rec);
key = nextStaticRegKey();
}
return ret;
}
| AbstractDb::ConfigRecord AbstractDb::getConfig | ( | const Key & | key | ) | const [virtual] |
Definition at line 474 of file AbstractDb.cxx.
{
AbstractDb::ConfigRecord rec;
Data data;
bool stat = dbReadRecord( ConfigTable, key, data );
if ( !stat )
{
return rec;
}
if ( data.empty() )
{
return rec;
}
iDataStream s(data);
short version;
assert( sizeof(version) == 2 );
s.read( (char*)(&version), sizeof(version) );
if ( version == 1 )
{
decodeString(s, rec.mDomain);
s.read( (char*)(&rec.mTlsPort), sizeof(rec.mTlsPort) );
assert( sizeof( rec.mTlsPort) == 2 );
}
else
{
// unknown version
ErrLog( <<"Data in ACL database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
| AbstractDb::FilterRecord AbstractDb::getFilter | ( | const Key & | key | ) | const [virtual] |
Definition at line 693 of file AbstractDb.cxx.
{
AbstractDb::FilterRecord rec;
Data data;
bool stat = dbReadRecord(FilterTable, key, data);
if (!stat)
{
return rec;
}
if (data.empty())
{
return rec;
}
iDataStream s(data);
short version;
assert(sizeof(version) == 2);
s.read((char*)(&version), sizeof(version));
if (version == 1)
{
decodeString(s, rec.mCondition1Header);
decodeString(s, rec.mCondition1Regex);
decodeString(s, rec.mCondition2Header);
decodeString(s, rec.mCondition2Regex);
decodeString(s, rec.mMethod);
decodeString(s, rec.mEvent);
s.read((char*)(&rec.mAction), sizeof(rec.mAction));
assert(sizeof(rec.mAction) == 2);
decodeString(s, rec.mActionData);
s.read((char*)(&rec.mOrder), sizeof(rec.mOrder));
assert(sizeof(rec.mOrder) == 2);
}
else
{
// unknown version
ErrLog( <<"Data in filter database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
| AbstractDb::RouteRecord AbstractDb::getRoute | ( | const Key & | key | ) | const [virtual] |
Definition at line 259 of file AbstractDb.cxx.
{
AbstractDb::RouteRecord rec;
Data data;
bool stat = dbReadRecord( RouteTable, key, data );
if ( !stat )
{
return rec;
}
if ( data.empty() )
{
return rec;
}
iDataStream s(data);
short version;
assert( sizeof(version) == 2 );
s.read( (char*)(&version), sizeof(version) );
if ( version == 1 )
{
decodeString(s, rec.mMethod);
decodeString(s, rec.mEvent);
decodeString(s, rec.mMatchingPattern);
decodeString(s, rec.mRewriteExpression);
s.read( (char*)(&rec.mOrder), sizeof(rec.mOrder) );
assert( sizeof( rec.mOrder) == 2 );
}
else
{
// unknown version
ErrLog( <<"Data in route database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
| int AbstractDb::getSecondaryKey | ( | const Table | table, |
| const Key & | key, | ||
| const resip::Data & | data, | ||
| void ** | secondaryKey, | ||
| unsigned int * | secondaryKeyLen | ||
| ) | [protected, virtual] |
Definition at line 83 of file AbstractDb.cxx.
{
if(table == SiloTable)
{
// Secondary Key for Silo table is DestUri
Data nonConstData(Data::Share, data.data(), data.size());
iDataStream s(nonConstData);
short version;
assert(sizeof(version) == 2);
s.read((char*)(&version), sizeof(version));
assert(version == 1);
if (version == 1)
{
// DestUri is first element after version
short len;
s.read( (char*)(&len), sizeof(len));
*secondaryKeyLen = (unsigned int)len;
*secondaryKey = (void*)(nonConstData.data() + (sizeof(version)+sizeof(len)));
return 0;
}
}
return -1;
}
| bool AbstractDb::getSiloRecords | ( | const Key & | skey, |
| AbstractDb::SiloRecordList & | recordList | ||
| ) | [virtual] |
Definition at line 824 of file AbstractDb.cxx.
{
AbstractDb::SiloRecord rec;
Data data;
bool moreRecords = dbFirstRecord(SiloTable, skey, data, false /* forUpdate? */);
if(moreRecords)
{
// Decode and store data
decodeSiloRecord(data,rec);
recordList.push_back(rec);
while((moreRecords = dbNextRecord(SiloTable, skey, data, false /* forUpdate? */)))
{
// Decode and store data
decodeSiloRecord(data,rec);
recordList.push_back(rec);
}
}
return true;
}
| AbstractDb::StaticRegRecord AbstractDb::getStaticReg | ( | const Key & | key | ) | const [virtual] |
Definition at line 578 of file AbstractDb.cxx.
{
AbstractDb::StaticRegRecord rec;
Data data;
bool stat = dbReadRecord( StaticRegTable, key, data );
if ( !stat )
{
return rec;
}
if ( data.empty() )
{
return rec;
}
iDataStream s(data);
short version;
assert( sizeof(version) == 2 );
s.read( (char*)(&version), sizeof(version) );
if ( version == 1 )
{
decodeString(s, rec.mAor);
decodeString(s, rec.mContact);
decodeString(s, rec.mPath);
}
else
{
// unknown version
ErrLog( <<"Data in StaticReg database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
| AbstractDb::UserRecord AbstractDb::getUser | ( | const Key & | key | ) | const [virtual] |
Reimplemented in repro::MySqlDb.
Definition at line 152 of file AbstractDb.cxx.
{
AbstractDb::UserRecord rec;
Data data;
bool stat = dbReadRecord( UserTable, key, data );
if ( !stat )
{
return rec;
}
if ( data.empty() )
{
return rec;
}
iDataStream s(data);
short version;
assert( sizeof(version) == 2 );
s.read( (char*)(&version), sizeof(version) );
if ( version == 2 )
{
decodeString(s, rec.user);
decodeString(s, rec.domain);
decodeString(s, rec.realm);
decodeString(s, rec.passwordHash);
decodeString(s, rec.name);
decodeString(s, rec.email);
decodeString(s, rec.forwardAddress);
}
else
{
// unknown version
ErrLog( <<"Data in user database with unknown version " << version );
ErrLog( <<"record size is " << data.size() );
}
return rec;
}
Reimplemented in repro::MySqlDb.
Definition at line 194 of file AbstractDb.cxx.
{
AbstractDb::UserRecord rec = getUser(key);
return rec.passwordHash;
}
| virtual bool repro::AbstractDb::isSane | ( | ) | [pure virtual] |
Implemented in repro::BerkeleyDb, and repro::MySqlDb.
| AbstractDb::Key AbstractDb::nextAclKey | ( | ) | [virtual] |
Definition at line 435 of file AbstractDb.cxx.
| AbstractDb::Key AbstractDb::nextConfigKey | ( | ) | [virtual] |
Definition at line 539 of file AbstractDb.cxx.
{
return dbNextKey(ConfigTable);
}
| AbstractDb::Key AbstractDb::nextFilterKey | ( | ) | [virtual] |
Definition at line 765 of file AbstractDb.cxx.
{
return dbNextKey(FilterTable);
}
| AbstractDb::Key AbstractDb::nextRouteKey | ( | ) | [virtual] |
Definition at line 326 of file AbstractDb.cxx.
{
return dbNextKey(RouteTable);
}
| AbstractDb::Key AbstractDb::nextStaticRegKey | ( | ) | [virtual] |
Definition at line 642 of file AbstractDb.cxx.
{
return dbNextKey(StaticRegTable);
}
| AbstractDb::Key AbstractDb::nextUserKey | ( | ) | [virtual] |
Reimplemented in repro::MySqlDb.
Definition at line 210 of file AbstractDb.cxx.
1.7.5.1