mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 21:40:36 -04:00
- Added flags for services and service permissions for peers
Flags are identity-related, meaning that all locations of the same peers have the same flags. - It's now possible to tweak which services each peer can use. Service that can be disabled are forums/channels, discovery, anonymous routing. - by default, peers have all flags on. - fixed missing error msg in p3cfgmgr when serialisation fails. - fixed bug in RemoteDirModel causing infinite loop to happen when group name is unknown git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5924 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
099a3ad33e
commit
e3da77612a
24 changed files with 887 additions and 242 deletions
|
@ -52,13 +52,24 @@ template<int n> class t_RsFlags32
|
|||
uint32_t _bits ;
|
||||
};
|
||||
|
||||
#define FLAGS_TAG_FILE_SEARCH 0xf29ba5
|
||||
#define FLAGS_TAG_PERMISSION 0x8133ea
|
||||
#define FLAGS_TAG_TRANSFER_REQS 0x4228af
|
||||
#define FLAGS_TAG_FILE_STORAGE 0x184738
|
||||
#define FLAGS_TAG_FILE_SEARCH 0xf29ba5
|
||||
#define FLAGS_TAG_SERVICE_PERM 0x380912
|
||||
|
||||
typedef t_RsFlags32<FLAGS_TAG_PERMISSION> FilePermissionFlags ;
|
||||
// Flags for requesting transfers, ask for turtle, cache, speed, etc.
|
||||
//
|
||||
typedef t_RsFlags32<FLAGS_TAG_TRANSFER_REQS> TransferRequestFlags ;
|
||||
typedef t_RsFlags32<FLAGS_TAG_FILE_STORAGE > FileStorageFlags ; // this makes it a uint32_t class incompatible with other flag class
|
||||
typedef t_RsFlags32<FLAGS_TAG_FILE_SEARCH > FileSearchFlags ; // this makes it a uint32_t class incompatible with other flag class
|
||||
|
||||
// Flags for file storage. Mainly permissions like BROWSABLE/NETWORK_WIDE for groups and peers.
|
||||
//
|
||||
typedef t_RsFlags32<FLAGS_TAG_FILE_STORAGE > FileStorageFlags ;
|
||||
|
||||
// Flags for searching in files that could be local, downloads, remote, etc.
|
||||
//
|
||||
typedef t_RsFlags32<FLAGS_TAG_FILE_SEARCH > FileSearchFlags ;
|
||||
|
||||
// Service permissions. Will allow each user to use or not use each service.
|
||||
//
|
||||
typedef t_RsFlags32<FLAGS_TAG_SERVICE_PERM > ServicePermissionFlags ;
|
||||
|
||||
|
|
|
@ -66,6 +66,14 @@ const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
|
|||
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
|
||||
const uint32_t RS_PEER_STATE_UNREACHABLE= 0x0008;
|
||||
|
||||
// Service permission flags.
|
||||
//
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_TURTLE ( 0x00000001 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_DISCOVERY ( 0x00000002 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_DISTRIB ( 0x00000004 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_TURTLE | RS_SERVICE_PERM_DISCOVERY | RS_SERVICE_PERM_DISTRIB ;
|
||||
// ...
|
||||
|
||||
/* Connect state */
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TUNNEL = 1;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
|
||||
|
@ -171,6 +179,9 @@ class RsPeerDetails
|
|||
|
||||
bool accept_connection;
|
||||
|
||||
/* Peer permission flags. What services the peer can use (Only valid if friend).*/
|
||||
ServicePermissionFlags service_perm_flags ;
|
||||
|
||||
/* Network details (only valid if friend) */
|
||||
uint32_t state;
|
||||
|
||||
|
@ -247,7 +258,7 @@ class RsPeers
|
|||
virtual bool getAssociatedSSLIds(const std::string &gpg_id, std::list<std::string> &ids) = 0;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id) = 0;
|
||||
virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL) = 0;
|
||||
virtual bool removeFriend(const std::string &ssl_or_gpg_id) = 0;
|
||||
virtual bool removeFriendLocation(const std::string &sslId) = 0;
|
||||
|
||||
|
@ -309,6 +320,11 @@ class RsPeers
|
|||
//
|
||||
virtual FileSearchFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags file_sharing_flags,const std::list<std::string>& file_parent_groups) = 0;
|
||||
|
||||
/* Service permission flags */
|
||||
|
||||
virtual ServicePermissionFlags servicePermissionFlags(const std::string& gpg_id) = 0;
|
||||
virtual ServicePermissionFlags servicePermissionFlags_sslid(const std::string& ssl_id) = 0;
|
||||
virtual void setServicePermissionFlags(const std::string& gpg_id,const ServicePermissionFlags& flags) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue