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.
|
|
|
|
*/
|
|
|
|
|
2010-06-05 15:16:39 -04:00
|
|
|
class p3ConnectMgr ;
|
|
|
|
|
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:
|
|
|
|
ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,
|
2010-06-05 15:16:39 -04:00
|
|
|
p3ConnectMgr *,
|
2008-08-09 13:03:24 -04:00
|
|
|
RsPeerId ownid, std::string cachedir);
|
|
|
|
|
|
|
|
/* overloaded search function */
|
2010-01-11 11:00:42 -05:00
|
|
|
virtual bool search(std::string hash, uint32_t 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:
|
2009-01-22 16:06:54 -05:00
|
|
|
ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid);
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
/* overloaded search function */
|
2010-01-11 11:00:42 -05:00
|
|
|
virtual bool search(std::string hash, uint32_t hintflags, 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 14:27:30 -04:00
|
|
|
virtual void setSharedDirectories(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
|
|
|
|
|
|
|
/***
|
|
|
|
* Configuration - store shared directories
|
|
|
|
*/
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual RsSerialiser *setupSerialiser();
|
|
|
|
virtual std::list<RsItem *> saveList(bool &cleanup);
|
|
|
|
virtual bool loadList(std::list<RsItem *> load);
|
|
|
|
|
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class ftCacheStrapper: public CacheStrapper, public ftSearch
|
|
|
|
{
|
|
|
|
public:
|
2010-01-13 15:56:55 -05:00
|
|
|
ftCacheStrapper(p3ConnectMgr *cm);
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
/* overloaded search function */
|
2010-01-11 11:00:42 -05:00
|
|
|
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const;
|
2008-08-09 13:03:24 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|