Added RsTlvKeySignatureSet to rstlvkeys

- added test to test/serialiser 
- Updated all relevant gxs test (ran whole suite, added gxsdata_test, tests meta serilisation, to pro file) 

Updated flag in rsgxsflags to account for authentication and private types 

Changed msgId/grpId generation to sha1 hash

removed photoservice VEG file from pro file




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5630 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-10-01 20:57:56 +00:00
parent b06214b779
commit 19e856c2a8
22 changed files with 467 additions and 202 deletions

View file

@ -62,9 +62,8 @@ void init_item(RsGxsGrpMetaData* metaGrp)
randString(SHORT_STR, metaGrp->mAuthorId);
randString(SHORT_STR, metaGrp->mGroupName);
init_item(metaGrp->adminSign);
init_item(metaGrp->signSet);
init_item(metaGrp->keys);
init_item(metaGrp->idSign);
metaGrp->mPublishTs = rand()%3452;
metaGrp->mGroupFlags = rand()%43;
@ -87,8 +86,7 @@ void init_item(RsGxsMsgMetaData* metaMsg)
randString(SHORT_STR, metaMsg->mOrigMsgId);
randString(SHORT_STR, metaMsg->mMsgName);
init_item(metaMsg->pubSign);
init_item(metaMsg->idSign);
init_item(metaMsg->signSet);
metaMsg->mPublishTs = rand()%313;
metaMsg->mMsgFlags = rand()%224;

View file

@ -10,13 +10,14 @@ QT += core network
QT -= gui
CONFIG += dstore_target #gen_exchange_target # #nxs_net_test
CONFIG += gen_exchange_target
#CONFIG += nxs_net_test
#CONFIG += dstore_target
#CONFIG += gxsdata_target
dstore_target {
TARGET = rs_dstore_test
}
gen_exchange_target {
@ -30,6 +31,12 @@ TARGET = nxs_net_test
}
gxsdata_target {
TARGET = gxsdata_test
}
CONFIG += console
CONFIG -= app_bundle
@ -161,53 +168,66 @@ install_rs {
binary_rs.files = ./RetroShare
}
dstore_target {
SOURCES += \
support.cc \
rsdataservice_test.cc \
data_support.cc
HEADERS += support.h \
rsdataservice_test.h \
data_support.h
}
gen_exchange_target {
SOURCES += \
support.cc \
genexchangetester.cpp \
genexchangetestservice.cpp \
rsdummyservices.cc \
rsgenexchange_test.cc
HEADERS += support.h \
rsdataservice_test.h \
rsdummyservices.h \
data_support.h
SOURCES += \
support.cc \
genexchangetester.cpp \
genexchangetestservice.cpp \
rsdummyservices.cc \
rsgenexchange_test.cc
HEADERS += support.h \
rsdataservice_test.h \
rsdummyservices.h \
data_support.h
}
nxs_net_test {
SOURCES += \
support.cc \
nxstesthub.cc \
rsgxsnetservice_test.cc \
nxstestscenario.cc \
data_support.cc
HEADERS += support.h \
nxstesthub.h \
rsgxsnetservice_test.h \
nxstestscenario.h \
data_support.h
SOURCES += \
support.cc \
nxstesthub.cc \
rsgxsnetservice_test.cc \
nxstestscenario.cc \
data_support.cc
HEADERS += support.h \
nxstesthub.h \
rsgxsnetservice_test.h \
nxstestscenario.h \
data_support.h
}
dstore_target {
TARGET = rs_dstore_test
SOURCES += \
support.cc \
rsdataservice_test.cc \
data_support.cc
HEADERS += support.h \
rsdataservice_test.h \
data_support.h
}
gxsdata_target {
SOURCES += \
support.cc \
data_support.cc \
rsgxsdata_test.cc
HEADERS += \
support.h \
rsgxsdata_test.h
}
INCLUDEPATH += ../../

View file

