mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
improved serialisation methods in RsGxsNet items, and added serialisation for RsGrpConfigItem
This commit is contained in:
parent
661038d9b2
commit
a4c14c2212
@ -4460,7 +4460,7 @@ uint32_t RsGxsNetService::getSyncAge(const RsGxsGroupId& grpId)
|
||||
if(it == mServerGrpConfigMap.end())
|
||||
return RS_GXS_DEFAULT_MSG_REQ_PERIOD ;
|
||||
else
|
||||
return it->second.msg_keep_delay ;
|
||||
return it->second.msg_req_delay ;
|
||||
}
|
||||
uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId,uint32_t default_value)
|
||||
{
|
||||
@ -4471,7 +4471,7 @@ uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId,uint32_t default_
|
||||
if(it == mServerGrpConfigMap.end())
|
||||
return default_value ;
|
||||
else
|
||||
return it->second.msg_req_delay ;
|
||||
return it->second.msg_keep_delay ;
|
||||
}
|
||||
|
||||
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
|
||||
|
@ -26,23 +26,15 @@
|
||||
#include "rsgxsupdateitems.h"
|
||||
#include "rsbaseserial.h"
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* CLEAR */
|
||||
/**********************************************************************************************/
|
||||
|
||||
void RsGxsGrpUpdateItem::clear()
|
||||
{
|
||||
grpUpdateTS = 0;
|
||||
peerID.clear();
|
||||
}
|
||||
std::ostream& RsGxsGrpUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsGxsGrpUpdateItem", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
out << "peerId: " << peerID << std::endl;
|
||||
printIndent(out, int_Indent);
|
||||
out << "grpUpdateTS: " << grpUpdateTS << std::endl;
|
||||
printIndent(out, int_Indent);
|
||||
return out ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RsGxsMsgUpdateItem::clear()
|
||||
{
|
||||
@ -50,6 +42,23 @@ void RsGxsMsgUpdateItem::clear()
|
||||
peerID.clear();
|
||||
}
|
||||
|
||||
void RsGxsServerMsgUpdateItem::clear()
|
||||
{
|
||||
msgUpdateTS = 0;
|
||||
grpId.clear();
|
||||
}
|
||||
|
||||
void RsGxsServerGrpUpdateItem::clear()
|
||||
{
|
||||
grpUpdateTS = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* PRINT */
|
||||
/**********************************************************************************************/
|
||||
|
||||
std::ostream& RsGxsMsgUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
{
|
||||
RsPeerId peerId;
|
||||
@ -75,13 +84,15 @@ std::ostream& RsGxsMsgUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RsGxsServerMsgUpdateItem::clear()
|
||||
std::ostream& RsGxsGrpUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
{
|
||||
msgUpdateTS = 0;
|
||||
grpId.clear();
|
||||
printRsItemBase(out, "RsGxsGrpUpdateItem", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
out << "peerId: " << peerID << std::endl;
|
||||
printIndent(out, int_Indent);
|
||||
out << "grpUpdateTS: " << grpUpdateTS << std::endl;
|
||||
printIndent(out, int_Indent);
|
||||
return out ;
|
||||
}
|
||||
|
||||
std::ostream& RsGxsServerMsgUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
@ -96,11 +107,6 @@ std::ostream& RsGxsServerMsgUpdateItem::print(std::ostream& out, uint16_t indent
|
||||
}
|
||||
|
||||
|
||||
void RsGxsServerGrpUpdateItem::clear()
|
||||
{
|
||||
grpUpdateTS = 0;
|
||||
}
|
||||
|
||||
std::ostream& RsGxsServerGrpUpdateItem::print(std::ostream& out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsGxsServerGrpUpdateItem", indent);
|
||||
@ -111,147 +117,128 @@ std::ostream& RsGxsServerGrpUpdateItem::print(std::ostream& out, uint16_t indent
|
||||
return out;
|
||||
}
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* SERIALISER */
|
||||
/**********************************************************************************************/
|
||||
|
||||
|
||||
uint32_t RsGxsUpdateSerialiser::size(RsItem* item)
|
||||
bool RsGxsNetServiceItem::serialise_header(void *data,uint32_t& pktsize,uint32_t& tlvsize, uint32_t& offset) const
|
||||
{
|
||||
RsGxsMsgUpdateItem* mui = NULL;
|
||||
RsGxsGrpUpdateItem* gui = NULL;
|
||||
RsGxsServerGrpUpdateItem* gsui = NULL;
|
||||
RsGxsServerMsgUpdateItem* msui = NULL;
|
||||
tlvsize = serial_size() ;
|
||||
offset = 0;
|
||||
|
||||
if((mui = dynamic_cast<RsGxsMsgUpdateItem*>(item)) != NULL)
|
||||
{
|
||||
return sizeGxsMsgUpdate(mui);
|
||||
}else if(( gui = dynamic_cast<RsGxsGrpUpdateItem*>(item)) != NULL){
|
||||
return sizeGxsGrpUpdate(gui);
|
||||
}else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
||||
{
|
||||
return sizeGxsServerGrpUpdate(gsui);
|
||||
}else if((msui = dynamic_cast<RsGxsServerMsgUpdateItem*>(item)) != NULL)
|
||||
{
|
||||
return sizeGxsServerMsgUpdate(msui);
|
||||
}else
|
||||
{
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
pktsize = tlvsize;
|
||||
|
||||
if(!setRsItemHeader(data, tlvsize, PacketId(), tlvsize))
|
||||
{
|
||||
std::cerr << "RsFileTransferItem::serialise_header(): ERROR. Not enough size!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::size(): Could not find appropriate size function"
|
||||
<< std::endl;
|
||||
std::cerr << "RsFileItemSerialiser::serialiseData() Header: " << ok << std::endl;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
offset += 8;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool RsGxsUpdateSerialiser::serialise(RsItem* item, void* data,
|
||||
uint32_t* size)
|
||||
{
|
||||
RsGxsMsgUpdateItem* mui;
|
||||
RsGxsGrpUpdateItem* gui;
|
||||
RsGxsServerGrpUpdateItem* gsui;
|
||||
RsGxsServerMsgUpdateItem* msui;
|
||||
|
||||
if((mui = dynamic_cast<RsGxsMsgUpdateItem*>(item)) != NULL)
|
||||
return serialiseGxsMsgUpdate(mui, data, size);
|
||||
else if((gui = dynamic_cast<RsGxsGrpUpdateItem*>(item)) != NULL)
|
||||
return serialiseGxsGrpUpdate(gui, data, size);
|
||||
else if((msui = dynamic_cast<RsGxsServerMsgUpdateItem*>(item)) != NULL)
|
||||
return serialiseGxsServerMsgUpdate(msui, data, size);
|
||||
else if((gsui = dynamic_cast<RsGxsServerGrpUpdateItem*>(item)) != NULL)
|
||||
return serialiseGxsServerGrpUpdate(gsui, data, size);
|
||||
else
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialise() item does not caste to known type"
|
||||
<< std::endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RsItem* RsGxsUpdateSerialiser::deserialise(void* data, uint32_t* size)
|
||||
{
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialise()" << std::endl;
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialise()" << std::endl;
|
||||
#endif
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)))
|
||||
{
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (SERVICE_TYPE != getRsItemService(rstype)))
|
||||
return NULL; /* wrong type */
|
||||
|
||||
switch(getRsItemSubType(rstype))
|
||||
{
|
||||
case RS_PKT_SUBTYPE_GXS_MSG_UPDATE: return deserialGxsMsgUpdate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_GRP_UPDATE: return deserialGxsGrpUpddate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE: return deserialGxsServerGrpUpddate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE: return deserialGxsServerMsgUpdate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_GRP_CONFIG: return deserialGxsGrpConfig(data, size);
|
||||
|
||||
case RS_PKT_SUBTYPE_GXS_MSG_UPDATE:
|
||||
return deserialGxsMsgUpdate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_GRP_UPDATE:
|
||||
return deserialGxsGrpUpddate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE:
|
||||
return deserialGxsServerGrpUpddate(data, size);
|
||||
case RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE:
|
||||
return deserialGxsServerMsgUpdate(data, size);
|
||||
default:
|
||||
default:
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
# ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialise() : data has no type"
|
||||
<< std::endl;
|
||||
#endif
|
||||
<< std::endl;
|
||||
# endif
|
||||
return NULL;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t RsGxsUpdateSerialiser::sizeGxsGrpUpdate(RsGxsGrpUpdateItem* item)
|
||||
/**********************************************************************************************/
|
||||
/* SERIAL_SIZE() */
|
||||
/**********************************************************************************************/
|
||||
|
||||
|
||||
uint32_t RsGxsGrpUpdateItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += item->peerID.serial_size();
|
||||
s += peerID.serial_size();
|
||||
s += 4; // mUpdateTS
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsGxsUpdateSerialiser::sizeGxsServerGrpUpdate(RsGxsServerGrpUpdateItem* /* item */)
|
||||
uint32_t RsGxsServerGrpUpdateItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += 4; // time stamp
|
||||
return s;
|
||||
}
|
||||
|
||||
bool RsGxsUpdateSerialiser::serialiseGxsGrpUpdate(RsGxsGrpUpdateItem* item,
|
||||
void* data, uint32_t* size)
|
||||
uint32_t RsGxsMsgUpdateItem::serial_size() const
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsGrpUpdate()" << std::endl;
|
||||
#endif
|
||||
uint32_t s = 8; // header size
|
||||
s += peerID.serial_size() ;//GetTlvStringSize(item->peerId);
|
||||
|
||||
uint32_t tlvsize = sizeGxsGrpUpdate(item);
|
||||
uint32_t offset = 0;
|
||||
s += msgUpdateInfos.size() * (4 + 4 + RsGxsGroupId::serial_size());
|
||||
s += 4; // number of map items
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsGrpUpdate() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
uint32_t RsGxsServerMsgUpdateItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += grpId.serial_size();
|
||||
s += 4; // grp TS
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsGxsGrpConfigItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += grpId.serial_size();
|
||||
s += 4; // msg_keep_delay
|
||||
s += 4; // msg_send_delay
|
||||
s += 4; // msg_req_delay
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* SERIALISE() */
|
||||
/**********************************************************************************************/
|
||||
|
||||
bool RsGxsGrpUpdateItem::serialise(void* data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* RsGxsGrpUpdateItem */
|
||||
|
||||
|
||||
ok &= item->peerID.serialise(data, *size, offset) ;
|
||||
ok &= setRawUInt32(data, *size, &offset, item->grpUpdateTS);
|
||||
ok &= peerID.serialise(data, size, offset) ;
|
||||
ok &= setRawUInt32(data, size, &offset, grpUpdateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -260,45 +247,20 @@ bool RsGxsUpdateSerialiser::serialiseGxsGrpUpdate(RsGxsGrpUpdateItem* item,
|
||||
ok = false;
|
||||
}
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsGrpUpdate() NOK" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsGxsUpdateSerialiser::serialiseGxsServerGrpUpdate(RsGxsServerGrpUpdateItem* item,
|
||||
void* data, uint32_t* size)
|
||||
bool RsGxsServerGrpUpdateItem::serialise(void* data, uint32_t& size) const
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerGrpUpdate()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeGxsServerGrpUpdate(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerGrpUpdate() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* RsGxsServerGrpUpdateItem */
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->grpUpdateTS);
|
||||
ok &= setRawUInt32(data, size, &offset, grpUpdateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -307,15 +269,153 @@ bool RsGxsUpdateSerialiser::serialiseGxsServerGrpUpdate(RsGxsServerGrpUpdateItem
|
||||
ok = false;
|
||||
}
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
if (!ok)
|
||||
return ok;
|
||||
}
|
||||
bool RsGxsMsgUpdateItem::serialise(void* data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
ok &= peerID.serialise(data, size, offset) ;
|
||||
|
||||
std::map<RsGxsGroupId, RsGxsMsgUpdateItem::MsgUpdateInfo>::const_iterator cit(msgUpdateInfos.begin());
|
||||
|
||||
uint32_t numItems = msgUpdateInfos.size();
|
||||
ok &= setRawUInt32(data, size, &offset, numItems);
|
||||
|
||||
for(; cit != msgUpdateInfos.end(); ++cit)
|
||||
{
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerGrpUpdate() NOK" << std::endl;
|
||||
ok &= cit->first.serialise(data, size, offset);
|
||||
ok &= setRawUInt32(data, size, &offset, cit->second.time_stamp);
|
||||
ok &= setRawUInt32(data, size, &offset, cit->second.message_count);
|
||||
}
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsMsgUpdate() FAIL Size Error! " << std::endl;
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsGxsServerMsgUpdateItem::serialise( void* data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
ok &= grpId.serialise(data, size, offset) ;
|
||||
ok &= setRawUInt32(data, size, &offset, msgUpdateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate() FAIL Size Error! " << std::endl;
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsGxsGrpConfigItem::serialise( void* data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
ok &= grpId.serialise(data, size, offset) ;
|
||||
ok &= setRawUInt32(data, size, &offset, msg_keep_delay);
|
||||
ok &= setRawUInt32(data, size, &offset, msg_send_delay);
|
||||
ok &= setRawUInt32(data, size, &offset, msg_req_delay);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate() FAIL Size Error! " << std::endl;
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* DESERIALISE() */
|
||||
/**********************************************************************************************/
|
||||
|
||||
RsGxsGrpConfigItem* RsGxsUpdateSerialiser::deserialGxsGrpConfig(void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsServerGrpUpdate()" << 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_GXS_GRP_CONFIG != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsGrpUpdate() FAIL wrong type" << std::endl;
|
||||
#endif
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*size < rssize) /* check size */
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsGrpUpdate() FAIL wrong size" << std::endl;
|
||||
#endif
|
||||
return NULL; /* not enough data */
|
||||
}
|
||||
|
||||
/* set the packet length */
|
||||
*size = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsGxsGrpConfigItem* item = new RsGxsGrpConfigItem(getRsItemService(rstype));
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= item->grpId.deserialise(data, *size, offset) ;
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->msg_keep_delay));
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->msg_send_delay));
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->msg_req_delay));
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxxGrpUpdate() FAIL size mismatch" << std::endl;
|
||||
#endif
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsGrpUpdate() NOK" << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
RsGxsGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsGrpUpddate(void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -381,8 +481,7 @@ RsGxsGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsGrpUpddate(void* data, uin
|
||||
return item;
|
||||
}
|
||||
|
||||
RsGxsServerGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerGrpUpddate(void* data,
|
||||
uint32_t* size)
|
||||
RsGxsServerGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerGrpUpddate(void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsServerGrpUpdate()" << std::endl;
|
||||
@ -394,9 +493,7 @@ RsGxsServerGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerGrpUpddate(voi
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE != getRsItemSubType(rstype)))
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (SERVICE_TYPE != getRsItemService(rstype)) || (RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsServerGrpUpdate() FAIL wrong type" << std::endl;
|
||||
@ -446,137 +543,9 @@ RsGxsServerGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerGrpUpddate(voi
|
||||
return item;
|
||||
}
|
||||
|
||||
uint32_t RsGxsUpdateSerialiser::sizeGxsMsgUpdate(RsGxsMsgUpdateItem* item)
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += item->peerID.serial_size() ;//GetTlvStringSize(item->peerId);
|
||||
|
||||
s += item->msgUpdateInfos.size() * (4 + 4 + RsGxsGroupId::serial_size());
|
||||
s += 4; // number of map items
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsGxsUpdateSerialiser::sizeGxsServerMsgUpdate(RsGxsServerMsgUpdateItem* item)
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
s += item->grpId.serial_size();
|
||||
s += 4; // grp TS
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool RsGxsUpdateSerialiser::serialiseGxsMsgUpdate(RsGxsMsgUpdateItem* item,
|
||||
void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsMsgUpdate()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeGxsMsgUpdate(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsMsgUpdate() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* RsGxsMsgUpdateItem */
|
||||
|
||||
|
||||
ok &= item->peerID.serialise(data, *size, offset) ;
|
||||
|
||||
std::map<RsGxsGroupId, RsGxsMsgUpdateItem::MsgUpdateInfo>::const_iterator cit(item->msgUpdateInfos.begin());
|
||||
|
||||
uint32_t numItems = item->msgUpdateInfos.size();
|
||||
ok &= setRawUInt32(data, *size, &offset, numItems);
|
||||
|
||||
for(; cit != item->msgUpdateInfos.end(); ++cit)
|
||||
{
|
||||
ok &= cit->first.serialise(data, *size, offset);
|
||||
ok &= setRawUInt32(data, *size, &offset, cit->second.time_stamp);
|
||||
ok &= setRawUInt32(data, *size, &offset, cit->second.message_count);
|
||||
}
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsMsgUpdate() FAIL Size Error! " << std::endl;
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsMsgUpdate() NOK" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate(RsGxsServerMsgUpdateItem* item,
|
||||
void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeGxsServerMsgUpdate(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* RsNxsSyncm */
|
||||
|
||||
|
||||
ok &= item->grpId.serialise(data, *size, offset) ;
|
||||
ok &= setRawUInt32(data, *size, &offset, item->msgUpdateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate() FAIL Size Error! " << std::endl;
|
||||
#endif
|
||||
ok = false;
|
||||
}
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
if (!ok)
|
||||
{
|
||||
std::cerr << "RsGxsUpdateSerialiser::serialiseGxsServerMsgUpdate() NOK" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
RsGxsMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsMsgUpdate(void* data,
|
||||
uint32_t* size)
|
||||
RsGxsMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsMsgUpdate(void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsMsgUpdate()" << std::endl;
|
||||
@ -588,9 +557,7 @@ RsGxsMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsMsgUpdate(void* data,
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_GXS_MSG_UPDATE != getRsItemSubType(rstype)))
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (SERVICE_TYPE != getRsItemService(rstype)) || (RS_PKT_SUBTYPE_GXS_MSG_UPDATE != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsMsgUpdate() FAIL wrong type" << std::endl;
|
||||
@ -662,8 +629,7 @@ RsGxsMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsMsgUpdate(void* data,
|
||||
return item;
|
||||
}
|
||||
|
||||
RsGxsServerMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerMsgUpdate(void* data,
|
||||
uint32_t* size)
|
||||
RsGxsServerMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerMsgUpdate(void* data, uint32_t* size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsServerMsgUpdate()" << std::endl;
|
||||
@ -675,9 +641,7 @@ RsGxsServerMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsServerMsgUpdate(void
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE != getRsItemSubType(rstype)))
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (SERVICE_TYPE != getRsItemService(rstype)) || (RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsGxsUpdateSerialiser::deserialGxsServerMsgUpdate() FAIL wrong type" << std::endl;
|
||||
|
@ -49,6 +49,23 @@ const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE = 0x08;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_GRP_CONFIG = 0x09;
|
||||
|
||||
class RsGxsNetServiceItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsGxsNetServiceItem(uint16_t serv_type,uint8_t subtype) : RsItem(RS_PKT_VERSION_SERVICE, serv_type, subtype) {}
|
||||
|
||||
virtual ~RsGxsNetServiceItem() {}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const = 0 ;
|
||||
virtual uint32_t serial_size() const = 0 ;
|
||||
|
||||
virtual void clear() = 0 ;
|
||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) = 0;
|
||||
|
||||
protected:
|
||||
bool serialise_header(void *data, uint32_t& pktsize, uint32_t& tlvsize, uint32_t& offset) const;
|
||||
};
|
||||
|
||||
class RsGxsGrpConfig
|
||||
{
|
||||
public:
|
||||
@ -72,16 +89,18 @@ public:
|
||||
time_t update_TS ; // last time the max visible count was updated.
|
||||
};
|
||||
|
||||
class RsGxsGrpConfigItem : public RsItem, public RsGxsGrpConfig
|
||||
class RsGxsGrpConfigItem : public RsGxsNetServiceItem, public RsGxsGrpConfig
|
||||
{
|
||||
public:
|
||||
RsGxsGrpConfigItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {}
|
||||
RsGxsGrpConfigItem(const RsGxsGrpConfig& m,uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG),RsGxsGrpConfig(m) {}
|
||||
RsGxsGrpConfigItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {}
|
||||
RsGxsGrpConfigItem(const RsGxsGrpConfig& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG),RsGxsGrpConfig(m) {}
|
||||
virtual ~RsGxsGrpConfigItem() {}
|
||||
|
||||
virtual void clear() {}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) { return out;}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||
virtual uint32_t serial_size() const ;
|
||||
};
|
||||
|
||||
class RsGxsGrpUpdate
|
||||
@ -93,16 +112,19 @@ public:
|
||||
uint32_t grpUpdateTS;
|
||||
};
|
||||
|
||||
class RsGxsGrpUpdateItem : public RsItem, public RsGxsGrpUpdate
|
||||
class RsGxsGrpUpdateItem : public RsGxsNetServiceItem, public RsGxsGrpUpdate
|
||||
{
|
||||
public:
|
||||
RsGxsGrpUpdateItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_UPDATE) {clear();}
|
||||
RsGxsGrpUpdateItem(const RsGxsGrpUpdate& u,uint16_t serv_type) : RsGxsGrpUpdate(u),RsItem(RS_PKT_VERSION_SERVICE, serv_type, RS_PKT_SUBTYPE_GXS_GRP_UPDATE) {clear();}
|
||||
RsGxsGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_UPDATE) {clear();}
|
||||
RsGxsGrpUpdateItem(const RsGxsGrpUpdate& u,uint16_t serv_type) : RsGxsNetServiceItem(serv_type, RS_PKT_SUBTYPE_GXS_GRP_UPDATE), RsGxsGrpUpdate(u) {clear();}
|
||||
|
||||
virtual ~RsGxsGrpUpdateItem() {}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||
virtual uint32_t serial_size() const ;
|
||||
};
|
||||
|
||||
class RsGxsServerGrpUpdate
|
||||
@ -113,16 +135,19 @@ public:
|
||||
uint32_t grpUpdateTS;
|
||||
};
|
||||
|
||||
class RsGxsServerGrpUpdateItem : public RsItem, public RsGxsServerGrpUpdate
|
||||
class RsGxsServerGrpUpdateItem : public RsGxsNetServiceItem, public RsGxsServerGrpUpdate
|
||||
{
|
||||
public:
|
||||
RsGxsServerGrpUpdateItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE) { clear();}
|
||||
RsGxsServerGrpUpdateItem(const RsGxsServerGrpUpdate& u,uint16_t serv_type) : RsGxsServerGrpUpdate(u),RsItem(RS_PKT_VERSION_SERVICE, serv_type, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE) {clear();}
|
||||
RsGxsServerGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE) { clear();}
|
||||
RsGxsServerGrpUpdateItem(const RsGxsServerGrpUpdate& u,uint16_t serv_type) : RsGxsNetServiceItem(serv_type, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE), RsGxsServerGrpUpdate(u) {clear();}
|
||||
|
||||
virtual ~RsGxsServerGrpUpdateItem() {}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||
virtual uint32_t serial_size() const ;
|
||||
};
|
||||
|
||||
class RsGxsMsgUpdate
|
||||
@ -140,16 +165,19 @@ public:
|
||||
std::map<RsGxsGroupId, MsgUpdateInfo> msgUpdateInfos;
|
||||
};
|
||||
|
||||
class RsGxsMsgUpdateItem : public RsItem, public RsGxsMsgUpdate
|
||||
class RsGxsMsgUpdateItem : public RsGxsNetServiceItem, public RsGxsMsgUpdate
|
||||
{
|
||||
public:
|
||||
RsGxsMsgUpdateItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE) { clear();}
|
||||
RsGxsMsgUpdateItem(const RsGxsMsgUpdate& m,uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE), RsGxsMsgUpdate(m) { clear();}
|
||||
RsGxsMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE) { clear();}
|
||||
RsGxsMsgUpdateItem(const RsGxsMsgUpdate& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE), RsGxsMsgUpdate(m) { clear();}
|
||||
|
||||
virtual ~RsGxsMsgUpdateItem() {}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||
virtual uint32_t serial_size() const ;
|
||||
};
|
||||
|
||||
class RsGxsServerMsgUpdate
|
||||
@ -161,15 +189,18 @@ public:
|
||||
uint32_t msgUpdateTS; // local time stamp this group last received a new msg
|
||||
};
|
||||
|
||||
class RsGxsServerMsgUpdateItem : public RsItem, public RsGxsServerMsgUpdate
|
||||
class RsGxsServerMsgUpdateItem : public RsGxsNetServiceItem, public RsGxsServerMsgUpdate
|
||||
{
|
||||
public:
|
||||
RsGxsServerMsgUpdateItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE) { clear();}
|
||||
RsGxsServerMsgUpdateItem(const RsGxsServerMsgUpdate& m,uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE),RsGxsServerMsgUpdate(m) { clear();}
|
||||
RsGxsServerMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE) { clear();}
|
||||
RsGxsServerMsgUpdateItem(const RsGxsServerMsgUpdate& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE),RsGxsServerMsgUpdate(m) { clear();}
|
||||
virtual ~RsGxsServerMsgUpdateItem() {}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const ;
|
||||
virtual uint32_t serial_size() const ;
|
||||
};
|
||||
|
||||
|
||||
@ -177,53 +208,44 @@ class RsGxsUpdateSerialiser : public RsSerialType
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsUpdateSerialiser(uint16_t servtype) :
|
||||
RsSerialType(RS_PKT_VERSION_SERVICE, servtype), SERVICE_TYPE(servtype) { return; }
|
||||
RsGxsUpdateSerialiser(uint16_t servtype) : RsSerialType(RS_PKT_VERSION_SERVICE, servtype), SERVICE_TYPE(servtype) {}
|
||||
|
||||
virtual ~RsGxsUpdateSerialiser() { return; }
|
||||
virtual ~RsGxsUpdateSerialiser() {}
|
||||
|
||||
virtual uint32_t size(RsItem *item);
|
||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size);
|
||||
virtual RsItem* deserialise(void *data, uint32_t *size);
|
||||
virtual uint32_t size(RsItem *item)
|
||||
{
|
||||
RsGxsNetServiceItem *gitem = dynamic_cast<RsGxsNetServiceItem *>(item);
|
||||
|
||||
if (!gitem)
|
||||
return 0;
|
||||
|
||||
return gitem->serial_size() ;
|
||||
}
|
||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size)
|
||||
{
|
||||
RsGxsNetServiceItem *gitem = dynamic_cast<RsGxsNetServiceItem *>(item);
|
||||
|
||||
if (!gitem)
|
||||
return false;
|
||||
|
||||
return gitem->serialise(data,*size) ;
|
||||
}
|
||||
|
||||
virtual RsItem* deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
RsGxsGrpConfigItem *deserialGxsGrpConfig(void *data, uint32_t *size);
|
||||
RsGxsServerMsgUpdateItem *deserialGxsServerMsgUpdate(void *data, uint32_t *size);
|
||||
RsGxsMsgUpdateItem *deserialGxsMsgUpdate(void *data, uint32_t *size);
|
||||
RsGxsServerGrpUpdateItem *deserialGxsServerGrpUpddate(void *data, uint32_t *size);
|
||||
RsGxsGrpUpdateItem *deserialGxsGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
bool checkItemHeader(void *data, uint32_t *size, uint16_t service_type,uint8_t subservice_type);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GRP_UPDATE_ITEM */
|
||||
|
||||
uint32_t sizeGxsGrpUpdate(RsGxsGrpUpdateItem* item);
|
||||
bool serialiseGxsGrpUpdate(RsGxsGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsGrpUpdateItem* deserialGxsGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GRP_SERVER_UPDATE_ITEM */
|
||||
|
||||
uint32_t sizeGxsServerGrpUpdate(RsGxsServerGrpUpdateItem* item);
|
||||
bool serialiseGxsServerGrpUpdate(RsGxsServerGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsServerGrpUpdateItem* deserialGxsServerGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_MSG_UPDATE_ITEM */
|
||||
|
||||
uint32_t sizeGxsMsgUpdate(RsGxsMsgUpdateItem* item);
|
||||
bool serialiseGxsMsgUpdate(RsGxsMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsMsgUpdateItem* deserialGxsMsgUpdate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_SERVER_UPDATE_ITEM */
|
||||
|
||||
uint32_t sizeGxsServerMsgUpdate(RsGxsServerMsgUpdateItem* item);
|
||||
bool serialiseGxsServerMsgUpdate(RsGxsServerMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsServerMsgUpdateItem* deserialGxsServerMsgUpdate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_CONFIG */
|
||||
|
||||
uint32_t sizeGxsGrpConfig(RsGxsGrpConfigItem* item);
|
||||
bool serialiseGxsGrpConfig(RsGxsGrpConfigItem *item, void *data, uint32_t *size);
|
||||
RsGxsGrpConfigItem* deserialGxsGrpConfig(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
const uint16_t SERVICE_TYPE;
|
||||
const uint16_t SERVICE_TYPE;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* RSGXSUPDATEITEMS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user