2012-11-29 22:48:28 +00:00
|
|
|
/*
|
|
|
|
* libretroshare/src/serialiser: rsgxscircleitems.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.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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RS_GXSCIRCLE_ITEMS_H
|
|
|
|
#define RS_GXSCIRCLE_ITEMS_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2017-04-18 21:11:37 +02:00
|
|
|
#include "rsitems/rsserviceids.h"
|
2017-04-26 14:28:25 +02:00
|
|
|
|
2014-03-29 15:34:37 +00:00
|
|
|
#include "serialiser/rstlvitem.h"
|
|
|
|
#include "serialiser/rstlvstring.h"
|
2014-04-01 08:00:20 +00:00
|
|
|
#include "serialiser/rstlvidset.h"
|
2012-11-29 22:48:28 +00:00
|
|
|
|
2017-04-26 14:28:25 +02:00
|
|
|
#include "rsitems/rsgxsitems.h"
|
2012-11-29 22:48:28 +00:00
|
|
|
#include "retroshare/rsgxscircles.h"
|
|
|
|
|
2016-05-11 17:59:42 -04:00
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSCIRCLE_GROUP_ITEM = 0x02;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSCIRCLE_MSG_ITEM = 0x03;
|
|
|
|
const uint8_t RS_PKT_SUBTYPE_GXSCIRCLE_SUBSCRIPTION_REQUEST_ITEM = 0x04;
|
2012-11-29 22:48:28 +00:00
|
|
|
|
2013-06-04 21:00:43 +00:00
|
|
|
const uint16_t GXSCIRCLE_PGPIDSET = 0x0001;
|
|
|
|
const uint16_t GXSCIRCLE_GXSIDSET = 0x0002;
|
|
|
|
const uint16_t GXSCIRCLE_SUBCIRCLESET = 0x0003;
|
2012-12-01 00:16:24 +00:00
|
|
|
|
2016-05-11 17:59:42 -04:00
|
|
|
// These classes are a mess. Needs proper item serialisation etc.
|
|
|
|
|
2012-11-29 22:48:28 +00:00
|
|
|
class RsGxsCircleGroupItem : public RsGxsGrpItem
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-04-26 20:57:28 +02:00
|
|
|
RsGxsCircleGroupItem(): RsGxsGrpItem(RS_SERVICE_GXS_TYPE_GXSCIRCLE, RS_PKT_SUBTYPE_GXSCIRCLE_GROUP_ITEM) {}
|
|
|
|
virtual ~RsGxsCircleGroupItem() {}
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
2012-11-29 22:48:28 +00:00
|
|
|
|
2012-12-01 00:16:24 +00:00
|
|
|
bool convertFrom(const RsGxsCircleGroup &group);
|
|
|
|
bool convertTo(RsGxsCircleGroup &group) const;
|
2012-11-29 22:48:28 +00:00
|
|
|
|
2012-12-01 00:16:24 +00:00
|
|
|
// DIFFERENT FROM OTHER ONES, as stupid serialisation otherwise.
|
2014-04-01 08:00:20 +00:00
|
|
|
RsTlvPgpIdSet pgpIdSet; // For Local Groups.
|
|
|
|
RsTlvGxsIdSet gxsIdSet; // For External Groups.
|
|
|
|
RsTlvGxsCircleIdSet subCircleSet;
|
2012-11-29 22:48:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsCircleMsgItem : public RsGxsMsgItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2017-04-26 20:57:28 +02:00
|
|
|
RsGxsCircleMsgItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSCIRCLE, RS_PKT_SUBTYPE_GXSCIRCLE_MSG_ITEM) {}
|
|
|
|
virtual ~RsGxsCircleMsgItem() {}
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
|
|
|
|
2012-11-29 22:48:28 +00:00
|
|
|
RsGxsCircleMsg msg;
|
|
|
|
};
|
|
|
|
|
2016-05-11 17:59:42 -04:00
|
|
|
class RsGxsCircleSubscriptionRequestItem: public RsGxsMsgItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsGxsCircleSubscriptionRequestItem() : RsGxsMsgItem(RS_SERVICE_GXS_TYPE_GXSCIRCLE, RS_PKT_SUBTYPE_GXSCIRCLE_SUBSCRIPTION_REQUEST_ITEM) { }
|
|
|
|
virtual ~RsGxsCircleSubscriptionRequestItem() {}
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SUBSCRIPTION_REQUEST_UNKNOWN = 0x00,
|
|
|
|
SUBSCRIPTION_REQUEST_SUBSCRIBE = 0x01,
|
|
|
|
SUBSCRIPTION_REQUEST_UNSUBSCRIBE = 0x02
|
|
|
|
};
|
|
|
|
|
2017-04-26 20:57:28 +02:00
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
|
|
|
|
|
|
|
uint32_t time_stamp ;
|
|
|
|
uint32_t time_out ;
|
2016-05-11 17:59:42 -04:00
|
|
|
uint8_t subscription_type ;
|
|
|
|
};
|
|
|
|
|
2017-04-26 20:57:28 +02:00
|
|
|
class RsGxsCircleSerialiser : public RsServiceSerializer
|
2012-11-29 22:48:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsGxsCircleSerialiser()
|
2017-04-26 20:57:28 +02:00
|
|
|
:RsServiceSerializer(RS_SERVICE_GXS_TYPE_GXSCIRCLE) {}
|
|
|
|
virtual ~RsGxsCircleSerialiser() {}
|
2012-11-29 22:48:28 +00:00
|
|
|
|
2017-04-26 20:57:28 +02:00
|
|
|
virtual RsItem *create_item(uint16_t service, uint8_t item_sub_id) const;
|
2012-11-29 22:48:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* RS_GXSCIRCLE_ITEMS_H */
|