2008-01-25 02:58:29 -05:00
|
|
|
#ifndef RETROSHARE_P3_PEER_INTERFACE_H
|
|
|
|
#define RETROSHARE_P3_PEER_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/rsserver: p3peers.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2004-2008 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-08-06 05:40:23 -04:00
|
|
|
#include "retroshare/rspeers.h"
|
2011-07-09 14:39:34 -04:00
|
|
|
class p3LinkMgr;
|
|
|
|
class p3PeerMgr;
|
|
|
|
class p3NetMgr;
|
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
|
|
|
|
class p3Peers: public RsPeers
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
p3Peers(p3LinkMgr *lm, p3PeerMgr *pm, p3NetMgr *nm);
|
2008-01-25 02:58:29 -05:00
|
|
|
virtual ~p3Peers() { return; }
|
|
|
|
|
|
|
|
/* Updates ... */
|
|
|
|
virtual bool FriendsChanged();
|
|
|
|
virtual bool OthersChanged();
|
|
|
|
|
|
|
|
/* Peer Details (Net & Auth) */
|
|
|
|
virtual std::string getOwnId();
|
|
|
|
|
2011-08-07 17:11:00 -04:00
|
|
|
|
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
virtual bool getOnlineList(std::list<std::string> &ids);
|
|
|
|
virtual bool getFriendList(std::list<std::string> &ids);
|
2010-01-13 16:22:52 -05:00
|
|
|
//virtual bool getOthersList(std::list<std::string> &ids);
|
2012-02-24 20:48:56 -05:00
|
|
|
virtual bool getPeerCount (unsigned int *friendCount, unsigned int *onlineCount, bool ssl);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool isOnline(const std::string &id);
|
|
|
|
virtual bool isFriend(const std::string &id);
|
|
|
|
virtual bool isGPGAccepted(const std::string &gpg_id_is_friend); //
|
|
|
|
virtual std::string getGPGName(const std::string &gpg_id);
|
|
|
|
virtual std::string getPeerName(const std::string &ssl_or_gpg_id);
|
2011-08-07 17:11:00 -04:00
|
|
|
virtual bool getPeerDetails(const std::string &ssl_or_gpg_id, RsPeerDetails &d);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2009-05-23 11:07:35 -04:00
|
|
|
/* Using PGP Ids */
|
2010-01-13 16:22:52 -05:00
|
|
|
virtual std::string getGPGOwnId();
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual std::string getGPGId(const std::string &ssl_id);
|
2012-06-14 16:13:31 -04:00
|
|
|
virtual bool isKeySupported(const std::string& ids);
|
2010-01-13 16:22:52 -05:00
|
|
|
virtual bool getGPGAcceptedList(std::list<std::string> &ids);
|
|
|
|
virtual bool getGPGSignedList(std::list<std::string> &ids);
|
|
|
|
virtual bool getGPGValidList(std::list<std::string> &ids);
|
|
|
|
virtual bool getGPGAllList(std::list<std::string> &ids);
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool getGPGDetails(const std::string &id, RsPeerDetails &d);
|
2011-08-07 17:11:00 -04:00
|
|
|
virtual bool getAssociatedSSLIds(const std::string &gpg_id, std::list<std::string> &ids);
|
2009-05-23 11:07:35 -04:00
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
/* Add/Remove Friends */
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id);
|
2011-08-07 17:11:00 -04:00
|
|
|
virtual bool removeFriend(const std::string &ssl_or_gpgid);
|
|
|
|
virtual bool removeFriendLocation(const std::string &sslId);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
|
|
|
/* Network Stuff */
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool connectAttempt(const std::string &id);
|
|
|
|
virtual bool setLocation(const std::string &ssl_id, const std::string &location);//location is shown in the gui to differentiate ssl certs
|
|
|
|
virtual bool setLocalAddress(const std::string &id, const std::string &addr, uint16_t port);
|
|
|
|
virtual bool setExtAddress(const std::string &id, const std::string &addr, uint16_t port);
|
|
|
|
virtual bool setDynDNS(const std::string &id, const std::string &dyndns);
|
|
|
|
virtual bool setNetworkMode(const std::string &id, uint32_t netMode);
|
|
|
|
virtual bool setVisState(const std::string &id, uint32_t mode);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2009-04-05 09:04:18 -04:00
|
|
|
virtual void getIPServersList(std::list<std::string>& ip_servers) ;
|
|
|
|
virtual void allowServerIPDetermination(bool) ;
|
2009-12-13 16:59:26 -05:00
|
|
|
virtual void allowTunnelConnection(bool) ;
|
2009-04-05 09:04:18 -04:00
|
|
|
virtual bool getAllowServerIPDetermination() ;
|
2009-12-13 16:59:26 -05:00
|
|
|
virtual bool getAllowTunnelConnection() ;
|
2009-04-05 09:04:18 -04:00
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
/* Auth Stuff */
|
2010-09-03 15:23:24 -04:00
|
|
|
// Get the invitation (GPG cert + local/ext address + SSL id for the given peer)
|
2012-08-13 15:37:50 -04:00
|
|
|
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures,bool old_format = false);
|
2010-09-03 15:23:24 -04:00
|
|
|
// same but for own id
|
2012-08-13 15:37:50 -04:00
|
|
|
virtual std::string GetRetroshareInvite(bool include_signatures,bool old_format = false);
|
2011-07-01 16:47:58 -04:00
|
|
|
virtual bool hasExportMinimal() ;
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool loadCertificateFromFile(const std::string &fname, std::string &id, std::string &gpg_id);
|
2012-08-13 15:37:50 -04:00
|
|
|
virtual bool loadCertificateFromString(const std::string& cert, std::string &id, std::string &gpg_id);
|
|
|
|
|
2011-04-08 14:53:12 -04:00
|
|
|
virtual bool loadDetailsFromStringCert(const std::string &cert, RsPeerDetails &pd, std::string& error_string);
|
2012-08-13 15:37:50 -04:00
|
|
|
|
2011-08-30 17:49:49 -04:00
|
|
|
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code);
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool saveCertificateToFile(const std::string &id, const std::string &fname);
|
|
|
|
virtual std::string saveCertificateToString(const std::string &id);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2010-11-06 12:40:18 -04:00
|
|
|
virtual bool signGPGCertificate(const std::string &id);
|
|
|
|
virtual bool trustGPGCertificate(const std::string &id, uint32_t trustlvl);
|
2008-01-25 02:58:29 -05:00
|
|
|
|
2010-09-22 18:37:57 -04:00
|
|
|
/* Group Stuff */
|
|
|
|
virtual bool addGroup(RsGroupInfo &groupInfo);
|
|
|
|
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo);
|
|
|
|
virtual bool removeGroup(const std::string &groupId);
|
|
|
|
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo);
|
|
|
|
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
|
|
|
virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign);
|
|
|
|
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign);
|
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
private:
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
p3LinkMgr *mLinkMgr;
|
|
|
|
p3PeerMgr *mPeerMgr;
|
|
|
|
p3NetMgr *mNetMgr;
|
|
|
|
|
2008-01-25 02:58:29 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|