mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Removed cpp source files, don't need them yet.
Added more clarity to declarations Also added comment on general implementation of an RsGeneralExchangeService git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4820 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
00c6010543
commit
a89c6fd08a
@ -1,5 +0,0 @@
|
||||
#include "rsgdp.h"
|
||||
|
||||
RsGdp::RsGdp()
|
||||
{
|
||||
}
|
@ -31,19 +31,24 @@
|
||||
#include <string>
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "gxs/rsgxs.h"
|
||||
#include "rsgnp.h"
|
||||
|
||||
typedef std::map<std::string, std::set<std::string> > MsgGrpId;
|
||||
typedef std::map<std::string, std::set<RsGxsSignedMessage*> > SignedMsgGrp;
|
||||
|
||||
|
||||
/*!
|
||||
* The main role of GDP is the preparation of messages requested from
|
||||
* GXS instance's storage module (RsGeneralStorageService)
|
||||
* The main role of GDP is the preparation and handing out of messages requested from
|
||||
* RsGeneralExchangeService and RsGeneralExchangeService
|
||||
*
|
||||
* It acts as a layer between RsGeneralStorageService and its parent GXS instance
|
||||
* It also acts as a layer between RsGeneralStorageService and its parent RsGeneralExchangeService
|
||||
* thus allowing for non-blocking requests, etc.
|
||||
* It also provides caching ability
|
||||
*
|
||||
*
|
||||
* Caching feature:
|
||||
* - A cache index should be maintained which is faster than normal message request
|
||||
* - This should allow fast retrieval of message based on grp id or msg id
|
||||
*/
|
||||
class RsGeneralDataService
|
||||
{
|
||||
@ -131,12 +136,15 @@ class RequestFilter {
|
||||
|
||||
/*!
|
||||
*
|
||||
* This is implemented by the concrete GXS class to represent to define how \n
|
||||
* RsGxsSignedMessage is stored and retrieved \n
|
||||
* This is implemented by the concrete GXS class to represent and define how \n
|
||||
* RsGxsSignedMessage is stored and retrieved from disk \n
|
||||
* More complicated queries are enabled through the use of \n
|
||||
* RequestFilter which through rtti store generic parameter used \n
|
||||
* The main reason for layering RsGeneralDataService between this and service implementer \n
|
||||
* is to avoid the overhead of storage access \n
|
||||
* RequestFilter which through rtti store generic parameters used by the RsGeneralStorageService implementation \n
|
||||
*
|
||||
*
|
||||
* The main reason for layering RsGeneralDataService between this and RsGeneralExchangeService implementer \n
|
||||
* is to avoid the overhead of storage access and while allowing a rich variety of implementations not having to \n
|
||||
* worry about efficiency \n
|
||||
*/
|
||||
class RsGeneralStorageService {
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "rsgixs.h"
|
||||
|
||||
RsGixs::RsGixs()
|
||||
{
|
||||
}
|
@ -106,41 +106,47 @@
|
||||
|
||||
/*!
|
||||
* Retroshare general identity exchange service
|
||||
* provides a means to distribute identities among peers
|
||||
* also provides encyption, decryption, verification,
|
||||
* and signing functionality using any created identities
|
||||
*
|
||||
* Purpose: \n
|
||||
* Provides a means to distribute identities among peers \n
|
||||
* also provides encyption, decryption, verification, \n
|
||||
* and signing functionality using any created or received identities \n
|
||||
*
|
||||
* This may best be implemented as a singleton like current AuthGPG? \n
|
||||
*
|
||||
*/
|
||||
class RsIdentityExchangeService
|
||||
class RsIdentityExchangeService : RsGeneralExchangeService
|
||||
{
|
||||
public:
|
||||
|
||||
RsGixs();
|
||||
|
||||
/*!
|
||||
* creates gixs profile and shares it
|
||||
* @param profile
|
||||
*/
|
||||
bool createKey(RsGixsProfile& profile) = 0; /* fills in mKeyId, and signature */
|
||||
virtual bool createKey(RsGixsProfile& profile) = 0; /* fills in mKeyId, and signature */
|
||||
|
||||
/*!
|
||||
* Use to query a whether given key is available by its key reference
|
||||
* @param keyref the keyref of key that is being checked for
|
||||
* @return true if available, false otherwise
|
||||
*/
|
||||
bool haveKey(const KeyRef& keyref) = 0;
|
||||
virtual bool haveKey(const KeyRef& keyref) = 0;
|
||||
|
||||
/*!
|
||||
* Use to query whether private key member of the given key reference is available
|
||||
* @param keyref the KeyRef of the key being checked for
|
||||
* @return true if private key is held here, false otherwise
|
||||
*/
|
||||
bool havePrivateKey(const KeyRef& keyref) = 0;
|
||||
virtual bool havePrivateKey(const KeyRef& keyref) = 0;
|
||||
|
||||
/*!
|
||||
* Use to request a given key reference
|
||||
* @param keyref the KeyRef of the key being requested
|
||||
* @return will
|
||||
*/
|
||||
bool requestKey(const KeyRef& keyref) = 0;
|
||||
virtual bool requestKey(const KeyRef& keyref) = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves a key identity
|
||||
@ -148,7 +154,7 @@
|
||||
* @return a pointer to a valid profile if successful, otherwise NULL
|
||||
*
|
||||
*/
|
||||
RsGixsProfile* getProfile(const KeyRef& keyref) = 0;
|
||||
virtual RsGixsProfile* getProfile(const KeyRef& keyref) = 0;
|
||||
|
||||
|
||||
/*** process data ***/
|
||||
@ -161,7 +167,7 @@
|
||||
* @param signature is set with the signature from signing with keyref
|
||||
* @return false if signing failed, true otherwise
|
||||
*/
|
||||
bool sign(const KeyRef& keyref, unsigned char* data, uint32_t dataLen, std::string& signature) = 0;
|
||||
virtual bool sign(const KeyRef& keyref, unsigned char* data, uint32_t dataLen, std::string& signature) = 0;
|
||||
|
||||
/*!
|
||||
* Verify that the data is signed by the key owner
|
||||
@ -171,7 +177,7 @@
|
||||
* @param signature
|
||||
* @return false if verification failed, false otherwise
|
||||
*/
|
||||
bool verify(const KeyRef& keyref, unsigned char* data, int dataLen, std::string& signature) = 0;
|
||||
virtual bool verify(const KeyRef& keyref, unsigned char* data, int dataLen, std::string& signature) = 0;
|
||||
|
||||
/*!
|
||||
* Attempt to decrypt data with a given key
|
||||
@ -182,7 +188,7 @@
|
||||
* @param decryptDataLen length of decrypted data
|
||||
* @return false
|
||||
*/
|
||||
bool decrypt(const KeyRef& keyref, unsigned char* data, int dataLen,
|
||||
virtual bool decrypt(const KeyRef& keyref, unsigned char* data, int dataLen,
|
||||
unsigned char*& decryptedData, uint32_t& decyptDataLen) = 0;
|
||||
|
||||
/*!
|
||||
@ -193,7 +199,7 @@
|
||||
* @param encryptedData encrypted data
|
||||
* @param encryptDataLen length of encrypted data
|
||||
*/
|
||||
bool encrypt(const KeyRef& keyref, unsigned char* data, int dataLen,
|
||||
virtual bool encrypt(const KeyRef& keyref, unsigned char* data, int dataLen,
|
||||
unsigned char*& encryptedData, uint32_t& encryptDataLen) = 0;
|
||||
|
||||
};
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "rsgnp.h"
|
||||
|
||||
RsGnp::RsGnp()
|
||||
{
|
||||
}
|
@ -35,16 +35,52 @@
|
||||
|
||||
#include "gxs/rsgxs.h"
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* This is universal format for messages that is transported throughout
|
||||
* the general exchange service chain. From concrete service to
|
||||
*/
|
||||
class RsGxsSignedMessage : RsItem {
|
||||
|
||||
uint32_t timestamp;
|
||||
void* signature;
|
||||
void* data;
|
||||
uint32_t msg_flags; /* encrypted */
|
||||
std::string msgId; /* hash of all message data */
|
||||
std::string grpId;
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Item for dealing
|
||||
* with grp list
|
||||
*/
|
||||
class RsGxsMessageList : public RsGxsSignedMessage {
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Item for dealing with group
|
||||
* description and msg list
|
||||
*/
|
||||
class RsGxsGroup : public RsGxsSignedMessage {
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef std::map<std::string, std::set<std::string> > PeerGrp;
|
||||
|
||||
/*!
|
||||
* Retroshare General Network Exchange Service: \n
|
||||
* This provides a module to service peers requests for GXS message \n
|
||||
* and also request GXS messages from other peers. \n
|
||||
* Users can make a general request for message under a grp id for a peer, all grp ids held \n
|
||||
* by a set of peers. And can also apply to timerange to them
|
||||
* An interface is provided for the observer pattern is provided to alert clients this class
|
||||
* when requests have been served
|
||||
* Interface:
|
||||
* - This provides a module to service peers requests for GXS message \n
|
||||
* and also request GXS messages from other peers. \n
|
||||
* - Users can make a general request for message under a grp id for a peer, all grp ids held \n
|
||||
* by a set of peers. And can also apply to timerange to them
|
||||
* - An interface is provided for the observer pattern so clients of this class
|
||||
* can check if their requests have been served
|
||||
*/
|
||||
class RsNetworktExchangeService
|
||||
{
|
||||
@ -90,8 +126,6 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* attempt to retrieve requested messages
|
||||
* @param requestCode
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "rsgxs.h"
|
||||
|
||||
RsGxs::RsGxs()
|
||||
{
|
||||
}
|
@ -34,18 +34,65 @@
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
/*!
|
||||
* This is universal format for messages that is transported throughout
|
||||
* the general exchange service chain. From concrete service to
|
||||
*/
|
||||
class RsGxsSignedMessage {
|
||||
#include "serialiser/rsbaseitems.h"
|
||||
#include "rsgnp.h"
|
||||
#include "rsgdp.h"
|
||||
#include "rsgixs.h"
|
||||
|
||||
uint32_t timestamp;
|
||||
void* signature;
|
||||
void* data;
|
||||
uint32_t msg_flags; /* encrypted */
|
||||
std::string msgId; /* hash of all message data */
|
||||
std::string grpId;
|
||||
/*!
|
||||
*
|
||||
* Brief explanation of how RsGeneralExchange service would work \n
|
||||
*
|
||||
* Resposibilities : Giving access to its RsGeneralDataService and RsNetworktExchangeService
|
||||
* instances \n
|
||||
*
|
||||
* Features: \n
|
||||
*
|
||||
* Internal Message Flow: \n\n
|
||||
*
|
||||
* - Storage of user generated messages : stores are made to RsGeneralDataService \n
|
||||
* - Outbound Requests are made via RsNetworktExchangeService from here, and delivered to the service \n
|
||||
* A consideration is allow the RsNetworktExchangeService x-ref GDP and GNP \n
|
||||
*
|
||||
* - Inbound request from peers are made by RsNetworktExchangeService to RsGeneralDataService \n
|
||||
* Again x-ref between GNP and GDP (Services don't see implementation so they don't know this) \n
|
||||
*
|
||||
* - RsNetworktExchangeService stores requested message \n
|
||||
*
|
||||
* Permissions: \n\n
|
||||
* - Permission are defined within the service, and mirror RsGroups feature set \n
|
||||
* - These are resolved in RsGeneralDataService \n
|
||||
*
|
||||
* Storage: \n\n
|
||||
*
|
||||
* - Storage mechnaism used by service can be whatever they want with current RsGeneralStorageService
|
||||
* interface \n
|
||||
* - But a partial (non-pure virtual) implementation may be done to enforce use of Retrodb
|
||||
* and efficiency \n
|
||||
*
|
||||
* Security:
|
||||
* - This accessible at all levels but generally the service and storage. \n
|
||||
* - Security feature can be used or not, for RsIdentityExchangeService this is not used obviously\n
|
||||
*
|
||||
*
|
||||
************************************/
|
||||
class RsGeneralExchangeService {
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* get the RsGeneralDataService instance serving this \n
|
||||
* RsGeneralExchangeService
|
||||
* @return data service
|
||||
*/
|
||||
virtual RsGeneralDataService* getDataService() = 0;
|
||||
|
||||
/*!
|
||||
* get the RsNetworktExchangeService instance serving this \n
|
||||
* RsGeneralExchangeService
|
||||
* @return network exchange service
|
||||
*/
|
||||
virtual RsNetworktExchangeService* getNetworkService() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include "rssqlite.h"
|
||||
|
||||
RsSqlite::RsSqlite()
|
||||
{
|
||||
}
|
@ -7,10 +7,10 @@
|
||||
#include <set>
|
||||
|
||||
/*!
|
||||
* The idea of RsDb is to provide a means for Retroshare core and
|
||||
* its services itself to maintain easy to use random access files via a database
|
||||
* Especially for messages, rather than all data to memory
|
||||
* It models itself after android's sqlite functionality
|
||||
* The idea of RsDb is to provide a means for Retroshare core and \n
|
||||
* its services to maintain an easy to use random access files via a database \n
|
||||
* Especially for messages, rather than all data to memory \n
|
||||
* It models itself after android's sqlite functionality \n
|
||||
*/
|
||||
class RetroDb
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user