mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-15 10:00:51 -04:00
Made p3identity compile. (but won't run yet!)
- Lots of tweaks to rsidentity & rsgixs interfaces to make them match. - added "mask" to gxs flag set operations. - added dummy RsMsgMetaData print functions. - enable compilation of code in .pro. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5702 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
02f8d27b6e
commit
57a99d1aa3
13 changed files with 341 additions and 234 deletions
|
@ -441,8 +441,9 @@ void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
|
|||
mMsgsToPublish.insert(std::make_pair(token, msgItem));
|
||||
}
|
||||
|
||||
void RsGenExchange::setGroupSubscribeFlag(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& flag)
|
||||
void RsGenExchange::setGroupSubscribeFlags(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& flag, const uint32_t& mask)
|
||||
{
|
||||
/* TODO APPLY MASK TO FLAGS */
|
||||
RsStackMutex stack(mGenMtx);
|
||||
token = mDataAccess->generatePublicToken();
|
||||
|
||||
|
@ -452,8 +453,9 @@ void RsGenExchange::setGroupSubscribeFlag(uint32_t& token, const RsGxsGroupId& g
|
|||
mGrpLocMetaMap.insert(std::make_pair(token, g));
|
||||
}
|
||||
|
||||
void RsGenExchange::setGroupStatusFlag(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status)
|
||||
void RsGenExchange::setGroupStatusFlags(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status, const uint32_t& mask)
|
||||
{
|
||||
/* TODO APPLY MASK TO FLAGS */
|
||||
RsStackMutex stack(mGenMtx);
|
||||
token = mDataAccess->generatePublicToken();
|
||||
|
||||
|
@ -475,8 +477,9 @@ void RsGenExchange::setGroupServiceString(uint32_t& token, const RsGxsGroupId& g
|
|||
mGrpLocMetaMap.insert(std::make_pair(token, g));
|
||||
}
|
||||
|
||||
void RsGenExchange::setMsgStatusFlag(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const uint32_t& status)
|
||||
void RsGenExchange::setMsgStatusFlags(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const uint32_t& status, const uint32_t& mask)
|
||||
{
|
||||
/* TODO APPLY MASK TO FLAGS */
|
||||
RsStackMutex stack(mGenMtx);
|
||||
token = mDataAccess->generatePublicToken();
|
||||
|
||||
|
|
|
@ -257,13 +257,13 @@ public:
|
|||
* @param token this is set to token value associated to this request
|
||||
* @param
|
||||
*/
|
||||
void setGroupSubscribeFlag(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status);
|
||||
void setGroupSubscribeFlags(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status, const uint32_t& mask);
|
||||
|
||||
void setGroupStatusFlag(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status);
|
||||
void setGroupStatusFlags(uint32_t& token, const RsGxsGroupId& grpId, const uint32_t& status, const uint32_t& mask);
|
||||
|
||||
void setGroupServiceString(uint32_t& token, const RsGxsGroupId& grpId, const std::string& servString);
|
||||
|
||||
void setMsgStatusFlag(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const uint32_t& status);
|
||||
void setMsgStatusFlags(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const uint32_t& status, const uint32_t& mask);
|
||||
|
||||
void setMsgServiceString(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, const std::string& servString );
|
||||
|
||||
|
|
|
@ -27,9 +27,12 @@
|
|||
*/
|
||||
|
||||
#include "gxs/rsgxs.h"
|
||||
#include "gxs/rsgenexchange.h"
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <set>
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
//#include <openssl/ssl.h>
|
||||
//#include <set>
|
||||
|
||||
/*!
|
||||
* GIXP: General Identity Exchange Service.
|
||||
|
@ -94,25 +97,27 @@
|
|||
* as these will be used very frequently.
|
||||
*****/
|
||||
|
||||
typedef std::string GxsId;
|
||||
//typedef std::string GxsId;
|
||||
|
||||
typedef std::string PeerId;
|
||||
|
||||
// External Interface -
|
||||
class RsIdentityService
|
||||
{
|
||||
enum IdentityType { Pseudonym, Signed, Anonymous };
|
||||
|
||||
virtual bool loadId(const GxsId &id) = 0;
|
||||
|
||||
virtual bool getNickname(const GxsId &id, std::string &nickname) = 0;
|
||||
|
||||
virtual bool createKey(RsGixsProfile& profile, uint32_t type) = 0; /* fills in mKeyId, and signature */
|
||||
|
||||
virtual RsGixsProfile* getProfile(const KeyRef& keyref) = 0;
|
||||
|
||||
// modify reputation.
|
||||
|
||||
};
|
||||
//
|
||||
//// External Interface -
|
||||
//class RsIdentityService
|
||||
//{
|
||||
// enum IdentityType { Pseudonym, Signed, Anonymous };
|
||||
//
|
||||
// virtual bool loadId(const GxsId &id) = 0;
|
||||
//
|
||||
// virtual bool getNickname(const GxsId &id, std::string &nickname) = 0;
|
||||
//
|
||||
// virtual bool createKey(RsGixsProfile& profile, uint32_t type) = 0; /* fills in mKeyId, and signature */
|
||||
//
|
||||
// virtual RsGixsProfile* getProfile(const KeyRef& keyref) = 0;
|
||||
//
|
||||
// // modify reputation.
|
||||
//
|
||||
//};
|
||||
|
||||
|
||||
/* Identity Interface for GXS Message Verification.
|
||||
|
@ -127,14 +132,14 @@ public:
|
|||
* @param keyref the keyref of key that is being checked for
|
||||
* @return true if available, false otherwise
|
||||
*/
|
||||
virtual bool haveKey(const GxsId &id) = 0;
|
||||
virtual bool haveKey(const RsGxsId &id) = 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
|
||||
*/
|
||||
virtual bool havePrivateKey(const GxsId &id) = 0;
|
||||
virtual bool havePrivateKey(const RsGxsId &id) = 0;
|
||||
|
||||
// The fetchKey has an optional peerList.. this is people that had the msg with the signature.
|
||||
// These same people should have the identity - so we ask them first.
|
||||
|
@ -143,7 +148,7 @@ public:
|
|||
* @param keyref the KeyRef of the key being requested
|
||||
* @return will
|
||||
*/
|
||||
virtual bool requestKey(const GxsId &id, const std::list<PeerId> &peers) = 0;
|
||||
virtual bool requestKey(const RsGxsId &id, const std::list<PeerId> &peers) = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves a key identity
|
||||
|
@ -151,18 +156,25 @@ public:
|
|||
* @return a pointer to a valid profile if successful, otherwise NULL
|
||||
*
|
||||
*/
|
||||
virtual int getKey(const GxsId &id, TlvSecurityKey &key) = 0;
|
||||
virtual int getPrivateKey(const GxsId &id, TlvSecurityKey &key) = 0; // For signing outgoing messages.
|
||||
virtual int getKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0;
|
||||
virtual int getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key) = 0; // For signing outgoing messages.
|
||||
|
||||
|
||||
};
|
||||
|
||||
class GixsReputation
|
||||
{
|
||||
public:
|
||||
RsGxsId id;
|
||||
int score;
|
||||
};
|
||||
|
||||
|
||||
class RsGixsReputation
|
||||
{
|
||||
public:
|
||||
// get Reputation.
|
||||
virtual bool getReputation(const GxsId &id, const GixsReputation &rep) = 0;
|
||||
virtual bool getReputation(const RsGxsId &id, const GixsReputation &rep) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,7 +183,8 @@ public:
|
|||
class RsGxsIdExchange: public RsGenExchange, public RsGixsReputation, public RsGixs
|
||||
{
|
||||
public:
|
||||
RsGxsIdExchange() { return; }
|
||||
RsGxsIdExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType)
|
||||
:RsGenExchange(gds,ns,serviceSerialiser,mServType) { return; }
|
||||
virtual ~RsGxsIdExchange() { return; }
|
||||
|
||||
};
|
||||
|
|
|
@ -138,9 +138,9 @@ bool RsGxsIfaceImpl::getMsgSummary(const uint32_t &token,
|
|||
bool RsGxsIfaceImpl::subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe)
|
||||
{
|
||||
if(subscribe)
|
||||
mGxs->setGroupSubscribeFlag(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
|
||||
mGxs->setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
||||
else
|
||||
mGxs->setGroupSubscribeFlag(token, grpId, ~GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
||||
mGxs->setGroupSubscribeFlags(token, grpId, 0, GXS_SERV::GROUP_SUBSCRIBE_MASK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue