- changed Sha1CheckSum from hand-made class to instance of t_GenericIdType<> (should be backward compatible)

- updated ft/, p3msgservice and p3chatservice accordingly
- added a new class for Sha1Sum in t_GeneridIdType<>, and an additional template argument to make ids of identical size 
	incompatible.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7082 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-02-01 19:10:45 +00:00
parent 10bf083ca3
commit 235280399f
19 changed files with 67 additions and 441 deletions

View file

@ -33,6 +33,7 @@
#include <iostream>
#include <string>
#include <stdint.h>
#include <util/rsid.h>
#include <retroshare/rsflags.h>
@ -60,24 +61,24 @@ const uint32_t RS_CONFIG_DIRECTORY = 0x0002 ;
const uint32_t RS_PGP_DIRECTORY = 0x0003 ;
const uint32_t RS_DIRECTORY_COUNT = 0x0004 ;
class Sha1CheckSum
{
public:
Sha1CheckSum() {}
explicit Sha1CheckSum(const uint8_t *twenty_bytes_digest) ; // inits form a 20-bytes digest.
explicit Sha1CheckSum(const std::string& fourty_bytes_string) ; // inits form a 40 bytes hexadecimal string.
static Sha1CheckSum random() ;
std::string toStdString() const ;
bool operator==(const Sha1CheckSum& s) const ;
bool operator<(const Sha1CheckSum& s) const ;
friend std::ostream& operator<<(std::ostream& out,const Sha1CheckSum& sum) { return out << sum.toStdString() ; }
// private:
uint32_t fourbytes[5] ;
};
//class Sha1CheckSum
//{
// public:
// Sha1CheckSum() {}
// explicit Sha1CheckSum(const uint8_t *twenty_bytes_digest) ; // inits form a 20-bytes digest.
// explicit Sha1CheckSum(const std::string& fourty_bytes_string) ; // inits form a 40 bytes hexadecimal string.
//
// static Sha1CheckSum random() ;
//
// std::string toStdString() const ;
//
// bool operator==(const Sha1CheckSum& s) const ;
// bool operator<(const Sha1CheckSum& s) const ;
//
// friend std::ostream& operator<<(std::ostream& out,const Sha1CheckSum& sum) { return out << sum.toStdString() ; }
//// private:
// uint32_t fourbytes[5] ;
//};
class TransferInfo
{
@ -372,7 +373,7 @@ template<class CRCTYPE> class t_CRCMap
friend class RsFileCRC32Map ;
};
typedef t_CRCMap<uint32_t> CRC32Map ;
//typedef t_CRCMap<uint32_t> CRC32Map ;
typedef t_CRCMap<Sha1CheckSum> Sha1Map ;
/* class which encapsulates download details */