merged remaining of v0.6-IdCleaning branch (7180->7213) to incorporate global router stuff in trunk

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7214 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-03-29 14:18:05 +00:00
parent 0e6302ac6a
commit 1042744685
53 changed files with 2387 additions and 1904 deletions

View file

@ -0,0 +1,93 @@
/*
* libretroshare/src/services: rsgrouter.h
*
* Services for RetroShare.
*
* Copyright 2013 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 "util/rsdir.h"
#include "grouter/groutertypes.h"
#include "retroshare/rsids.h"
typedef GRouterKeyIdType GRouterKeyId ; // we use SSLIds, so that it's easier in the GUI to mix up peer ids with grouter ids.
class GRouterClientService ;
class RsGRouterGenericDataItem ;
class RsGRouter
{
public:
// This is the interface file for the global router service.
//
struct GRouterRoutingCacheInfo
{
GRouterMsgPropagationId mid ;
RsPeerId local_origin;
GRouterKeyId destination ;
time_t time_stamp ;
uint32_t status ;
uint32_t data_size ;
};
struct GRouterPublishedKeyInfo
{
std::string description_string ;
uint32_t service_id ;
};
struct GRouterRoutingMatrixInfo
{
// Probabilities of reaching a given key for each friend.
// This concerns all known keys.
//
std::map<GRouterKeyId, std::vector<float> > per_friend_probabilities ;
// List of friend ids in the same order. Should roughly correspond to the friends that are currently online.
//
std::vector<RsPeerId> friend_ids ;
// List of own published keys, with associated service ID
//
std::map<GRouterKeyId,GRouterPublishedKeyInfo> published_keys ;
};
//===================================================//
// Debugging info //
//===================================================//
virtual bool getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& infos) =0;
virtual bool getRoutingMatrixInfo(GRouterRoutingMatrixInfo& info) =0;
// retrieve the routing probabilities
//===================================================//
// Communication to other services. //
//===================================================//
virtual void sendData(const GRouterKeyId& destination, RsGRouterGenericDataItem *item) =0;
virtual bool registerKey(const GRouterKeyId& key,const GRouterServiceId& client_id,const std::string& description_string) =0;
};
// To access the GRouter from anywhere
//
extern RsGRouter *rsGRouter ;

View file

@ -218,8 +218,10 @@ static const uint32_t RS_GENERIC_ID_GXS_GROUP_ID_TYPE = 0x0005 ;
static const uint32_t RS_GENERIC_ID_GXS_ID_TYPE = 0x0006 ;
static const uint32_t RS_GENERIC_ID_GXS_MSG_ID_TYPE = 0x0007 ;
static const uint32_t RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE = 0x0008 ;
static const uint32_t RS_GENERIC_ID_GROUTER_ID_TYPE = 0x0009 ;
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ;
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GROUTER_ID_TYPE> GRouterKeyIdType ;
typedef t_RsGenericIdType< PGP_KEY_ID_SIZE , true, RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType ;
typedef t_RsGenericIdType< SHA1_SIZE , false, RS_GENERIC_ID_SHA1_ID_TYPE> Sha1CheckSum ;
typedef t_RsGenericIdType< PGP_KEY_FINGERPRINT_SIZE, true, RS_GENERIC_ID_PGP_FINGERPRINT_TYPE> PGPFingerprintType ;

View file

@ -33,6 +33,7 @@
#include <set>
#include "rstypes.h"
#include "rsgxsifacetypes.h"
/********************** For Messages and Channels *****************/
@ -88,32 +89,42 @@ typedef uint64_t ChatLobbyMsgId ;
typedef std::string ChatLobbyNickName ;
typedef RsPeerId DistantChatPeerId ;
typedef RsPeerId DistantMsgPeerId ;
typedef GRouterKeyIdType DistantMsgPeerId ;
class MessageInfo
{
public:
MessageInfo() {}
std::string msgId;
RsPeerId srcId;
public:
MessageInfo() {}
std::string msgId;
unsigned int msgflags;
RsPeerId rspeerid_srcId;
RsGxsId rsgxsid_srcId;
std::list<RsPeerId> msgto;
std::list<RsPeerId> msgcc;
std::list<RsPeerId> msgbcc;
unsigned int msgflags;
std::string title;
std::string msg;
// friend destinations
//
std::list<RsPeerId> rspeerid_msgto; // RsPeerId is used here for various purposes:
std::list<RsPeerId> rspeerid_msgcc; // - real peer ids which are actual friend locations
std::list<RsPeerId> rspeerid_msgbcc; // -
std::string attach_title;
std::string attach_comment;
std::list<FileInfo> files;
std::map<std::string,std::string> encryption_keys ; // for concerned ids only the public pgp key id to encrypt the message with.
int size; /* total of files */
int count; /* file count */
// distant peers
//
std::list<RsGxsId> rsgxsid_msgto; // RsPeerId is used here for various purposes:
std::list<RsGxsId> rsgxsid_msgcc; // - real peer ids which are actual friend locations
std::list<RsGxsId> rsgxsid_msgbcc; // -
int ts;
std::string title;
std::string msg;
std::string attach_title;
std::string attach_comment;
std::list<FileInfo> files;
int size; /* total of files */
int count; /* file count */
int ts;
};
class MsgInfoSummary
@ -241,7 +252,7 @@ extern RsMsgs *rsMsgs;
struct DistantOfflineMessengingInvite
{
RsPgpId issuer_pgp_id ;
Sha1CheckSum hash ;
DistantMsgPeerId peer_id ;
time_t time_of_validity ;
};
@ -291,11 +302,8 @@ virtual bool resetMessageStandardTagTypes(MsgTagType& tags) = 0;
/* Private distant messages */
/****************************************/
virtual bool createDistantOfflineMessengingInvite(time_t validity_time_stamp, DistantMsgPeerId& hash)=0 ;
virtual bool getDistantOfflineMessengingInvites(std::vector<DistantOfflineMessengingInvite>& invites) = 0 ;
virtual void enableDistantMessaging(bool b) = 0;
virtual bool distantMessagingEnabled() = 0;
virtual bool getDistantMessagePeerId(const RsPgpId& pgp_id, DistantMsgPeerId& peerId) = 0;
/****************************************/
/* Chat */