Got group retrieval working with gui and fixed subsequent bugs

add p3distribsecurity mirror gxssecurity (does not have grp or msg verification implemented, but other methods are valid)


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5406 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-08-12 20:46:21 +00:00
parent 148d1310a2
commit acaefada65
12 changed files with 1166 additions and 762 deletions

View File

@ -0,0 +1,280 @@
/*
* libretroshare/src/distrib: p3distribverify.cc
*
*
* Copyright 2008-2010 by Robert Fernie
* 2011 Christopher Evi-Parker
*
* 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 "retroshare@lunamutt.com".
*
*/
#include "gxssecurity.h"
#include "pqi/authgpg.h"
#include "retroshare/rspeers.h"
GxsSecurity::GxsSecurity()
{
}
GxsSecurity::~GxsSecurity()
{
}
RSA *GxsSecurity::extractPublicKey(RsTlvSecurityKey& key)
{
const unsigned char *keyptr = (const unsigned char *) key.keyData.bin_data;
long keylen = key.keyData.bin_len;
/* extract admin key */
RSA *rsakey = d2i_RSAPublicKey(NULL, &(keyptr), keylen);
return rsakey;
}
bool GxsSecurity::validateNxsMsg(RsNxsMsg *msg)
{
return false;
}
std::string GxsSecurity::getBinDataSign(void *data, int len)
{
unsigned char *tmp = (unsigned char *) data;
// copy first CERTSIGNLEN bytes...
if (len > CERTSIGNLEN)
{
len = CERTSIGNLEN;
}
std::string id;
for(uint32_t i = 0; i < CERTSIGNLEN; i++)
{
rs_sprintf_append(id, "%02x", (uint16_t) (((uint8_t *) (tmp))[i]));
}
return id;
}
bool GxsSecurity::encrypt(void *& out, int & outlen, const void *in, int inlen, EVP_PKEY *privateKey)
{
#ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity::encrypt() " << std::endl;
#endif
RSA *rsa_publish_pub = NULL;
EVP_PKEY *public_key = NULL;
RSA* rsa_publish = EVP_PKEY_get1_RSA(privateKey);
rsa_publish_pub = RSAPublicKey_dup(rsa_publish);
if(rsa_publish_pub != NULL){
public_key = EVP_PKEY_new();
EVP_PKEY_assign_RSA(public_key, rsa_publish_pub);
}else{
#ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity(): Could not generate publish key " << grpId
<< std::endl;
#endif
return false;
}
EVP_CIPHER_CTX ctx;
int eklen, net_ekl;
unsigned char *ek;
unsigned char iv[EVP_MAX_IV_LENGTH];
EVP_CIPHER_CTX_init(&ctx);
int out_currOffset = 0;
int out_offset = 0;
int max_evp_key_size = EVP_PKEY_size(public_key);
ek = (unsigned char*)malloc(max_evp_key_size);
const EVP_CIPHER *cipher = EVP_aes_128_cbc();
int cipher_block_size = EVP_CIPHER_block_size(cipher);
int size_net_ekl = sizeof(net_ekl);
int max_outlen = inlen + cipher_block_size + EVP_MAX_IV_LENGTH + max_evp_key_size + size_net_ekl;
// intialize context and send store encrypted cipher in ek
if(!EVP_SealInit(&ctx, EVP_aes_128_cbc(), &ek, &eklen, iv, &public_key, 1)) return false;
// now assign memory to out accounting for data, and cipher block size, key length, and key length val
out = new unsigned char[inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH];
net_ekl = htonl(eklen);
memcpy((unsigned char*)out + out_offset, &net_ekl, size_net_ekl);
out_offset += size_net_ekl;
memcpy((unsigned char*)out + out_offset, ek, eklen);
out_offset += eklen;
memcpy((unsigned char*)out + out_offset, iv, EVP_MAX_IV_LENGTH);
out_offset += EVP_MAX_IV_LENGTH;
// now encrypt actual data
if(!EVP_SealUpdate(&ctx, (unsigned char*) out + out_offset, &out_currOffset, (unsigned char*) in, inlen)) return false;
// move along to partial block space
out_offset += out_currOffset;
// add padding
if(!EVP_SealFinal(&ctx, (unsigned char*) out + out_offset, &out_currOffset)) return false;
// move to end
out_offset += out_currOffset;
// make sure offset has not gone passed valid memory bounds
if(out_offset > max_outlen) return false;
// free encrypted key data
free(ek);
outlen = out_offset;
return true;
delete[] ek;
#ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity::encrypt() finished with outlen : " << outlen << std::endl;
#endif
return true;
}
bool GxsSecurity::decrypt(void *& out, int & outlen, const void *in, int inlen, EVP_PKEY *privateKey)
{
#ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity::decrypt() " << std::endl;
#endif
EVP_CIPHER_CTX ctx;
int eklen = 0, net_ekl = 0;
unsigned char *ek = NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
ek = (unsigned char*)malloc(EVP_PKEY_size(privateKey));
EVP_CIPHER_CTX_init(&ctx);
int in_offset = 0, out_currOffset = 0;
int size_net_ekl = sizeof(net_ekl);
memcpy(&net_ekl, (unsigned char*)in, size_net_ekl);
eklen = ntohl(net_ekl);
in_offset += size_net_ekl;
memcpy(ek, (unsigned char*)in + in_offset, eklen);
in_offset += eklen;
memcpy(iv, (unsigned char*)in + in_offset, EVP_MAX_IV_LENGTH);
in_offset += EVP_MAX_IV_LENGTH;
const EVP_CIPHER* cipher = EVP_aes_128_cbc();
if(!EVP_OpenInit(&ctx, cipher, ek, eklen, iv, privateKey)) return false;
out = new unsigned char[inlen - in_offset];
if(!EVP_OpenUpdate(&ctx, (unsigned char*) out, &out_currOffset, (unsigned char*)in + in_offset, inlen - in_offset)) return false;
in_offset += out_currOffset;
outlen += out_currOffset;
if(!EVP_OpenFinal(&ctx, (unsigned char*)out + out_currOffset, &out_currOffset)) return false;
outlen += out_currOffset;
free(ek);
return true;
}
std::string GxsSecurity::getRsaKeySign(RSA *pubkey)
{
int len = BN_num_bytes(pubkey -> n);
unsigned char tmp[len];
BN_bn2bin(pubkey -> n, tmp);
// copy first CERTSIGNLEN bytes...
if (len > CERTSIGNLEN)
{
len = CERTSIGNLEN;
}
std::string id;
for(uint32_t i = 0; i < CERTSIGNLEN; i++)
{
rs_sprintf_append(id, "%02x", (uint16_t) (((uint8_t *) (tmp))[i]));
}
return id;
}
bool GxsSecurity::validateNxsGrp(RsNxsGrp *newGrp)
{
}
void GxsSecurity::setRSAPublicKey(RsTlvSecurityKey & key, RSA *rsa_pub)
{
unsigned char data[10240]; /* more than enough space */
unsigned char *ptr = data;
int reqspace = i2d_RSAPublicKey(rsa_pub, &ptr);
key.keyData.setBinData(data, reqspace);
std::string keyId = getRsaKeySign(rsa_pub);
key.keyId = keyId;
}
void GxsSecurity::setRSAPrivateKey(RsTlvSecurityKey & key, RSA *rsa_priv)
{
unsigned char data[10240]; /* more than enough space */
unsigned char *ptr = data;
int reqspace = i2d_RSAPrivateKey(rsa_priv, &ptr);
key.keyData.setBinData(data, reqspace);
std::string keyId = getRsaKeySign(rsa_priv);
key.keyId = keyId;
}
RSA *GxsSecurity::extractPrivateKey(RsTlvSecurityKey & key)
{
const unsigned char *keyptr = (const unsigned char *) key.keyData.bin_data;
long keylen = key.keyData.bin_len;
/* extract admin key */
RSA *rsakey = d2i_RSAPrivateKey(NULL, &(keyptr), keylen);
return rsakey;
}

View File

@ -0,0 +1,132 @@
#ifndef GXSSECURITY_H
#define GXSSECURITY_H
/*
* libretroshare/src/gxs: gxssecurity
*
* Security functions for Gxs
*
* Copyright 2008-2010 by Robert Fernie
* 2012 Christopher Evi-Parker
*
* 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 "retroshare@lunamutt.com".
*
*/
#include "serialiser/rstlvkeys.h"
#include "serialiser/rsnxsitems.h"
#include <openssl/ssl.h>
#include <openssl/evp.h>
/*!
* This contains functionality for performing security
* operations needed to validate data received in RsGenExchange
* Also has routine for creating security objects around msgs and groups
*/
class GxsSecurity {
public:
GxsSecurity();
~GxsSecurity();
/*!
* extracts the public key from an RsTlvSecurityKey
* @param key RsTlvSecurityKey to extract public RSA key from
* @return pointer to the public RSA key if successful, null otherwise
*/
static RSA *extractPublicKey(RsTlvSecurityKey &key);
/*!
* extracts the public key from an RsTlvSecurityKey
* @param key RsTlvSecurityKey to extract private RSA key from
* @return pointer to the private RSA key if successful, null otherwise
*/
static RSA *extractPrivateKey(RsTlvSecurityKey &key);
/*!
* stores the rsa public key in a RsTlvSecurityKey
* @param key RsTlvSecurityKey to store the public rsa key in
* @param rsa_pub
*/
static void setRSAPublicKey(RsTlvSecurityKey &key, RSA *rsa_pub);
/*!
* stores the rsa private key in a RsTlvSecurityKey
* @param key stores the rsa private key in a RsTlvSecurityKey
* @param rsa_priv the rsa private key to store
*/
static void setRSAPrivateKey(RsTlvSecurityKey &key, RSA *rsa_priv);
/*!
* extracts signature from RSA key
* @param pubkey
* @return signature of RSA key in hex format
*/
static std::string getRsaKeySign(RSA *pubkey);
/*!
* extracts the signature and stores it in a string
* in hex format
* @param data
* @param len
* @return
*/
static std::string getBinDataSign(void *data, int len);
/*!
* Encrypts data using envelope encryption (taken from open ssl's evp_sealinit )
* only full publish key holders can encrypt data for given group
*@param out
*@param outlen
*@param in
*@param inlen
*/
static bool encrypt(void *&out, int &outlen, const void *in, int inlen, EVP_PKEY *privateKey);
/**
* Decrypts data using evelope decryption (taken from open ssl's evp_sealinit )
* only full publish key holders can decrypt data for a group
* @param out where decrypted data is written to
* @param outlen
* @param in
* @param inlen
* @return false if encryption failed
*/
static bool decrypt(void *&out, int &outlen, const void *in, int inlen, EVP_PKEY *privateKey);
/*!
* uses grp signature to check if group has been
* tampered with
* @param newGrp
* @return true if group valid false otherwise
*/
static bool validateNxsGrp(RsNxsGrp *newGrp);
/*!
* uses groupinfo public key to verify signature of signed message
* @param info groupinfo for which msg is meant for
* @param msg
* @return false if verfication of signature is not passed
*/
static bool validateNxsMsg(RsNxsMsg *msg);
};
#endif // GXSSECURITY_H

View File

@ -24,7 +24,13 @@
*
*/
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include "rsgenexchange.h"
#include "gxssecurity.h"
RsGenExchange::RsGenExchange(RsGeneralDataService *gds,
RsNetworkExchangeService *ns, RsSerialType *serviceSerialiser, uint16_t servType)
@ -62,6 +68,30 @@ void RsGenExchange::tick()
}
void RsGenExchange::createGroup(RsNxsGrp *grp)
{
/* create Keys */
RSA *rsa_admin = RSA_generate_key(2048, 65537, NULL, NULL);
RSA *rsa_admin_pub = RSAPublicKey_dup(rsa_admin);
/* set keys */
RsTlvSecurityKey adminKey;
GxsSecurity::setRSAPublicKey(adminKey, rsa_admin_pub);
adminKey.startTS = time(NULL);
adminKey.endTS = 0; /* no end */
RsGxsGrpMetaData* meta = grp->metaData;
meta->keys.keys[adminKey.keyId] = adminKey;
meta->mGroupId = adminKey.keyId;
grp->grpId = meta->mGroupId;
adminKey.TlvClear();
// free the private key for now, as it is not in use
RSA_free(rsa_admin);
}
bool RsGenExchange::getGroupList(const uint32_t &token, std::list<RsGxsGroupId> &groupIds)
{
@ -125,7 +155,7 @@ bool RsGenExchange::getMsgMeta(const uint32_t &token,
return ok;
}
bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem *> grpItem)
bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem *>& grpItem)
{
std::list<RsNxsGrp*> nxsGrps;
@ -294,13 +324,16 @@ void RsGenExchange::publishGrps()
char gData[size];
bool ok = mSerialiser->serialise(grpItem, gData, &size);
grp->grp.setBinData(gData, size);
if(ok)
{
grp->metaData = new RsGxsGrpMetaData();
*(grp->metaData) = grpItem->meta;
createGroup(grp);
ok = mDataAccess->addGroupData(grp);
RsGxsGroupChange* gc = new RsGxsGroupChange();
gc->grpIdList.push_back(grp->grpId);
mNotifications.push_back(gc);
}

View File

@ -143,7 +143,7 @@ protected:
* @param token token to be redeemed for grpitem retrieval
* @param grpItem the items to be retrieved for token are stored here
*/
bool getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem*> grpItem);
bool getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem*>& grpItem);
/*!
* retrieves message data associated to a request token
@ -193,9 +193,7 @@ protected:
virtual void notifyChanges(std::vector<RsGxsNotify*>& changes) = 0;
void publishGrps();
void publishMsgs();
private:
@ -205,6 +203,12 @@ private:
void processRecvdGroups();
void publishGrps();
void publishMsgs();
void createGroup(RsNxsGrp* grp);
private:
RsMutex mGenMtx;

View File

@ -57,7 +57,7 @@
const uint8_t RsTokenServiceV2::GXS_REQUEST_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED.
RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
: mDataStore(ds), mDataMutex("RsGxsDataAccess")
: mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0)
{
}
@ -217,6 +217,7 @@ void RsGxsDataAccess::storeRequest(GxsRequest* req)
{
RsStackMutex stack(mDataMutex); /****** LOCKED *****/
req->status = GXS_REQUEST_STATUS_PENDING;
mRequests[req->token] = req;
return;
@ -263,20 +264,22 @@ bool RsGxsDataAccess::clearRequest(const uint32_t& token)
bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<RsGxsGrpMetaData*>& groupInfo)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getGroupSummary() Unable to retrieve group summary" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
GroupMetaReq* gmreq = dynamic_cast<GroupMetaReq*>(req);
if(gmreq)
{
groupInfo = gmreq->mGroupMetaData;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getGroupSummary() Req found, failed caste" << std::endl;
return false;
@ -291,21 +294,22 @@ bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<RsGxsGrpM
bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list<RsNxsGrp*>& grpData)
{
RsStackMutex stack(mDataMutex);
GxsRequest* req = retrieveRequest(token);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getGroupData() Unable to retrieve group data" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
GroupDataReq* gmreq = dynamic_cast<GroupDataReq*>(req);
if(gmreq)
{
grpData = gmreq->mGroupData;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getGroupData() Req found, failed caste" << std::endl;
return false;
@ -320,20 +324,23 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list<RsNxsGrp*>&
bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgData)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getMsgData() Unable to retrieve group data" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
MsgDataReq* mdreq = dynamic_cast<MsgDataReq*>(req);
if(mdreq)
{
msgData = mdreq->mMsgData;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getMsgData() Req found, failed caste" << std::endl;
return false;
@ -348,20 +355,23 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat
bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msgInfo)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getMsgSummary() Unable to retrieve group data" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
MsgMetaReq* mmreq = dynamic_cast<MsgMetaReq*>(req);
if(mmreq)
{
msgInfo = mmreq->mMsgMetaData;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getMsgSummary() Req found, failed caste" << std::endl;
@ -377,20 +387,22 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg
bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getMsgList() Unable to retrieve group data" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
MsgIdReq* mireq = dynamic_cast<MsgIdReq*>(req);
if(mireq)
{
msgIds = mireq->mMsgIdResult;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getMsgList() Req found, failed caste" << std::endl;
@ -406,21 +418,23 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::list<RsGxsGroupId>& groupIds)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL){
std::cerr << "RsGxsDataAccess::getGroupList() Unable to retrieve group data,"
"\nRequest does not exist" << std::endl;
return false;
}else if(req->token == GXS_REQUEST_STATUS_COMPLETE){
}else if(req->status == GXS_REQUEST_STATUS_COMPLETE){
GroupIdReq* gireq = dynamic_cast<GroupIdReq*>(req);
if(gireq)
{
groupIds = gireq->mGroupIdResult;
updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
locked_updateRequestStatus(token, GXS_REQUEST_STATUS_DONE);
}else{
std::cerr << "RsGxsDataAccess::getGroupList() Req found, failed caste" << std::endl;
@ -435,11 +449,9 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::list<RsGxsGroupId
}
GxsRequest* RsGxsDataAccess::retrieveRequest(const uint32_t& token)
GxsRequest* RsGxsDataAccess::locked_retrieveRequest(const uint32_t& token)
{
RsStackMutex stack(mDataMutex);
if(mRequests.find(token) == mRequests.end()) return NULL;
GxsRequest* req = mRequests[token];
@ -528,7 +540,7 @@ void RsGxsDataAccess::processRequests()
std::cerr << std::endl;
toClear.push_back(req->token);
}
else if (now - req->reqTime > MAX_REQUEST_AGE)
else if (false/*now - req->reqTime > MAX_REQUEST_AGE*/)
{
std::cerr << "RsGxsDataAccess::processrequests() Clearing Old Request Token: " << req->token;
std::cerr << std::endl;
@ -551,13 +563,13 @@ bool RsGxsDataAccess::getGroupData(GroupDataReq* req)
{
std::map<RsGxsGroupId, RsNxsGrp*> grpData;
mDataStore->retrieveNxsGrps(grpData, true, true);
bool ok = mDataStore->retrieveNxsGrps(grpData, true, true);
std::map<RsGxsGroupId, RsNxsGrp*>::iterator mit = grpData.begin();
for(; mit != grpData.end(); mit++)
req->mGroupData.push_back(mit->second);
return true;
return ok;
}
bool RsGxsDataAccess::getGroupSummary(GroupMetaReq* req)
@ -862,11 +874,11 @@ bool RsGxsDataAccess::checkRequestStatus(const uint32_t& token,
uint32_t& status, uint32_t& reqtype, uint32_t& anstype, time_t& ts)
{
GxsRequest* req = retrieveRequest(token);
RsStackMutex stack(mDataMutex);
if(!req)
GxsRequest* req = locked_retrieveRequest(token);
if(req == NULL)
return false;
anstype = req->ansType;
@ -911,12 +923,10 @@ void RsGxsDataAccess::tokenList(std::list<uint32_t>& tokens) {
}
}
bool RsGxsDataAccess::updateRequestStatus(const uint32_t& token,
bool RsGxsDataAccess::locked_updateRequestStatus(const uint32_t& token,
const uint32_t& status) {
RsStackMutex stack(mDataMutex);
GxsRequest* req = retrieveRequest(token);
GxsRequest* req = locked_retrieveRequest(token);
if(req)
req->status = status;

View File

@ -191,7 +191,7 @@ private:
* @param token the value of the token for the request object handle wanted
* @return the request associated to this token
*/
GxsRequest* retrieveRequest(const uint32_t& token);
GxsRequest* locked_retrieveRequest(const uint32_t& token);
/*!
* Add a gxs request to queue
@ -222,7 +222,7 @@ private:
* @param status the status to set
* @return
*/
bool updateRequestStatus(const uint32_t &token, const uint32_t &status);
bool locked_updateRequestStatus(const uint32_t &token, const uint32_t &status);
/*!
* Use to query the status and other values of a given token

View File

@ -1,10 +1,11 @@
TEMPLATE = lib
#CONFIG += staticlib release
#CONFIG += staticlib testnetwork
CONFIG += staticlib bitdht
# CONFIG += staticlib release
# CONFIG += staticlib testnetwork
CONFIG += staticlib \
bitdht
CONFIG -= qt
TARGET = retroshare
CONFIG += test_voip
# GXS Stuff.
@ -13,22 +14,21 @@ CONFIG += newservices
# Beware: All data of the stripped services are lost
DEFINES *= PQI_DISABLE_TUNNEL
#ENABLE_CACHE_OPT
# ENABLE_CACHE_OPT
profiling {
QMAKE_CXXFLAGS -= -fomit-frame-pointer
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
}
release {
# UDP and TUNNEL dont work anymore.
#DEFINES *= PQI_DISABLE_UDP
QMAKE_CXXFLAGS *= -pg \
-g \
-fno-omit-frame-pointer
}
release:
# UDP and TUNNEL dont work anymore.
# DEFINES *= PQI_DISABLE_UDP
# treat warnings as error for better removing
#QMAKE_CFLAGS += -Werror
#QMAKE_CXXFLAGS += -Werror
# QMAKE_CFLAGS += -Werror
# QMAKE_CXXFLAGS += -Werror
testnetwork {
# used in rsserver/rsinit.cc Enabled Port Restrictions, and makes Proxy Port next to Dht Port.
DEFINES *= LOCALNET_TESTING
@ -45,98 +45,77 @@ testnetwork {
# used in dht/connectstatebox to reduce connection times and display debug.
# DEFINES *= TESTING_PERIODS
# DEFINES *= DEBUG_CONNECTBOX
QMAKE_CXXFLAGS -= -fomit-frame-pointer
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
QMAKE_CXXFLAGS *= -g \
-fno-omit-frame-pointer
}
CONFIG += debug
debug {
# DEFINES *= DEBUG
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
# DEFINES *= CONTROL_DEBUG FT_DEBUG DEBUG_FTCHUNK P3TURTLE_DEBUG
# DEFINES *= P3TURTLE_DEBUG
# DEFINES *= NET_DEBUG
# DEFINES *= DISTRIB_DEBUG
# DEFINES *= P3TURTLE_DEBUG FT_DEBUG DEBUG_FTCHUNK MPLEX_DEBUG
# DEFINES *= STATUS_DEBUG SERV_DEBUG RSSERIAL_DEBUG #CONN_DEBUG
QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
# DEFINES *= DEBUG
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
# DEFINES *= CONTROL_DEBUG FT_DEBUG DEBUG_FTCHUNK P3TURTLE_DEBUG
# DEFINES *= P3TURTLE_DEBUG
# DEFINES *= NET_DEBUG
# DEFINES *= DISTRIB_DEBUG
# DEFINES *= P3TURTLE_DEBUG FT_DEBUG DEBUG_FTCHUNK MPLEX_DEBUG
# DEFINES *= STATUS_DEBUG SERV_DEBUG RSSERIAL_DEBUG #CONN_DEBUG
QMAKE_CXXFLAGS -= -O2 \
-fomit-frame-pointer
QMAKE_CXXFLAGS *= -g \
-fno-omit-frame-pointer
}
bitdht {
HEADERS += dht/p3bitdht.h \
HEADERS += dht/p3bitdht.h \
dht/connectstatebox.h \
dht/stunaddrassist.h
SOURCES += dht/p3bitdht.cc \
SOURCES += dht/p3bitdht.cc \
dht/p3bitdht_interface.cc \
dht/p3bitdht_peers.cc \
dht/p3bitdht_peernet.cc \
dht/p3bitdht_relay.cc \
dht/connectstatebox.cc
HEADERS += tcponudp/udppeer.h \
HEADERS += tcponudp/udppeer.h \
tcponudp/bio_tou.h \
tcponudp/tcppacket.h \
tcponudp/tcpstream.h \
tcponudp/tou.h \
tcponudp/udpstunner.h \
tcponudp/udprelay.h \
SOURCES += tcponudp/udppeer.cc \
tcponudp/udprelay.h
SOURCES += tcponudp/udppeer.cc \
tcponudp/tcppacket.cc \
tcponudp/tcpstream.cc \
tcponudp/tou.cc \
tcponudp/bss_tou.c \
tcponudp/udpstunner.cc \
tcponudp/udprelay.cc \
# These two aren't actually used (and don't compile) ....
# but could be useful later
#
# tcponudp/udpstunner.h \
# tcponudp/udpstunner.cc \
#
tcponudp/udprelay.cc
# These two aren't actually used (and don't compile) ....
# but could be useful later
# tcponudp/udpstunner.h \
# tcponudp/udpstunner.cc \
BITDHT_DIR = ../../libbitdht/src
INCLUDEPATH += . $${BITDHT_DIR}
INCLUDEPATH += . \
$${BITDHT_DIR}
# The next line if for compliance with debian packages. Keep it!
INCLUDEPATH += ../libbitdht
DEFINES *= RS_USE_BITDHT
}
test_bitdht {
# DISABLE TCP CONNECTIONS...
DEFINES *= P3CONNMGR_NO_TCP_CONNECTIONS
# NO AUTO CONNECTIONS??? FOR TESTING DHT STATUS.
DEFINES *= P3CONNMGR_NO_AUTO_CONNECTION
# ENABLED UDP NOW.
}
# ENABLED UDP NOW.
use_blogs {
HEADERS += services/p3blogs.h
SOURCES += services/p3blogs.cc
DEFINES *= RS_USE_BLOGS
}
PUBLIC_HEADERS = retroshare/rsblogs.h \
retroshare/rschannels.h \
retroshare/rsdisc.h \
@ -159,51 +138,49 @@ PUBLIC_HEADERS = retroshare/rsblogs.h \
retroshare/rsdht.h \
retroshare/rsdsdv.h \
retroshare/rsconfig.h
HEADERS += plugins/pluginmanager.h \
plugins/dlfcn_win32.h \
serialiser/rspluginitems.h
HEADERS += $$PUBLIC_HEADERS
# public headers to be...
HEADERS += retroshare/rsgame.h \
retroshare/rsphoto.h
################################# Linux ##########################################
linux-* {
isEmpty(PREFIX) { PREFIX = /usr }
isEmpty(INC_DIR) { INC_DIR = $${PREFIX}/include/retroshare/ }
isEmpty(LIB_DIR) { LIB_DIR = $${PREFIX}/lib/ }
# ################################ Linux ##########################################
linux-*:isEmpty(PREFIX) {
PREFIX = /usr \
}
isEmpty(INC_DIR) {
INC_DIR = $${PREFIX}/include/retroshare/ \
}
isEmpty(LIB_DIR) {
LIB_DIR = $${PREFIX}/lib/ \
}
# These two lines fixe compilation on ubuntu natty. Probably a ubuntu packaging error.
INCLUDEPATH *= /usr/lib/x86_64-linux-gnu/glib-2.0/include/
INCLUDEPATH *= /usr/lib/i386-linux-gnu/glib-2.0/include/
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
INCLUDEPATH *= $${OPENPGPSDK_DIR} \
../openpgpsdk
DESTDIR = lib
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
QMAKE_CXXFLAGS *= -Wall \
-D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
SSL_DIR = /usr/include/openssl
UPNP_DIR = /usr/include/upnp
INCLUDEPATH += . $${SSL_DIR} $${UPNP_DIR}
INCLUDEPATH += . \
$${SSL_DIR} \
$${UPNP_DIR}
#gpg files
system(which gpg-error-config >/dev/null 2>&1) {
INCLUDEPATH += $$system(gpg-error-config --cflags | sed -e "s/-I//g")
} else {
message(Could not find gpg-error-config on your system, assuming gpg-error.h is in /usr/include)
}
system(which gpgme-config >/dev/null 2>&1) {
INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
} else {
message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
}
# gpg files
system(which gpg-error-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpg-error-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpg-error-config on your system, assuming gpg-error.h is in /usr/include)
system(which gpgme-config >/dev/null 2>&1):INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
else:message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
#libupnp implementation files
# libupnp implementation files
HEADERS += upnp/UPnPBase.h
SOURCES += upnp/UPnPBase.cpp
@ -216,58 +193,54 @@ linux-* {
include_rsiface.files = $$PUBLIC_HEADERS
INSTALLS += include_rsiface
#CONFIG += version_detail_bash_script
# CONFIG += version_detail_bash_script
DEFINES *= UBUNTU
INCLUDEPATH += /usr/include/glib-2.0/ /usr/lib/glib-2.0/include
INCLUDEPATH += /usr/include/glib-2.0/ \
/usr/lib/glib-2.0/include
LIBS *= -lgnome-keyring
}
linux-g++ {
OBJECTS_DIR = temp/linux-g++/obj
}
linux-g++-64 {
OBJECTS_DIR = temp/linux-g++-64/obj
}
version_detail_bash_script {
linux-g++:OBJECTS_DIR = temp/linux-g++/obj
linux-g++-64:OBJECTS_DIR = temp/linux-g++-64/obj
version_detail_bash_script {
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
}
#################### Cross compilation for windows under Linux ####################
win32-x-g++ {
# ################### Cross compilation for windows under Linux ####################
win32-x-g++ {
OBJECTS_DIR = temp/win32xgcc/obj
DESTDIR = lib.win32xgcc
DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU
DEFINES *= WINDOWS_SYS \
WIN32 \
WIN_CROSS_UBUNTU
QMAKE_CXXFLAGS *= -Wmissing-include-dirs
QMAKE_CC = i586-mingw32msvc-g++
QMAKE_LIB = i586-mingw32msvc-ar
QMAKE_AR = i586-mingw32msvc-ar
DEFINES *= STATICLIB WIN32
DEFINES *= STATICLIB \
WIN32
#miniupnp implementation files
# miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
SSL_DIR=../../../../openssl
SSL_DIR = ../../../../openssl
UPNPC_DIR = ../../../../miniupnpc-1.3
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
INCLUDEPATH *= /usr/i586-mingw32msvc/include \
${HOME}/.wine/drive_c/pthreads/include/
}
INCLUDEPATH *= /usr/i586-mingw32msvc/include ${HOME}/.wine/drive_c/pthreads/include/
}
################################# Windows ##########################################
win32 {
# ################################ Windows ##########################################
win32 {
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
DEFINES *= WINDOWS_SYS \
WIN32 \
STATICLIB \
MINGW
DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib
@ -282,42 +255,42 @@ win32 {
QMAKE_CFLAGS_RELEASE += -O0
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
# QMAKE_CXXFLAGS_DEBUG += -O2
# QMAKE_CFLAGS_DEBUG += -O2
DEFINES += USE_CMD_ARGS
#miniupnp implementation files
# miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
UPNPC_DIR = ../../../miniupnpc-1.3
PTHREADS_DIR = ../../../pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../zlib-1.2.3
SSL_DIR = ../../../openssl-1.0.1c
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${OPENPGPSDK_DIR}
INCLUDEPATH += . \
$${SSL_DIR}/include \
$${UPNPC_DIR} \
$${PTHREADS_DIR} \
$${ZLIB_DIR} \
$${OPENPGPSDK_DIR}
newcache {
SQLITE_DIR = ../../../sqlite-autoconf-3071300
INCLUDEPATH += . $${SQLITE_DIR}
INCLUDEPATH += . \
$${SQLITE_DIR}
}
}
}
################################# MacOSX ##########################################
mac {
# ################################ MacOSX ##########################################
mac {
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
#DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
#DEFINES *= MINIUPNPC_VERSION=13
# DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
# DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib
#miniupnp implementation files
# miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
@ -326,45 +299,46 @@ mac {
CONFIG += zcnatassist
# Beautiful Hack to fix 64bit file access.
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dfopen64=fopen -Dvstatfs64=vstatfs
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko \
-Dftello64=ftello \
-Dfopen64=fopen \
-Dvstatfs64=vstatfs
UPNPC_DIR = ../../../miniupnpc-1.0
#GPG_ERROR_DIR = ../../../../libgpg-error-1.7
#GPGME_DIR = ../../../../gpgme-1.1.8
# GPG_ERROR_DIR = ../../../../libgpg-error-1.7
# GPGME_DIR = ../../../../gpgme-1.1.8
OPENPGPSDK_DIR = ../../openpgpsdk/src
INCLUDEPATH += . $${UPNPC_DIR}
INCLUDEPATH += . \
$${UPNPC_DIR}
INCLUDEPATH += $${OPENPGPSDK_DIR}
}
#../openpgpsdk
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}
################################# FreeBSD ##########################################
freebsd-* {
# ../openpgpsdk
# INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
# ################################ FreeBSD ##########################################
freebsd-* {
INCLUDEPATH *= /usr/local/include/gpgme
INCLUDEPATH *= /usr/local/include/glib-2.0
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko \
-Dftello64=ftello \
-Dstat64=stat \
-Dstatvfs64=statvfs \
-Dfopen64=fopen
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
#libupnp implementation files
# libupnp implementation files
HEADERS += upnp/UPnPBase.h
SOURCES += upnp/UPnPBase.cpp
DESTDIR = lib
}
}
################################### COMMON stuff ##################################
HEADERS += dbase/cachestrapper.h \
# ################################## COMMON stuff ##################################
HEADERS += dbase/cachestrapper.h \
dbase/fimonitor.h \
dbase/findex.h \
dbase/fistore.h
#HEADERS += dht/p3bitdht.h \
HEADERS += ft/ftchunkmap.h \
# HEADERS += dht/p3bitdht.h \
HEADERS += ft/ftchunkmap.h \
ft/ftcontroller.h \
ft/ftdata.h \
ft/ftdatamultiplex.h \
@ -376,8 +350,7 @@ HEADERS += ft/ftchunkmap.h \
ft/ftsearch.h \
ft/ftserver.h \
ft/fttransfermodule.h
HEADERS += pqi/authssl.h \
HEADERS += pqi/authssl.h \
pqi/authgpg.h \
pgp/pgphandler.h \
pgp/pgpkeyutil.h \
@ -419,16 +392,14 @@ HEADERS += pqi/authssl.h \
pqi/pqiqosstreamer.h \
pqi/sslfns.h \
pqi/pqinetstatebox.h
HEADERS += rsserver/p3discovery.h \
HEADERS += rsserver/p3discovery.h \
rsserver/p3face.h \
rsserver/p3history.h \
rsserver/p3msgs.h \
rsserver/p3peers.h \
rsserver/p3status.h \
rsserver/p3serverconfig.h
HEADERS += serialiser/rsbaseitems.h \
HEADERS += serialiser/rsbaseitems.h \
serialiser/rsbaseserial.h \
serialiser/rsblogitems.h \
serialiser/rschannelitems.h \
@ -455,8 +426,7 @@ HEADERS += serialiser/rsbaseitems.h \
serialiser/rsbanlistitems.h \
serialiser/rsbwctrlitems.h \
serialiser/rstunnelitems.h
HEADERS += services/p3channels.h \
HEADERS += services/p3channels.h \
services/p3chatservice.h \
services/p3disc.h \
services/p3forums.h \
@ -469,18 +439,15 @@ HEADERS += services/p3channels.h \
services/p3banlist.h \
services/p3bwctrl.h \
services/p3tunnel.h
HEADERS += distrib/p3distrib.h \
HEADERS += distrib/p3distrib.h \
distrib/p3distribsecurity.h
# services/p3blogs.h \
HEADERS += turtle/p3turtle.h \
# services/p3blogs.h \
HEADERS += turtle/p3turtle.h \
turtle/rsturtleitem.h \
turtle/turtletypes.h
HEADERS += upnp/upnphandler.h
HEADERS += util/folderiterator.h \
HEADERS += upnp/upnphandler.h
HEADERS += util/folderiterator.h \
util/rsdebug.h \
util/smallobject.h \
util/rsdir.h \
@ -495,16 +462,13 @@ HEADERS += util/folderiterator.h \
util/rswin.h \
util/rsrandom.h \
util/radix64.h \
util/pugiconfig.h \
SOURCES += dbase/cachestrapper.cc \
util/pugiconfig.h
SOURCES += dbase/cachestrapper.cc \
dbase/fimonitor.cc \
dbase/findex.cc \
dbase/fistore.cc \
dbase/rsexpr.cc
SOURCES += ft/ftchunkmap.cc \
SOURCES += ft/ftchunkmap.cc \
ft/ftcontroller.cc \
ft/ftdata.cc \
ft/ftdatamultiplex.cc \
@ -514,9 +478,8 @@ SOURCES += ft/ftchunkmap.cc \
ft/ftfileprovider.cc \
ft/ftfilesearch.cc \
ft/ftserver.cc \
ft/fttransfermodule.cc \
SOURCES += pqi/authgpg.cc \
ft/fttransfermodule.cc
SOURCES += pqi/authgpg.cc \
pqi/authssl.cc \
pgp/pgphandler.cc \
pgp/pgpkeyutil.cc \
@ -550,8 +513,7 @@ SOURCES += pqi/authgpg.cc \
pqi/pqiqosstreamer.cc \
pqi/sslfns.cc \
pqi/pqinetstatebox.cc
SOURCES += rsserver/p3discovery.cc \
SOURCES += rsserver/p3discovery.cc \
rsserver/p3face-config.cc \
rsserver/p3face-msgs.cc \
rsserver/p3face-server.cc \
@ -564,12 +526,10 @@ SOURCES += rsserver/p3discovery.cc \
rsserver/rsloginhandler.cc \
rsserver/rstypes.cc \
rsserver/p3serverconfig.cc
SOURCES += plugins/pluginmanager.cc \
SOURCES += plugins/pluginmanager.cc \
plugins/dlfcn_win32.cc \
serialiser/rspluginitems.cc
SOURCES += serialiser/rsbaseitems.cc \
SOURCES += serialiser/rsbaseitems.cc \
serialiser/rsbaseserial.cc \
serialiser/rsblogitems.cc \
serialiser/rschannelitems.cc \
@ -596,8 +556,7 @@ SOURCES += serialiser/rsbaseitems.cc \
serialiser/rsbanlistitems.cc \
serialiser/rsbwctrlitems.cc \
serialiser/rstunnelitems.cc
SOURCES += services/p3channels.cc \
SOURCES += services/p3channels.cc \
services/p3chatservice.cc \
services/p3disc.cc \
services/p3forums.cc \
@ -607,22 +566,19 @@ SOURCES += services/p3channels.cc \
services/p3statusservice.cc \
services/p3dsdv.cc \
services/p3banlist.cc \
services/p3bwctrl.cc \
services/p3bwctrl.cc
# removed because getPeer() doesn t exist services/p3tunnel.cc
SOURCES += distrib/p3distrib.cc \
# removed because getPeer() doesn t exist services/p3tunnel.cc
SOURCES += distrib/p3distrib.cc \
distrib/p3distribsecurity.cc
SOURCES += turtle/p3turtle.cc \
SOURCES += turtle/p3turtle.cc \
turtle/rsturtleitem.cc
# turtle/turtlerouting.cc \
# turtle/turtlesearch.cc \
# turtle/turtletunnels.cc
SOURCES += upnp/upnphandler.cc
SOURCES += util/folderiterator.cc \
# turtle/turtlerouting.cc \
# turtle/turtlesearch.cc \
# turtle/turtletunnels.cc
SOURCES += upnp/upnphandler.cc
SOURCES += util/folderiterator.cc \
util/rsdebug.cc \
util/smallobject.cc \
util/rsdir.cc \
@ -635,37 +591,26 @@ SOURCES += util/folderiterator.cc \
util/rsthreads.cc \
util/rsversion.cc \
util/rswin.cc \
util/rsrandom.cc \
zeroconf {
HEADERS += zeroconf/p3zeroconf.h \
SOURCES += zeroconf/p3zeroconf.cc \
# Disable Zeroconf (we still need the code for zcnatassist
# DEFINES *= RS_ENABLE_ZEROCONF
}
# This is seperated from the above for windows/linux platforms.
# It is acceptable to build in zeroconf and have it not work,
# but unacceptable to rely on Apple's libraries for Upnp when we have alternatives. '
zcnatassist {
HEADERS += zeroconf/p3zcnatassist.h \
SOURCES += zeroconf/p3zcnatassist.cc \
util/rsrandom.cc
zeroconf {
HEADERS += zeroconf/p3zeroconf.h
SOURCES += zeroconf/p3zeroconf.cc
}
# Disable Zeroconf (we still need the code for zcnatassist
# DEFINES *= RS_ENABLE_ZEROCONF
# This is seperated from the above for windows/linux platforms.
# It is acceptable to build in zeroconf and have it not work,
# but unacceptable to rely on Apple's libraries for Upnp when we have alternatives. '
zcnatassist {
HEADERS += zeroconf/p3zcnatassist.h
SOURCES += zeroconf/p3zcnatassist.cc
DEFINES *= RS_ENABLE_ZCNATASSIST
}
}
# new gxs cache system
newcache {
HEADERS += serialiser/rsnxsitems.h \
newcache {
HEADERS += serialiser/rsnxsitems.h \
gxs/rsgds.h \
gxs/rsgxs.h \
gxs/rsdataservice.h \
@ -680,9 +625,9 @@ HEADERS += serialiser/rsnxsitems.h \
serialiser/rsgxsitems.h \
serialiser/rsphotov2items.h \
util/retrodb.h \
gxs/gxscoreserver.h
SOURCES += serialiser/rsnxsitems.cc \
gxs/gxscoreserver.h \
gxs/gxssecurity.h
SOURCES += serialiser/rsnxsitems.cc \
gxs/rsdataservice.cc \
gxs/rsgenexchange.cc \
gxs/rsgxsnetservice.cc \
@ -692,14 +637,11 @@ SOURCES += serialiser/rsnxsitems.cc \
gxs/rsgxsdataaccess.cc \
serialiser/rsphotov2items.cc \
util/retrodb.cc \
gxs/gxscoreserver.cc
}
newservices {
HEADERS += services/p3photoservice.h \
gxs/gxscoreserver.cc \
gxs/gxssecurity.cc
}
newservices {
HEADERS += services/p3photoservice.h \
serialiser/rsphotoitems.h \
retroshare/rsphoto.h \
services/p3gxsservice.h \
@ -714,20 +656,16 @@ HEADERS += services/p3photoservice.h \
retroshare/rsposted.h \
services/p3posted.h \
services/p3photoserviceV2.h \
retroshare/rsphotoV2.h \
SOURCES += services/p3photoservice.cc \
retroshare/rsphotoV2.h
SOURCES += services/p3photoservice.cc \
serialiser/rsphotoitems.cc \
services/p3gxsservice.cc \
services/p3wikiservice.cc \
services/p3wire.cc \
services/p3idservice.cc \
services/p3forumsv2.cc \
services/p3posted.cc \
# Other Old Code.
# rsserver/p3photo.cc \
}
services/p3posted.cc
}

View File

@ -196,7 +196,7 @@ public:
RsTlvBinaryData grp; /// actual group data
/*!
* This should contains all the data
* This should contains all data
* which is not specific to the Gxs service data
*/
RsTlvBinaryData meta;

View File

@ -13,12 +13,6 @@ bool p3PhotoServiceV2::updated()
{
bool changed = (!mGroupChange.empty() || !mMsgChange.empty());
std::list<RsGxsGroupId> gL;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
groupsChanged(gL);
msgsChanged(msgs);
return changed;
}

View File

@ -331,12 +331,8 @@ void PhotoAddDialog::publishAlbum()
std::cerr << "PhotoAddDialog::publishAlbum() New Album Mode Submitting.....";
std::cerr << std::endl;
uint32_t token;
rsPhotoV2->submitAlbumDetails(album);
// tell tokenQueue to expect results from submission.
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_SUMMARY, 0);
}
@ -408,7 +404,6 @@ void PhotoAddDialog::publishPhotos(std::string albumId)
std::cerr << "PhotoAddDialog::publishAlbum() Photo(" << i << ") ";
uint32_t token;
if (isNewPhoto)
{
std::cerr << "Is a New Photo";

View File

@ -145,7 +145,15 @@ void PhotoDialog::checkUpdate()
if (rsPhotoV2->updated())
{
//insertAlbums();
requestAlbumList();
std::list<std::string> grpIds;
rsPhotoV2->groupsChanged(grpIds);
if(!grpIds.empty())
requestAlbumList(grpIds);
GxsMsgIdResult res;
rsPhotoV2->msgsChanged(res);
if(!res.empty())
requestPhotoList(res);
}
return;
@ -427,15 +435,23 @@ void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
/**************************** Request / Response Filling of Data ************************/
void PhotoDialog::requestAlbumList()
void PhotoDialog::requestAlbumList(std::list<std::string>& ids)
{
std::list<std::string> ids;
RsTokReqOptionsV2 opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_IDS;
uint32_t token;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
}
void PhotoDialog::requestPhotoList(GxsMsgReq& req)
{
RsTokReqOptionsV2 opts;
uint32_t token;
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, req, 0);
return;
}
void PhotoDialog::loadAlbumList(const uint32_t &token)
{
@ -461,6 +477,7 @@ void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
}

View File

@ -58,8 +58,9 @@ private slots:
private:
/* Request Response Functions for loading data */
void requestAlbumList();
void requestAlbumList(std::list<std::string>& ids);
void requestAlbumData(std::list<std::string> &ids);
void requestPhotoList(GxsMsgReq &albumIds);
void requestPhotoList(const std::string &albumId);
void requestPhotoData(GxsMsgReq &photoIds);