mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Add gxs update items for nxs sync optimisation
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6901 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6871f9875a
commit
2e886bf443
2 changed files with 453 additions and 0 deletions
105
libretroshare/src/serialiser/rsgxsupdateitems.h
Normal file
105
libretroshare/src/serialiser/rsgxsupdateitems.h
Normal file
|
@ -0,0 +1,105 @@
|
|||
#ifndef RSGXSUPDATEITEMS_H_
|
||||
#define RSGXSUPDATEITEMS_H_
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rsgxsupdateitems.h
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2012 Christopher Evi-Parker
|
||||
*
|
||||
* 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 <map>
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
#include "gxs/rsgxsdata.h"
|
||||
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_GRP_UPDATE = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE = 0x0002;
|
||||
|
||||
class RsGxsGrpUpdateItem : public RsItem {
|
||||
public:
|
||||
RsGxsGrpUpdateItem();
|
||||
virtual ~RsGxsGrpUpdateItem();
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
std::string peerId;
|
||||
uint32_t grpUpdateTS;
|
||||
};
|
||||
|
||||
class RsGxsMsgUpdateItem : public RsItem
|
||||
{
|
||||
public:
|
||||
RsGxsMsgUpdateItem();
|
||||
virtual ~RsGxsMsgUpdateItem();
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
std::string peerId;
|
||||
std::map<std::string, uint32_t> msgUpdateTS;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RsGxsUpdateSerialiser : public RsSerialType
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsUpdateSerialiser(uint16_t servtype) :
|
||||
RsSerialType(RS_PKT_VERSION_SERVICE, servtype), SERVICE_TYPE(servtype) { return; }
|
||||
|
||||
virtual ~RsGxsUpdateSerialiser() { return; }
|
||||
|
||||
virtual uint32_t size(RsItem *item);
|
||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size);
|
||||
virtual RsItem* deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GRP_UPDATE_ITEM */
|
||||
|
||||
virtual uint32_t sizeGxsGrpUpdate(RsGxsGrpUpdateItem* item);
|
||||
virtual bool serialiseGxsGrpUpdate(RsGxsGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsGrpUpdateItem* deserialGxsGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_ */
|
||||
|
||||
virtual uint32_t sizeGxsMsgUpdate(RsGxsMsgUpdateItem* item);
|
||||
virtual bool serialiseGxsMsgUpdate(RsGxsMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsMsgUpdateItem* deserialGxsMsgUpdate(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
const uint16_t SERVICE_TYPE;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* RSGXSUPDATEITEMS_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue