2008-01-25 03:01:40 -05:00
|
|
|
#ifndef RETROSHARE_PEER_GUI_INTERFACE_H
|
|
|
|
#define RETROSHARE_PEER_GUI_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/rsiface: rspeer.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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
|
2012-11-01 06:06:12 -04:00
|
|
|
#include <retroshare/rstypes.h>
|
|
|
|
#include <retroshare/rsfiles.h>
|
2014-03-17 16:56:06 -04:00
|
|
|
#include <retroshare/rsids.h>
|
2012-11-01 06:06:12 -04:00
|
|
|
|
2010-01-13 16:08:46 -05:00
|
|
|
/* The Main Interface Class - for information about your Peers
|
2015-12-31 13:32:46 -05:00
|
|
|
* A peer is another RS instance, means associated with an SSL certificate
|
|
|
|
* A same GPG person can have multiple peer running with different SSL certs signed by the same GPG key
|
|
|
|
* Thus a peer have SSL cert details, and also the parent GPG details
|
|
|
|
*/
|
2008-01-25 03:01:40 -05:00
|
|
|
class RsPeers;
|
2015-12-31 13:32:46 -05:00
|
|
|
extern RsPeers *rsPeers;
|
|
|
|
|
|
|
|
/* TODO: 2015/12/31 As for type safetyness all those constant must be declared as enum!
|
|
|
|
* C++ now supports typed enum so there is no ambiguity in serialization size
|
|
|
|
*/
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2012-07-07 12:26:54 -04:00
|
|
|
/* Trust Levels. Should be the same values than what is declared in PGPHandler.h */
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2012-07-07 12:26:54 -04:00
|
|
|
const uint32_t RS_TRUST_LVL_UNDEFINED = 0;
|
|
|
|
const uint32_t RS_TRUST_LVL_UNKNOWN = 1;
|
|
|
|
const uint32_t RS_TRUST_LVL_NEVER = 2;
|
|
|
|
const uint32_t RS_TRUST_LVL_MARGINAL = 3;
|
|
|
|
const uint32_t RS_TRUST_LVL_FULL = 4;
|
|
|
|
const uint32_t RS_TRUST_LVL_ULTIMATE = 5;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2015-06-12 17:04:11 -04:00
|
|
|
|
|
|
|
const uint32_t SELF_SIGNATURE_RESULT_PENDING = 0x00;
|
|
|
|
const uint32_t SELF_SIGNATURE_RESULT_SUCCESS = 0x01;
|
|
|
|
const uint32_t SELF_SIGNATURE_RESULT_FAILED = 0x02;
|
|
|
|
|
2008-01-25 03:01:40 -05:00
|
|
|
/* Net Mode */
|
|
|
|
const uint32_t RS_NETMODE_UDP = 0x0001;
|
|
|
|
const uint32_t RS_NETMODE_UPNP = 0x0002;
|
|
|
|
const uint32_t RS_NETMODE_EXT = 0x0003;
|
2013-09-08 22:10:49 -04:00
|
|
|
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
|
|
|
|
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2015-09-07 05:22:15 -04:00
|
|
|
/* Hidden Type */
|
|
|
|
const uint32_t RS_HIDDEN_TYPE_NONE = 0x0000;
|
2015-09-08 07:48:30 -04:00
|
|
|
const uint32_t RS_HIDDEN_TYPE_UNKNOWN = 0x0001;
|
|
|
|
const uint32_t RS_HIDDEN_TYPE_TOR = 0x0002;
|
|
|
|
const uint32_t RS_HIDDEN_TYPE_I2P = 0x0004;
|
2015-09-15 10:18:46 -04:00
|
|
|
/* mask to match all valid hidden types */
|
|
|
|
const uint32_t RS_HIDDEN_TYPE_MASK = RS_HIDDEN_TYPE_I2P | RS_HIDDEN_TYPE_TOR;
|
2015-09-07 05:22:15 -04:00
|
|
|
|
2008-02-07 11:18:34 -05:00
|
|
|
/* Visibility */
|
2013-09-28 04:09:59 -04:00
|
|
|
const uint32_t RS_VS_DISC_OFF = 0x0000;
|
|
|
|
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
|
|
|
|
const uint32_t RS_VS_DISC_FULL = 0x0002;
|
|
|
|
|
|
|
|
const uint32_t RS_VS_DHT_OFF = 0x0000;
|
|
|
|
const uint32_t RS_VS_DHT_PASSIVE = 0x0001;
|
|
|
|
const uint32_t RS_VS_DHT_FULL = 0x0002;
|
2008-02-07 11:18:34 -05:00
|
|
|
|
2008-01-25 03:01:40 -05:00
|
|
|
/* State */
|
|
|
|
const uint32_t RS_PEER_STATE_FRIEND = 0x0001;
|
|
|
|
const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
|
|
|
|
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
|
2008-02-28 10:58:54 -05:00
|
|
|
const uint32_t RS_PEER_STATE_UNREACHABLE= 0x0008;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2015-02-02 17:32:30 -05:00
|
|
|
// Service option flags.
|
2012-12-01 14:22:22 -05:00
|
|
|
//
|
2015-02-18 14:07:58 -05:00
|
|
|
const ServicePermissionFlags RS_NODE_PERM_NONE ( 0x00000000 ) ;// 0x1, 0x2 and Ox4 are deprecated.
|
|
|
|
const ServicePermissionFlags RS_NODE_PERM_DIRECT_DL ( 0x00000008 ) ;// Accept to directly DL from this peer (breaks anonymity)
|
|
|
|
const ServicePermissionFlags RS_NODE_PERM_ALLOW_PUSH ( 0x00000010 ) ;// Auto-DL files recommended by this peer
|
2015-06-01 15:44:36 -04:00
|
|
|
const ServicePermissionFlags RS_NODE_PERM_REQUIRE_WL ( 0x00000020 ) ;// Require white list clearance for connection
|
2015-06-06 09:21:59 -04:00
|
|
|
const ServicePermissionFlags RS_NODE_PERM_DEFAULT = RS_NODE_PERM_DIRECT_DL ;
|
2015-06-01 15:44:36 -04:00
|
|
|
const ServicePermissionFlags RS_NODE_PERM_ALL = RS_NODE_PERM_DIRECT_DL | RS_NODE_PERM_ALLOW_PUSH | RS_NODE_PERM_REQUIRE_WL;
|
2015-02-02 17:32:30 -05:00
|
|
|
|
2012-12-01 14:22:22 -05:00
|
|
|
// ...
|
|
|
|
|
2011-01-06 13:26:39 -05:00
|
|
|
/* Connect state */
|
2013-08-22 03:26:13 -04:00
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_OFFLINE = 0;
|
2011-01-06 13:26:39 -05:00
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
|
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
|
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
2014-10-26 12:24:45 -04:00
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
|
2015-09-07 06:59:21 -04:00
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_I2P = 7;
|
|
|
|
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 8;
|
2011-01-06 13:26:39 -05:00
|
|
|
|
2012-12-22 16:22:03 -05:00
|
|
|
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
|
|
|
|
|
2012-08-13 15:37:50 -04:00
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_NO_ERROR = 0x00 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_UNKOWN_ERROR = 0x01 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_NO_BEGIN_TAG = 0x02 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_NO_END_TAG = 0x03 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_NO_CHECKSUM = 0x04 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_WRONG_NUMBER = 0x05 ;
|
|
|
|
const int RS_PEER_CERT_CLEANING_CODE_WRONG_RADIX_CHAR = 0x06 ;
|
2011-08-30 17:49:49 -04:00
|
|
|
|
2012-12-22 16:22:03 -05:00
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_NO_ERROR = 0x10 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_SIZE_ERROR = 0x11 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_INVALID_LOCATION_ID = 0x12 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_INVALID_EXTERNAL_IP = 0x13 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_INVALID_LOCAL_IP = 0x14 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_INVALID_CHECKSUM_SECTION = 0x15 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_CHECKSUM_ERROR = 0x16 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_UNKNOWN_SECTION_PTAG = 0x17 ;
|
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_MISSING_CHECKSUM = 0x18 ;
|
2014-01-18 11:53:19 -05:00
|
|
|
const uint32_t CERTIFICATE_PARSING_ERROR_WRONG_VERSION = 0x19 ;
|
2012-12-22 16:22:03 -05:00
|
|
|
|
2013-05-29 17:32:02 -04:00
|
|
|
const uint32_t PGP_KEYRING_REMOVAL_ERROR_NO_ERROR = 0x20 ;
|
|
|
|
const uint32_t PGP_KEYRING_REMOVAL_ERROR_CANT_REMOVE_SECRET_KEYS = 0x21 ;
|
|
|
|
const uint32_t PGP_KEYRING_REMOVAL_ERROR_CANNOT_CREATE_BACKUP = 0x22 ;
|
|
|
|
const uint32_t PGP_KEYRING_REMOVAL_ERROR_CANNOT_WRITE_BACKUP = 0x23 ;
|
2013-05-31 15:16:04 -04:00
|
|
|
const uint32_t PGP_KEYRING_REMOVAL_ERROR_DATA_INCONSISTENCY = 0x24 ;
|
2013-05-29 17:32:02 -04:00
|
|
|
|
2012-01-08 17:15:19 -05:00
|
|
|
/* LinkType Flags */
|
|
|
|
|
|
|
|
// CONNECTION
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_MASK = 0x0000ffff;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_TCP_MASK = 0x0000000f;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_TCP_UNKNOWN = 0x00000001;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_TCP_LOCAL = 0x00000002;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_TCP_EXTERNAL = 0x00000004;
|
|
|
|
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UDP_MASK = 0x000000f0;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UDP_UNKNOWN = 0x00000010;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UDP_DIRECT = 0x00000020;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UDP_PROXY = 0x00000040;
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UDP_RELAY = 0x00000080;
|
|
|
|
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_OTHER_MASK = 0x00000f00;
|
|
|
|
|
|
|
|
const uint32_t RS_NET_CONN_TRANS_UNKNOWN = 0x00001000;
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_MASK = 0x000f0000;
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_UNKNOWN = 0x00000000;
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_TRICKLE = 0x00010000;
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_LOW = 0x00020000;
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_NORMAL = 0x00040000;
|
|
|
|
const uint32_t RS_NET_CONN_SPEED_HIGH = 0x00080000;
|
|
|
|
|
|
|
|
const uint32_t RS_NET_CONN_QUALITY_MASK = 0x00f00000;
|
|
|
|
const uint32_t RS_NET_CONN_QUALITY_UNKNOWN = 0x00000000;
|
|
|
|
|
|
|
|
// THIS INFO MUST BE SUPPLIED BY PEERMGR....
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_MASK = 0x0f000000;
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_UNKNOWN = 0x00000000;
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_ACQUAINTANCE = 0x01000000;
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_FRIEND = 0x02000000;
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_SERVER = 0x04000000;
|
|
|
|
const uint32_t RS_NET_CONN_TYPE_CLIENT = 0x08000000;
|
|
|
|
|
2014-09-28 05:54:20 -04:00
|
|
|
// working state of proxy
|
|
|
|
|
|
|
|
const uint32_t RS_NET_PROXY_STATUS_UNKNOWN = 0x0000 ;
|
|
|
|
const uint32_t RS_NET_PROXY_STATUS_OK = 0x0001 ;
|
|
|
|
|
2012-12-22 16:22:03 -05:00
|
|
|
// Potential certificate parsing errors.
|
2012-01-08 17:15:19 -05:00
|
|
|
|
|
|
|
|
2010-09-22 18:37:57 -04:00
|
|
|
/* Groups */
|
|
|
|
#define RS_GROUP_ID_FRIENDS "Friends"
|
|
|
|
#define RS_GROUP_ID_FAMILY "Family"
|
|
|
|
#define RS_GROUP_ID_COWORKERS "Co-Workers"
|
|
|
|
#define RS_GROUP_ID_OTHERS "Other Contacts"
|
|
|
|
#define RS_GROUP_ID_FAVORITES "Favorites"
|
|
|
|
|
|
|
|
const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
|
|
|
|
|
2008-01-25 03:01:40 -05:00
|
|
|
/* A couple of helper functions for translating the numbers games */
|
|
|
|
|
|
|
|
std::string RsPeerTrustString(uint32_t trustLvl);
|
|
|
|
std::string RsPeerNetModeString(uint32_t netModel);
|
|
|
|
std::string RsPeerLastConnectString(uint32_t lastConnect);
|
|
|
|
|
|
|
|
|
|
|
|
/* Details class */
|
|
|
|
class RsPeerDetails
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
RsPeerDetails();
|
|
|
|
|
|
|
|
/* Auth details */
|
2011-01-06 13:26:39 -05:00
|
|
|
bool isOnlyGPGdetail;
|
2014-03-17 16:56:06 -04:00
|
|
|
RsPeerId id;
|
|
|
|
RsPgpId gpg_id;
|
|
|
|
|
2008-01-25 03:01:40 -05:00
|
|
|
std::string name;
|
|
|
|
std::string email;
|
|
|
|
std::string location;
|
|
|
|
std::string org;
|
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
RsPgpId issuer;
|
2009-08-09 09:06:24 -04:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
PGPFingerprintType fpr; /* pgp fingerprint */
|
2015-12-31 13:32:46 -05:00
|
|
|
std::string authcode; // TODO: 2015/12/31 (cyril) what is this used for ?????
|
2014-03-17 16:56:06 -04:00
|
|
|
std::list<RsPgpId> gpgSigners;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
|
|
|
uint32_t trustLvl;
|
2009-05-25 07:38:47 -04:00
|
|
|
uint32_t validLvl;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2011-01-06 13:26:39 -05:00
|
|
|
bool ownsign; /* we have signed the remote peer GPG key */
|
|
|
|
bool hasSignedMe; /* the remote peer has signed my GPG key */
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2011-01-06 13:26:39 -05:00
|
|
|
bool accept_connection;
|
2010-01-13 16:22:52 -05:00
|
|
|
|
2015-02-02 17:32:30 -05:00
|
|
|
/* Peer permission flags. What services the peer can use (Only valid if friend).*/
|
|
|
|
ServicePermissionFlags service_perm_flags ;
|
2012-12-01 14:22:22 -05:00
|
|
|
|
2015-02-02 17:32:30 -05:00
|
|
|
/* Network details (only valid if friend) */
|
2015-12-31 13:32:46 -05:00
|
|
|
uint32_t state;
|
|
|
|
bool actAsServer;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2015-12-31 13:32:46 -05:00
|
|
|
// TODO: 2015/12/31 to take advantage of multiple connection this must be
|
|
|
|
// replaced by a set of addresses
|
|
|
|
std::string connectAddr ; // current address if connected.
|
|
|
|
uint16_t connectPort ;
|
2014-02-01 09:16:15 -05:00
|
|
|
|
|
|
|
// Hidden Node details.
|
2015-12-31 13:32:46 -05:00
|
|
|
bool isHiddenNode;
|
|
|
|
std::string hiddenNodeAddress;
|
|
|
|
uint16_t hiddenNodePort;
|
|
|
|
uint32_t hiddenType;
|
2013-09-08 22:10:49 -04:00
|
|
|
|
|
|
|
// Filled in for Standard Node.
|
2015-12-31 13:32:46 -05:00
|
|
|
std::string localAddr;
|
|
|
|
uint16_t localPort;
|
|
|
|
std::string extAddr;
|
|
|
|
uint16_t extPort;
|
|
|
|
std::string dyndns;
|
|
|
|
std::list<std::string> ipAddressList;
|
|
|
|
|
|
|
|
uint32_t netMode;
|
2013-09-28 04:09:59 -04:00
|
|
|
/* vis State */
|
2015-12-31 13:32:46 -05:00
|
|
|
uint16_t vs_disc;
|
|
|
|
uint16_t vs_dht;
|
2008-01-25 03:01:40 -05:00
|
|
|
|
|
|
|
/* basic stats */
|
2015-12-31 13:32:46 -05:00
|
|
|
uint32_t lastConnect; /* how long ago */
|
|
|
|
uint32_t lastUsed; /* how long ago since last used: signature verif, connect attempt, etc */
|
|
|
|
uint32_t connectState; /* RS_PEER_CONNECTSTATE_... */
|
|
|
|
std::string connectStateString; /* Additional string like ip address */
|
|
|
|
uint32_t connectPeriod;
|
|
|
|
bool foundDHT;
|
2012-01-08 17:15:19 -05:00
|
|
|
|
2013-08-22 03:26:13 -04:00
|
|
|
/* have we been denied */
|
2015-12-31 13:32:46 -05:00
|
|
|
bool wasDeniedConnection;
|
|
|
|
time_t deniedTS;
|
2013-08-22 03:26:13 -04:00
|
|
|
|
2012-01-08 17:15:19 -05:00
|
|
|
/* linkType */
|
2015-12-31 13:32:46 -05:00
|
|
|
uint32_t linkType;
|
2016-06-07 21:48:22 -04:00
|
|
|
|
|
|
|
uint32_t maxRateUp;
|
|
|
|
uint32_t maxRateDn;
|
2008-01-25 03:01:40 -05:00
|
|
|
};
|
|
|
|
|
2013-06-28 17:47:25 -04:00
|
|
|
// This class is used to get info about crytographic algorithms used with a
|
|
|
|
// particular peer.
|
|
|
|
class RsPeerCryptoParams
|
|
|
|
{
|
2015-12-31 13:32:46 -05:00
|
|
|
public:
|
|
|
|
int connexion_state;
|
|
|
|
std::string cipher_name;
|
|
|
|
int cipher_bits_1;
|
|
|
|
int cipher_bits_2;
|
|
|
|
std::string cipher_version;
|
2013-06-28 17:47:25 -04:00
|
|
|
};
|
|
|
|
|
2010-09-22 18:37:57 -04:00
|
|
|
class RsGroupInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGroupInfo();
|
|
|
|
|
|
|
|
std::string id;
|
|
|
|
std::string name;
|
2015-12-31 13:32:46 -05:00
|
|
|
uint32_t flag;
|
2010-09-22 18:37:57 -04:00
|
|
|
|
2015-12-31 13:32:46 -05:00
|
|
|
std::set<RsPgpId> peerIds;
|
2010-09-22 18:37:57 -04:00
|
|
|
};
|
|
|
|
|
2008-01-25 03:01:40 -05:00
|
|
|
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
|
|
|
|
|
2015-12-31 13:32:46 -05:00
|
|
|
/* TODO: 2015/12/31 this class seems foundamental for RetroShare code
|
|
|
|
* understanding must document it as soon as possible
|
|
|
|
*/
|
2008-01-25 03:01:40 -05:00
|
|
|
class RsPeers
|
|
|
|
{
|
2015-12-31 13:32:46 -05:00
|
|
|
public:
|
2008-01-25 03:01:40 -05:00
|
|
|
|
2015-12-31 13:32:46 -05:00
|
|
|
RsPeers() {}
|
|
|
|
virtual ~RsPeers() {}
|
|
|
|
|
|
|
|
// TODO: 2015/12/31 is this dead code?
|
|
|
|
/* Updates ... */
|
|
|
|
// not implemented
|
|
|
|
//virtual bool FriendsChanged() = 0;
|
|
|
|
//virtual bool OthersChanged() = 0;
|
|
|
|
|
|
|
|
/* Peer Details (Net & Auth) */
|
|
|
|
virtual const RsPeerId& getOwnId() = 0;
|
|
|
|
|
|
|
|
virtual bool haveSecretKey(const RsPgpId& gpg_id) = 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 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 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 RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0;
|
|
|
|
virtual bool removeFriend(const RsPgpId& pgp_id) = 0;
|
|
|
|
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
|
|
|
|
|
|
|
|
/* keyring management */
|
|
|
|
virtual bool removeKeysFromPGPKeyring(const std::set<RsPgpId>& pgp_ids,std::string& backup_file,uint32_t& error_code) = 0;
|
|
|
|
|
|
|
|
/* Network Stuff */
|
|
|
|
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 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 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(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
|
|
|
virtual bool setProxyServer(const uint32_t type, const std::string &addr, const uint16_t port) = 0;
|
|
|
|
|
|
|
|
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
|
|
|
|
virtual void allowServerIPDetermination(bool) = 0;
|
|
|
|
virtual bool resetOwnExternalAddressList() = 0;
|
|
|
|
virtual bool getAllowServerIPDetermination() = 0 ;
|
|
|
|
|
|
|
|
/* Auth Stuff */
|
|
|
|
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, 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 RsPeerId& id, const std::string &fname) = 0;
|
|
|
|
virtual std::string saveCertificateToString(const RsPeerId &id) = 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;
|
|
|
|
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
|
|
|
virtual bool removeGroup(const std::string &groupId) = 0;
|
|
|
|
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 RsPgpId& peerId, bool assign) = 0;
|
|
|
|
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
|
|
|
|
|
|
|
/* Group sharing permission */
|
|
|
|
|
|
|
|
// Given
|
|
|
|
// - the peer id
|
|
|
|
// - the permission flags of a given hash, e.g. a combination of
|
|
|
|
// RS_DIR_FLAGS_NETWORK_WIDE_OTHERS, RS_DIR_FLAGS_NETWORK_WIDE_GROUPS, RS_DIR_FLAGS_BROWSABLE_OTHERS and RS_DIR_FLAGS_BROWSABLE_GROUPS
|
|
|
|
// - the parent groups of the file
|
|
|
|
//
|
|
|
|
// ... 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 RsPeerId& peer_id, FileStorageFlags file_sharing_flags,
|
|
|
|
const std::list<std::string>& file_parent_groups) = 0;
|
|
|
|
|
|
|
|
/* Service permission flags */
|
|
|
|
|
|
|
|
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;
|
2016-06-07 21:48:22 -04:00
|
|
|
|
|
|
|
virtual bool setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate) =0;
|
2016-06-08 22:44:28 -04:00
|
|
|
virtual bool getPeerMaximumRates(const RsPeerId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate) =0;
|
2008-01-25 03:01:40 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|