2008-07-02 09:19:59 -04:00
|
|
|
#ifndef RS_FILES_GUI_INTERFACE_H
|
|
|
|
#define RS_FILES_GUI_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/rsiface: rsfiles.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* 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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "rsiface/rstypes.h"
|
|
|
|
|
|
|
|
class RsFiles;
|
|
|
|
extern RsFiles *rsFiles;
|
|
|
|
|
2008-07-02 12:58:13 -04:00
|
|
|
class Expression;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
/* These are used mainly by ftController at the moment */
|
|
|
|
const uint32_t RS_FILE_CTRL_PAUSE = 0x00000100;
|
|
|
|
const uint32_t RS_FILE_CTRL_START = 0x00000200;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001;
|
|
|
|
const uint32_t RS_FILE_RATE_SLOW = 0x00000002;
|
|
|
|
const uint32_t RS_FILE_RATE_STANDARD = 0x00000003;
|
|
|
|
const uint32_t RS_FILE_RATE_FAST = 0x00000004;
|
|
|
|
const uint32_t RS_FILE_RATE_STREAM_AUDIO = 0x00000005;
|
|
|
|
const uint32_t RS_FILE_RATE_STREAM_VIDEO = 0x00000006;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-08-09 13:03:24 -04:00
|
|
|
const uint32_t RS_FILE_PEER_ONLINE = 0x00001000;
|
|
|
|
const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-07-06 11:05:59 -04:00
|
|
|
/************************************
|
|
|
|
* Used To indicate where to search.
|
2008-08-03 08:45:53 -04:00
|
|
|
*
|
|
|
|
* The Order of these is very important,
|
|
|
|
* it specifies the search order too.
|
|
|
|
*
|
2008-07-06 11:05:59 -04:00
|
|
|
*/
|
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
const uint32_t RS_FILE_HINTS_MASK = 0x00ffffff;
|
2008-07-06 11:05:59 -04:00
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
const uint32_t RS_FILE_HINTS_CACHE = 0x00000001;
|
|
|
|
const uint32_t RS_FILE_HINTS_EXTRA = 0x00000002;
|
|
|
|
const uint32_t RS_FILE_HINTS_LOCAL = 0x00000004;
|
|
|
|
const uint32_t RS_FILE_HINTS_REMOTE = 0x00000008;
|
|
|
|
const uint32_t RS_FILE_HINTS_DOWNLOAD = 0x00000010;
|
|
|
|
const uint32_t RS_FILE_HINTS_UPLOAD = 0x00000020;
|
2008-07-06 11:05:59 -04:00
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
const uint32_t RS_FILE_HINTS_SPEC_ONLY = 0x01000000;
|
2008-07-06 11:05:59 -04:00
|
|
|
|
|
|
|
|
2008-07-02 09:19:59 -04:00
|
|
|
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
|
|
|
|
|
|
|
|
|
|
|
class RsFiles
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsFiles() { return; }
|
|
|
|
virtual ~RsFiles() { return; }
|
|
|
|
|
|
|
|
/****************************************/
|
|
|
|
/* download */
|
|
|
|
|
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Control of Downloads.
|
|
|
|
***/
|
2008-08-09 13:03:24 -04:00
|
|
|
virtual bool FileRequest(std::string fname, std::string hash, uint32_t size,
|
|
|
|
std::string dest, uint32_t flags, std::list<std::string> srcIds) = 0;
|
2008-07-02 12:58:13 -04:00
|
|
|
virtual bool FileCancel(std::string hash) = 0;
|
|
|
|
virtual bool FileControl(std::string hash, uint32_t flags) = 0;
|
|
|
|
virtual bool FileClearCompleted() = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Download / Upload Details.
|
|
|
|
***/
|
|
|
|
virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
|
|
|
|
virtual bool FileUploads(std::list<std::string> &hashs) = 0;
|
|
|
|
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Extra List Access
|
|
|
|
***/
|
2008-07-02 12:58:13 -04:00
|
|
|
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
|
|
|
|
uint32_t period, uint32_t flags) = 0;
|
|
|
|
virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
virtual bool ExtraFileHash(std::string localpath,
|
2008-07-02 12:58:13 -04:00
|
|
|
uint32_t period, uint32_t flags) = 0;
|
|
|
|
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Directory Listing / Search Interface
|
2008-07-02 09:19:59 -04:00
|
|
|
*/
|
2008-07-02 12:58:13 -04:00
|
|
|
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
|
|
|
|
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-07-02 12:58:13 -04:00
|
|
|
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
|
|
|
|
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results) = 0;
|
2008-07-02 09:19:59 -04:00
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Utility Functions.
|
|
|
|
***/
|
2008-07-02 09:19:59 -04:00
|
|
|
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
|
|
|
virtual void ForceDirectoryCheck() = 0;
|
|
|
|
virtual bool InDirectoryCheck() = 0;
|
|
|
|
|
2008-08-03 08:45:53 -04:00
|
|
|
/***
|
|
|
|
* Directory Control
|
|
|
|
***/
|
2008-07-02 12:58:13 -04:00
|
|
|
virtual void setDownloadDirectory(std::string path) = 0;
|
|
|
|
virtual void setPartialsDirectory(std::string path) = 0;
|
|
|
|
virtual std::string getDownloadDirectory() = 0;
|
|
|
|
virtual std::string getPartialsDirectory() = 0;
|
|
|
|
|
|
|
|
virtual bool getSharedDirectories(std::list<std::string> &dirs) = 0;
|
|
|
|
virtual bool addSharedDirectory(std::string dir) = 0;
|
|
|
|
virtual bool removeSharedDirectory(std::string dir) = 0;
|
|
|
|
|
2008-07-02 09:19:59 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|