mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 05:22:31 -04:00

Validated chunks are shared to other peers. Force check is now very simple since it just turns all chunks into "needs checking" mode and sums are asked to sources. Sources maintain a temporary cache of chunks. Since sums are requested sparsely, this should not affect the sources in terms of performance. We can still imagine precomputing and saving sha1 of chunks while hashing them. For backward compatibility reasons, the following has been setup *temporarily* in this version: - unvalidated chunks are still considered as already obtained, and are shared and saved - force check has been disabled - final file check is maintained - in case of file fail, the old checking mode will be used. All changes for next version are kept in the define 'USE_NEW_CHUNK_CHECKING_CODE' that will be made the default in a few weeks. At start, I expect most chunk to stya yellow during download, until most sources are able to provide chunk hashs. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5019 b45a01b8-16f6-495d-af2f-9b41ad6348cc
104 lines
2.9 KiB
C++
104 lines
2.9 KiB
C++
/*
|
|
* libretroshare/src/pqi pqi.h
|
|
*
|
|
* 3P/PQI network interface for RetroShare.
|
|
*
|
|
* Copyright 2004-2008 by Robert Fernie.
|
|
*
|
|
* 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@lunamutt.com".
|
|
*
|
|
*/
|
|
|
|
|
|
#ifndef PQI_TOP_HEADER
|
|
#define PQI_TOP_HEADER
|
|
|
|
/* This just includes the standard headers required.
|
|
*/
|
|
|
|
|
|
#include "pqi/pqi_base.h"
|
|
#include "pqi/pqinetwork.h"
|
|
#include "serialiser/rsserial.h"
|
|
#include "serialiser/rsbaseitems.h"
|
|
|
|
#include <iostream>
|
|
#include <functional>
|
|
#include <algorithm>
|
|
|
|
/********************** SEARCH INTERFACE ***************************/
|
|
// this is an interface.... so should be
|
|
// classified as virtual = 0;
|
|
|
|
class SearchInterface
|
|
{
|
|
public:
|
|
SearchInterface() { return; }
|
|
|
|
virtual ~SearchInterface() { return; }
|
|
|
|
// Cache Requests
|
|
virtual int SearchSpecific(RsCacheRequest *) = 0;
|
|
virtual RsCacheRequest *RequestedSearch() = 0;
|
|
|
|
// Cache Results
|
|
virtual int SendSearchResult(RsCacheItem *item) = 0;
|
|
virtual RsCacheItem *GetSearchResult() = 0;
|
|
|
|
// FileTransfer.
|
|
virtual RsFileRequest *GetFileRequest() = 0;
|
|
virtual int SendFileRequest(RsFileRequest *) = 0;
|
|
|
|
virtual RsFileData *GetFileData() = 0;
|
|
virtual int SendFileData(RsFileData *) = 0;
|
|
|
|
virtual RsFileChunkMapRequest *GetFileChunkMapRequest() = 0;
|
|
virtual int SendFileChunkMapRequest(RsFileChunkMapRequest *) = 0;
|
|
|
|
virtual RsFileChunkMap *GetFileChunkMap() = 0;
|
|
virtual int SendFileChunkMap(RsFileChunkMap *) = 0;
|
|
|
|
virtual RsFileCRC32MapRequest *GetFileCRC32MapRequest() = 0;
|
|
virtual int SendFileCRC32MapRequest(RsFileCRC32MapRequest *) = 0;
|
|
|
|
virtual RsFileCRC32Map *GetFileCRC32Map() = 0;
|
|
virtual int SendFileCRC32Map(RsFileCRC32Map *) = 0;
|
|
|
|
virtual RsFileSingleChunkCrcRequest *GetFileSingleChunkCrcRequest()=0;
|
|
virtual int SendFileSingleChunkCrcRequest(RsFileSingleChunkCrcRequest *ns)=0;
|
|
|
|
virtual RsFileSingleChunkCrc *GetFileSingleChunkCrc()=0;
|
|
virtual int SendFileSingleChunkCrc(RsFileSingleChunkCrc *ns)=0;
|
|
|
|
};
|
|
|
|
class P3Interface: public SearchInterface
|
|
{
|
|
public:
|
|
P3Interface() {return; }
|
|
virtual ~P3Interface() {return; }
|
|
|
|
virtual int tick() { return 1; }
|
|
virtual int status() { return 1; }
|
|
|
|
virtual int SendRsRawItem(RsRawItem *) = 0;
|
|
virtual RsRawItem *GetRsRawItem() = 0;
|
|
|
|
};
|
|
|
|
#endif // PQI_TOP_HEADER
|
|
|