mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Started implementing flags to handle the sharing mode.
What works: - the gui shows the flags in ShareManager - the flags are loaded/saved to ft_shared.cfg and passed on to FileIndexMonitor What does not work yet: - the flags are not accounted for yet by FileIndexMonitor In addition: - simplified the directories dialog in Preferences, so that it calls the ShareManager instead of dupplicating the directories management code that becomes larger. - setup the ShareManager to be a singleton, so as to coherently call it from different places. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1486 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
aa1658245c
commit
f9dc3b223b
19 changed files with 512 additions and 313 deletions
|
@ -39,9 +39,9 @@
|
|||
#include <openssl/sha.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/***********
|
||||
* #define FIM_DEBUG 1
|
||||
***********/
|
||||
//***********
|
||||
#define FIM_DEBUG 1
|
||||
// ***********/
|
||||
|
||||
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid)
|
||||
:CacheSource(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cachedir), fi(pid),
|
||||
|
@ -59,7 +59,7 @@ FileIndexMonitor::~FileIndexMonitor()
|
|||
return;
|
||||
}
|
||||
|
||||
bool FileIndexMonitor::findLocalFile(std::string hash,
|
||||
bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t flags,
|
||||
std::string &fullpath, uint64_t &size) const
|
||||
{
|
||||
std::list<FileEntry *> results;
|
||||
|
@ -602,13 +602,45 @@ void FileIndexMonitor::updateCycle()
|
|||
cb->notifyHashingInfo("") ;
|
||||
}
|
||||
|
||||
void FileIndexMonitor::updateShareFlags(const SharedDirInfo& dir)
|
||||
{
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "*** FileIndexMonitor: Updating flags for " << dir.filename << " to " << dir.shareflags << std::endl ;
|
||||
#endif
|
||||
{
|
||||
RsStackMutex stack(fiMutex) ; /* LOCKED DIRS */
|
||||
|
||||
if(pendingDirs)
|
||||
for(std::list<SharedDirInfo>::iterator it(pendingDirList.begin());it!=pendingDirList.end();++it)
|
||||
{
|
||||
std::cerr << "** testing pending dir " << (*it).filename << std::endl ;
|
||||
if((*it).filename == dir.filename)
|
||||
{
|
||||
std::cerr << "** Updating to " << (*it).shareflags << "!!" << std::endl ;
|
||||
(*it).shareflags = dir.shareflags ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
for(std::map<std::string,SharedDirInfo>::iterator it(directoryMap.begin());it!=directoryMap.end();++it)
|
||||
{
|
||||
std::cerr << "** testing " << (*it).second.filename << std::endl ;
|
||||
if((*it).second.filename == dir.filename)
|
||||
{
|
||||
std::cerr << "** Updating from " << it->second.shareflags << "!!" << std::endl ;
|
||||
(*it).second.shareflags = dir.shareflags ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* interface */
|
||||
void FileIndexMonitor::setSharedDirectories(std::list<std::string> dirs)
|
||||
void FileIndexMonitor::setSharedDirectories(std::list<SharedDirInfo> dirs)
|
||||
{
|
||||
|
||||
std::list<std::string> checkeddirs;
|
||||
std::list<SharedDirInfo> checkeddirs;
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "FileIndexMonitor::setSharedDirectories() :\n";
|
||||
#endif
|
||||
|
@ -617,12 +649,12 @@ void FileIndexMonitor::setSharedDirectories(std::list<std::string> dirs)
|
|||
{
|
||||
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "\t" << *it;
|
||||
std::cerr << "\t" << (*it).filename;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
/* check if dir exists before adding in */
|
||||
std::string path = (*it);
|
||||
std::string path = (*it).filename;
|
||||
DIR *dir = opendir(path.c_str());
|
||||
if (!dir)
|
||||
{
|
||||
|
@ -633,41 +665,37 @@ void FileIndexMonitor::setSharedDirectories(std::list<std::string> dirs)
|
|||
}
|
||||
else
|
||||
{
|
||||
checkeddirs.push_back(path);
|
||||
checkeddirs.push_back(*it);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
fiMutex.lock(); { /* LOCKED DIRS */
|
||||
{
|
||||
RsStackMutex stack(fiMutex) ;/* LOCKED DIRS */
|
||||
|
||||
pendingDirs = true;
|
||||
pendingDirList = checkeddirs;
|
||||
|
||||
} fiMutex.unlock(); /* UNLOCKED DIRS */
|
||||
pendingDirs = true;
|
||||
pendingDirList = checkeddirs;
|
||||
}
|
||||
}
|
||||
|
||||
/* interface */
|
||||
void FileIndexMonitor::getSharedDirectories(std::list<std::string> &dirs)
|
||||
void FileIndexMonitor::getSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
fiMutex.lock(); { /* LOCKED DIRS */
|
||||
{
|
||||
RsStackMutex stack(fiMutex) ; /* LOCKED DIRS */
|
||||
|
||||
/* must provide pendingDirs, as other parts depend on instanteous response */
|
||||
if (pendingDirs)
|
||||
{
|
||||
dirs = pendingDirList;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get actual list (not pending stuff) */
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); it++)
|
||||
/* must provide pendingDirs, as other parts depend on instanteous response */
|
||||
if (pendingDirs)
|
||||
dirs = pendingDirList;
|
||||
else
|
||||
{
|
||||
dirs.push_back(it->second);
|
||||
/* get actual list (not pending stuff) */
|
||||
std::map<std::string, SharedDirInfo>::const_iterator it;
|
||||
|
||||
for(it = directoryMap.begin(); it != directoryMap.end(); it++)
|
||||
dirs.push_back(it->second) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} fiMutex.unlock(); /* UNLOCKED DIRS */
|
||||
}
|
||||
|
||||
|
||||
|
@ -718,12 +746,12 @@ bool FileIndexMonitor::internal_setSharedDirectories()
|
|||
directoryMap.clear();
|
||||
|
||||
/* iterate through the directories */
|
||||
std::list<std::string>::iterator it;
|
||||
std::map<std::string, std::string>::const_iterator cit;
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::map<std::string, SharedDirInfo>::const_iterator cit;
|
||||
for(it = pendingDirList.begin(); it != pendingDirList.end(); it++)
|
||||
{
|
||||
/* get the head directory */
|
||||
std::string root_dir = *it;
|
||||
std::string root_dir = (*it).filename;
|
||||
std::string top_dir = RsDirUtil::getTopDir(root_dir);
|
||||
|
||||
/* if unique -> add, else add modifier */
|
||||
|
@ -741,7 +769,7 @@ bool FileIndexMonitor::internal_setSharedDirectories()
|
|||
{
|
||||
unique = true;
|
||||
/* add it! */
|
||||
directoryMap[tst_dir.c_str()] = root_dir;
|
||||
directoryMap[tst_dir.c_str()] = *it;
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "Added [" << tst_dir << "] => " << root_dir << std::endl;
|
||||
#endif
|
||||
|
@ -774,7 +802,7 @@ std::string FileIndexMonitor::locked_findRealRoot(std::string rootdir) const
|
|||
/**** MUST ALREADY BE LOCKED ****/
|
||||
std::string realroot = "";
|
||||
|
||||
std::map<std::string, std::string>::const_iterator cit;
|
||||
std::map<std::string, SharedDirInfo>::const_iterator cit;
|
||||
if (directoryMap.end()== (cit=directoryMap.find(rootdir)))
|
||||
{
|
||||
std::cerr << "FileIndexMonitor::locked_findRealRoot() Invalid RootDir: ";
|
||||
|
@ -782,7 +810,7 @@ std::string FileIndexMonitor::locked_findRealRoot(std::string rootdir) const
|
|||
}
|
||||
else
|
||||
{
|
||||
realroot = cit->second;
|
||||
realroot = cit->second.filename;
|
||||
}
|
||||
|
||||
return realroot;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "dbase/cachestrapper.h"
|
||||
#include "dbase/findex.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
/******************************************************************************************
|
||||
* The Local Monitoring Class: FileIndexMonitor.
|
||||
|
@ -66,67 +67,71 @@ class NotifyBase ;
|
|||
* FileIndexMonitor
|
||||
*****************************************************************************************/
|
||||
|
||||
static const uint32_t RS_SHARED_FLAGS_PUBLIC = 0x0001 ;
|
||||
static const uint32_t RS_SHARED_FLAGS_ANONYM = 0x0002 ;
|
||||
|
||||
class FileIndexMonitor: public CacheSource, public RsThread
|
||||
{
|
||||
public:
|
||||
FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in, std::string cachedir, std::string pid);
|
||||
virtual ~FileIndexMonitor();
|
||||
FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in, std::string cachedir, std::string pid);
|
||||
virtual ~FileIndexMonitor();
|
||||
|
||||
/* external interface for filetransfer */
|
||||
bool findLocalFile(std::string hash, std::string &fullpath, uint64_t &size) const;
|
||||
/* external interface for filetransfer */
|
||||
bool findLocalFile(std::string hash,uint32_t f, std::string &fullpath, uint64_t &size) const;
|
||||
|
||||
/* external interface for local access to files */
|
||||
bool convertSharedFilePath(std::string path, std::string &fullpath);
|
||||
/* external interface for local access to files */
|
||||
bool convertSharedFilePath(std::string path, std::string &fullpath);
|
||||
|
||||
|
||||
/* Interacting with CacheSource */
|
||||
/* overloaded from CacheSource */
|
||||
virtual bool loadLocalCache(const CacheData &data); /* called with stored data */
|
||||
bool updateCache(const CacheData &data); /* we call when we have a new cache for others */
|
||||
/* Interacting with CacheSource */
|
||||
/* overloaded from CacheSource */
|
||||
virtual bool loadLocalCache(const CacheData &data); /* called with stored data */
|
||||
bool updateCache(const CacheData &data); /* we call when we have a new cache for others */
|
||||
|
||||
|
||||
/* the FileIndexMonitor inner workings */
|
||||
//virtual void run(std::string& currentJob); /* overloaded from RsThread */
|
||||
//void updateCycle(std::string& currentJob);
|
||||
virtual void run(); /* overloaded from RsThread */
|
||||
void updateCycle();
|
||||
/* the FileIndexMonitor inner workings */
|
||||
//virtual void run(std::string& currentJob); /* overloaded from RsThread */
|
||||
//void updateCycle(std::string& currentJob);
|
||||
virtual void run(); /* overloaded from RsThread */
|
||||
void updateCycle();
|
||||
|
||||
virtual void setSharedDirectories(std::list<std::string> dirs);
|
||||
void getSharedDirectories(std::list<std::string> &dirs);
|
||||
virtual void setSharedDirectories(std::list<SharedDirInfo> dirs);
|
||||
void getSharedDirectories(std::list<SharedDirInfo>& dirs);
|
||||
void updateShareFlags(const SharedDirInfo& info) ;
|
||||
|
||||
void setPeriod(int insecs);
|
||||
void forceDirectoryCheck();
|
||||
bool inDirectoryCheck();
|
||||
void setPeriod(int insecs);
|
||||
void forceDirectoryCheck();
|
||||
bool inDirectoryCheck();
|
||||
|
||||
/* util fns */
|
||||
/* util fns */
|
||||
|
||||
private:
|
||||
|
||||
/* the mutex should be locked before calling... these. */
|
||||
std::string locked_findRealRoot(std::string base) const;
|
||||
bool hashFile(std::string path, FileEntry &fi); /* To Implement */
|
||||
/* the mutex should be locked before calling... these. */
|
||||
std::string locked_findRealRoot(std::string base) const;
|
||||
bool hashFile(std::string path, FileEntry &fi); /* To Implement */
|
||||
|
||||
/* data */
|
||||
/* data */
|
||||
|
||||
mutable RsMutex fiMutex;
|
||||
mutable RsMutex fiMutex;
|
||||
|
||||
FileIndex fi;
|
||||
FileIndex fi;
|
||||
|
||||
int updatePeriod;
|
||||
std::map<std::string, std::string> directoryMap; /* used by findRealRoot */
|
||||
int updatePeriod;
|
||||
std::map<std::string, SharedDirInfo> directoryMap; /* used by findRealRoot */
|
||||
|
||||
/* flags to kick - if we were busy or sleeping */
|
||||
bool pendingDirs;
|
||||
bool pendingForceCacheWrite;
|
||||
/* flags to kick - if we were busy or sleeping */
|
||||
bool pendingDirs;
|
||||
bool pendingForceCacheWrite;
|
||||
|
||||
/* flags to force Check, to tell if we're in check */
|
||||
bool mForceCheck;
|
||||
bool mInCheck;
|
||||
/* flags to force Check, to tell if we're in check */
|
||||
bool mForceCheck;
|
||||
bool mInCheck;
|
||||
|
||||
std::list<std::string> pendingDirList;
|
||||
bool internal_setSharedDirectories();
|
||||
std::list<SharedDirInfo> pendingDirList;
|
||||
bool internal_setSharedDirectories();
|
||||
|
||||
NotifyBase *cb ;
|
||||
NotifyBase *cb ;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -136,7 +136,10 @@ bool ftFiMonitor::search(std::string hash, uint64_t size, uint32_t hintflags, Fi
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (findLocalFile(hash, path, fsize))
|
||||
// setup search flags according to hintflags
|
||||
uint32_t flags = 0;
|
||||
|
||||
if(findLocalFile(hash, flags, path, fsize))
|
||||
{
|
||||
/* fill in details */
|
||||
#ifdef DB_DEBUG
|
||||
|
@ -184,15 +187,16 @@ std::list<RsItem *> ftFiMonitor::saveList(bool &cleanup)
|
|||
#endif
|
||||
|
||||
/* get list of directories */
|
||||
std::list<std::string> dirList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
|
||||
getSharedDirectories(dirList);
|
||||
|
||||
for(it = dirList.begin(); it != dirList.end(); it++)
|
||||
{
|
||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
||||
fi->file.path = *it;
|
||||
fi->file.path = (*it).filename ;
|
||||
fi->flags = (*it).shareflags ;
|
||||
|
||||
sList.push_back(fi);
|
||||
}
|
||||
|
@ -214,7 +218,7 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
|
||||
time_t ts = time(NULL);
|
||||
|
||||
std::list<std::string> dirList;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
for(it = load.begin(); it != load.end(); it++)
|
||||
|
@ -228,7 +232,11 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
|
||||
/* ensure that it exists? */
|
||||
|
||||
dirList.push_back(fi->file.path);
|
||||
SharedDirInfo info ;
|
||||
info.filename = fi->file.path;
|
||||
info.shareflags = fi->flags & (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE) ;
|
||||
|
||||
dirList.push_back(info) ;
|
||||
}
|
||||
|
||||
/* set directories */
|
||||
|
@ -236,7 +244,15 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ftFiMonitor::setSharedDirectories(std::list<std::string> dirList)
|
||||
void ftFiMonitor::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
FileIndexMonitor::updateShareFlags(info);
|
||||
|
||||
/* flag for config */
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
void ftFiMonitor::setSharedDirectories(std::list<SharedDirInfo> dirList)
|
||||
{
|
||||
FileIndexMonitor::setSharedDirectories(dirList);
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
|
|||
virtual bool search(std::string hash, uint64_t size, uint32_t hintflags, FileInfo &info) const;
|
||||
|
||||
/* overloaded set dirs enables config indication */
|
||||
virtual void setSharedDirectories(std::list<std::string> dirList);
|
||||
virtual void setSharedDirectories(std::list<SharedDirInfo> dirList);
|
||||
virtual void updateShareFlags(const SharedDirInfo& info) ;
|
||||
|
||||
/***
|
||||
* Configuration - store shared directories
|
||||
|
|
|
@ -246,6 +246,8 @@ bool ftServer::FileRequest(std::string fname, std::string hash, uint64_t size,
|
|||
// dest, flags, srcIds);
|
||||
const DwlDetails details(fname, hash, size, dest, flags, srcIds, Normal);
|
||||
mFtDwlQueue->insertDownload(details);
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool ftServer::FileCancel(std::string hash)
|
||||
|
@ -471,32 +473,46 @@ bool ftServer::InDirectoryCheck()
|
|||
return mFiMon->inDirectoryCheck();
|
||||
}
|
||||
|
||||
bool ftServer::getSharedDirectories(std::list<std::string> &dirs)
|
||||
bool ftServer::getSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
mFiMon->getSharedDirectories(dirs);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::setSharedDirectories(std::list<std::string> &dirs)
|
||||
bool ftServer::setSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
mFiMon->setSharedDirectories(dirs);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::addSharedDirectory(std::string dir)
|
||||
bool ftServer::addSharedDirectory(SharedDirInfo dir)
|
||||
{
|
||||
std::list<std::string> dirList;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
mFiMon->getSharedDirectories(dirList);
|
||||
|
||||
// check that the directory is not already in the list.
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirList.begin());it!=dirList.end();++it)
|
||||
if((*it).filename == dir.filename)
|
||||
return false ;
|
||||
|
||||
// ok then, add the shared directory.
|
||||
dirList.push_back(dir);
|
||||
|
||||
mFiMon->setSharedDirectories(dirList);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftServer::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
mFiMon->updateShareFlags(info);
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool ftServer::removeSharedDirectory(std::string dir)
|
||||
{
|
||||
std::list<std::string> dirList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::removeSharedDirectory(" << dir << ")";
|
||||
|
@ -509,13 +525,14 @@ bool ftServer::removeSharedDirectory(std::string dir)
|
|||
for(it = dirList.begin(); it != dirList.end(); it++)
|
||||
{
|
||||
std::cerr << "ftServer::removeSharedDirectory()";
|
||||
std::cerr << " existing: " << *it;
|
||||
std::cerr << " existing: " << (*it).filename;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dirList.end() == (it =
|
||||
std::find(dirList.begin(), dirList.end(), dir)))
|
||||
for(it = dirList.begin();it!=dirList.end() && (*it).filename != dir;++it) ;
|
||||
|
||||
if(it == dirList.end())
|
||||
{
|
||||
#ifdef SERVER_DEBUG
|
||||
std::cerr << "ftServer::removeSharedDirectory()";
|
||||
|
@ -551,8 +568,11 @@ bool ftServer::getShareDownloadDirectory()
|
|||
|
||||
bool ftServer::shareDownloadDirectory()
|
||||
{
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
return addSharedDirectory(dir);
|
||||
SharedDirInfo inf ;
|
||||
inf.filename = mFtController->getDownloadDirectory();
|
||||
inf.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||
|
||||
return addSharedDirectory(inf);
|
||||
}
|
||||
|
||||
bool ftServer::unshareDownloadDirectory()
|
||||
|
|
|
@ -175,9 +175,10 @@ virtual void setPartialsDirectory(std::string path);
|
|||
virtual std::string getDownloadDirectory();
|
||||
virtual std::string getPartialsDirectory();
|
||||
|
||||
virtual bool getSharedDirectories(std::list<std::string> &dirs);
|
||||
virtual bool setSharedDirectories(std::list<std::string> &dirs);
|
||||
virtual bool addSharedDirectory(std::string dir);
|
||||
virtual bool getSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool setSharedDirectories(std::list<SharedDirInfo> &dirs);
|
||||
virtual bool addSharedDirectory(SharedDirInfo dir);
|
||||
virtual bool updateShareFlags(const SharedDirInfo& dir); // updates the flags. The directory should already exist !
|
||||
virtual bool removeSharedDirectory(std::string dir);
|
||||
|
||||
virtual void setShareDownloadDirectory(bool value);
|
||||
|
|
|
@ -62,14 +62,19 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
|
|||
|
||||
const uint32_t RS_FILE_HINTS_MASK = 0x00ffffff;
|
||||
|
||||
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;
|
||||
const uint32_t RS_FILE_HINTS_TURTLE = 0x00000040;
|
||||
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;
|
||||
const uint32_t RS_FILE_HINTS_TURTLE = 0x00000040;
|
||||
const uint32_t RS_FILE_HINTS_NETWORK_WIDE = 0x00000080; // anonymously shared over network
|
||||
const uint32_t RS_FILE_HINTS_BROWSABLE = 0x00000100; // browsable by friends
|
||||
|
||||
//const uint32_t RS_SHARED_DIR_ANONYMOUS = 0x01 ;
|
||||
//const uint32_t RS_SHARED_DIR_BROWSABLE = 0x02 ;
|
||||
//const uint32_t RS_SHARED_DIR_UNIVERSAL = 0x03 ;
|
||||
|
||||
const uint32_t RS_FILE_HINTS_SPEC_ONLY = 0x01000000;
|
||||
const uint32_t RS_FILE_HINTS_NO_SEARCH = 0x02000000;
|
||||
|
@ -86,6 +91,11 @@ const uint32_t CB_CODE_CACHE = 0x0001;
|
|||
const uint32_t CB_CODE_EXTRA = 0x0002;
|
||||
const uint32_t CB_CODE_MEDIA = 0x0004;
|
||||
|
||||
struct SharedDirInfo
|
||||
{
|
||||
std::string filename ;
|
||||
uint32_t shareflags ; // RS_FILE_HINTS_ANONYMOUS | RS_FILE_HINTS_BROWSABLE
|
||||
};
|
||||
|
||||
class RsFiles
|
||||
{
|
||||
|
@ -161,8 +171,9 @@ 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 getSharedDirectories(std::list<SharedDirInfo> &dirs) = 0;
|
||||
virtual bool addSharedDirectory(SharedDirInfo dir) = 0;
|
||||
virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; // updates the flags. The directory should already exist !
|
||||
virtual bool removeSharedDirectory(std::string dir) = 0;
|
||||
|
||||
virtual void setShareDownloadDirectory(bool value) = 0;
|
||||
|
|
|
@ -153,7 +153,7 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
|
|||
#else
|
||||
/* The lease parameter is also gone in minupnpc 1.0 */
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
eport, iport, iaddr, 0, proto);
|
||||
eport, iport, iaddr,0, 0, proto);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue