moved gxs comment and Id items to rsitems/

This commit is contained in:
csoler 2017-04-26 14:28:25 +02:00
parent 97d0df0737
commit 508a2e2864
17 changed files with 31 additions and 39 deletions

View file

@ -0,0 +1,448 @@
/*
* libretroshare/src/serialiser: rsgxscommentitems.cc
*
* RetroShare C++ Interface.
*
* Copyright 2012-2013 by Robert Fernie
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <iostream>
#include "rsgxscommentitems.h"
#include "serialiser/rstlvbase.h"
#include "serialiser/rsbaseserial.h"
#include "serialization/rstypeserializer.h"
//#define GXSCOMMENT_DEBUG 1
RsItem *RsGxsCommentSerialiser::create_item(uint16_t service_id,uint8_t item_subtype) const
{
if(service_id != getRsItemService(PacketId()))
return NULL ;
switch(item_subtype)
{
case RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM: return new RsGxsCommentItem(getRsItemService(PacketId())) ;
case RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM: return new RsGxsVoteItem(getRsItemService(PacketId()));
default:
return NULL ;
}
}
#ifdef TO_REMOVE
uint32_t RsGxsCommentSerialiser::size(RsItem *item)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::size()" << std::endl;
#endif
RsGxsCommentItem* com_item = NULL;
RsGxsVoteItem* vote_item = NULL;
if((com_item = dynamic_cast<RsGxsCommentItem*>(item)) != NULL)
{
return sizeGxsCommentItem(com_item);
}
else if((vote_item = dynamic_cast<RsGxsVoteItem*>(item)) != NULL)
{
return sizeGxsVoteItem(vote_item);
}
std::cerr << "RsGxsCommentSerialiser::size() ERROR invalid item" << std::endl;
return 0;
}
bool RsGxsCommentSerialiser::serialise(RsItem *item, void *data, uint32_t *size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialise()" << std::endl;
#endif
RsGxsCommentItem* com_item = NULL;
RsGxsVoteItem* vote_item = NULL;
if((com_item = dynamic_cast<RsGxsCommentItem*>(item)) != NULL)
{
return serialiseGxsCommentItem(com_item, data, size);
}
else if((vote_item = dynamic_cast<RsGxsVoteItem*>(item)) != NULL)
{
return serialiseGxsVoteItem(vote_item, data, size);
}
std::cerr << "RsGxsCommentSerialiser::serialise() ERROR invalid item" << std::endl;
return false;
}
RsItem* RsGxsCommentSerialiser::deserialise(void* data, uint32_t* size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialise()" << std::endl;
#endif
/* get the type and size */
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(getRsItemService(PacketId()) != getRsItemService(rstype)))
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialise() ERROR Wrong Type" << std::endl;
#endif
return NULL; /* wrong type */
}
switch(getRsItemSubType(rstype))
{
case RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM:
return deserialiseGxsCommentItem(data, size);
break;
case RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM:
return deserialiseGxsVoteItem(data, size);
break;
default:
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialise(): unknown subtype";
std::cerr << std::endl;
#endif
break;
}
return NULL;
}
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
void RsGxsCommentItem::clear()
{
mMsg.mComment.clear();
}
std::ostream& RsGxsCommentItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsCommentItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "Comment: " << mMsg.mComment << std::endl;
printRsItemEnd(out ,"RsGxsCommentItem", indent);
return out;
}
uint32_t RsGxsCommentSerialiser::sizeGxsCommentItem(RsGxsCommentItem *item)
{
const RsGxsComment& msg = item->mMsg;
uint32_t s = 8; // header
s += GetTlvStringSize(msg.mComment); // mMsg.
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::sizeGxsCommentItem() is: " << s << std::endl;
msg.print(std::cerr);
#endif
return s;
}
#endif
void RsGxsCommentItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,1,mMsg.mComment,"mMsg.mComment") ;
}
#ifdef TO_REMOVE
bool RsGxsCommentSerialiser::serialiseGxsCommentItem(RsGxsCommentItem *item, void *data, uint32_t *size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsCommentItem()" << std::endl;
#endif
uint32_t tlvsize = sizeGxsCommentItem(item);
uint32_t offset = 0;
if(*size < tlvsize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsCommentItem() Failed size too small" << std::endl;
#endif
return false;
}
*size = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
/* skip the header */
offset += 8;
/* GxsCommentItem */
ok &= SetTlvString(data, tlvsize, &offset, 1, item->mMsg.mComment);
if(offset != tlvsize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsCommentItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSCOMMENT_DEBUG
if (!ok)
{
std::cerr << "RsGxsCommentSerialiser::serialiseGxsCommentItem() NOK" << std::endl;
}
#endif
return ok;
}
RsGxsCommentItem* RsGxsCommentSerialiser::deserialiseGxsCommentItem(void *data, uint32_t *size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsCommentItem()" << 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)) ||
(getRsItemService(PacketId()) != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsCommentItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsCommentItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsCommentItem* item = new RsGxsCommentItem(getRsItemService(PacketId()));
/* skip the header */
offset += 8;
ok &= GetTlvString(data, rssize, &offset, 1, item->mMsg.mComment);
if (offset != rssize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsCommentItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsCommentItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
void RsGxsVoteItem::clear()
{
mMsg.mVoteType = 0;
}
std::ostream& RsGxsVoteItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsVoteItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "VoteType: " << mMsg.mVoteType << std::endl;
printRsItemEnd(out ,"RsGxsVoteItem", indent);
return out;
}
uint32_t RsGxsCommentSerialiser::sizeGxsVoteItem(RsGxsVoteItem */*item*/)
{
uint32_t s = 8; // header
s += 4; // vote flags.
return s;
}
#endif
void RsGxsVoteItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process<uint32_t>(j,ctx,mMsg.mVoteType,"mMsg.mVoteType") ;
}
#ifdef TO_REMOVE
bool RsGxsCommentSerialiser::serialiseGxsVoteItem(RsGxsVoteItem *item, void *data, uint32_t *size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsVoteItem()" << std::endl;
#endif
uint32_t tlvsize = sizeGxsVoteItem(item);
uint32_t offset = 0;
if(*size < tlvsize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsVoteItem()" << std::endl;
#endif
return false;
}
*size = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
/* skip the header */
offset += 8;
/* GxsVoteItem */
ok &= setRawUInt32(data, tlvsize, &offset, item->mMsg.mVoteType);
if(offset != tlvsize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::serialiseGxsVoteItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSCOMMENT_DEBUG
if (!ok)
{
std::cerr << "RsGxsCommentSerialiser::serialiseGxsVoteItem() NOK" << std::endl;
}
#endif
return ok;
}
RsGxsVoteItem* RsGxsCommentSerialiser::deserialiseGxsVoteItem(void *data, uint32_t *size)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsVoteItem()" << 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)) ||
(getRsItemService(PacketId()) != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsVoteItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsVoteItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsVoteItem* item = new RsGxsVoteItem(getRsItemService(PacketId()));
/* skip the header */
offset += 8;
ok &= getRawUInt32(data, rssize, &offset, &(item->mMsg.mVoteType));
if (offset != rssize)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsVoteItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSCOMMENT_DEBUG
std::cerr << "RsGxsCommentSerialiser::deserialiseGxsVoteItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
#endif

View file

@ -0,0 +1,79 @@
/*
* libretroshare/src/serialiser: rsgxscommentitems.h
*
* RetroShare C++ Interface.
*
* Copyright 2012-2012 by Robert Fernie
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef RS_GXS_COMMENT_ITEMS_H
#define RS_GXS_COMMENT_ITEMS_H
#include <map>
#include "rsitems/rsserviceids.h"
#include "serialiser/rsserial.h"
//#include "serialiser/rstlvtypes.h"
#include "rsgxsitems.h"
#include "retroshare/rsgxscommon.h"
const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1;
const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2;
class RsGxsCommentItem : public RsGxsMsgItem
{
public:
RsGxsCommentItem(uint16_t service_type): RsGxsMsgItem(service_type, RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM) {}
virtual ~RsGxsCommentItem() {}
void clear(){}
virtual void serial_process(RsGenericSerializer::SerializeJob /* j */,RsGenericSerializer::SerializeContext& /* ctx */);
RsGxsComment mMsg;
};
class RsGxsVoteItem : public RsGxsMsgItem
{
public:
RsGxsVoteItem(uint16_t service_type): RsGxsMsgItem(service_type, RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM) {}
virtual ~RsGxsVoteItem() {}
void clear(){}
virtual void serial_process(RsGenericSerializer::SerializeJob /* j */,RsGenericSerializer::SerializeContext& /* ctx */);
RsGxsVote mMsg;
};
class RsGxsCommentSerialiser : public RsServiceSerializer
{
public:
RsGxsCommentSerialiser(uint16_t service_type) :RsServiceSerializer(service_type) {}
virtual ~RsGxsCommentSerialiser() {}
RsItem *create_item(uint16_t service_id,uint8_t item_subtype) const ;
};
#endif /* RS_GXS_COMMENT_ITEMS_H */

View file

@ -0,0 +1,735 @@
/*
* libretroshare/src/serialiser: rsgxsiditems.cc
*
* RetroShare C++ Interface.
*
* Copyright 2012-2012 by Robert Fernie
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <iostream>
#include "rsgxsiditems.h"
#include "serialiser/rstlvbase.h"
#include "serialiser/rsbaseserial.h"
#include "serialiser/rstlvstring.h"
#include "util/rsstring.h"
#include "serialization/rstypeserializer.h"
#define GXSID_DEBUG 1
RsItem *RsGxsIdSerialiser::create_item(uint16_t service_id,uint8_t item_subtype) const
{
if(service_id != RS_SERVICE_GXS_TYPE_GXSID)
return NULL ;
switch(item_subtype)
{
case RS_PKT_SUBTYPE_GXSID_GROUP_ITEM : return new RsGxsIdGroupItem ();
case RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM: return new RsGxsIdLocalInfoItem() ;
default:
return NULL ;
}
}
void RsGxsIdLocalInfoItem::clear()
{
mTimeStamps.clear() ;
}
void RsGxsIdGroupItem::clear()
{
mPgpIdHash.clear();
mPgpIdSign.clear();
mRecognTags.clear();
mImage.TlvClear();
}
#ifdef TO_REMOVE
RsItem* RsGxsIdSerialiser::deserialise(void* data, uint32_t* size)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || (RS_SERVICE_GXS_TYPE_GXSID != getRsItemService(rstype)))
return NULL; /* wrong type */
switch(getRsItemSubType(rstype))
{
case RS_PKT_SUBTYPE_GXSID_GROUP_ITEM: return deserialise_GxsIdGroupItem(data, size);
case RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM: return deserialise_GxsIdLocalInfoItem(data, size);
#if 0
case RS_PKT_SUBTYPE_GXSID_OPINION_ITEM: return deserialise_GxsIdOpinionItem(data, size);
case RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM: return deserialise_GxsIdCommentItem(data, size);
#endif
default:
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialise(): unknown subtype";
std::cerr << std::endl;
#endif
break;
}
return NULL;
}
bool RsGxsIdItem::serialise_header(void *data,uint32_t& pktsize,uint32_t& tlvsize, uint32_t& offset)
{
tlvsize = serial_size() ;
offset = 0;
if (pktsize < tlvsize)
return false; /* not enough space */
pktsize = tlvsize;
if(!setRsItemHeader(data, tlvsize, PacketId(), tlvsize))
{
std::cerr << "RsItem::serialise_header(): ERROR. Not enough size!" << std::endl;
return false ;
}
offset += 8;
return true ;
}
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
uint32_t RsGxsIdLocalInfoItem::serial_size()
{
uint32_t s = 8 ; // header
s += 4 ; // number of items
s += mTimeStamps.size() * (RsGxsId::SIZE_IN_BYTES + 8) ;
s += 4 ; // number of contacts
s += mContacts.size() * RsGxsId::SIZE_IN_BYTES ;
return s;
}
std::ostream& RsGxsIdLocalInfoItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsIdLocalInfoItem", indent);
// convert from binary to hex.
for(std::map<RsGxsId,time_t>::const_iterator it(mTimeStamps.begin());it!=mTimeStamps.end();++it)
out << it->first << " : " << it->second << std::endl;
printRsItemEnd(out ,"RsGxsIdLocalInfoItem", indent);
return out;
}
std::ostream& RsGxsIdGroupItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsIdGroupItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "MetaData: " << meta << std::endl;
printIndent(out, int_Indent);
out << "PgpIdHash: " << mPgpIdHash << std::endl;
printIndent(out, int_Indent);
std::string signhex;
// convert from binary to hex.
for(unsigned int i = 0; i < mPgpIdSign.length(); i++)
{
rs_sprintf_append(signhex, "%02x", (uint32_t) ((uint8_t) mPgpIdSign[i]));
}
out << "PgpIdSign: " << signhex << std::endl;
printIndent(out, int_Indent);
out << "RecognTags:" << std::endl;
RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, mRecognTags);
set.print(out, int_Indent + 2);
printRsItemEnd(out ,"RsGxsIdGroupItem", indent);
return out;
}
uint32_t RsGxsIdGroupItem::serial_size()
{
uint32_t s = 8; // header
s += Sha1CheckSum::SIZE_IN_BYTES;
s += GetTlvStringSize(mPgpIdSign);
RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, mRecognTags);
s += set.TlvSize();
s += mImage.TlvSize() ;
return s;
}
#endif
void RsGxsIdLocalInfoItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,mTimeStamps,"mTimeStamps") ;
RsTypeSerializer::serial_process(j,ctx,mContacts,"mContacts") ;
}
#ifdef TO_REMOVE
bool RsGxsIdLocalInfoItem::serialise(void *data, uint32_t& size)
{
uint32_t tlvsize,offset=0;
bool ok = true;
if(!serialise_header(data,size,tlvsize,offset))
return false ;
ok &= setRawUInt32(data, tlvsize, &offset, mTimeStamps.size()) ;
for(std::map<RsGxsId,time_t>::const_iterator it = mTimeStamps.begin();it!=mTimeStamps.end();++it)
{
ok &= it->first.serialise(data,tlvsize,offset) ;
ok &= setRawTimeT(data,tlvsize,&offset,it->second) ;
}
ok &= setRawUInt32(data, tlvsize, &offset, mContacts.size()) ;
for(std::set<RsGxsId>::const_iterator it(mContacts.begin());it!=mContacts.end();++it)
ok &= (*it).serialise(data,tlvsize,offset) ;
if(offset != tlvsize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdGroupItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSID_DEBUG
if (!ok)
{
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdgroupItem() NOK" << std::endl;
}
#endif
return ok;
}
#endif
void RsGxsIdGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,mPgpIdHash,"mPgpIdHash") ;
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_SIGN,mPgpIdSign,"mPgpIdSign") ;
RsTlvStringSetRef rset(TLV_TYPE_RECOGNSET,mRecognTags) ;
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,rset,"mRecognTags") ;
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,mImage,"mImage") ;
}
#ifdef TO_REMOVE
bool RsGxsIdGroupItem::serialise(void *data, uint32_t& size)
{
uint32_t tlvsize,offset=0;
bool ok = true;
if(!serialise_header(data,size,tlvsize,offset))
return false ;
/* GxsIdGroupItem */
ok &= mPgpIdHash.serialise(data, tlvsize, offset);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_SIGN, mPgpIdSign);
RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, mRecognTags);
ok &= set.SetTlv(data, tlvsize, &offset);
ok &= mImage.SetTlv(data,tlvsize,&offset) ;
if(offset != tlvsize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdGroupItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSID_DEBUG
if (!ok)
{
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdgroupItem() NOK" << std::endl;
}
#endif
return ok;
}
#endif
bool RsGxsIdGroupItem::fromGxsIdGroup(RsGxsIdGroup &group, bool moveImage)
{
clear();
meta = group.mMeta;
mPgpIdHash = group.mPgpIdHash;
mPgpIdSign = group.mPgpIdSign;
mRecognTags = group.mRecognTags;
if (moveImage)
{
mImage.binData.bin_data = group.mImage.mData;
mImage.binData.bin_len = group.mImage.mSize;
group.mImage.shallowClear();
}
else
{
mImage.binData.setBinData(group.mImage.mData, group.mImage.mSize);
}
return true ;
}
bool RsGxsIdGroupItem::toGxsIdGroup(RsGxsIdGroup &group, bool moveImage)
{
group.mMeta = meta;
group.mPgpIdHash = mPgpIdHash;
group.mPgpIdSign = mPgpIdSign;
group.mRecognTags = mRecognTags;
if (moveImage)
{
group.mImage.take((uint8_t *) mImage.binData.bin_data, mImage.binData.bin_len);
// mImage doesn't have a ShallowClear at the moment!
mImage.binData.TlvShallowClear();
}
else
{
group.mImage.copy((uint8_t *) mImage.binData.bin_data, mImage.binData.bin_len);
}
return true ;
}
#ifdef TO_REMOVE
RsGxsIdGroupItem* RsGxsIdSerialiser::deserialise_GxsIdGroupItem(void *data, uint32_t *size)
{
/* 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)) ||
(RS_SERVICE_GXS_TYPE_GXSID != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSID_GROUP_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsIdGroupItem* item = new RsGxsIdGroupItem();
/* skip the header */
offset += 8;
ok &= item->mPgpIdHash.deserialise(data, rssize, offset);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_SIGN, item->mPgpIdSign);
RsTlvStringSetRef set(TLV_TYPE_RECOGNSET, item->mRecognTags);
ok &= set.GetTlv(data, rssize, &offset);
// image is optional,so that we can continue reading old items.
if(offset < rssize)
ok &= item->mImage.GetTlv(data,rssize,&offset) ;
if (offset != rssize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
RsGxsIdLocalInfoItem *RsGxsIdSerialiser::deserialise_GxsIdLocalInfoItem(void *data, uint32_t *size)
{
/* 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)) ||
(RS_SERVICE_GXS_TYPE_GXSID != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsIdLocalInfoItem* item = new RsGxsIdLocalInfoItem();
/* skip the header */
offset += 8;
uint32_t n=0 ;
ok &= getRawUInt32(data, rssize, &offset, &n) ;
for(uint32_t i=0;ok && i<n;++i)
{
RsGxsId gxsid ;
time_t TS ;
ok &= gxsid.deserialise(data,rssize,offset) ;
ok &= getRawTimeT(data,rssize,&offset,TS) ;
item->mTimeStamps[gxsid] = TS ;
}
if (offset < rssize) // backward compatibility, making that section optional.
{
ok &= getRawUInt32(data, rssize, &offset, &n) ;
RsGxsId gxsid ;
for(uint32_t i=0;ok && i<n;++i)
{
ok &= gxsid.deserialise(data,rssize,offset) ;
item->mContacts.insert(gxsid) ;
}
}
if (offset != rssize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdGroupItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
#endif
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
#if 0
void RsGxsIdOpinionItem::clear()
{
opinion.mOpinion = 0;
opinion.mReputation = 0;
opinion.mComment = "";
}
std::ostream& RsGxsIdOpinionItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsIdOpinionItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "Opinion: " << opinion.mOpinion << std::endl;
printIndent(out, int_Indent);
out << "Reputation: " << opinion.mReputation << std::endl;
printIndent(out, int_Indent);
out << "Comment: " << opinion.mComment << std::endl;
printRsItemEnd(out ,"RsGxsIdOpinionItem", indent);
return out;
}
uint32_t RsGxsIdOpinionItem::serial_size()
{
const RsGxsIdOpinion& opinion = item->opinion;
uint32_t s = 8; // header
s += 4; // mOpinion.
s += 4; // mReputation.
s += GetTlvStringSize(opinion.mComment);
return s;
}
bool RsGxsIdOpinionItem::serialise(void *data, uint32_t *size)
{
uint32_t tlvsize,offset=0;
bool ok = true;
if(!serialise_header(data,size,tlvsize,offset))
return false ;
/* GxsIdOpinionItem */
ok &= setRawUInt32(data, tlvsize, &offset, item->opinion.mOpinion);
ok &= setRawUInt32(data, tlvsize, &offset, item->opinion.mReputation);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->opinion.mComment);
if(offset != tlvsize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdOpinionItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSID_DEBUG
if (!ok)
{
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdgroupItem() NOK" << std::endl;
}
#endif
return ok;
}
RsGxsIdOpinionItem* RsGxsIdSerialiser::deserialise_GxsIdOpinionItem(void *data, uint32_t *size)
{
/* 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)) ||
(RS_SERVICE_GXS_TYPE_GXSID != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSID_OPINION_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdOpinionItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdOpinionItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsIdOpinionItem* item = new RsGxsIdOpinionItem();
/* skip the header */
offset += 8;
ok &= getRawUInt32(data, rssize, &offset, &(item->opinion.mOpinion));
ok &= getRawUInt32(data, rssize, &offset, &(item->opinion.mReputation));
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->opinion.mComment);
if (offset != rssize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdOpinionItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdOpinionItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
/*****************************************************************************************/
/*****************************************************************************************/
/*****************************************************************************************/
void RsGxsIdCommentItem::clear()
{
comment.mComment.clear();
}
std::ostream& RsGxsIdCommentItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsIdCommentItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "Comment: " << comment.mComment << std::endl;
printRsItemEnd(out ,"RsGxsIdCommentItem", indent);
return out;
}
uint32_t RsGxsIdCommentItem::serial_size()
{
const RsGxsIdComment& comment = item->comment;
uint32_t s = 8; // header
s += GetTlvStringSize(comment.mComment);
return s;
}
bool RsGxsIdCommentItem::serialise(void *data, uint32_t *size)
{
uint32_t tlvsize,offset=0;
bool ok = true;
if(!serialise_header(data,size,tlvsize,offset))
return false ;
/* GxsIdCommentItem */
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment);
if(offset != tlvsize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdCommentItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXSID_DEBUG
if (!ok)
{
std::cerr << "RsGxsIdSerialiser::serialiseGxsIdgroupItem() NOK" << std::endl;
}
#endif
return ok;
}
RsGxsIdCommentItem* RsGxsIdSerialiser::deserialise_GxsIdCommentItem(void *data, uint32_t *size)
{
/* 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)) ||
(RS_SERVICE_GXS_TYPE_GXSID != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdCommentItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdCommentItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsIdCommentItem* item = new RsGxsIdCommentItem();
/* skip the header */
offset += 8;
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->comment.mComment);
if (offset != rssize)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdCommentItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXSID_DEBUG
std::cerr << "RsGxsIdSerialiser::deserialiseGxsIdCommentItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
#endif

View file

@ -0,0 +1,132 @@
/*
* libretroshare/src/serialiser: rsgxsiditems.h
*
* RetroShare C++ Interface.
*
* Copyright 2012-2012 by Robert Fernie
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef RS_GXS_IDENTITY_ITEMS_H
#define RS_GXS_IDENTITY_ITEMS_H
#include <map>
#include "rsitems/rsserviceids.h"
#include "serialiser/rsserial.h"
#include "rsgxsitems.h"
#include "retroshare/rsidentity.h"
//const uint8_t RS_PKT_SUBTYPE_GXSID_GROUP_ITEM_deprecated = 0x02;
const uint8_t RS_PKT_SUBTYPE_GXSID_GROUP_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_GXSID_OPINION_ITEM = 0x03;
const uint8_t RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM = 0x04;
const uint8_t RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM = 0x05;
class RsGxsIdItem: public RsGxsGrpItem
{
public:
RsGxsIdItem(uint8_t item_subtype) : RsGxsGrpItem(RS_SERVICE_GXS_TYPE_GXSID,item_subtype) {}
};
class RsGxsIdGroupItem : public RsGxsIdItem
{
public:
RsGxsIdGroupItem(): RsGxsIdItem(RS_PKT_SUBTYPE_GXSID_GROUP_ITEM) {}
virtual ~RsGxsIdGroupItem() {}
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
virtual void clear();
bool fromGxsIdGroup(RsGxsIdGroup &group, bool moveImage);
bool toGxsIdGroup(RsGxsIdGroup &group, bool moveImage);
Sha1CheckSum mPgpIdHash;
// Need a signature as proof - otherwise anyone could add others Hashes.
// This is a string, as the length is variable.
std::string mPgpIdSign;
// Recognition Strings. MAX# defined above.
std::list<std::string> mRecognTags;
// Avatar
RsTlvImage mImage ;
};
class RsGxsIdLocalInfoItem : public RsGxsIdItem
{
public:
RsGxsIdLocalInfoItem(): RsGxsIdItem(RS_PKT_SUBTYPE_GXSID_LOCAL_INFO_ITEM) {}
virtual ~RsGxsIdLocalInfoItem() {}
virtual void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
std::map<RsGxsId,time_t> mTimeStamps ;
std::set<RsGxsId> mContacts ;
};
#if 0
class RsGxsIdOpinionItem : public RsGxsMsgItem
{
public:
RsGxsIdOpinionItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSID,
RS_PKT_SUBTYPE_GXSID_OPINION_ITEM) {return; }
virtual ~RsGxsIdOpinionItem() { return;}
void clear();
virtual bool serialise(void *data,uint32_t& size) = 0 ;
virtual uint32_t serial_size() = 0 ;
std::ostream &print(std::ostream &out, uint16_t indent = 0);
RsGxsIdOpinion opinion;
};
class RsGxsIdCommentItem : public RsGxsMsgItem
{
public:
RsGxsIdCommentItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSID,
RS_PKT_SUBTYPE_GXSID_COMMENT_ITEM) { return; }
virtual ~RsGxsIdCommentItem() { return; }
void clear();
virtual bool serialise(void *data,uint32_t& size) = 0 ;
virtual uint32_t serial_size() = 0 ;
std::ostream &print(std::ostream &out, uint16_t indent = 0);
RsGxsIdComment comment;
};
#endif
class RsGxsIdSerialiser : public RsServiceSerializer
{
public:
RsGxsIdSerialiser() :RsServiceSerializer(RS_SERVICE_GXS_TYPE_GXSID) {}
virtual ~RsGxsIdSerialiser() {}
virtual RsItem *create_item(uint16_t service_id,uint8_t item_subtype) const ;
};
#endif /* RS_GXS_IDENTITY_ITEMS_H */

View file

@ -0,0 +1,73 @@
/*
* rsgxsitems.cc
*
* Created on: 26 Jul 2012
* Author: crispy
*/
#include "rsgxsitems.h"
#include "gxs/rsgxsdata.h"
#include <iostream>
void RsMsgMetaData::operator =(const RsGxsMsgMetaData& rGxsMeta)
{
this->mAuthorId = rGxsMeta.mAuthorId;
this->mChildTs = rGxsMeta.mChildTs;
this->mGroupId = rGxsMeta.mGroupId;
this->mMsgFlags = rGxsMeta.mMsgFlags;
this->mMsgId = rGxsMeta.mMsgId;
this->mMsgName = rGxsMeta.mMsgName;
this->mMsgStatus = rGxsMeta.mMsgStatus;
this->mOrigMsgId = rGxsMeta.mOrigMsgId;
this->mParentId = rGxsMeta.mParentId;
this->mPublishTs = rGxsMeta.mPublishTs;
this->mThreadId = rGxsMeta.mThreadId;
this->mServiceString = rGxsMeta.mServiceString;
}
void RsGroupMetaData::operator =(const RsGxsGrpMetaData& rGxsMeta)
{
this->mAuthorId = rGxsMeta.mAuthorId;
this->mGroupFlags = rGxsMeta.mGroupFlags;
this->mGroupId = rGxsMeta.mGroupId;
this->mGroupStatus = rGxsMeta.mGroupStatus;
this->mLastPost = rGxsMeta.mLastPost;
this->mVisibleMsgCount = rGxsMeta.mVisibleMsgCount;
this->mPop = rGxsMeta.mPop;
this->mPublishTs = rGxsMeta.mPublishTs;
this->mSubscribeFlags = rGxsMeta.mSubscribeFlags;
this->mGroupName = rGxsMeta.mGroupName;
this->mServiceString = rGxsMeta.mServiceString;
this->mSignFlags = rGxsMeta.mSignFlags;
this->mCircleId = rGxsMeta.mCircleId;
this->mCircleType = rGxsMeta.mCircleType;
this->mInternalCircle = rGxsMeta.mInternalCircle;
this->mOriginator = rGxsMeta.mOriginator;
this->mAuthenFlags = rGxsMeta.mAuthenFlags;
// std::cout << "rGxsMeta.mParentGrpId= " <<rGxsMeta.mParentGrpId<<"\n";
// std::cout << "rGxsMeta.mParentGrpId.length()= " <<rGxsMeta.mParentGrpId.length()<<"\n";
//std::cout << "this->mParentGrpId= " <<this->mParentGrpId<<"\n";
this->mParentGrpId = rGxsMeta.mParentGrpId;
}
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
{
out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
return out;
}
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
{
out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
out << " Name: " << meta.mMsgName;
out << " OrigMsgId: " << meta.mOrigMsgId;
out << " ThreadId: " << meta.mThreadId;
out << " ParentId: " << meta.mParentId;
out << " AuthorId: " << meta.mAuthorId;
out << " Name: " << meta.mMsgName << " ]";
return out;
}

View file

@ -0,0 +1,68 @@
#ifndef RSGXSITEMS_H
#define RSGXSITEMS_H
/*
* libretroshare/src/serialiser: rsgxsitems.h
*
* RetroShare Serialiser.
*
* Copyright 2012 Christopher Evi-Parker, Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "rsitems/rsitem.h"
#include "rsitems/rsserviceids.h"
#include "serialiser/rsserial.h"
//#include "serialiser/rstlvtypes.h"
//#include "serialiser/rstlvkeys.h"
#include "retroshare/rsgxsifacetypes.h"
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta);
class RsGxsGrpItem : public RsItem
{
public:
RsGxsGrpItem(uint16_t service, uint8_t subtype)
: RsItem(RS_PKT_VERSION_SERVICE, service, subtype) { return; }
virtual ~RsGxsGrpItem(){}
RsGroupMetaData meta;
};
class RsGxsMsgItem : public RsItem
{
public:
RsGxsMsgItem(uint16_t service, uint8_t subtype)
: RsItem(RS_PKT_VERSION_SERVICE, service, subtype) { return; }
virtual ~RsGxsMsgItem(){}
RsMsgMetaData meta;
};
#endif // RSGXSITEMS_H