mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-02 21:23:08 -04:00
Commit of the new UDP Connection methods and
the rewrite of the retroshare core networking stack. This check-in commits the changes to the serialiser code. Added serialisation of Key-Value pairs Config message. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@312 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
37d6a4b968
commit
9ba4549133
2 changed files with 245 additions and 20 deletions
|
@ -32,9 +32,13 @@
|
|||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
|
||||
const uint8_t RS_PKT_TYPE_PEER_CONFIG = 0x01;
|
||||
const uint8_t RS_PKT_TYPE_CACHE_CONFIG = 0x02;
|
||||
const uint8_t RS_PKT_TYPE_FILE_CONFIG = 0x03;
|
||||
const uint8_t RS_PKT_TYPE_GENERAL_CONFIG = 0x01;
|
||||
const uint8_t RS_PKT_TYPE_PEER_CONFIG = 0x02;
|
||||
const uint8_t RS_PKT_TYPE_CACHE_CONFIG = 0x03;
|
||||
const uint8_t RS_PKT_TYPE_FILE_CONFIG = 0x04;
|
||||
|
||||
/* GENERAL CONFIG SUBTYPES */
|
||||
const uint8_t RS_PKT_SUBTYPE_KEY_VALUE = 0x01;
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
|
@ -186,4 +190,43 @@ virtual RsFileTransfer * deserialiseTransfer(void *data, uint32_t *size);
|
|||
|
||||
/**************************************************************************/
|
||||
|
||||
/* Config items that are used generally */
|
||||
|
||||
class RsConfigKeyValueSet: public RsItem
|
||||
{
|
||||
public:
|
||||
RsConfigKeyValueSet()
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
|
||||
RS_PKT_TYPE_GENERAL_CONFIG,
|
||||
RS_PKT_SUBTYPE_KEY_VALUE)
|
||||
{ return; }
|
||||
virtual ~RsConfigKeyValueSet();
|
||||
virtual void clear();
|
||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
RsTlvKeyValueSet tlvkvs;
|
||||
};
|
||||
|
||||
|
||||
class RsGeneralConfigSerialiser: public RsSerialType
|
||||
{
|
||||
public:
|
||||
RsGeneralConfigSerialiser()
|
||||
:RsSerialType(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
|
||||
RS_PKT_TYPE_GENERAL_CONFIG)
|
||||
{ return; }
|
||||
|
||||
virtual ~RsGeneralConfigSerialiser();
|
||||
|
||||
virtual uint32_t size(RsItem *);
|
||||
virtual bool serialise (RsItem *item, void *data, uint32_t *size);
|
||||
virtual RsItem * deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
uint32_t sizeKeyValueSet(RsConfigKeyValueSet *item);
|
||||
bool serialiseKeyValueSet(RsConfigKeyValueSet *item, void *data, uint32_t *pktsize);
|
||||
RsConfigKeyValueSet *deserialiseKeyValueSet(void *data, uint32_t *pktsize);
|
||||
|
||||
};
|
||||
|
||||
#endif /* RS_CONFIG_ITEMS_SERIALISER_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue