Merge branch 'master' into extra_locators_merge

This commit is contained in:
Gioacchino Mazzurco 2018-07-02 12:22:23 +02:00
commit 1dd707710b
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
241 changed files with 20454 additions and 3066 deletions

View file

@ -182,7 +182,7 @@ private:
class StringExpression: public Expression
{
public:
StringExpression(enum StringOperator op, std::list<std::string> &t, bool ic): Op(op),terms(t), IgnoreCase(ic){}
StringExpression(enum StringOperator op, const std::list<std::string> &t, bool ic): Op(op),terms(t), IgnoreCase(ic){}
virtual void linearize(LinearizedExpression& e) const ;
virtual std::string toStdString(const std::string& varstr) const;
@ -275,7 +275,7 @@ Some implementations of StringExpressions.
class NameExpression: public StringExpression
{
public:
NameExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
NameExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
StringExpression(op,t,ic) {}
bool eval(const ExpFileEntry& file);
@ -290,7 +290,7 @@ public:
class PathExpression: public StringExpression {
public:
PathExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
PathExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
StringExpression(op,t,ic) {}
bool eval(const ExpFileEntry& file);
@ -305,7 +305,7 @@ public:
class ExtExpression: public StringExpression {
public:
ExtExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
ExtExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
StringExpression(op,t,ic) {}
bool eval(const ExpFileEntry& file);
@ -320,7 +320,7 @@ public:
class HashExpression: public StringExpression {
public:
HashExpression(enum StringOperator op, std::list<std::string> &t):
HashExpression(enum StringOperator op, const std::list<std::string> &t):
StringExpression(op,t, true) {}
bool eval(const ExpFileEntry& file);

View file

@ -168,10 +168,9 @@ public:
class RsFiles
{
public:
RsFiles() { return; }
virtual ~RsFiles() { return; }
public:
RsFiles() {}
virtual ~RsFiles() {}
/**
* Provides file data for the gui: media streaming or rpc clients.
@ -278,8 +277,8 @@ class RsFiles
***/
virtual void requestDirUpdate(void *ref) =0 ; // triggers the update of the given reference. Used when browsing.
virtual void setDownloadDirectory(std::string path) = 0;
virtual void setPartialsDirectory(std::string path) = 0;
virtual bool setDownloadDirectory(std::string path) = 0;
virtual bool setPartialsDirectory(std::string path) = 0;
virtual std::string getDownloadDirectory() = 0;
virtual std::string getPartialsDirectory() = 0;

View file

@ -124,24 +124,27 @@ class RsGxsComment
};
class RsGxsCommentService
struct RsGxsCommentService
{
public:
RsGxsCommentService() {}
virtual ~RsGxsCommentService() {}
RsGxsCommentService() { return; }
virtual ~RsGxsCommentService() { return; }
/** Get previously requested comment data with token */
virtual bool getCommentData( uint32_t token,
std::vector<RsGxsComment> &comments ) = 0;
virtual bool getRelatedComments( uint32_t token,
std::vector<RsGxsComment> &comments ) = 0;
virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
//virtual bool getDetailedCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments);
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
virtual bool acknowledgeComment(
uint32_t token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
virtual bool acknowledgeVote(
uint32_t token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
};

View file

@ -40,8 +40,8 @@ class RsGxsChanges
public:
RsGxsChanges(): mService(0){}
RsTokenService *mService;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgs;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgsMeta;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
std::list<RsGxsGroupId> mGrps;
std::list<RsGxsGroupId> mGrpsMeta;
};

View file

@ -1,3 +1,23 @@
/*
* rsgxsifacetypes.h
*
* Copyright (C) 2013 crispy
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* rsgxsifacetypes.h
*
@ -13,18 +33,20 @@
#include <string>
#include <inttypes.h>
#include <retroshare/rstypes.h>
#include <retroshare/rsids.h>
#include "retroshare/rstypes.h"
#include "retroshare/rsids.h"
#include "serialiser/rsserializable.h"
#include "serialiser/rstypeserializer.h"
typedef GXSGroupId RsGxsGroupId;
typedef Sha1CheckSum RsGxsMessageId;
typedef GXSId RsGxsId;
typedef GXSCircleId RsGxsCircleId;
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgIdResult;
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMessageId> > MsgRelatedIdResult;
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq;
typedef std::map<RsGxsGrpMsgIdPair, std::set<RsGxsMessageId> > MsgRelatedIdResult;
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgReq;
struct RsMsgMetaData;
@ -34,7 +56,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > MsgMetaResult;
class RsGxsGrpMetaData;
class RsGxsMsgMetaData;
struct RsGroupMetaData
struct RsGroupMetaData : RsSerializable
{
// (csoler) The correct default value to be used in mCircleType is GXS_CIRCLE_TYPE_PUBLIC, which is defined in rsgxscircles.h,
// but because of a loop in the includes, I cannot include it here. So I replaced with its current value 0x0001.
@ -73,6 +95,30 @@ struct RsGroupMetaData
std::string mServiceString; // Service Specific Free-Form extra storage.
RsPeerId mOriginator;
RsGxsCircleId mInternalCircle;
/// @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{
RS_SERIAL_PROCESS(mGroupId);
RS_SERIAL_PROCESS(mGroupName);
RS_SERIAL_PROCESS(mGroupFlags);
RS_SERIAL_PROCESS(mSignFlags);
RS_SERIAL_PROCESS(mPublishTs);
RS_SERIAL_PROCESS(mAuthorId);
RS_SERIAL_PROCESS(mCircleId);
RS_SERIAL_PROCESS(mCircleType);
RS_SERIAL_PROCESS(mAuthenFlags);
RS_SERIAL_PROCESS(mParentGrpId);
RS_SERIAL_PROCESS(mSubscribeFlags);
RS_SERIAL_PROCESS(mPop);
RS_SERIAL_PROCESS(mVisibleMsgCount);
RS_SERIAL_PROCESS(mLastPost);
RS_SERIAL_PROCESS(mGroupStatus);
RS_SERIAL_PROCESS(mServiceString);
RS_SERIAL_PROCESS(mOriginator);
RS_SERIAL_PROCESS(mInternalCircle);
}
};

View file

@ -46,7 +46,7 @@ class RsGxsMsgChange : public RsGxsNotify
{
public:
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
NotifyType getType(){ return NOTIFY_TYPE;}
bool metaChange() { return mMetaChange; }
private:

View file

@ -6,7 +6,8 @@
*
* RetroShare C++ Interface.
*
* Copyright 2012-2012 by Robert Fernie.
* Copyright (C) 2012 Robert Fernie.
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -36,9 +37,12 @@
#include "retroshare/rsids.h"
#include "serialiser/rstlvimage.h"
#include "retroshare/rsgxscommon.h"
#include "serialiser/rsserializable.h"
#include "serialiser/rstypeserializer.h"
#include "util/rsdeprecate.h"
/* The Main Interface Class - for information about your Peers */
class RsIdentity;
struct RsIdentity;
extern RsIdentity *rsIdentity;
@ -63,6 +67,7 @@ extern RsIdentity *rsIdentity;
#define RSID_RELATION_OTHER 0x0008
#define RSID_RELATION_UNKNOWN 0x0010
/// @deprecated remove toghether with RsGxsIdGroup::mRecognTags
#define RSRECOGN_MAX_TAGINFO 5
// Unicode symbols. NOT utf-8 bytes, because of multi byte characters
@ -77,27 +82,36 @@ static const uint32_t RS_IDENTITY_FLAGS_PGP_KNOWN = 0x0004;
static const uint32_t RS_IDENTITY_FLAGS_IS_OWN_ID = 0x0008;
static const uint32_t RS_IDENTITY_FLAGS_IS_DEPRECATED= 0x0010; // used to denote keys with deprecated fingerprint format.
class GxsReputation
struct GxsReputation : RsSerializable
{
public:
GxsReputation();
GxsReputation();
bool updateIdScore(bool pgpLinked, bool pgpKnown);
bool update(); // checks ranges and calculates overall score.
int mOverallScore;
int mIdScore; // PGP, Known, etc.
int mOwnOpinion;
int mPeerOpinion;
bool updateIdScore(bool pgpLinked, bool pgpKnown);
bool update(); /// checks ranges and calculates overall score.
int32_t mOverallScore;
int32_t mIdScore; /// PGP, Known, etc.
int32_t mOwnOpinion;
int32_t mPeerOpinion;
/// @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{
RS_SERIAL_PROCESS(mOverallScore);
RS_SERIAL_PROCESS(mIdScore);
RS_SERIAL_PROCESS(mOwnOpinion);
RS_SERIAL_PROCESS(mPeerOpinion);
}
};
struct RsGxsIdGroup
struct RsGxsIdGroup : RsSerializable
{
RsGxsIdGroup() :
mLastUsageTS(0), mPgpKnown(false), mIsAContact(false) {}
~RsGxsIdGroup() {}
RsGroupMetaData mMeta;
// In GroupMetaData.
@ -120,7 +134,7 @@ struct RsGxsIdGroup
std::string mPgpIdSign;
// Recognition Strings. MAX# defined above.
std::list<std::string> mRecognTags;
RS_DEPRECATED std::list<std::string> mRecognTags;
// Avatar
RsGxsImage mImage ;
@ -131,8 +145,11 @@ struct RsGxsIdGroup
bool mIsAContact; // change that into flags one day
RsPgpId mPgpId;
GxsReputation mReputation;
};
/// @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx );
};
std::ostream &operator<<(std::ostream &out, const RsGxsIdGroup &group);
@ -149,12 +166,11 @@ class RsRecognTag
};
class RsRecognTagDetails
struct RsRecognTagDetails
{
public:
RsRecognTagDetails()
:valid_from(0), valid_to(0), tag_class(0), tag_type(0),
is_valid(false), is_pending(false) { return; }
RsRecognTagDetails() :
valid_from(0), valid_to(0), tag_class(0), tag_type(0), is_valid(false),
is_pending(false) {}
time_t valid_from;
time_t valid_to;
@ -167,105 +183,166 @@ class RsRecognTagDetails
bool is_pending;
};
class RsIdOpinion
{
public:
RsGxsId id;
int rating;
};
class RsIdentityParameters
struct RsIdentityParameters
{
public:
RsIdentityParameters(): isPgpLinked(false) { return; }
RsIdentityParameters() :
isPgpLinked(false) {}
bool isPgpLinked;
std::string nickname;
RsGxsImage mImage ;
std::string nickname;
RsGxsImage mImage;
};
class RsIdentityUsage
struct RsIdentityUsage : RsSerializable
{
public:
enum UsageCode { UNKNOWN_USAGE = 0x00,
GROUP_ADMIN_SIGNATURE_CREATION = 0x01, // These 2 are normally not normal GXS identities, but nothing prevents it to happen either.
GROUP_ADMIN_SIGNATURE_VALIDATION = 0x02,
GROUP_AUTHOR_SIGNATURE_CREATION = 0x03, // not typically used, since most services do not require group author signatures
GROUP_AUTHOR_SIGNATURE_VALIDATION = 0x04,
MESSAGE_AUTHOR_SIGNATURE_CREATION = 0x05, // most common use case. Messages are signed by authors in e.g. forums.
MESSAGE_AUTHOR_SIGNATURE_VALIDATION = 0x06,
GROUP_AUTHOR_KEEP_ALIVE = 0x07, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
MESSAGE_AUTHOR_KEEP_ALIVE = 0x08, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
CHAT_LOBBY_MSG_VALIDATION = 0x09, // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
GLOBAL_ROUTER_SIGNATURE_CHECK = 0x0a, // Global router message validation
GLOBAL_ROUTER_SIGNATURE_CREATION = 0x0b, // Global router message signature
GXS_TUNNEL_DH_SIGNATURE_CHECK = 0x0c, //
GXS_TUNNEL_DH_SIGNATURE_CREATION = 0x0d, //
IDENTITY_DATA_UPDATE = 0x0e, // Group update on that identity data. Can be avatar, name, etc.
IDENTITY_GENERIC_SIGNATURE_CHECK = 0x0f, // Any signature verified for that identity
IDENTITY_GENERIC_SIGNATURE_CREATION = 0x10, // Any signature made by that identity
IDENTITY_GENERIC_ENCRYPTION = 0x11,
IDENTITY_GENERIC_DECRYPTION = 0x12,
CIRCLE_MEMBERSHIP_CHECK = 0x13
} ;
enum UsageCode : uint8_t
{
UNKNOWN_USAGE = 0x00,
explicit RsIdentityUsage(uint16_t service,const RsIdentityUsage::UsageCode& code,const RsGxsGroupId& gid=RsGxsGroupId(),const RsGxsMessageId& mid=RsGxsMessageId(),uint64_t additional_id=0,const std::string& comment = std::string());
/** These 2 are normally not normal GXS identities, but nothing prevents
* it to happen either. */
GROUP_ADMIN_SIGNATURE_CREATION = 0x01,
GROUP_ADMIN_SIGNATURE_VALIDATION = 0x02,
uint16_t mServiceId; // Id of the service using that identity, as understood by rsServiceControl
UsageCode mUsageCode; // Specific code to use. Will allow forming the correct translated message in the GUI if necessary.
RsGxsGroupId mGrpId; // Group ID using the identity
/** Not typically used, since most services do not require group author
* signatures */
GROUP_AUTHOR_SIGNATURE_CREATION = 0x03,
GROUP_AUTHOR_SIGNATURE_VALIDATION = 0x04,
RsGxsMessageId mMsgId; // Message ID using the identity
uint64_t mAdditionalId; // Some additional ID. Can be used for e.g. chat lobbies.
std::string mComment ; // additional comment to be used mainly for debugging, but not GUI display
/// most common use case. Messages are signed by authors in e.g. forums.
MESSAGE_AUTHOR_SIGNATURE_CREATION = 0x05,
MESSAGE_AUTHOR_SIGNATURE_VALIDATION = 0x06,
bool operator<(const RsIdentityUsage& u) const
{
return mHash < u.mHash ;
}
RsFileHash mHash ;
/** Identities are stamped regularly by crawlign the set of messages for
* all groups. That helps keepign the useful identities in hand. */
GROUP_AUTHOR_KEEP_ALIVE = 0x07,
MESSAGE_AUTHOR_KEEP_ALIVE = 0x08,
/** Chat lobby msgs are signed, so each time one comes, or a chat lobby
* event comes, a signature verificaiton happens. */
CHAT_LOBBY_MSG_VALIDATION = 0x09,
/// Global router message validation
GLOBAL_ROUTER_SIGNATURE_CHECK = 0x0a,
/// Global router message signature
GLOBAL_ROUTER_SIGNATURE_CREATION = 0x0b,
GXS_TUNNEL_DH_SIGNATURE_CHECK = 0x0c,
GXS_TUNNEL_DH_SIGNATURE_CREATION = 0x0d,
/// Group update on that identity data. Can be avatar, name, etc.
IDENTITY_DATA_UPDATE = 0x0e,
/// Any signature verified for that identity
IDENTITY_GENERIC_SIGNATURE_CHECK = 0x0f,
/// Any signature made by that identity
IDENTITY_GENERIC_SIGNATURE_CREATION = 0x10,
IDENTITY_GENERIC_ENCRYPTION = 0x11,
IDENTITY_GENERIC_DECRYPTION = 0x12,
CIRCLE_MEMBERSHIP_CHECK = 0x13
} ;
RsIdentityUsage( uint16_t service, const RsIdentityUsage::UsageCode& code,
const RsGxsGroupId& gid = RsGxsGroupId(),
const RsGxsMessageId& mid = RsGxsMessageId(),
uint64_t additional_id=0,
const std::string& comment = std::string() );
/// Id of the service using that identity, as understood by rsServiceControl
uint16_t mServiceId;
/** Specific code to use. Will allow forming the correct translated message
* in the GUI if necessary. */
UsageCode mUsageCode;
/// Group ID using the identity
RsGxsGroupId mGrpId;
/// Message ID using the identity
RsGxsMessageId mMsgId;
/// Some additional ID. Can be used for e.g. chat lobbies.
uint64_t mAdditionalId;
/// additional comment to be used mainly for debugging, but not GUI display
std::string mComment;
bool operator<(const RsIdentityUsage& u) const { return mHash < u.mHash; }
RsFileHash mHash ;
/// @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{
RS_SERIAL_PROCESS(mServiceId);
RS_SERIAL_PROCESS(mUsageCode);
RS_SERIAL_PROCESS(mGrpId);
RS_SERIAL_PROCESS(mMsgId);
RS_SERIAL_PROCESS(mAdditionalId);
RS_SERIAL_PROCESS(mComment);
RS_SERIAL_PROCESS(mHash);
}
friend struct RsTypeSerializer;
private:
/** Accessible only to friend class RsTypeSerializer needed for
* deserialization */
RsIdentityUsage();
};
class RsIdentityDetails
struct RsIdentityDetails : RsSerializable
{
public:
RsIdentityDetails()
: mFlags(0), mLastUsageTS(0) { return; }
RsIdentityDetails() : mFlags(0), mLastUsageTS(0) {}
RsGxsId mId;
// identity details.
std::string mNickname;
uint32_t mFlags ;
uint32_t mFlags;
// PGP Stuff.
RsPgpId mPgpId;
RsPgpId mPgpId;
// Recogn details.
std::list<RsRecognTag> mRecognTags;
/// @deprecated Recogn details.
RS_DEPRECATED std::list<RsRecognTag> mRecognTags;
// Cyril: Reputation details. At some point we might want to merge information
// between the two into a single global score. Since the old reputation system
// is not finished yet, I leave this in place. We should decide what to do with it.
RsReputations::ReputationInfo mReputation;
/** Cyril: Reputation details. At some point we might want to merge
* information between the two into a single global score. Since the old
* reputation system is not finished yet, I leave this in place. We should
* decide what to do with it.
*/
RsReputations::ReputationInfo mReputation;
// avatar
RsGxsImage mAvatar ;
RsGxsImage mAvatar;
// last usage
time_t mLastUsageTS ;
std::map<RsIdentityUsage,time_t> mUseCases ;
time_t mLastUsageTS;
std::map<RsIdentityUsage,time_t> mUseCases;
/// @see RsSerializable
virtual void serial_process(RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx)
{
RS_SERIAL_PROCESS(mId);
RS_SERIAL_PROCESS(mNickname);
RS_SERIAL_PROCESS(mFlags);
RS_SERIAL_PROCESS(mPgpId);
//RS_SERIAL_PROCESS(mReputation);
//RS_SERIAL_PROCESS(mAvatar);
RS_SERIAL_PROCESS(mLastUsageTS);
RS_SERIAL_PROCESS(mUseCases);
}
};
class RsIdentity: public RsGxsIfaceHelper
struct RsIdentity : RsGxsIfaceHelper
{
public:
explicit RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
virtual ~RsIdentity() {}

View file

@ -61,14 +61,17 @@
/* TODO CLEANUP: RS_TOKREQ_ANSTYPE_* values are meaningless and not used by
* RsTokenService or its implementation, and may be arbitrarly defined by each
* GXS client as they are of no usage, their use is deprecated */
* GXS client as they are of no usage, their use is deprecated, up until the
* definitive cleanup is done new code must use RS_DEPRECATED_TOKREQ_ANSTYPE for
* easier cleanup. */
#ifndef RS_NO_WARN_DEPRECATED
# warning RS_TOKREQ_ANSTYPE_* macros are deprecated!
#endif
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
#define RS_DEPRECATED_TOKREQ_ANSTYPE 0x0000
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
/*!

View file

@ -36,6 +36,8 @@
#include <retroshare/rsids.h>
#include <retroshare/rsflags.h>
#include <serialiser/rsserializable.h>
#include <serialiser/rstypeserializer.h>
#define USE_NEW_CHUNK_CHECKING_CODE
@ -118,13 +120,21 @@ class Condition
std::string name;
};
class PeerBandwidthLimits
struct PeerBandwidthLimits : RsSerializable
{
public:
PeerBandwidthLimits() : max_up_rate_kbs(0), max_dl_rate_kbs(0) {}
uint32_t max_up_rate_kbs ;
uint32_t max_dl_rate_kbs ;
PeerBandwidthLimits() : max_up_rate_kbs(0), max_dl_rate_kbs(0) {}
uint32_t max_up_rate_kbs;
uint32_t max_dl_rate_kbs;
/// @see RsSerializable
void serial_process(RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx)
{
RS_SERIAL_PROCESS(max_up_rate_kbs);
RS_SERIAL_PROCESS(max_dl_rate_kbs);
}
};
//class SearchRequest // unused stuff.
@ -295,7 +305,7 @@ class FileChunksInfo
std::map<uint32_t, std::vector<SliceInfo> > pending_slices ;
};
class CompressedChunkMap
class CompressedChunkMap : public RsSerializable
{
public:
CompressedChunkMap() {}
@ -345,10 +355,16 @@ class CompressedChunkMap
inline void set(uint32_t j) { _map[j >> 5] |= (1 << (j & 31)) ; }
inline void reset(uint32_t j) { _map[j >> 5] &= ~(1 << (j & 31)) ; }
/// compressed map, one bit per chunk
std::vector<uint32_t> _map ;
/// compressed map, one bit per chunk
std::vector<uint32_t> _map;
/// @see RsSerializable
void serial_process(RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx)
{ RS_SERIAL_PROCESS(_map); }
};
template<class CRCTYPE> class t_CRCMap
{
public: