18#define RESIPROCATE_SUBSYSTEM Subsystem::REPRO
20#define REPRO_DB_VERSION_USERS 3
25 short len = (short)data.
size();
26 s.write( (
char*)(&len) ,
sizeof( len ) );
27 s.write( data.
data(), len );
39 s.read((
char*)(&len),
sizeof(len));
45 ErrLog( <<
"Tried to decode a database record that was much larger (>8k) than expected. Returning an empty Data instead." );
49 s.read(data.
getBuf(len), len);
88 unsigned int* secondaryKeyLen)
98 s.read((
char*)(&version),
sizeof(version));
104 s.read( (
char*)(&len),
sizeof(len));
105 *secondaryKeyLen = (
unsigned int)len;
106 *secondaryKey = (
void*)(nonConstData.
data() + (
sizeof(version)+
sizeof(len)));
121 s.write( (
char*)(&version) ,
sizeof(version) );
172 s.read( (
char*)(&version),
sizeof(version) );
185 else if ( version == 2 )
202 ErrLog( <<
"Data in user database with unknown version " << version );
244 s.write( (
char*)(&version) ,
sizeof(version) );
282 s.read( (
char*)(&version),
sizeof(version) );
292 ErrLog( <<
"Data in TlsPeerIdentity database with unknown version " << version );
304 resip_assert(
"TlsPeerIdentity not implemented for this database backend");
330 s.write( (
char*)(&version) ,
sizeof(version) );
384 s.read( (
char*)(&version),
sizeof(version) );
398 ErrLog( <<
"Data in route database with unknown version " << version );
412 while ( !key.
empty() )
451 s.write( (
char*)(&version) ,
sizeof(version) );
455 s.write( (
char*)(&rec.
mMask) ,
sizeof( rec.
mMask ) );
456 s.write( (
char*)(&rec.
mPort) ,
sizeof( rec.
mPort ) );
493 s.read( (
char*)(&version),
sizeof(version) );
499 s.read( (
char*)(&rec.
mMask),
sizeof(rec.
mMask) );
500 s.read( (
char*)(&rec.
mPort),
sizeof(rec.
mPort) );
507 ErrLog( <<
"Data in ACL database with unknown version " << version );
521 while ( !key.
empty() )
560 s.write( (
char*)(&version) ,
sizeof(version) );
599 s.read( (
char*)(&version),
sizeof(version) );
611 ErrLog( <<
"Data in Config database with unknown version " << version );
625 while ( !key.
empty() )
664 s.write( (
char*)(&version) ,
sizeof(version) );
703 s.read( (
char*)(&version),
sizeof(version) );
714 ErrLog( <<
"Data in StaticReg database with unknown version " << version );
728 while ( !key.
empty() )
762 s.write((
char*)(&version) ,
sizeof(version));
818 s.read((
char*)(&version),
sizeof(version));
837 ErrLog( <<
"Data in filter database with unknown version " << version );
851 while ( !key.
empty() )
888 s.write((
char*)(&version) ,
sizeof(version));
910 s.read((
char*)(&version),
sizeof(version));
925 ErrLog( <<
"Data in silo database with unknown version " << version );
941 recordList.push_back(rec);
946 recordList.push_back(rec);
965 Data originalSendTimeData;
972 pb.
data(originalSendTimeData, anchor);
974 if((
unsigned long)(now - originalSendTime) > expirationTime)
#define REPRO_DB_VERSION_USERS
static void decodeString(iDataStream &s, Data &data)
static void encodeString(oDataStream &s, const Data &data)
#define resip_assert(x)
This file needs to work for both C and C++ code.
resip::Data mCondition1Header
resip::Data mCondition2Regex
resip::Data mCondition2Header
resip::Data mCondition1Regex
resip::Data mRewriteExpression
resip::Data mMatchingPattern
uint64_t mOriginalSentTime
resip::Data authorizedIdentity
resip::Data forwardAddress
resip::Data passwordHashAlt
std::vector< RouteRecord > RouteRecordList
virtual bool dbNextRecord(const Table table, const resip::Data &key, resip::Data &data, bool forUpdate, bool first=false)=0
virtual bool addToSilo(const Key &key, const SiloRecord &rec)
virtual bool addTlsPeerIdentity(const Key &key, const TlsPeerIdentityRecord &rec)
virtual ConfigRecord getConfig(const Key &key) const
std::vector< ConfigRecord > ConfigRecordList
virtual Key nextStaticRegKey()
virtual Key nextTlsPeerIdentityKey()
virtual Key firstConfigKey()
virtual resip::Data dbNextKey(const Table table, bool first=false)=0
virtual void decodeSiloRecord(resip::Data &data, SiloRecord &rec)
virtual void eraseStaticReg(const Key &key)
virtual RouteRecord getRoute(const Key &key) const
virtual Key firstAclKey()
virtual resip::Data dbFirstKey(const Table table)
virtual void cleanupExpiredSiloRecords(uint64_t now, unsigned long expirationTime)
virtual AclRecord getAcl(const Key &key) const
virtual Key firstStaticRegKey()
std::vector< SiloRecord > SiloRecordList
virtual bool addAcl(const Key &key, const AclRecord &rec)
virtual bool addStaticReg(const Key &key, const StaticRegRecord &rec)
virtual void eraseSiloRecord(const Key &key)
virtual bool dbFirstRecord(const Table table, const resip::Data &key, resip::Data &data, bool forUpdate)
virtual FilterRecordList getAllFilters()
virtual void eraseTlsPeerIdentity(const Key &key)
virtual StaticRegRecord getStaticReg(const Key &key) const
virtual Key nextFilterKey()
virtual void eraseRoute(const Key &key)
virtual Key firstRouteKey()
virtual AclRecordList getAllAcls()
virtual Key nextUserKey()
std::vector< StaticRegRecord > StaticRegRecordList
virtual Key nextRouteKey()
virtual bool dbWriteRecord(const Table table, const resip::Data &key, const resip::Data &data)=0
virtual RouteRecordList getAllRoutes()
virtual bool addFilter(const Key &key, const FilterRecord &rec)
virtual Key firstUserKey()
virtual void eraseUser(const Key &key)
virtual bool isAuthorized(const std::set< resip::Data > &peerNames, const std::set< resip::Data > &identities) const
virtual void eraseAcl(const Key &key)
std::vector< FilterRecord > FilterRecordList
virtual Key firstTlsPeerIdentityKey()
virtual void eraseFilter(const Key &key)
virtual StaticRegRecordList getAllStaticRegs()
virtual void encodeRoute(const RouteRecord &rec, resip::Data &buffer)
virtual ConfigRecordList getAllConfigs()
virtual resip::Data getUserAuthInfo(const Key &key) const
virtual bool dbReadRecord(const Table table, const resip::Data &key, resip::Data &data) const =0
return false if not found
virtual void encodeFilter(const FilterRecord &rec, resip::Data &buffer)
virtual bool getSiloRecords(const Key &skey, SiloRecordList &recordList)
virtual void eraseConfig(const Key &key)
virtual FilterRecord getFilter(const Key &key) const
virtual bool addUser(const Key &key, const UserRecord &rec)
virtual bool addRoute(const Key &key, const RouteRecord &rec)
virtual Key nextConfigKey()
virtual Key firstFilterKey()
virtual bool addConfig(const Key &key, const ConfigRecord &rec)
virtual UserRecord getUser(const Key &key) const
virtual void dbEraseRecord(const Table table, const resip::Data &key, bool isSecondaryKey=false)=0
virtual TlsPeerIdentityRecord getTlsPeerIdentity(const Key &key) const
virtual void encodeUser(const UserRecord &rec, resip::Data &buffer)
std::vector< AclRecord > AclRecordList
virtual int getSecondaryKey(const Table table, const Key &key, const resip::Data &data, void **secondaryKey, unsigned int *secondaryKeyLen)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
@ Share
The Data instance will use the buffer in a read-only mode.
char * getBuf(size_type length)
Set size to be exactly {length}, extending buffer if needed.
uint64_t convertUInt64() const
Takes the contents of the Data and converts them to an unsigned 64-bit integer.
bool empty() const noexcept
Checks whether the Data is empty.
size_type size() const noexcept
Returns the number of bytes in this Data.
Data & clear()
Clears the contents of this Data.
const char * data() const noexcept
Returns a pointer to the contents of this Data.
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipToChar(char c)
CurrentPosition position() const
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
An istream that operates on an existing Data.
An ostream that operates on an existing Data.
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;
unsigned __int64 uint64_t