@ -339,8 +339,7 @@ void tearDown(){
bool operator ==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r)
{
if(!(l.adminSign == r.adminSign)) return false;
if(!(l.idSign == r.idSign)) return false;
if(!(l.signSet == r.signSet)) return false;
if(!(l.keys == r.keys)) return false;
if(l.mGroupFlags != r.mGroupFlags) return false;
if(l.mPublishTs != r.mPublishTs) return false;
@ -358,8 +357,7 @@ bool operator ==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r)
bool operator ==(const RsGxsMsgMetaData& l, const RsGxsMsgMetaData& r)
{
if(!(l.idSign == r.idSign)) return false;
if(!(l.pubSign == r.pubSign)) return false;
if(!(l.signSet == r.signSet)) return false;
if(l.mGroupId != r.mGroupId) return false;
if(l.mAuthorId != r.mAuthorId) return false;
if(l.mParentId != r.mParentId) return false;

View file

@ -14,14 +14,14 @@ int main()
{
GenExchangeTester tester;
// CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
// CHECK(tester.testSpecificMsgMetaRetrieval()); REPORT("testSpecificMsgMetaRetrieval()");
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
// CHECK(tester.testMsgIdRetrieval_OptParents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
// CHECK(tester.testMsgIdRetrieval_OptOrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
// CHECK(tester.testMsgIdRetrieval_OptLatest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
// CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
// CHECK(tester.testMsgChildRetrieval()); REPORT("tester.testMsgMetaModRequest()");
CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
CHECK(tester.testMsgChildRetrieval()); REPORT("tester.testMsgMetaModRequest()");
CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");

View file

@ -49,8 +49,7 @@ int main()
bool operator ==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r)
{
if(!(l.adminSign == r.adminSign)) return false;
if(!(l.idSign == r.idSign)) return false;
if(!(l.signSet == r.signSet)) return false;
if(!(l.keys == r.keys)) return false;
if(l.mGroupFlags != r.mGroupFlags) return false;
if(l.mPublishTs != r.mPublishTs) return false;
@ -64,8 +63,7 @@ bool operator ==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r)
bool operator ==(const RsGxsMsgMetaData& l, const RsGxsMsgMetaData& r)
{
if(!(l.idSign == r.idSign)) return false;
if(!(l.pubSign == r.pubSign)) return false;
if(!(l.signSet == r.signSet)) return false;
if(l.mGroupId != r.mGroupId) return false;
if(l.mAuthorId != r.mAuthorId) return false;
if(l.mParentId != r.mParentId) return false;

View file

@ -103,6 +103,30 @@ bool operator==(const RsTlvSecurityKey& sk1, const RsTlvSecurityKey& sk2)
return true;
}
bool operator==(const RsTlvKeySignatureSet& kss1, const RsTlvKeySignatureSet& kss2)
{
const std::map<SignType, RsTlvKeySignature>& set1 = kss1.keySignSet,
&set2 = kss2.keySignSet;
if(set1.size() != set2.size()) return false;
std::map<SignType, RsTlvKeySignature>::const_iterator it1 = set1.begin(), it2;
for(; it1 != set1.end(); it1++)
{
SignType st1 = it1->first;
if( (it2 =set2.find(st1)) == set2.end())
return false;
if(!(it1->second == it2->second))
return false;
}
return true;
}
bool operator==(const RsTlvKeySignature& ks1, const RsTlvKeySignature& ks2)
{
@ -138,6 +162,19 @@ void init_item(RsTlvImage& im)
return;
}
void init_item(RsTlvKeySignatureSet &kss)
{
int numSign = rand()%21;
for(int i=0; i < numSign; i++)
{
RsTlvKeySignature sign;
SignType sType = rand()%2452;
init_item(sign);
kss.keySignSet.insert(std::make_pair(sType, sign));
}
}
bool operator==(const RsTlvBinaryData& bd1, const RsTlvBinaryData& bd2)
{
if(bd1.tlvtype != bd2.tlvtype) return false;

View file

@ -56,6 +56,7 @@ void randString(const uint32_t, std::wstring&);
void init_item(RsTlvSecurityKey&);
void init_item(RsTlvKeySignature&);
void init_item(RsTlvKeySignatureSet&);
void init_item(RsTlvBinaryData&);
void init_item(RsTlvFileItem&);
void init_item(RsTlvFileSet&);
@ -74,6 +75,7 @@ bool operator==(const RsTlvHashSet&, const RsTlvHashSet&);
bool operator==(const RsTlvImage&, const RsTlvImage& );
bool operator==(const RsTlvPeerIdSet& , const RsTlvPeerIdSet& );
bool operator==(const RsTlvSecurityKeySet& , const RsTlvSecurityKeySet& );
bool operator==(const RsTlvKeySignatureSet& , const RsTlvKeySignatureSet& );

View file

@ -81,6 +81,30 @@ bool operator==(const RsTlvKeySignature& ks1, const RsTlvKeySignature& ks2)
return true;
}
bool operator==(const RsTlvKeySignatureSet& kss1, const RsTlvKeySignatureSet& kss2)
{
const std::map<SignType, RsTlvKeySignature>& set1 = kss1.keySignSet,
&set2 = kss2.keySignSet;
if(set1.size() != set2.size()) return false;
std::map<SignType, RsTlvKeySignature>::const_iterator it1 = set1.begin(), it2;
for(; it1 != set1.end(); it1++)
{
SignType st1 = it1->first;
if( (it2 =set2.find(st1)) == set2.end())
return false;
if(!(it1->second == it2->second))
return false;
}
return true;
}
bool operator==(const RsTlvPeerIdSet& pids1, const RsTlvPeerIdSet& pids2)
{
std::list<std::string>::const_iterator it1 = pids1.ids.begin(),
@ -153,6 +177,18 @@ void init_item(RsTlvKeySignature& ks)
return;
}
void init_item(RsTlvKeySignatureSet &kss)
{
int numSign = rand()%21;
for(int i=0; i < numSign; i++)
{
RsTlvKeySignature sign;
SignType sType = rand()%2452;
init_item(sign);
kss.keySignSet.insert(std::make_pair(sType, sign));
}
}
bool operator==(const RsTlvImage& img1, const RsTlvImage& img2)

View file

@ -56,6 +56,7 @@ void randString(const uint32_t, std::wstring&);
void init_item(RsTlvSecurityKey&);
void init_item(RsTlvKeySignature&);
void init_item(RsTlvKeySignatureSet&);
void init_item(RsTlvBinaryData&);
void init_item(RsTlvFileItem&);
void init_item(RsTlvFileSet&);
@ -72,6 +73,7 @@ bool operator==(const RsTlvFileSet&, const RsTlvFileSet& );
bool operator==(const RsTlvHashSet&, const RsTlvHashSet&);
bool operator==(const RsTlvImage&, const RsTlvImage& );
bool operator==(const RsTlvPeerIdSet& , const RsTlvPeerIdSet& );
bool operator==(const RsTlvKeySignatureSet& , const RsTlvKeySignatureSet& );

View file

@ -0,0 +1,36 @@
#include "support.h"
#include "serialiser/rstlvkeys.h"
INITTEST();
bool test_RsTlvKeySignatureSet();
int main()
{
test_RsTlvKeySignatureSet(); REPORT("test_RsTlvKeySignatureSet()");
FINALREPORT("RsTlvKey Test");
}
bool test_RsTlvKeySignatureSet()
{
RsTlvKeySignatureSet set;
init_item(set);
char data[set.TlvSize()];
uint32_t offset = 0;
set.SetTlv(data, set.TlvSize(), &offset);
RsTlvKeySignatureSet setConfirm;
offset = 0;
setConfirm.GetTlv(data, set.TlvSize(), &offset);
CHECK(setConfirm == set);
}