2018-05-22 22:03:11 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/ft: ftturtlefiletransferitem.cc *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2013 by Cyril Soler <csoler@users.sourceforge.net> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
2018-05-28 22:03:39 +02:00
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
2018-05-22 22:03:11 +02:00
|
|
|
* 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 *
|
2018-05-28 22:03:39 +02:00
|
|
|
* GNU Lesser General Public License for more details. *
|
2018-05-22 22:03:11 +02:00
|
|
|
* *
|
2018-05-28 22:03:39 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
2018-05-22 22:03:11 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2013-04-06 09:21:01 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <stdexcept>
|
|
|
|
|
2016-01-12 21:10:11 -05:00
|
|
|
#include <util/rsmemory.h>
|
2017-04-18 21:11:37 +02:00
|
|
|
#include <rsitems/itempriorities.h>
|
2013-04-06 09:21:01 +00:00
|
|
|
#include <ft/ftturtlefiletransferitem.h>
|
|
|
|
|
2017-04-30 16:05:37 +02:00
|
|
|
#include <serialiser/rstypeserializer.h>
|
2017-04-15 18:46:44 +02:00
|
|
|
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleFileMapRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,direction,"direction") ;
|
|
|
|
}
|
|
|
|
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleFileMapItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,direction,"direction") ;
|
|
|
|
RsTypeSerializer::serial_process (j,ctx,compressed_map._map,"map") ;
|
|
|
|
}
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleChunkCrcRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,chunk_number,"chunk_number") ;
|
|
|
|
}
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleChunkCrcItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,chunk_number,"chunk_number") ;
|
|
|
|
RsTypeSerializer::serial_process (j,ctx,check_sum,"check_sum") ;
|
|
|
|
}
|
|
|
|
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleFileRequestItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,chunk_offset,"chunk_offset") ;
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,chunk_size,"chunk_size") ;
|
|
|
|
}
|
2017-04-26 11:40:46 +02:00
|
|
|
void RsTurtleFileDataItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
2017-04-15 18:46:44 +02:00
|
|
|
{
|
|
|
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_id,"tunnel_id") ;
|
|
|
|
RsTypeSerializer::serial_process<uint64_t>(j,ctx,chunk_offset,"chunk_offset") ;
|
|
|
|
|
|
|
|
RsTypeSerializer::TlvMemBlock_proxy prox(chunk_data,chunk_size) ;
|
|
|
|
|
|
|
|
RsTypeSerializer::serial_process(j,ctx,prox,"chunk_data") ;
|
|
|
|
}
|
|
|
|
|