merge of branch v0.6-idclean 7180

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7187 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-03-17 20:56:06 +00:00
parent 7815efb16f
commit 0f29d28b1b
397 changed files with 6503 additions and 5702 deletions

View file

@ -32,6 +32,7 @@
#include <retroshare/rstypes.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsids.h>
/* The Main Interface Class - for information about your Peers
* A peer is another RS instance, means associated with an SSL certificate
@ -186,18 +187,19 @@ class RsPeerDetails
/* Auth details */
bool isOnlyGPGdetail;
std::string id;
std::string gpg_id;
RsPeerId id;
RsPgpId gpg_id;
std::string name;
std::string email;
std::string location;
std::string org;
std::string issuer;
RsPgpId issuer;
std::string fpr; /* pgp fingerprint */
std::string authcode;
std::list<std::string> gpgSigners;
PGPFingerprintType fpr; /* pgp fingerprint */
std::string authcode; // (cyril) what is this used for ?????
std::list<RsPgpId> gpgSigners;
uint32_t trustLvl;
uint32_t validLvl;
@ -272,7 +274,7 @@ public:
std::string name;
uint32_t flag;
std::list<std::string> peerIds;
std::list<RsPgpId> peerIds;
};
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
@ -289,54 +291,53 @@ class RsPeers
virtual bool OthersChanged() = 0;
/* Peer Details (Net & Auth) */
virtual std::string getOwnId() = 0;
virtual const RsPeerId& getOwnId() = 0;
virtual bool haveSecretKey(const std::string& gpg_id) = 0 ;
virtual bool haveSecretKey(const RsPgpId& gpg_id) = 0 ;
virtual bool getOnlineList(std::list<std::string> &ssl_ids) = 0;
virtual bool getFriendList(std::list<std::string> &ssl_ids) = 0;
//virtual bool getOthersList(std::list<std::string> &ssl_ids) = 0;
virtual bool getOnlineList(std::list<RsPeerId> &ssl_ids) = 0;
virtual bool getFriendList(std::list<RsPeerId> &ssl_ids) = 0;
virtual bool getPeerCount (unsigned int *pnFriendCount, unsigned int *pnnOnlineCount, bool ssl) = 0;
virtual bool isOnline(const std::string &ssl_id) = 0;
virtual bool isFriend(const std::string &ssl_id) = 0;
virtual bool isGPGAccepted(const std::string &gpg_id_is_friend) = 0; //
virtual std::string getPeerName(const std::string &ssl_or_gpg_id) = 0;
virtual std::string getGPGName(const std::string &gpg_id) = 0;
virtual bool getPeerDetails(const std::string &ssl_or_gpg_id, RsPeerDetails &d) = 0; //get Peer detail accept SSL and PGP certs
virtual bool isOnline(const RsPeerId &ssl_id) = 0;
virtual bool isFriend(const RsPeerId &ssl_id) = 0;
virtual bool isGPGAccepted(const RsPgpId &gpg_id_is_friend) = 0; //
virtual std::string getPeerName(const RsPeerId &ssl_id) = 0;
virtual std::string getGPGName(const RsPgpId& gpg_id) = 0;
virtual bool getPeerDetails(const RsPeerId& ssl_id, RsPeerDetails &d) = 0;
virtual bool getGPGDetails(const RsPgpId& gpg_id, RsPeerDetails &d) = 0;
/* Using PGP Ids */
virtual std::string getGPGOwnId() = 0;
virtual std::string getGPGId(const std::string &sslid_or_gpgid) = 0; //return the gpg id of the given gpg or ssl id
virtual bool isKeySupported(const std::string& gpg_ids) = 0;
virtual bool getGPGAcceptedList(std::list<std::string> &gpg_ids) = 0;
virtual bool getGPGSignedList(std::list<std::string> &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key
virtual bool getGPGValidList(std::list<std::string> &gpg_ids) = 0;
virtual bool getGPGAllList(std::list<std::string> &gpg_ids) = 0;
virtual bool getGPGDetails(const std::string &gpg_id, RsPeerDetails &d) = 0;
virtual bool getAssociatedSSLIds(const std::string &gpg_id, std::list<std::string> &ids) = 0;
virtual const RsPgpId& getGPGOwnId() = 0;
virtual RsPgpId getGPGId(const RsPeerId& sslid) = 0; //return the gpg id of the given ssl id
virtual bool isKeySupported(const RsPgpId& gpg_ids) = 0;
virtual bool getGPGAcceptedList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGSignedList(std::list<RsPgpId> &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0;
/* Add/Remove Friends */
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;
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL) = 0;
virtual bool removeFriend(const RsPgpId& pgp_id) = 0;
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
/* keyring management */
virtual bool removeKeysFromPGPKeyring(const std::list<std::string>& pgp_ids,std::string& backup_file,uint32_t& error_code)=0 ;
virtual bool removeKeysFromPGPKeyring(const std::list<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code)=0 ;
/* Network Stuff */
virtual bool connectAttempt(const std::string &ssl_id) = 0;
virtual bool setLocation(const std::string &ssl_id, const std::string &location) = 0;//location is shown in the gui to differentiate ssl certs
virtual bool connectAttempt(const RsPeerId& ssl_id) = 0;
virtual bool setLocation(const RsPeerId &ssl_id, const std::string &location) = 0;//location is shown in the gui to differentiate ssl certs
virtual bool setHiddenNode(const std::string &id, const std::string &hidden_node_address) = 0;
virtual bool setHiddenNode(const std::string &id, const std::string &address, uint16_t port) = 0;
virtual bool setHiddenNode(const RsPeerId &id, const std::string &hidden_node_address) = 0;
virtual bool setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port) = 0;
virtual bool setLocalAddress(const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setExtAddress( const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setDynDNS(const std::string &id, const std::string &addr) = 0;
virtual bool setNetworkMode(const std::string &ssl_id, uint32_t netMode) = 0;
virtual bool setVisState(const std::string &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
virtual bool setLocalAddress(const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setExtAddress( const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setDynDNS(const RsPeerId &id, const std::string &addr) = 0;
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
virtual bool getProxyServer(std::string &addr, uint16_t &port) = 0;
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
@ -346,24 +347,25 @@ class RsPeers
virtual bool getAllowServerIPDetermination() = 0 ;
/* Auth Stuff */
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures) = 0;
virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) = 0 ;
virtual std::string GetRetroshareInvite(const RsPeerId& ssl_id,bool include_signatures) = 0;
virtual std::string getPGPKey(const RsPgpId& pgp_id,bool include_signatures) = 0;
virtual bool GetPGPBase64StringAndCheckSum(const RsPgpId& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) = 0 ;
virtual std::string GetRetroshareInvite(bool include_signatures) = 0;
virtual bool hasExportMinimal() = 0 ;
// Add keys to the keyring
virtual bool loadCertificateFromString(const std::string& cert, std::string& ssl_id,std::string& pgp_id, std::string& error_string) = 0;
virtual bool loadCertificateFromString(const std::string& cert, RsPeerId& ssl_id,RsPgpId& pgp_id, std::string& error_string) = 0;
// Gets the GPG details, but does not add the key to the keyring.
virtual bool loadDetailsFromStringCert(const std::string& certGPG, RsPeerDetails &pd,uint32_t& error_code) = 0;
// Certificate utils
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code) = 0;
virtual bool saveCertificateToFile(const std::string& id, const std::string &fname) = 0;
virtual std::string saveCertificateToString(const std::string &id) = 0;
virtual bool saveCertificateToFile(const RsPeerId& id, const std::string &fname) = 0;
virtual std::string saveCertificateToString(const RsPeerId &id) = 0;
virtual bool signGPGCertificate(const std::string &gpg_id) = 0;
virtual bool trustGPGCertificate(const std::string &gpg_id, uint32_t trustlvl) = 0;
virtual bool signGPGCertificate(const RsPgpId &gpg_id) = 0;
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
/* Group Stuff */
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
@ -372,8 +374,8 @@ class RsPeers
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
// groupId == "" && assign == false -> remove from all groups
virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign) = 0;
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign) = 0;
virtual bool assignPeerToGroup(const std::string &groupId, const RsPgpId& peerId, bool assign) = 0;
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
/* Group sharing permission */
@ -386,13 +388,13 @@ class RsPeers
// ... computes the sharing file permission hint flags set for this peer, that is a combination of
// RS_FILE_HINTS_NETWORK_WIDE and RS_FILE_HINTS_BROWSABLE.
//
virtual FileSearchFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags file_sharing_flags,const std::list<std::string>& file_parent_groups) = 0;
virtual FileSearchFlags computePeerPermissionFlags(const RsPeerId& 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;
virtual ServicePermissionFlags servicePermissionFlags(const RsPgpId& gpg_id) = 0;
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) = 0;
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags) = 0;
};
#endif