mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 07:25:36 -04:00
added load/save of random bias in GxsNetTunnel service
This commit is contained in:
parent
57bb31ece6
commit
5be57046f1
6 changed files with 56 additions and 19 deletions
|
@ -44,6 +44,7 @@ RsItem* RsGxsUpdateSerialiser::create_item(uint16_t service,uint8_t item_subtype
|
|||
case RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE: return new RsGxsServerGrpUpdateItem(SERVICE_TYPE);
|
||||
case RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE: return new RsGxsServerMsgUpdateItem(SERVICE_TYPE);
|
||||
case RS_PKT_SUBTYPE_GXS_GRP_CONFIG: return new RsGxsGrpConfigItem(SERVICE_TYPE);
|
||||
case RS_PKT_SUBTYPE_GXS_RANDOM_BIAS: return new RsGxsTunnelRandomBiasItem(SERVICE_TYPE);
|
||||
default:
|
||||
return NULL ;
|
||||
}
|
||||
|
@ -76,6 +77,11 @@ void RsGxsServerGrpUpdateItem::clear()
|
|||
grpUpdateTS = 0;
|
||||
}
|
||||
|
||||
void RsGxsTunnelRandomBiasItem::clear()
|
||||
{
|
||||
mRandomBias.clear() ;
|
||||
}
|
||||
|
||||
/**********************************************************************************************/
|
||||
/* SERIALISER */
|
||||
/**********************************************************************************************/
|
||||
|
@ -134,5 +140,8 @@ void RsGxsGrpConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGe
|
|||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,msg_send_delay,"msg_send_delay") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,msg_req_delay,"msg_req_delay") ;
|
||||
}
|
||||
|
||||
void RsGxsTunnelRandomBiasItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,mRandomBias,"random bias") ;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "gxs/rsgxs.h"
|
||||
#include "gxs/rsgxsdata.h"
|
||||
#include "gxs/rsgxsnettunnel.h"
|
||||
#include "serialiser/rstlvidset.h"
|
||||
|
||||
|
||||
|
@ -48,6 +49,7 @@ const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE = 0x03;
|
|||
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;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_RANDOM_BIAS = 0x0a;
|
||||
|
||||
class RsGxsNetServiceItem: public RsItem
|
||||
{
|
||||
|
@ -186,6 +188,17 @@ public:
|
|||
RsGxsGroupId grpId;
|
||||
};
|
||||
|
||||
class RsGxsTunnelRandomBiasItem: public RsGxsNetServiceItem
|
||||
{
|
||||
public:
|
||||
explicit RsGxsTunnelRandomBiasItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_RANDOM_BIAS) { clear();}
|
||||
virtual ~RsGxsTunnelRandomBiasItem() {}
|
||||
|
||||
virtual void clear();
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||
|
||||
Bias20Bytes mRandomBias; // Cannot be a simple char[] because of serialization.
|
||||
};
|
||||
|
||||
class RsGxsUpdateSerialiser : public RsServiceSerializer
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue