mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
merged new GRouter model (branch v0.6-NewGRouterModel 7837-7863). Provides a fully functional distant messaging system. The asynchronous part will be implemented shortly
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7867 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
34f968a112
44 changed files with 2447 additions and 1854 deletions
|
@ -27,8 +27,9 @@
|
|||
|
||||
#include "util/rsdir.h"
|
||||
#include "retroshare/rsids.h"
|
||||
#include "retroshare/rsgxsifacetypes.h"
|
||||
|
||||
typedef GRouterKeyIdType GRouterKeyId ; // we use SSLIds, so that it's easier in the GUI to mix up peer ids with grouter ids.
|
||||
typedef RsGxsId GRouterKeyId ; // we use SSLIds, so that it's easier in the GUI to mix up peer ids with grouter ids.
|
||||
typedef uint32_t GRouterServiceId ;
|
||||
typedef uint64_t GRouterMsgPropagationId ;
|
||||
|
||||
|
@ -37,62 +38,70 @@ 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 ;
|
||||
};
|
||||
public:
|
||||
// This is the interface file for the global router service.
|
||||
//
|
||||
struct GRouterRoutingCacheInfo
|
||||
{
|
||||
GRouterMsgPropagationId mid ;
|
||||
RsPeerId local_origin;
|
||||
GRouterKeyId destination ;
|
||||
time_t routing_time;
|
||||
time_t last_tunnel_attempt_time;
|
||||
time_t last_sent_time;
|
||||
bool receipt_available ;
|
||||
uint32_t data_status ;
|
||||
uint32_t tunnel_status ;
|
||||
uint32_t data_size ;
|
||||
Sha1CheckSum data_hash ;
|
||||
};
|
||||
|
||||
struct GRouterPublishedKeyInfo
|
||||
{
|
||||
std::string description_string ;
|
||||
uint32_t service_id ;
|
||||
};
|
||||
struct GRouterPublishedKeyInfo
|
||||
{
|
||||
std::string description_string ;
|
||||
RsGxsId authentication_key ;
|
||||
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 ;
|
||||
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 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 ;
|
||||
};
|
||||
// List of own published keys, with associated service ID
|
||||
//
|
||||
std::map<Sha1CheckSum,GRouterPublishedKeyInfo> published_keys ;
|
||||
};
|
||||
|
||||
//===================================================//
|
||||
// Debugging info //
|
||||
//===================================================//
|
||||
//===================================================//
|
||||
// Debugging info //
|
||||
//===================================================//
|
||||
|
||||
virtual bool getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& infos) =0;
|
||||
virtual bool getRoutingMatrixInfo(GRouterRoutingMatrixInfo& info) =0;
|
||||
virtual bool getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& infos) =0;
|
||||
virtual bool getRoutingMatrixInfo(GRouterRoutingMatrixInfo& info) =0;
|
||||
|
||||
// retrieve the routing probabilities
|
||||
|
||||
//===================================================//
|
||||
// Communication to other services. //
|
||||
//===================================================//
|
||||
// retrieve the routing probabilities
|
||||
|
||||
virtual void sendData(const GRouterKeyId& destination, const GRouterServiceId& client_id, RsGRouterGenericDataItem *item,GRouterMsgPropagationId& id) =0;
|
||||
virtual bool registerKey(const GRouterKeyId& key,const GRouterServiceId& client_id,const std::string& description_string) =0;
|
||||
//===================================================//
|
||||
// Communication to other services. //
|
||||
//===================================================//
|
||||
|
||||
//===================================================//
|
||||
// Routage feedback from other services //
|
||||
//===================================================//
|
||||
virtual bool sendData(const RsGxsId& destination, const GRouterServiceId& client_id, const uint8_t *data, uint32_t data_size, const RsGxsId& signing_id, GRouterMsgPropagationId& id) =0;
|
||||
virtual bool cancel(GRouterMsgPropagationId mid) =0;
|
||||
|
||||
virtual void addRoutingClue(const GRouterKeyId& destination, const RsPeerId& source) =0;
|
||||
virtual bool registerKey(const RsGxsId& authentication_id, const GRouterServiceId& client_id,const std::string& description_string)=0 ;
|
||||
|
||||
//===================================================//
|
||||
// Routage feedback from other services //
|
||||
//===================================================//
|
||||
|
||||
virtual void addRoutingClue(const GRouterKeyId& destination, const RsPeerId& source) =0;
|
||||
};
|
||||
|
||||
// To access the GRouter from anywhere
|
||||
|
|
|
@ -219,7 +219,7 @@ 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< 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 ;
|
||||
|
|
|
@ -90,12 +90,12 @@
|
|||
|
||||
const ChatLobbyFlags RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE( 0x00000001 ) ;
|
||||
|
||||
typedef uint64_t ChatLobbyId ;
|
||||
typedef uint64_t ChatLobbyMsgId ;
|
||||
typedef uint64_t ChatLobbyId ;
|
||||
typedef uint64_t ChatLobbyMsgId ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
|
||||
typedef RsPeerId DistantChatPeerId ;
|
||||
typedef GRouterKeyIdType DistantMsgPeerId ;
|
||||
typedef RsPeerId DistantChatPeerId ;
|
||||
//typedef GRouterKeyId DistantMsgPeerId ;
|
||||
|
||||
typedef uint64_t MessageId ;
|
||||
|
||||
|
@ -368,14 +368,6 @@ std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
|||
class RsMsgs;
|
||||
extern RsMsgs *rsMsgs;
|
||||
|
||||
struct DistantOfflineMessengingInvite
|
||||
{
|
||||
RsPgpId issuer_pgp_id ;
|
||||
DistantMsgPeerId peer_id ;
|
||||
time_t time_of_validity ;
|
||||
};
|
||||
|
||||
|
||||
class RsMsgs
|
||||
{
|
||||
public:
|
||||
|
@ -390,7 +382,6 @@ virtual ~RsMsgs() { return; }
|
|||
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
||||
virtual bool getMessage(const std::string &mId, MessageInfo &msg) = 0;
|
||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox) = 0;
|
||||
virtual bool decryptMessage(const std::string& mId) = 0 ;
|
||||
|
||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||
virtual bool SystemMessage(const std::string &title, const std::string &message, uint32_t systemFlag) = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue