From a89c6fd08a92643276c3ebced80fce053a38f441 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Thu, 19 Jan 2012 23:32:27 +0000 Subject: [PATCH] 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 --- libretroshare/src/gxs/rsgdp.cpp | 5 --- libretroshare/src/gxs/rsgdp.h | 26 +++++++---- libretroshare/src/gxs/rsgixs.cpp | 5 --- libretroshare/src/gxs/rsgixs.h | 32 ++++++++------ libretroshare/src/gxs/rsgnp.cpp | 5 --- libretroshare/src/gxs/rsgnp.h | 50 ++++++++++++++++++---- libretroshare/src/gxs/rsgxs.cpp | 5 --- libretroshare/src/gxs/rsgxs.h | 69 +++++++++++++++++++++++++----- libretroshare/src/util/retrodb.cpp | 5 --- libretroshare/src/util/retrodb.h | 8 ++-- 10 files changed, 140 insertions(+), 70 deletions(-) delete mode 100644 libretroshare/src/gxs/rsgdp.cpp delete mode 100644 libretroshare/src/gxs/rsgixs.cpp delete mode 100644 libretroshare/src/gxs/rsgnp.cpp delete mode 100644 libretroshare/src/gxs/rsgxs.cpp delete mode 100644 libretroshare/src/util/retrodb.cpp diff --git a/libretroshare/src/gxs/rsgdp.cpp b/libretroshare/src/gxs/rsgdp.cpp deleted file mode 100644 index 8bebc85bd..000000000 --- a/libretroshare/src/gxs/rsgdp.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "rsgdp.h" - -RsGdp::RsGdp() -{ -} diff --git a/libretroshare/src/gxs/rsgdp.h b/libretroshare/src/gxs/rsgdp.h index de51eb5fc..0c4579f3b 100644 --- a/libretroshare/src/gxs/rsgdp.h +++ b/libretroshare/src/gxs/rsgdp.h @@ -31,19 +31,24 @@ #include #include "inttypes.h" -#include "gxs/rsgxs.h" +#include "rsgnp.h" typedef std::map > MsgGrpId; typedef std::map > 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 { diff --git a/libretroshare/src/gxs/rsgixs.cpp b/libretroshare/src/gxs/rsgixs.cpp deleted file mode 100644 index c03d23903..000000000 --- a/libretroshare/src/gxs/rsgixs.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "rsgixs.h" - -RsGixs::RsGixs() -{ -} diff --git a/libretroshare/src/gxs/rsgixs.h b/libretroshare/src/gxs/rsgixs.h index d2788c8b3..b4b739033 100644 --- a/libretroshare/src/gxs/rsgixs.h +++ b/libretroshare/src/gxs/rsgixs.h @@ -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; }; diff --git a/libretroshare/src/gxs/rsgnp.cpp b/libretroshare/src/gxs/rsgnp.cpp deleted file mode 100644 index dc4ab034d..000000000 --- a/libretroshare/src/gxs/rsgnp.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "rsgnp.h" - -RsGnp::RsGnp() -{ -} diff --git a/libretroshare/src/gxs/rsgnp.h b/libretroshare/src/gxs/rsgnp.h index c095c0d20..df6364121 100644 --- a/libretroshare/src/gxs/rsgnp.h +++ b/libretroshare/src/gxs/rsgnp.h @@ -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 > 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 diff --git a/libretroshare/src/gxs/rsgxs.cpp b/libretroshare/src/gxs/rsgxs.cpp deleted file mode 100644 index e3e2a65ea..000000000 --- a/libretroshare/src/gxs/rsgxs.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "rsgxs.h" - -RsGxs::RsGxs() -{ -} diff --git a/libretroshare/src/gxs/rsgxs.h b/libretroshare/src/gxs/rsgxs.h index d6e300d0b..9749e7b6b 100644 --- a/libretroshare/src/gxs/rsgxs.h +++ b/libretroshare/src/gxs/rsgxs.h @@ -34,18 +34,65 @@ #include #include -/*! - * 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; }; diff --git a/libretroshare/src/util/retrodb.cpp b/libretroshare/src/util/retrodb.cpp deleted file mode 100644 index 75bb6632a..000000000 --- a/libretroshare/src/util/retrodb.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "rssqlite.h" - -RsSqlite::RsSqlite() -{ -} diff --git a/libretroshare/src/util/retrodb.h b/libretroshare/src/util/retrodb.h index f35c479d7..9a3e8f153 100644 --- a/libretroshare/src/util/retrodb.h +++ b/libretroshare/src/util/retrodb.h @@ -7,10 +7,10 @@ #include /*! - * 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 {