2016-09-12 18:01:26 -04:00
|
|
|
/*
|
|
|
|
* RetroShare File lists service items
|
|
|
|
*
|
|
|
|
* file_sharing/rsfilelistsitems.cc
|
|
|
|
*
|
|
|
|
* Copyright 2016 Mr.Alice
|
|
|
|
*
|
|
|
|
* 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.project@gmail.com".
|
|
|
|
*
|
|
|
|
*/
|
2016-08-22 01:49:45 -04:00
|
|
|
#include "serialiser/rsbaseserial.h"
|
|
|
|
|
2017-04-30 10:05:37 -04:00
|
|
|
#include "serialiser/rstypeserializer.h"
|
2017-04-26 05:40:46 -04:00
|
|
|
|
2016-08-20 10:23:11 -04:00
|
|
|
#include "file_sharing/rsfilelistitems.h"
|
|
|
|
|
2017-04-26 05:40:46 -04:00
|
|
|
void RsFileListsSyncRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-24 07:30:18 -04:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process (j,ctx,entry_hash,"entry_hash") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,flags ,"flags") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,last_known_recurs_modf_TS,"last_known_recurs_modf_TS") ;
|
|
|
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,request_id,"request_id") ;
|
|
|
|
}
|
2017-04-26 05:40:46 -04:00
|
|
|
void RsFileListsSyncResponseItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-24 07:30:18 -04:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process (j,ctx,entry_hash,"entry_hash") ;
|
|
|
|
RsTypeSerializer::serial_process (j,ctx,checksum,"checksum") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t> (j,ctx,flags ,"flags") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t> (j,ctx,last_known_recurs_modf_TS,"last_known_recurs_modf_TS") ;
|
|
|
|
RsTypeSerializer::serial_process<uint64_t> (j,ctx,request_id,"request_id") ;
|
|
|
|
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,directory_content_data,"directory_content_data") ;
|
|
|
|
}
|
|
|
|
|
|
|
|
RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const
|
|
|
|
{
|
|
|
|
if(service != RS_SERVICE_TYPE_FILE_DATABASE)
|
|
|
|
return NULL ;
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM: return new RsFileListsSyncRequestItem();
|
|
|
|
case RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM: return new RsFileListsSyncResponseItem();
|
|
|
|
default:
|
|
|
|
return NULL ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void RsFileListsSyncResponseItem::clear()
|
|
|
|
{
|
|
|
|
directory_content_data.TlvClear();
|
|
|
|
}
|