2018-05-29 21:08:17 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/rsitems: rspluginitems.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2009 by Cyril Soler <csoler@users.sourceforge.net> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program 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 Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2011-07-05 20:29:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-28 16:39:54 +02:00
|
|
|
#include "rsitems/rsitem.h"
|
2017-04-24 22:47:08 +02:00
|
|
|
#include "rsitems/rsconfigitems.h"
|
2011-07-05 20:29:07 +00:00
|
|
|
|
2017-04-30 16:05:37 +02:00
|
|
|
#include "serialiser/rstypeserializer.h"
|
2014-03-29 15:34:37 +00:00
|
|
|
|
2011-07-05 20:29:07 +00:00
|
|
|
const uint8_t RS_PKT_CLASS_PLUGIN_SUBTYPE_HASHSET = 0x01 ;
|
|
|
|
|
|
|
|
class RsPluginItem: public RsItem
|
|
|
|
{
|
|
|
|
public:
|
2017-07-28 09:34:44 +02:00
|
|
|
explicit RsPluginItem(uint8_t plugin_item_subtype): RsItem(RS_PKT_VERSION1,RS_PKT_CLASS_CONFIG,RS_PKT_TYPE_PLUGIN_CONFIG,plugin_item_subtype) {}
|
2011-07-05 20:29:07 +00:00
|
|
|
virtual ~RsPluginItem() {}
|
|
|
|
|
|
|
|
virtual void clear() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsPluginHashSetItem: public RsPluginItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsPluginHashSetItem() : RsPluginItem(RS_PKT_CLASS_PLUGIN_SUBTYPE_HASHSET) {}
|
|
|
|
RsPluginHashSetItem(void *data,uint32_t size) ;
|
|
|
|
|
2017-04-28 16:39:54 +02:00
|
|
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,hashes,"hashes");
|
|
|
|
}
|
|
|
|
|
2011-07-05 20:29:07 +00:00
|
|
|
RsTlvHashSet hashes ;
|
2017-04-28 16:39:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class RsPluginSerialiser: public RsConfigSerializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsPluginSerialiser() : RsConfigSerializer(RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PLUGIN_CONFIG) {}
|
2011-07-05 20:29:07 +00:00
|
|
|
|
2017-04-28 16:39:54 +02:00
|
|
|
virtual RsItem *create_item(uint8_t class_type, uint8_t item_type) const
|
|
|
|
{
|
|
|
|
if(class_type == RS_PKT_TYPE_PLUGIN_CONFIG && item_type == RS_PKT_CLASS_PLUGIN_SUBTYPE_HASHSET)
|
|
|
|
return new RsPluginHashSetItem() ;
|
2011-07-05 20:29:07 +00:00
|
|
|
|
2017-04-28 16:39:54 +02:00
|
|
|
return NULL ;
|
|
|
|
}
|
2011-07-05 20:29:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|