2008-08-09 13:03:24 -04:00
|
|
|
/*
|
|
|
|
* libretroshare/src/ft: ftdbase.h
|
|
|
|
*
|
|
|
|
* File Transfer for RetroShare.
|
|
|
|
*
|
|
|
|
* Copyright 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 FT_DBASE_INTERFACE_HEADER
|
|
|
|
#define FT_DBASE_INTERFACE_HEADER
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ftdbase.
|
|
|
|
*
|
|
|
|
* Wrappers for the Cache/FiStore/FiMonitor classes.
|
|
|
|
* So they work in the ft world.
|
|
|
|
*/
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
class p3LinkMgr ;
|
|
|
|
class p3PeerMgr ;
|
2014-03-28 23:57:44 -04:00
|
|
|
class p3ServiceControl ;
|
2011-07-09 14:39:34 -04:00
|
|
|
|
2010-06-05 15:16:39 -04:00
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
#include "ft/ftsearch.h"
|
2008-11-15 15:00:29 -05:00
|
|
|
#include "pqi/p3cfgmgr.h"
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
#include "dbase/fistore.h"
|
|
|
|
#include "dbase/fimonitor.h"
|
|
|
|
#include "dbase/cachestrapper.h"
|
|
|
|
|
|
|
|
|
|
|
|
class ftFiStore: public FileIndexStore, public ftSearch
|
|
|
|
{
|
|
|
|
public:
|
2014-01-07 17:51:22 -05:00
|
|
|
ftFiStore(CacheStrapper *cs, CacheTransfer *cft, p3PeerMgr *pm,
|
2008-08-09 13:03:24 -04:00
|
|
|
RsPeerId ownid, std::string cachedir);
|
|
|
|
|
|
|
|
/* overloaded search function */
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
|
2008-08-09 13:03:24 -04:00
|
|
|
};
|
|
|
|
|
2008-11-15 15:00:29 -05:00
|
|
|
class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
|
2008-08-09 13:03:24 -04:00
|
|
|
{
|
|
|
|
public:
|
2014-03-17 16:56:06 -04:00
|
|
|
ftFiMonitor(CacheStrapper *cs,std::string cachedir, const RsPeerId& pid,const std::string& config_dir);
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
/* overloaded search function */
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
|
|
|
|
virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, const RsPeerId& peer_id, FileInfo &info) const;
|
2008-08-09 13:03:24 -04:00
|
|
|
|
2008-11-15 15:00:29 -05:00
|
|
|
/* overloaded set dirs enables config indication */
|
2010-09-17 15:21:14 -04:00
|
|
|
virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirList);
|
2009-08-03 15:43:52 -04:00
|
|
|
virtual void updateShareFlags(const SharedDirInfo& info) ;
|
2008-11-15 15:00:29 -05:00
|
|
|
|
2010-10-31 16:35:31 -04:00
|
|
|
void setRememberHashCacheDuration(uint32_t days) ;
|
|
|
|
uint32_t rememberHashCacheDuration() const ;
|
|
|
|
void setRememberHashCache(bool) ;
|
|
|
|
bool rememberHashCache() ;
|
|
|
|
void clearHashCache() ;
|
2011-03-28 17:52:21 -04:00
|
|
|
void setWatchPeriod(int seconds) ; // can be negative, which means auto-check disabled.
|
|
|
|
int watchPeriod() const ;
|
2010-10-31 16:35:31 -04:00
|
|
|
|
2008-11-15 15:00:29 -05:00
|
|
|
/***
|
|
|
|
* Configuration - store shared directories
|
|
|
|
*/
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual RsSerialiser *setupSerialiser();
|
2010-12-18 14:35:07 -05:00
|
|
|
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
|
|
|
|
virtual bool loadList(std::list<RsItem *>& load);
|
2008-11-15 15:00:29 -05:00
|
|
|
|
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class ftCacheStrapper: public CacheStrapper, public ftSearch
|
|
|
|
{
|
|
|
|
public:
|
2014-03-28 23:57:44 -04:00
|
|
|
ftCacheStrapper(p3ServiceControl *cm, uint32_t ftServiceId);
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
/* overloaded search function */
|
2014-03-17 16:56:06 -04:00
|
|
|
virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|