- 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:
csoler 2012-12-01 19:22:22 +00:00
parent 099a3ad33e
commit e3da77612a
24 changed files with 887 additions and 242 deletions

View file

@ -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