mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added default encryption policy variable and GUI to change it
This commit is contained in:
parent
8486346368
commit
babc126be3
@ -168,13 +168,6 @@ bool DirectoryStorage::updateHash(const EntryIndex& index,const RsFileHash& hash
|
|||||||
return mFileHierarchy->updateHash(index,hash);
|
return mFileHierarchy->updateHash(index,hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DirectoryStorage::searchHash(const RsFileHash& hash, const RsFileHash& real_hash, EntryIndex& result) const
|
|
||||||
{
|
|
||||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
|
||||||
#warning code needed here
|
|
||||||
return mFileHierarchy->searchHash(hash,result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectoryStorage::load(const std::string& local_file_name)
|
void DirectoryStorage::load(const std::string& local_file_name)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||||
@ -296,6 +289,32 @@ bool DirectoryStorage::getIndexFromDirHash(const RsFileHash& hash,EntryIndex& in
|
|||||||
/* Local Directory Storage */
|
/* Local Directory Storage */
|
||||||
/******************************************************************************************************************/
|
/******************************************************************************************************************/
|
||||||
|
|
||||||
|
bool LocalDirectoryStorage::locked_findRealHash(const RsFileHash& hash, RsFileHash& real_hash) const
|
||||||
|
{
|
||||||
|
std::map<RsFileHash,RsFileHash>::const_iterator it = mEncryptedHashes.find(hash) ;
|
||||||
|
|
||||||
|
if(it == mEncryptedHashes.end())
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
real_hash = it->second ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LocalDirectoryStorage::searchHash(const RsFileHash& hash, RsFileHash& real_hash, EntryIndex& result) const
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||||
|
|
||||||
|
if(locked_findRealHash(hash,real_hash) && mFileHierarchy->searchHash(real_hash,result))
|
||||||
|
return true ;
|
||||||
|
|
||||||
|
if(mFileHierarchy->searchHash(hash,result))
|
||||||
|
{
|
||||||
|
real_hash.clear();
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
void LocalDirectoryStorage::setSharedDirectoryList(const std::list<SharedDirInfo>& lst)
|
void LocalDirectoryStorage::setSharedDirectoryList(const std::list<SharedDirInfo>& lst)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||||
|
@ -53,7 +53,6 @@ class DirectoryStorage
|
|||||||
|
|
||||||
virtual int searchTerms(const std::list<std::string>& terms, std::list<EntryIndex> &results) const ;
|
virtual int searchTerms(const std::list<std::string>& terms, std::list<EntryIndex> &results) const ;
|
||||||
virtual int searchBoolExp(RsRegularExpression::Expression * exp, std::list<EntryIndex> &results) const ;
|
virtual int searchBoolExp(RsRegularExpression::Expression * exp, std::list<EntryIndex> &results) const ;
|
||||||
virtual int searchHash(const RsFileHash& hash, const RsFileHash &real_hash, EntryIndex &results) const ;
|
|
||||||
|
|
||||||
// gets/sets the various time stamps:
|
// gets/sets the various time stamps:
|
||||||
//
|
//
|
||||||
@ -216,6 +215,19 @@ public:
|
|||||||
void updateShareFlags(const SharedDirInfo& info) ;
|
void updateShareFlags(const SharedDirInfo& info) ;
|
||||||
bool convertSharedFilePath(const std::string& path_with_virtual_name,std::string& fullpath) ;
|
bool convertSharedFilePath(const std::string& path_with_virtual_name,std::string& fullpath) ;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief searchHash
|
||||||
|
* Looks into local database of shared files for the given hash. Also looks for files such that the hash of the hash
|
||||||
|
* matches the given hash, and returns the real hash.
|
||||||
|
* \param hash hash to look for
|
||||||
|
* \param real_hash hash such that H(real_hash) = hash, or null hash if not found.
|
||||||
|
* \param results Entry index of the file that is found
|
||||||
|
* \return
|
||||||
|
* true is a file is found
|
||||||
|
* false otherwise.
|
||||||
|
*/
|
||||||
|
virtual int searchHash(const RsFileHash& hash, RsFileHash &real_hash, EntryIndex &results) const ;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief updateTimeStamps
|
* \brief updateTimeStamps
|
||||||
* Checks recursive TS and update the if needed.
|
* Checks recursive TS and update the if needed.
|
||||||
@ -261,6 +273,7 @@ public:
|
|||||||
bool serialiseDirEntry(const EntryIndex& indx, RsTlvBinaryData& bindata, const RsPeerId &client_id) ;
|
bool serialiseDirEntry(const EntryIndex& indx, RsTlvBinaryData& bindata, const RsPeerId &client_id) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool locked_findRealHash(const RsFileHash& hash, RsFileHash& real_hash) const;
|
||||||
std::string locked_getVirtualPath(EntryIndex indx) const ;
|
std::string locked_getVirtualPath(EntryIndex indx) const ;
|
||||||
std::string locked_getVirtualDirName(EntryIndex indx) const ;
|
std::string locked_getVirtualDirName(EntryIndex indx) const ;
|
||||||
|
|
||||||
@ -268,6 +281,7 @@ private:
|
|||||||
std::string locked_findRealRootFromVirtualFilename(const std::string& virtual_rootdir) const;
|
std::string locked_findRealRootFromVirtualFilename(const std::string& virtual_rootdir) const;
|
||||||
|
|
||||||
std::map<std::string,SharedDirInfo> mLocalDirs ; // map is better for search. it->first=it->second.filename
|
std::map<std::string,SharedDirInfo> mLocalDirs ; // map is better for search. it->first=it->second.filename
|
||||||
|
std::map<RsFileHash,RsFileHash> mEncryptedHashes; // map such that hash(it->second) = it->first
|
||||||
std::string mFileName;
|
std::string mFileName;
|
||||||
|
|
||||||
bool mTSChanged ;
|
bool mTSChanged ;
|
||||||
|
@ -113,6 +113,7 @@ ftController::ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t f
|
|||||||
{
|
{
|
||||||
_max_active_downloads = 5 ; // default queue size
|
_max_active_downloads = 5 ; // default queue size
|
||||||
_min_prioritized_transfers = 3 ;
|
_min_prioritized_transfers = 3 ;
|
||||||
|
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE;
|
||||||
/* TODO */
|
/* TODO */
|
||||||
cnt = 0 ;
|
cnt = 0 ;
|
||||||
}
|
}
|
||||||
@ -580,7 +581,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
|
|||||||
_queue[pos]->mState = ftFileControl::DOWNLOADING ;
|
_queue[pos]->mState = ftFileControl::DOWNLOADING ;
|
||||||
|
|
||||||
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||||
mTurtle->monitorTunnels(_queue[pos]->mHash,mFtServer,true) ;
|
mFtServer->activateTunnels(_queue[pos]->mHash,_queue[pos]->mFlags,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pos >= _max_active_downloads && _queue[pos]->mState != ftFileControl::QUEUED && _queue[pos]->mState != ftFileControl::PAUSED)
|
if(pos >= _max_active_downloads && _queue[pos]->mState != ftFileControl::QUEUED && _queue[pos]->mState != ftFileControl::PAUSED)
|
||||||
@ -589,7 +590,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
|
|||||||
_queue[pos]->mCreator->closeFile() ;
|
_queue[pos]->mCreator->closeFile() ;
|
||||||
|
|
||||||
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||||
mTurtle->stopMonitoringTunnels(_queue[pos]->mHash) ;
|
mFtServer->activateTunnels(_queue[pos]->mHash,_queue[pos]->mFlags,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +836,7 @@ bool ftController::completeFile(const RsFileHash& hash)
|
|||||||
mDownloads.erase(it);
|
mDownloads.erase(it);
|
||||||
|
|
||||||
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||||
mTurtle->stopMonitoringTunnels(hash_to_suppress) ;
|
mFtServer->activateTunnels(hash_to_suppress,flags,false);
|
||||||
|
|
||||||
} /******* UNLOCKED ********/
|
} /******* UNLOCKED ********/
|
||||||
|
|
||||||
@ -978,6 +979,17 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
|
|||||||
if(alreadyHaveFile(hash, info))
|
if(alreadyHaveFile(hash, info))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
if(mDefaultEncryptionPolicy == RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT)
|
||||||
|
{
|
||||||
|
flags |= RS_FILE_REQ_ENCRYPTED ;
|
||||||
|
flags &= ~RS_FILE_REQ_UNENCRYPTED ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags |= RS_FILE_REQ_ENCRYPTED ;
|
||||||
|
flags |= RS_FILE_REQ_UNENCRYPTED ;
|
||||||
|
}
|
||||||
|
|
||||||
if(size == 0) // we treat this special case because
|
if(size == 0) // we treat this special case because
|
||||||
{
|
{
|
||||||
/* if no destpath - send to download directory */
|
/* if no destpath - send to download directory */
|
||||||
@ -1174,7 +1186,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
|
|||||||
// We check that flags are consistent.
|
// We check that flags are consistent.
|
||||||
|
|
||||||
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||||
mTurtle->monitorTunnels(hash,mFtServer,true) ;
|
mFtServer->activateTunnels(hash,flags,true);
|
||||||
|
|
||||||
bool assume_availability = false;
|
bool assume_availability = false;
|
||||||
|
|
||||||
@ -1275,7 +1287,7 @@ bool ftController::setChunkStrategy(const RsFileHash& hash,FileChunksInfo::Chunk
|
|||||||
|
|
||||||
bool ftController::FileCancel(const RsFileHash& hash)
|
bool ftController::FileCancel(const RsFileHash& hash)
|
||||||
{
|
{
|
||||||
rsTurtle->stopMonitoringTunnels(hash) ;
|
mFtServer->activateTunnels(hash,TransferRequestFlags(0),false);
|
||||||
|
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
std::cerr << "ftController::FileCancel" << std::endl;
|
std::cerr << "ftController::FileCancel" << std::endl;
|
||||||
@ -1813,6 +1825,7 @@ const std::string download_dir_ss("DOWN_DIR");
|
|||||||
const std::string partial_dir_ss("PART_DIR");
|
const std::string partial_dir_ss("PART_DIR");
|
||||||
const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY");
|
const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY");
|
||||||
const std::string free_space_limit_ss("FREE_SPACE_LIMIT");
|
const std::string free_space_limit_ss("FREE_SPACE_LIMIT");
|
||||||
|
const std::string default_encryption_policy("DEFAULT_ENCRYPTION_POLICY");
|
||||||
|
|
||||||
|
|
||||||
/* p3Config Interface */
|
/* p3Config Interface */
|
||||||
@ -2102,6 +2115,25 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
|
|||||||
setPartialsDirectory(mit->second);
|
setPartialsDirectory(mit->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configMap.end() != (mit = configMap.find(default_encryption_policy)))
|
||||||
|
{
|
||||||
|
if(mit->second == "STRICT")
|
||||||
|
{
|
||||||
|
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT ;
|
||||||
|
std::cerr << "Note: loading default value for encryption policy: STRICT" << std::endl;
|
||||||
|
}
|
||||||
|
else if(mit->second == "PERMISSIVE")
|
||||||
|
{
|
||||||
|
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE ;
|
||||||
|
std::cerr << "Note: loading default value for encryption policy: PERMISSIVE" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) encryption policy not recognized: \"" << mit->second << "\"" << std::endl;
|
||||||
|
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (configMap.end() != (mit = configMap.find(default_chunk_strategy_ss)))
|
if (configMap.end() != (mit = configMap.find(default_chunk_strategy_ss)))
|
||||||
{
|
{
|
||||||
if(mit->second == "STREAMING")
|
if(mit->second == "STREAMING")
|
||||||
|
@ -237,6 +237,7 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
|||||||
ftServer *mFtServer ;
|
ftServer *mFtServer ;
|
||||||
p3ServiceControl *mServiceCtrl;
|
p3ServiceControl *mServiceCtrl;
|
||||||
uint32_t mFtServiceId;
|
uint32_t mFtServiceId;
|
||||||
|
uint32_t mDefaultEncryptionPolicy ;
|
||||||
|
|
||||||
uint32_t cnt ;
|
uint32_t cnt ;
|
||||||
RsMutex ctrlMutex;
|
RsMutex ctrlMutex;
|
||||||
|
@ -250,6 +250,26 @@ bool ftServer::FileRequest(const std::string& fname, const RsFileHash& hash, uin
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ftServer::activateTunnels(const RsFileHash& hash,TransferRequestFlags flags,bool onoff)
|
||||||
|
{
|
||||||
|
RsFileHash hash_of_hash ;
|
||||||
|
|
||||||
|
encryptHash(hash,hash_of_hash) ;
|
||||||
|
mEncryptedHashes.insert(std::make_pair(hash_of_hash,hash)) ;
|
||||||
|
|
||||||
|
if(onoff)
|
||||||
|
{
|
||||||
|
if(flags & RS_FILE_REQ_ENCRYPTED) mTurtleRouter->monitorTunnels(hash_of_hash,this,true) ;
|
||||||
|
if(flags & RS_FILE_REQ_UNENCRYPTED) mTurtleRouter->monitorTunnels(hash,this,true) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTurtleRouter->stopMonitoringTunnels(hash_of_hash);
|
||||||
|
mTurtleRouter->stopMonitoringTunnels(hash);
|
||||||
|
}
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
|
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
|
||||||
{
|
{
|
||||||
return mFtController->setDestinationName(hash,name);
|
return mFtController->setDestinationName(hash,name);
|
||||||
@ -462,7 +482,12 @@ bool ftServer::handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_i
|
|||||||
FileInfo info ;
|
FileInfo info ;
|
||||||
bool res = FileDetails(hash, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info);
|
bool res = FileDetails(hash, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info);
|
||||||
|
|
||||||
#warning need code here => turn H(H) into real hash
|
if(info.transfer_info_flags & RS_FILE_REQ_ENCRYPTED)
|
||||||
|
{
|
||||||
|
std::cerr << "handleTunnelRequest: openning encrypted FT tunnel for H(H(F))=" << hash << " and H(F)=" << info.hash << std::endl;
|
||||||
|
mEncryptedHashes[info.hash] = hash ;
|
||||||
|
}
|
||||||
|
#warning needs to tweak for swarming with encrypted FT
|
||||||
if( (!res) && FileDetails(hash,RS_FILE_HINTS_DOWNLOAD,info))
|
if( (!res) && FileDetails(hash,RS_FILE_HINTS_DOWNLOAD,info))
|
||||||
{
|
{
|
||||||
// This file is currently being downloaded. Let's look if we already have a chunk or not. If not, no need to
|
// This file is currently being downloaded. Let's look if we already have a chunk or not. If not, no need to
|
||||||
@ -1191,6 +1216,12 @@ bool ftServer::decryptItem(RsTurtleGenericDataItem *encrypted_item,const RsFileH
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ftServer::encryptHash(const RsFileHash& hash, RsFileHash& hash_of_hash)
|
||||||
|
{
|
||||||
|
hash_of_hash = RsDirUtil::sha1sum(hash.toByteArray(),hash.SIZE_IN_BYTES);
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
bool ftServer::findRealHash(const RsFileHash& hash, RsFileHash& real_hash)
|
bool ftServer::findRealHash(const RsFileHash& hash, RsFileHash& real_hash)
|
||||||
{
|
{
|
||||||
std::map<RsFileHash,RsFileHash>::const_iterator it = mEncryptedHashes.find(hash) ;
|
std::map<RsFileHash,RsFileHash>::const_iterator it = mEncryptedHashes.find(hash) ;
|
||||||
|
@ -217,6 +217,8 @@ public:
|
|||||||
/*************** Data Transfer Interface ***********************/
|
/*************** Data Transfer Interface ***********************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
public:
|
public:
|
||||||
|
virtual bool activateTunnels(const RsFileHash& hash,TransferRequestFlags flags,bool onoff);
|
||||||
|
|
||||||
virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data);
|
virtual bool sendData(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize, void *data);
|
||||||
virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize);
|
virtual bool sendDataRequest(const RsPeerId& peerId, const RsFileHash& hash, uint64_t size, uint64_t offset, uint32_t chunksize);
|
||||||
virtual bool sendChunkMapRequest(const RsPeerId& peer_id,const RsFileHash& hash,bool is_client) ;
|
virtual bool sendChunkMapRequest(const RsPeerId& peer_id,const RsFileHash& hash,bool is_client) ;
|
||||||
@ -255,6 +257,7 @@ protected:
|
|||||||
|
|
||||||
// fnds out what is the real hash of encrypted hash hash
|
// fnds out what is the real hash of encrypted hash hash
|
||||||
bool findRealHash(const RsFileHash& hash, RsFileHash& real_hash);
|
bool findRealHash(const RsFileHash& hash, RsFileHash& real_hash);
|
||||||
|
bool encryptHash(const RsFileHash& hash, RsFileHash& hash_of_hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -43,6 +43,9 @@ const uint32_t RS_FILE_CTRL_PAUSE = 0x00000100;
|
|||||||
const uint32_t RS_FILE_CTRL_START = 0x00000200;
|
const uint32_t RS_FILE_CTRL_START = 0x00000200;
|
||||||
const uint32_t RS_FILE_CTRL_FORCE_CHECK = 0x00000400;
|
const uint32_t RS_FILE_CTRL_FORCE_CHECK = 0x00000400;
|
||||||
|
|
||||||
|
const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT = 0x00000001 ;
|
||||||
|
const uint32_t RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE = 0x00000002 ;
|
||||||
|
|
||||||
const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001;
|
const uint32_t RS_FILE_RATE_TRICKLE = 0x00000001;
|
||||||
const uint32_t RS_FILE_RATE_SLOW = 0x00000002;
|
const uint32_t RS_FILE_RATE_SLOW = 0x00000002;
|
||||||
const uint32_t RS_FILE_RATE_STANDARD = 0x00000003;
|
const uint32_t RS_FILE_RATE_STANDARD = 0x00000003;
|
||||||
@ -79,6 +82,7 @@ const FileSearchFlags RS_FILE_HINTS_PERMISSION_MASK ( 0x00000180 );// OR
|
|||||||
//
|
//
|
||||||
const TransferRequestFlags RS_FILE_REQ_ANONYMOUS_ROUTING ( 0x00000040 ); // Use to ask turtle router to download the file.
|
const TransferRequestFlags RS_FILE_REQ_ANONYMOUS_ROUTING ( 0x00000040 ); // Use to ask turtle router to download the file.
|
||||||
const TransferRequestFlags RS_FILE_REQ_ENCRYPTED ( 0x00000080 ); // Asks for end-to-end encryption of file at the level of ftServer
|
const TransferRequestFlags RS_FILE_REQ_ENCRYPTED ( 0x00000080 ); // Asks for end-to-end encryption of file at the level of ftServer
|
||||||
|
const TransferRequestFlags RS_FILE_REQ_UNENCRYPTED ( 0x00000100 ); // Asks for no end-to-end encryption of file at the level of ftServer
|
||||||
const TransferRequestFlags RS_FILE_REQ_ASSUME_AVAILABILITY ( 0x00000200 ); // Assume full source availability. Used for cache files.
|
const TransferRequestFlags RS_FILE_REQ_ASSUME_AVAILABILITY ( 0x00000200 ); // Assume full source availability. Used for cache files.
|
||||||
const TransferRequestFlags RS_FILE_REQ_CACHE_deprecated ( 0x00000400 ); // Old stuff used for cache files. Not used anymore.
|
const TransferRequestFlags RS_FILE_REQ_CACHE_deprecated ( 0x00000400 ); // Old stuff used for cache files. Not used anymore.
|
||||||
const TransferRequestFlags RS_FILE_REQ_EXTRA ( 0x00000800 );
|
const TransferRequestFlags RS_FILE_REQ_EXTRA ( 0x00000800 );
|
||||||
@ -142,6 +146,8 @@ class RsFiles
|
|||||||
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0;
|
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0;
|
||||||
virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0;
|
virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0;
|
||||||
virtual bool FileClearCompleted() = 0;
|
virtual bool FileClearCompleted() = 0;
|
||||||
|
virtual void setDefaultEncryptionPolicy(uint32_t policy)=0 ; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE
|
||||||
|
virtual uint32_t defaultEncryptionPolicy()=0 ;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Control of Downloads Priority.
|
* Control of Downloads Priority.
|
||||||
|
@ -44,10 +44,17 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
case FileChunksInfo::CHUNK_STRATEGY_RANDOM: ui._defaultStrategy_CB->setCurrentIndex(2) ; break ;
|
case FileChunksInfo::CHUNK_STRATEGY_RANDOM: ui._defaultStrategy_CB->setCurrentIndex(2) ; break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(rsFiles->defaultEncryptionPolicy())
|
||||||
|
{
|
||||||
|
case RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE: ui._e2e_encryption_CB->setCurrentIndex(0) ; break ;
|
||||||
|
case RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT : ui._e2e_encryption_CB->setCurrentIndex(1) ; break ;
|
||||||
|
}
|
||||||
|
|
||||||
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
|
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
|
||||||
|
|
||||||
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
|
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
|
||||||
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
|
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
|
||||||
|
QObject::connect(ui._e2e_encryption_CB,SIGNAL(activated(int)),this,SLOT(updateEncryptionPolicy(int))) ;
|
||||||
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
|
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
|
||||||
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
|
QObject::connect(ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
|
||||||
|
|
||||||
@ -57,6 +64,19 @@ void TransferPage::updateMaxTRUpRate(int b)
|
|||||||
{
|
{
|
||||||
rsTurtle->setMaxTRForwardRate(b) ;
|
rsTurtle->setMaxTRForwardRate(b) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransferPage::updateEncryptionPolicy(int b)
|
||||||
|
{
|
||||||
|
switch(b)
|
||||||
|
{
|
||||||
|
case 1: rsFiles->setDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT) ;
|
||||||
|
break ;
|
||||||
|
default:
|
||||||
|
case 0: rsFiles->setDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE) ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TransferPage::updateDefaultStrategy(int i)
|
void TransferPage::updateDefaultStrategy(int i)
|
||||||
{
|
{
|
||||||
switch(i)
|
switch(i)
|
||||||
|
@ -49,6 +49,7 @@ class TransferPage: public ConfigPage
|
|||||||
void updateDefaultStrategy(int) ;
|
void updateDefaultStrategy(int) ;
|
||||||
void updateDiskSizeLimit(int) ;
|
void updateDiskSizeLimit(int) ;
|
||||||
void updateMaxTRUpRate(int);
|
void updateMaxTRUpRate(int);
|
||||||
|
void updateEncryptionPolicy(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>700</width>
|
<width>741</width>
|
||||||
<height>356</height>
|
<height>372</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -49,6 +49,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>End-to-end encryption:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -135,6 +142,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="_e2e_encryption_CB">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Accepted</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enforced</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
Reference in New Issue
Block a user