merged with upstream head

This commit is contained in:
csoler 2015-10-25 20:42:41 -04:00
commit f24bddf6f1
204 changed files with 9044 additions and 6814 deletions

View file

@ -1,25 +0,0 @@
RS_TOP_DIR = ..
##### Define any flags that are needed for this section #######
###############################################################
###############################################################
include $(RS_TOP_DIR)/scripts/config.mk
###############################################################
OBJ = notifytxt.o retroshare.o
#TESTOBJ =
TESTS = retroshare-nogui
all: tests
retroshare-nogui: $(OBJ)
$(CC) $(CFLAGS) -o retroshare-nogui $(OBJ) $(LIBS)
###############################################################
include $(RS_TOP_DIR)/scripts/rules.mk
###############################################################

View file

@ -32,6 +32,7 @@
#include "retroshare/rstokenservice.h"
#include "retroshare/rsgxsifacehelper.h"
#include "retroshare/rsreputations.h"
#include "retroshare/rsids.h"
#include "serialiser/rstlvimage.h"
#include "retroshare/rsgxscommon.h"
@ -158,8 +159,7 @@ class RsIdentityDetails
{
public:
RsIdentityDetails()
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false),
mReputation(), mLastUsageTS(0) { return; }
:mIsOwnId(false), mPgpLinked(false), mPgpKnown(false), mLastUsageTS(0) { return; }
RsGxsId mId;
@ -175,8 +175,12 @@ public:
// Recogn details.
std::list<RsRecognTag> mRecognTags;
// reputation details.
GxsReputation mReputation;
// Cyril: Reputation details. At some point we might want to merge information
// between the two into a single global score. Since the old reputation system
// is not finished yet, I leave this in place. We should decide what to do with it.
GxsReputation mReputation_oldSystem; // this is the old "mReputation" field, which apparently is not used.
RsReputations::ReputationInfo mReputation;
// avatar
RsGxsImage mAvatar ;
@ -214,7 +218,7 @@ public:
/********************************************************************************************/
/********************************************************************************************/
// For Other Services....
// It should be impossible for them to get a message which we don't have the identity.
// Its a major error if we don't have the identity.

View file

@ -63,6 +63,14 @@ const uint32_t RS_NETMODE_EXT = 0x0003;
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
/* Hidden Type */
const uint32_t RS_HIDDEN_TYPE_NONE = 0x0000;
const uint32_t RS_HIDDEN_TYPE_UNKNOWN = 0x0001;
const uint32_t RS_HIDDEN_TYPE_TOR = 0x0002;
const uint32_t RS_HIDDEN_TYPE_I2P = 0x0004;
/* mask to match all valid hidden types */
const uint32_t RS_HIDDEN_TYPE_MASK = RS_HIDDEN_TYPE_I2P | RS_HIDDEN_TYPE_TOR;
/* Visibility */
const uint32_t RS_VS_DISC_OFF = 0x0000;
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
@ -96,7 +104,8 @@ 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;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_I2P = 7;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 8;
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
@ -232,6 +241,7 @@ class RsPeerDetails
bool isHiddenNode;
std::string hiddenNodeAddress;
uint16_t hiddenNodePort;
uint32_t hiddenType;
// Filled in for Standard Node.
std::string localAddr;
@ -350,8 +360,8 @@ class RsPeers
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,uint32_t& status_flags) = 0;
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 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;

View file

@ -40,6 +40,7 @@ extern RsPluginHandler *rsPlugins ;
class p3Service ;
class RsServiceControl ;
class RsReputations ;
class RsTurtle ;
class RsDht ;
class RsDisc ;
@ -116,6 +117,7 @@ public:
RsUtil::inited_ptr<PgpAuxUtils> mPgpAuxUtils;
RsUtil::inited_ptr<RsGxsForums> mGxsForums;
RsUtil::inited_ptr<RsGxsChannels> mGxsChannels;
RsUtil::inited_ptr<RsReputations> mReputations;
};
class RsPlugin

View file

@ -0,0 +1,58 @@
/*
* libretroshare/src/services: rsreputation.h
*
* Services for RetroShare.
*
* Copyright 2015 by Cyril Soler
*
* 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 "csoler@users.sourceforge.net".
*
*/
#pragma once
#include "retroshare/rsids.h"
#include "retroshare/rsgxsifacetypes.h"
class RsReputations
{
public:
// This is the interface file for the reputation system
//
enum Opinion { OPINION_NEGATIVE = 0, OPINION_NEUTRAL = 1, OPINION_POSITIVE = 2 } ;
enum Assessment { ASSESSMENT_BAD = 0, ASSESSMENT_OK = 1 } ;
struct ReputationInfo
{
RsReputations::Opinion mOwnOpinion ;
float mOverallReputationScore ;
float mFriendAverage ;
RsReputations::Assessment mAssessment; // this should help clients in taking decisions
};
virtual bool setOwnOpinion(const RsGxsId& key_id, const Opinion& op) =0;
virtual bool getReputationInfo(const RsGxsId& id,ReputationInfo& info) =0 ;
// This one is a proxy designed to allow fast checking of a GXS id.
// it basically returns true if assessment is not ASSESSMENT_OK
virtual bool isIdentityBanned(const RsGxsId& id) =0;
};
// To access reputations from anywhere
//
extern RsReputations *rsReputations ;