mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
libretroshare src now compilable.
nxsitems not tested yet renamed retrodb src file to .cc regular librs naming convention wrote deserialisation section of nxsitems, need to write print and clear rsitem base functions git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5144 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
db8d019b3f
commit
50a0ed0656
@ -280,21 +280,6 @@ bool CacheStore::getStoredCache(CacheData &data)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CacheStore::cached(const std::string /*cacheId*/)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CacheStore::updateCacheDocument(pugi::xml_document& /*cacheDoc*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void CacheStore::updateCacheTable()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool CacheStore::locked_getStoredCache(CacheData &data)
|
||||
{
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "pqi/pqimonitor.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include "util/pugixml.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -316,33 +315,7 @@ class CacheStore
|
||||
*/
|
||||
bool locked_getStoredCache(CacheData &data);
|
||||
|
||||
|
||||
//////////////// Cache Optimisation //////////////////
|
||||
|
||||
/**
|
||||
*@param id the key for determing whether this data has been cached or not
|
||||
*@return true if data referenced by key has been cached false otherwise
|
||||
*/
|
||||
bool cached(const std::string cacheId);
|
||||
|
||||
/**
|
||||
* TODO: will be abstract
|
||||
* The deriving class should return a document which accurately reflects its data
|
||||
* structure
|
||||
* @param cacheDoc document reflecting derving class's cache data structure
|
||||
*/
|
||||
virtual void updateCacheDocument(pugi::xml_document& cacheDoc);
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////// Cache Optimisation //////////////////
|
||||
private:
|
||||
/**
|
||||
* This updates the cache table with information from the xml document
|
||||
*
|
||||
*/
|
||||
void updateCacheTable();
|
||||
|
||||
uint16_t cacheType; /* for checking */
|
||||
bool multiCache; /* do we care about subid's */
|
||||
@ -355,14 +328,6 @@ class CacheStore
|
||||
mutable RsMutex cMutex;
|
||||
std::map<RsPeerId, CacheSet> caches;
|
||||
|
||||
////////////// cache optimisation ////////////////
|
||||
|
||||
/// whether to run in cache optimisation mode
|
||||
bool cacheOptMode;
|
||||
|
||||
/// stores whether given instance of cache data has been loaded already or not
|
||||
std::map<std::string, bool> cacheTable;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
#CONFIG += staticlib release
|
||||
#CONFIG += staticlib testnetwork
|
||||
CONFIG += staticlib bitdht newservices
|
||||
CONFIG += staticlib bitdht newcache# newservices
|
||||
CONFIG -= qt
|
||||
TARGET = retroshare
|
||||
|
||||
@ -158,7 +158,7 @@ PUBLIC_HEADERS = retroshare/rsblogs.h \
|
||||
|
||||
HEADERS += plugins/pluginmanager.h \
|
||||
plugins/dlfcn_win32.h \
|
||||
serialiser/rspluginitems.h \
|
||||
serialiser/rspluginitems.h
|
||||
|
||||
|
||||
HEADERS += $$PUBLIC_HEADERS
|
||||
@ -259,29 +259,32 @@ win32-x-g++ {
|
||||
|
||||
|
||||
win32 {
|
||||
QMAKE_CC = g++
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
DEFINES *= MINIUPNPC_VERSION=13
|
||||
DESTDIR = lib
|
||||
QMAKE_CC = g++
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
DEFINES *= MINIUPNPC_VERSION=13
|
||||
DESTDIR = lib
|
||||
|
||||
# Switch off optimization for release version
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE += -O0
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
QMAKE_CFLAGS_RELEASE += -O0
|
||||
# Switch on extra warnings
|
||||
QMAKE_CFLAGS += -Wextra
|
||||
QMAKE_CXXFLAGS += -Wextra
|
||||
|
||||
# Switch on optimization for debug version
|
||||
#QMAKE_CXXFLAGS_DEBUG += -O2
|
||||
#QMAKE_CFLAGS_DEBUG += -O2
|
||||
# Switch off optimization for release version
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE += -O0
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
QMAKE_CFLAGS_RELEASE += -O0
|
||||
|
||||
DEFINES += USE_CMD_ARGS
|
||||
# Switch on optimization for debug version
|
||||
#QMAKE_CXXFLAGS_DEBUG += -O2
|
||||
#QMAKE_CFLAGS_DEBUG += -O2
|
||||
|
||||
#miniupnp implementation files
|
||||
HEADERS += upnp/upnputil.h
|
||||
SOURCES += upnp/upnputil.c
|
||||
DEFINES += USE_CMD_ARGS
|
||||
|
||||
#miniupnp implementation files
|
||||
HEADERS += upnp/upnputil.h
|
||||
SOURCES += upnp/upnputil.c
|
||||
|
||||
UPNPC_DIR = ../../../lib/miniupnpc-1.3
|
||||
GPG_ERROR_DIR = ../../../lib/libgpg-error-1.7
|
||||
@ -291,8 +294,12 @@ win32 {
|
||||
ZLIB_DIR = ../../../lib/zlib-1.2.3
|
||||
SSL_DIR = ../../../OpenSSL
|
||||
|
||||
PTHREADS_DIR = ../../pthreads-w32-2-8-0-release
|
||||
ZLIB_DIR = ../../zlib-1.2.3
|
||||
SSL_DIR = ../../../OpenSSL
|
||||
|
||||
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
|
||||
|
||||
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src ../../../../Libraries/sqlite/sqlite-autoconf-3070900
|
||||
}
|
||||
|
||||
|
||||
@ -337,6 +344,7 @@ freebsd-* {
|
||||
|
||||
################################### COMMON stuff ##################################
|
||||
|
||||
|
||||
HEADERS += dbase/cachestrapper.h \
|
||||
dbase/fimonitor.h \
|
||||
dbase/findex.h \
|
||||
@ -652,17 +660,20 @@ SOURCES += zeroconf/p3zeroconf.cc \
|
||||
|
||||
newcache {
|
||||
|
||||
HEADERS += gxs/rsgxs.h \
|
||||
gxs/rsgnp.h \
|
||||
gxs/rsgdp.h \
|
||||
util/retrodb.h \
|
||||
gxs/rsgixs.h
|
||||
HEADERS += serialiser/rsnxsitems.h
|
||||
|
||||
SOURCES += gxs/rsgxs.cpp \
|
||||
gxs/rsgnp.cpp \
|
||||
gxs/rsgdp.cpp \
|
||||
util/retrodb.cpp \
|
||||
gxs/rsgixs.cpp
|
||||
#gxs/rsgxs.h \
|
||||
# gxs/rsgnp.h \
|
||||
# gxs/rsgdp.h \
|
||||
# util/retrodb.h \
|
||||
# gxs/rsgixs.h
|
||||
|
||||
SOURCES += serialiser/rsnxsitems.cpp
|
||||
#gxs/rsgxs.cpp \
|
||||
# gxs/rsgnp.cpp \
|
||||
# gxs/rsgdp.cpp \
|
||||
# util/retrodb.cpp \
|
||||
# gxs/rsgixs.cpp
|
||||
|
||||
}
|
||||
|
||||
@ -686,4 +697,3 @@ SOURCES += services/p3photoservice.cc \
|
||||
# rsserver/p3photo.cc \
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
#include "rsnxsitems.h"
|
||||
#include "rsbaseserial.h"
|
||||
|
||||
|
||||
const uint8_t RsSyncGrpList::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsSyncGrpList::FLAG_RESPONSE = 0x002;
|
||||
|
||||
const uint8_t RsSyncGrpMsgList::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsSyncGrpMsgList::FLAG_RESPONSE = 0x002;
|
||||
|
||||
const uint8_t RsSyncGrp::FLAG_USE_SYNC_HASH = 0x001;
|
||||
|
||||
const uint8_t RsSyncGrpMsg::FLAG_USE_SYNC_HASH = 0x001;
|
||||
|
||||
|
||||
|
||||
RsNxsSerialiser::size(RsItem *item) {
|
||||
uint32_t RsNxsSerialiser::size(RsItem *item) {
|
||||
|
||||
RsGrpResp* grp;
|
||||
RsGrpMsgResp* gmp;
|
||||
@ -27,10 +36,10 @@ RsNxsSerialiser::size(RsItem *item) {
|
||||
sizeSyncGrpMsg(sgm);
|
||||
}else if ((sgml = dynamic_cast<RsSyncGrpMsgList*>(item)) != NULL)
|
||||
{
|
||||
sizeSynGrpMsgList(sgml);
|
||||
sizeSyncGrpMsgList(sgml);
|
||||
}else if((grp = dynamic_cast<RsGrpResp*>(item)) != NULL)
|
||||
{
|
||||
sizeGrpMsgResp(grp);
|
||||
sizeGrpResp(grp);
|
||||
}else if((gmp = dynamic_cast<RsGrpMsgResp*>(item)) != NULL)
|
||||
{
|
||||
sizeGrpMsgResp(gmp);
|
||||
@ -59,11 +68,11 @@ RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) {
|
||||
case RS_PKT_SUBTYPE_SYNC_GRP:
|
||||
return deserialSyncGrp(data, size);
|
||||
case RS_PKT_SUBTYPE_SYNC_GRP_LIST:
|
||||
return deserialGrpReq(data, size);
|
||||
return deserialSyncGrpList(data, size);
|
||||
case RS_PKT_SUBTYPE_SYNC_MSG:
|
||||
return deserialSynGrpMsg(data, size);
|
||||
return deserialSyncGrpMsg(data, size);
|
||||
case RS_PKT_SUBTYPE_SYNC_MSG_LIST:
|
||||
return deserialSynGrpMsgList(data, size);
|
||||
return deserialSyncGrpMsgList(data, size);
|
||||
case RS_PKT_SUBTYPE_GRPS_RESP:
|
||||
return deserialGrpMsgResp(data, size);
|
||||
case RS_PKT_SUBTYPE_MSG_RESP:
|
||||
@ -111,7 +120,7 @@ bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size){
|
||||
return serialiseSynGrpMsgList(sgml, data, size);
|
||||
}else if((grp = dynamic_cast<RsGrpResp*>(item)) != NULL)
|
||||
{
|
||||
return serialiseGrpMsgResp(grp, data, size);
|
||||
return serialiseGrpResp(grp, data, size);
|
||||
}else if((gmp = dynamic_cast<RsGrpMsgResp*>(item)) != NULL)
|
||||
{
|
||||
return serialiseGrpMsgResp(gmp, data, size);
|
||||
@ -133,7 +142,7 @@ bool RsNxsSerialiser::serialiseSynGrpMsgList(RsSyncGrpMsgList *item, void *data,
|
||||
std::cerr << "RsNxsSerialiser::serialiseSynGrpMsgList()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeSynGrpMsgList(item);
|
||||
uint32_t tlvsize = sizeSyncGrpMsgList(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
@ -154,8 +163,8 @@ bool RsNxsSerialiser::serialiseSynGrpMsgList(RsSyncGrpMsgList *item, void *data,
|
||||
|
||||
/* RsSyncGrpMsgList */
|
||||
|
||||
ok &= SetTlvUInt8(data, size, offset, TLV_TYPE_UINT8_SERID, item->flag);
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
|
||||
std::map<std::string, std::list<uint32_t> >::iterator mit =
|
||||
item->msgs.begin();
|
||||
@ -163,22 +172,22 @@ bool RsNxsSerialiser::serialiseSynGrpMsgList(RsSyncGrpMsgList *item, void *data,
|
||||
// number of msgs
|
||||
uint32_t nMsgs = item->msgs.size();
|
||||
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nMsgs);
|
||||
ok &= setRawUInt32(data, *size, &offset, nMsgs);
|
||||
|
||||
for(; mit != item->msgs.end(); mit++){
|
||||
|
||||
// if not version contains then this
|
||||
// entry is invalid
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_MSGID, mit->first);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, mit->first);
|
||||
|
||||
uint32_t nVersions = mit->second.size();
|
||||
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nVersions);
|
||||
ok &= setRawUInt32(data, *size, &offset, nVersions);
|
||||
|
||||
std::list<uint32_t>::iterator lit = mit->second.begin();
|
||||
for(; lit != mit->second.end(); lit++)
|
||||
{
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_AGE, *lit);
|
||||
ok &= setRawUInt32(data, *size, &offset, *lit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,13 +239,13 @@ bool RsNxsSerialiser::serialiseGrpMsgResp(RsGrpMsgResp *item, void *data, uint32
|
||||
|
||||
// number of msgs
|
||||
uint32_t nMsgs = item->msgs.size();
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nMsgs);
|
||||
ok &= setRawUInt32(data, *size, &offset,nMsgs);
|
||||
|
||||
std::list<RsTlvBinaryData>::iterator lit = item->msgs.begin();
|
||||
|
||||
for(; lit != item->msgs.end(); lit++){
|
||||
RsTlvBinaryData& b = *lit;
|
||||
b.SetTlv(data, size, offset);
|
||||
b.SetTlv(data, *size, &offset);
|
||||
}
|
||||
|
||||
if(offset != tlvsize){
|
||||
@ -284,13 +293,13 @@ bool RsNxsSerialiser::serialiseGrpResp(RsGrpResp *item, void *data, uint32_t *si
|
||||
|
||||
// number of grps
|
||||
uint32_t nGrps = item->grps.size();
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nGrps);
|
||||
ok &= setRawUInt32(data, *size, &offset, nGrps);
|
||||
|
||||
std::list<RsTlvBinaryData>::iterator lit = item->grps.begin();
|
||||
|
||||
for(; lit != item->grps.end(); lit++){
|
||||
RsTlvBinaryData& b = *lit;
|
||||
b.SetTlv(data, size, offset);
|
||||
b.SetTlv(data, *size, &offset);
|
||||
}
|
||||
|
||||
if(offset != tlvsize){
|
||||
@ -336,9 +345,9 @@ bool RsNxsSerialiser::serialiseSyncGrp(RsSyncGrp *item, void *data, uint32_t *si
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= SetTlvUInt8(data, size, offset, TLV_TYPE_UINT8_SERID, item->flag);
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_AGE, item->syncAge);
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->syncAge);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -389,25 +398,25 @@ bool RsNxsSerialiser::serialiseSyncGrpList(RsSyncGrpList *item, void *data, uint
|
||||
item->grps.begin();
|
||||
|
||||
// number of grps
|
||||
uint32_t nGrps = item->msgs.size();
|
||||
uint32_t nGrps = item->grps.size();
|
||||
|
||||
ok &= SetTlvUInt8(data, size, offset, TLV_TYPE_UINT8_SERID, item->flag);
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nGrps);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= setRawUInt32(data, *size, &offset, nGrps);
|
||||
|
||||
for(; mit != item->grps.end(); mit++){
|
||||
|
||||
// if not version contains then this
|
||||
// entry is invalid
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_MSGID, mit->first);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, mit->first);
|
||||
|
||||
uint32_t nVersions = mit->second.size();
|
||||
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_SIZE, nVersions);
|
||||
ok &= setRawUInt32(data, *size, &offset, nVersions);
|
||||
|
||||
std::list<uint32_t>::iterator lit = mit->second.begin();
|
||||
for(; lit != mit->second.end(); lit++)
|
||||
{
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_AGE, *lit);
|
||||
ok &= setRawUInt32(data, *size, &offset, *lit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,10 +462,10 @@ bool RsNxsSerialiser::serialiseSyncGrpMsg(RsSyncGrpMsg *item, void *data, uint32
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= SetTlvUInt8(data, size, offset, TLV_TYPE_UINT8_SERID, item->flag);
|
||||
ok &= SetTlvUInt32(data, size, offset, TLV_TYPE_UINT32_AGE, item->syncAge);
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= SetTlvString(data, size, offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->syncAge);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -483,3 +492,598 @@ bool RsNxsSerialiser::serialiseNxsSearchReq(RsNxsSearchReq *item, void *data, ui
|
||||
bool RsNxsSerialiser::serialiseNxsSearchResp(RsNxsSearchResp *item, void *data, uint32_t *size){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*** deserialisation ***/
|
||||
|
||||
|
||||
RsGrpResp* RsNxsSerialiser::deserialGrpResp(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_GRPS_RESP != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsGrpResp* item = new RsGrpResp(getRsItemService(rstype));
|
||||
item->grps;
|
||||
|
||||
while(offset < *size){
|
||||
|
||||
RsTlvBinaryData b(SERVICE_TYPE);
|
||||
ok &= b.GetTlv(data, *size, &offset);
|
||||
item->grps.push_back(b);
|
||||
}
|
||||
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsGrpMsgResp* RsNxsSerialiser::deserialGrpMsgResp(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpResp()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_MSG_RESP != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpMsgResp() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpMsgResp() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsGrpMsgResp* item = new RsGrpMsgResp(getRsItemService(rstype));
|
||||
|
||||
while(offset < *size){
|
||||
|
||||
RsTlvBinaryData b(SERVICE_TYPE);
|
||||
ok &= b.GetTlv(data, *size, &offset);
|
||||
item->msgs.push_back(b);
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpMsgResp() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialGrpMsgResp() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsSyncGrp* RsNxsSerialiser::deserialSyncGrp(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_SYNC_GRP != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsSyncGrp* item = new RsSyncGrp(getRsItemService(rstype));
|
||||
|
||||
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->syncAge));
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsSyncGrpList* RsNxsSerialiser::deserialSyncGrpList(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpList()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_SYNC_GRP_LIST != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsSyncGrpList* item = new RsSyncGrpList(getRsItemService(rstype));
|
||||
|
||||
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
||||
// now get number of grps
|
||||
|
||||
uint32_t nGroups = 0;
|
||||
ok &= GetTlvUInt32(data, *size, &offset, TLV_TYPE_UINT32_SIZE, &nGroups);
|
||||
|
||||
for(uint32_t i =0; i < nGroups; i++){
|
||||
uint32_t nVersions;
|
||||
ok &= getRawUInt32(data, *size, &offset, &nVersions);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
std::string grpId;
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, grpId);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
std::list<uint32_t> verL;
|
||||
|
||||
for(uint32_t j =0; j < nVersions; j++){
|
||||
|
||||
uint32_t version;
|
||||
ok &= getRawUInt32(data, *size, &offset, &version);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
verL.push_back(version);
|
||||
|
||||
}
|
||||
|
||||
if(!ok) break;
|
||||
item->grps[grpId] = verL;
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsSyncGrpMsgList* RsNxsSerialiser::deserialSyncGrpMsgList(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_SYNC_MSG_LIST != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList( FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsSyncGrpMsgList* item = new RsSyncGrpMsgList(getRsItemService(rstype));
|
||||
|
||||
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
|
||||
// now get number of msgs
|
||||
|
||||
uint32_t nMsgs = 0;
|
||||
ok &= getRawUInt32(data, *size, &offset, &nMsgs);
|
||||
|
||||
for(uint32_t i =0; i < nMsgs; i++){
|
||||
uint32_t nVersions;
|
||||
ok &= getRawUInt32(data, *size, &offset, &nVersions);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
std::string msgId;
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID,msgId);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
std::list<uint32_t> verL;
|
||||
|
||||
for(uint32_t j =0; j < nVersions; j++){
|
||||
|
||||
uint32_t version;
|
||||
ok &= getRawUInt32(data, *size, &offset, &version);
|
||||
|
||||
if(!ok) break;
|
||||
|
||||
verL.push_back(version);
|
||||
|
||||
}
|
||||
|
||||
if(!ok) break;
|
||||
item->msgs[msgId] = verL;
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsSyncGrpMsg* RsNxsSerialiser::deserialSyncGrpMsg(void *data, uint32_t *size)
|
||||
{
|
||||
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrp()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_SYNC_MSG != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsSyncGrpMsg* item = new RsSyncGrpMsg(getRsItemService(rstype));
|
||||
|
||||
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->syncAge));
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
RsNxsSearchReq* RsNxsSerialiser::deserialNxsSearchReq(void *data, uint32_t *size)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RsNxsSearchResp* RsNxsSerialiser::deserialNxsSearchResp(void *data, uint32_t *size)
|
||||
{
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** size functions ***/
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeGrpMsgResp(RsGrpMsgResp *item)
|
||||
{
|
||||
|
||||
uint32_t s = 8; //header size
|
||||
|
||||
std::list<RsTlvBinaryData>::iterator it =
|
||||
item->msgs.begin();
|
||||
|
||||
for(; it != item->msgs.end(); it++)
|
||||
s += (*it).TlvSize();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeGrpResp(RsGrpResp *item)
|
||||
{
|
||||
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
std::list<RsTlvBinaryData>::iterator it =
|
||||
item->grps.begin();
|
||||
|
||||
for(; it != item->grps.end(); it++)
|
||||
s += (*it).TlvSize();
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeSyncGrp(RsSyncGrp *item)
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 1; // flag
|
||||
s += 4; // sync age
|
||||
s += GetTlvStringSize(item->syncHash);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeSyncGrpList(RsSyncGrpList *item)
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 1; // flag
|
||||
s += 4; // number of grps
|
||||
|
||||
std::map<std::string, std::list<uint32_t> >::iterator mit
|
||||
= item->grps.begin();
|
||||
|
||||
for(; mit != item->grps.end(); mit++){
|
||||
|
||||
s += 4; // number of versions
|
||||
s += GetTlvStringSize(mit->first);
|
||||
|
||||
const std::list<uint32_t>& verL = mit->second;
|
||||
std::list<uint32_t>::const_iterator lit =
|
||||
verL.begin();
|
||||
|
||||
for(; lit != verL.end(); lit++){
|
||||
s += 4; // version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeSyncGrpMsg(RsSyncGrpMsg *item)
|
||||
{
|
||||
|
||||
uint32_t s = 8;
|
||||
|
||||
s += 1; // flag
|
||||
s += 4; // age
|
||||
s += GetTlvStringSize(item->grpId);
|
||||
s += GetTlvStringSize(item->syncHash);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeSyncGrpMsgList(RsSyncGrpMsgList *item)
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 1; // flag
|
||||
s += 4; // number of msgs
|
||||
s += GetTlvStringSize(item->grpId);
|
||||
std::map<std::string, std::list<uint32_t> >::iterator mit
|
||||
= item->msgs.begin();
|
||||
|
||||
for(; mit != item->msgs.end(); mit++){
|
||||
|
||||
s += 4; // number of versions
|
||||
s += GetTlvStringSize(mit->first);
|
||||
|
||||
const std::list<uint32_t>& verL = mit->second;
|
||||
std::list<uint32_t>::const_iterator lit =
|
||||
verL.begin();
|
||||
|
||||
for(; lit != verL.end(); lit++){
|
||||
s += 4; // version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsSearchReq(RsNxsSearchReq *item)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsSearchResp(RsNxsSearchResp *item)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -38,18 +38,18 @@
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_GRP = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_GRP_LIST = 0x0002;
|
||||
const uint8_t RS_PKT_SUBTYPE_GRPS_RESP = 0x0008;
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_MSG = 0x0010;
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_MSG_LIST = 0x0020;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_RESP = 0x0080;
|
||||
const uint8_t RS_PKT_SUBTYPE_SEARCH_REQ = 0x0100;
|
||||
const uint8_t RS_PKT_SUBTYPE_SEARCH_RESP = 0x0200;
|
||||
const uint8_t RS_PKT_SUBTYPE_GRPS_RESP = 0x0004;
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_MSG = 0x0008;
|
||||
const uint8_t RS_PKT_SUBTYPE_SYNC_MSG_LIST = 0x0010;
|
||||
const uint8_t RS_PKT_SUBTYPE_MSG_RESP = 0x0020;
|
||||
const uint8_t RS_PKT_SUBTYPE_SEARCH_REQ = 0x0040;
|
||||
const uint8_t RS_PKT_SUBTYPE_SEARCH_RESP = 0x0080;
|
||||
|
||||
|
||||
/*!
|
||||
* Base class for Network exchange service
|
||||
* Main purpose is rtti based routing of for serialisation
|
||||
* and deserialisation
|
||||
* Main purpose is for rtti based routing used in the
|
||||
* serialisation and deserialisation of NXS packets
|
||||
*
|
||||
* Service type is set by plugin service
|
||||
*/
|
||||
@ -59,6 +59,9 @@ class RsNxs : public RsItem
|
||||
public:
|
||||
RsNxs(uint16_t servtype, uint8_t subtype)
|
||||
: RsItem(RS_PKT_VERSION_SERVICE, servtype, subtype) { return; }
|
||||
|
||||
virtual void clear() { }
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0) { return out; }
|
||||
};
|
||||
|
||||
|
||||
@ -67,7 +70,7 @@ public:
|
||||
* Server may advise client peer to use sync file
|
||||
* while serving his request. This results
|
||||
*/
|
||||
class RsSyncGrp : RsNxs {
|
||||
class RsSyncGrp : public RsNxs {
|
||||
|
||||
public:
|
||||
|
||||
@ -90,7 +93,7 @@ class RsSyncGrpList : public RsNxs
|
||||
{
|
||||
|
||||
public:
|
||||
RsSynchGrpList(uint16_t servtype) : RsNxs(servtype, RS_PKT_SUBTYPE_SYNC_GRP_LIST) { return ; }
|
||||
RsSyncGrpList(uint16_t servtype) : RsNxs(servtype, RS_PKT_SUBTYPE_SYNC_GRP_LIST) { return ; }
|
||||
|
||||
static const uint8_t FLAG_REQUEST;
|
||||
static const uint8_t FLAG_RESPONSE;
|
||||
@ -126,12 +129,14 @@ class RsSyncGrpMsg : public RsNxs
|
||||
|
||||
public:
|
||||
|
||||
RsSyncGrpMsgs(uint16_t servtype) : RsNxs(servtype, RS_PKT_SUBTYPE_SYNC_MSG) {return; }
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
|
||||
RsSyncGrpMsg(uint16_t servtype) : RsNxs(servtype, RS_PKT_SUBTYPE_SYNC_MSG) {return; }
|
||||
|
||||
std::string grpId;
|
||||
uint32_t flag;
|
||||
uint8_t flag;
|
||||
uint32_t syncAge;
|
||||
uint32_t syncHash;
|
||||
std::string syncHash;
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -147,7 +152,7 @@ public:
|
||||
|
||||
RsSyncGrpMsgList(uint16_t servtype) : RsNxs(servtype, RS_PKT_SUBTYPE_SYNC_MSG_LIST) { return; }
|
||||
|
||||
uint32_t flag; // response/req
|
||||
uint8_t flag; // response/req
|
||||
std::string grpId;
|
||||
std::map<std::string, std::list<uint32_t> > msgs; // msg/versions pairs
|
||||
|
||||
@ -174,7 +179,7 @@ class RsNxsSearchReq : public RsNxs
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchReq(uint16_t servtype): RsNxs(servtype, RS_PKT_SUBTYPE_SEARCH_REQ) { return; }
|
||||
RsNxsSearchReq(uint16_t servtype): RsNxs(servtype, RS_PKT_SUBTYPE_SEARCH_REQ), searchTerm(servtype) { return; }
|
||||
uint16_t token;
|
||||
RsTlvBinaryData searchTerm; // service aware of item class
|
||||
};
|
||||
@ -200,7 +205,7 @@ class RsNxsSerialiser : public RsSerialType
|
||||
{
|
||||
|
||||
RsNxsSerialiser(uint16_t servtype) :
|
||||
RsSerialType(RS_PKT_VERSION_SERVICE, servtype) { return; }
|
||||
RsSerialType(RS_PKT_VERSION_SERVICE, servtype), SERVICE_TYPE(servtype) { return; }
|
||||
|
||||
virtual ~RsNxsSerialiser() { return; }
|
||||
|
||||
@ -237,9 +242,9 @@ private:
|
||||
|
||||
/* RS_PKT_SUBTYPE_SYNC_MSG_LIST */
|
||||
|
||||
virtual uint32_t sizeSynGrpMsgList(RsSyncGrpMsgList* item);
|
||||
virtual uint32_t sizeSyncGrpMsgList(RsSyncGrpMsgList* item);
|
||||
virtual bool serialiseSynGrpMsgList(RsSyncGrpMsgList* item, void *data, uint32_t* size);
|
||||
virtual RsSyncGrpMsgList* deserialSynGrpMsgList(void *data, uint32_t *size);
|
||||
virtual RsSyncGrpMsgList* deserialSyncGrpMsgList(void *data, uint32_t *size);
|
||||
|
||||
|
||||
/* RS_PKT_SUBTYPE_MSG_RESP */
|
||||
@ -252,7 +257,7 @@ private:
|
||||
|
||||
virtual uint32_t sizeNxsSearchReq(RsNxsSearchReq* item);
|
||||
virtual bool serialiseNxsSearchReq(RsNxsSearchReq* item, void* data, uint32_t* size);
|
||||
virtual RsNxsSearchResp* deserialNxsSearchReq(void *data, uint32_t *size);
|
||||
virtual RsNxsSearchReq* deserialNxsSearchReq(void *data, uint32_t *size);
|
||||
|
||||
/* RS_PKT_SUBTYPE_SEARCH_RESP */
|
||||
|
||||
@ -260,6 +265,9 @@ private:
|
||||
virtual bool serialiseNxsSearchResp(RsNxsSearchResp *item, void *data, uint32_t *size);
|
||||
virtual RsNxsSearchResp* deserialNxsSearchResp(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
const uint16_t SERVICE_TYPE;
|
||||
};
|
||||
|
||||
#endif // RSNXSITEMS_H
|
||||
|
Loading…
Reference in New Issue
Block a user