mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
Merged Code from: /branches/v0.5-new_cache_system/ into main trunk.
- Revisions 4771 => 5334 * This merge brings a lot of unfinished code for GXS (new cache system) - See branch commits for more details. * Code is disabled, and should have minimal effect on trunk build. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5338 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
bec1407648
170 changed files with 44564 additions and 11756 deletions
27
libretroshare/src/serialiser/rsgxsitem.h
Normal file
27
libretroshare/src/serialiser/rsgxsitem.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef RSGXSITEM_H
|
||||
#define RSGXSITEM_H
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
|
||||
class RsGxsGrpItem : RsItem
|
||||
{
|
||||
|
||||
RsGxsItem() : RsItem(0) { return; }
|
||||
virtual ~RsGxsItem();
|
||||
|
||||
};
|
||||
|
||||
class RsGxsMsgItem : RsItem
|
||||
{
|
||||
|
||||
RsGxsItem() : RsItem(0) { return; }
|
||||
virtual ~RsGxsItem();
|
||||
|
||||
};
|
||||
|
||||
#endif // RSGXSITEM_H
|
40
libretroshare/src/serialiser/rsgxsitems.cc
Normal file
40
libretroshare/src/serialiser/rsgxsitems.cc
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* rsgxsitems.cc
|
||||
*
|
||||
* Created on: 26 Jul 2012
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
|
||||
#include "rsgxsitems.h"
|
||||
#include "gxs/rsgxsdata.h"
|
||||
|
||||
void RsMsgMetaData::operator =(const RsGxsMsgMetaData& rGxsMeta)
|
||||
{
|
||||
this->mAuthorId = rGxsMeta.mAuthorId;
|
||||
this->mChildTs = rGxsMeta.mChildTs;
|
||||
this->mGroupId = rGxsMeta.mGroupId;
|
||||
this->mMsgFlags = rGxsMeta.mMsgFlags;
|
||||
this->mMsgId = rGxsMeta.mMsgId;
|
||||
this->mMsgName = rGxsMeta.mMsgName;
|
||||
this->mMsgStatus = rGxsMeta.mMsgStatus;
|
||||
this->mOrigMsgId = rGxsMeta.mOrigMsgId;
|
||||
this->mParentId = rGxsMeta.mParentId;
|
||||
this->mPublishTs = rGxsMeta.mPublishTs;
|
||||
this->mThreadId = rGxsMeta.mThreadId;
|
||||
}
|
||||
|
||||
|
||||
void RsGroupMetaData::operator =(const RsGxsGrpMetaData& rGxsMeta)
|
||||
{
|
||||
this->mAuthorId = rGxsMeta.mAuthorId;
|
||||
this->mGroupFlags = rGxsMeta.mGroupFlags;
|
||||
this->mGroupId = rGxsMeta.mGroupId;
|
||||
this->mGroupStatus = rGxsMeta.mGroupStatus;
|
||||
this->mLastPost = rGxsMeta.mLastPost;
|
||||
this->mMsgCount = rGxsMeta.mMsgCount;
|
||||
this->mPop = rGxsMeta.mPop;
|
||||
this->mPublishTs = rGxsMeta.mPublishTs;
|
||||
this->mSubscribeFlags = rGxsMeta.mSubscribeFlags;
|
||||
this->mGroupName = rGxsMeta.mGroupName;
|
||||
}
|
155
libretroshare/src/serialiser/rsgxsitems.h
Normal file
155
libretroshare/src/serialiser/rsgxsitems.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
#ifndef RSGXSITEMS_H
|
||||
#define RSGXSITEMS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rsgxsitems.h
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2012 Christopher Evi-Parker, Robert Fernie.
|
||||
*
|
||||
* 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/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
class RsGxsGrpMetaData;
|
||||
class RsGxsMsgMetaData;
|
||||
|
||||
class RsGroupMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
RsGroupMetaData()
|
||||
{
|
||||
mGroupFlags = 0;
|
||||
mSubscribeFlags = 0;
|
||||
|
||||
mPop = 0;
|
||||
mMsgCount = 0;
|
||||
mLastPost = 0;
|
||||
mGroupStatus = 0;
|
||||
|
||||
//mPublishTs = 0;
|
||||
}
|
||||
|
||||
void operator =(const RsGxsGrpMetaData& rGxsMeta);
|
||||
// {
|
||||
// this->mAuthorId = rGxsMeta.mAuthorId;
|
||||
// this->mGroupFlags = rGxsMeta.mGroupFlags;
|
||||
// this->mGroupId = rGxsMeta.mGroupId;
|
||||
// this->mGroupStatus = rGxsMeta.mGroupStatus;
|
||||
// this->mLastPost = rGxsMeta.mLastPost;
|
||||
// this->mMsgCount = rGxsMeta.mMsgCount;
|
||||
// this->mPop = rGxsMeta.mPop;
|
||||
// this->mPublishTs = rGxsMeta.mPublishTs;
|
||||
// this->mSubscribeFlags = rGxsMeta.mSubscribeFlags;
|
||||
// this->mGroupName = rGxsMeta.mGroupName;
|
||||
// }
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mGroupName;
|
||||
uint32_t mGroupFlags;
|
||||
|
||||
time_t mPublishTs; // Mandatory.
|
||||
std::string mAuthorId; // Optional.
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
|
||||
uint32_t mSubscribeFlags;
|
||||
|
||||
uint32_t mPop; // HOW DO WE DO THIS NOW.
|
||||
uint32_t mMsgCount; // ???
|
||||
time_t mLastPost; // ???
|
||||
|
||||
uint32_t mGroupStatus;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class RsMsgMetaData
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgMetaData()
|
||||
{
|
||||
mPublishTs = 0;
|
||||
mMsgFlags = 0;
|
||||
mMsgStatus = 0;
|
||||
mChildTs = 0;
|
||||
}
|
||||
|
||||
void operator =(const RsGxsMsgMetaData& rGxsMeta);
|
||||
|
||||
|
||||
std::string mGroupId;
|
||||
std::string mMsgId;
|
||||
|
||||
std::string mThreadId;
|
||||
std::string mParentId;
|
||||
std::string mOrigMsgId;
|
||||
|
||||
std::string mAuthorId;
|
||||
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
|
||||
uint32_t mMsgFlags; // Whats this for?
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
uint32_t mMsgStatus;
|
||||
time_t mChildTs;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class RsGxsGrpItem : public RsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsGxsGrpItem() : RsItem(0) { return; }
|
||||
virtual ~RsGxsGrpItem(){}
|
||||
|
||||
RsGroupMetaData meta;
|
||||
|
||||
};
|
||||
|
||||
class RsGxsMsgItem : public RsItem
|
||||
{
|
||||
|
||||
public:
|
||||
RsGxsMsgItem() : RsItem(0) { return; }
|
||||
virtual ~RsGxsMsgItem(){}
|
||||
|
||||
RsMsgMetaData meta;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // RSGXSITEMS_H
|
1299
libretroshare/src/serialiser/rsnxsitems.cc
Normal file
1299
libretroshare/src/serialiser/rsnxsitems.cc
Normal file
File diff suppressed because it is too large
Load diff
462
libretroshare/src/serialiser/rsnxsitems.h
Normal file
462
libretroshare/src/serialiser/rsnxsitems.h
Normal file
|
@ -0,0 +1,462 @@
|
|||
#ifndef RSNXSITEMS_H
|
||||
#define RSNXSITEMS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rsnxssitems.h
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2012 Christopher Evi-Parker, Robert Fernie.
|
||||
*
|
||||
* 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 <map>
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
#include "gxs/rsgxsdata.h"
|
||||
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_GRP = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM = 0x0002;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_GRP = 0x0004;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM = 0x0008;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_MSG = 0x0010;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_MSG = 0x0020;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_TRANS = 0x0040;
|
||||
|
||||
|
||||
// possibility create second service to deal with this functionality
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_EXTENDED = 0x0080; // in order to extend supported pkt subtypes
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_SEARCH_GRP = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_SEARCH_MSG = 0x0002;
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_DELETE_GRP = 0x0004;
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_DELETE_MSG = 0x0008;
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_SEARCH_REQ = 0x0010;
|
||||
|
||||
|
||||
/*!
|
||||
* Base class for Network exchange service
|
||||
* Main purpose is for rtti based routing used in the
|
||||
* serialisation and deserialisation of NXS packets
|
||||
*
|
||||
* Service type is set by plugin service
|
||||
*/
|
||||
class RsNxsItem : public RsItem
|
||||
{
|
||||
|
||||
public:
|
||||
RsNxsItem(uint16_t servtype, uint8_t subtype)
|
||||
: RsItem(RS_PKT_VERSION_SERVICE, servtype, subtype), transactionNumber(0) { return; }
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0) = 0;
|
||||
|
||||
uint32_t transactionNumber; // set to zero if this is not a transaction item
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Use to request grp list from peer
|
||||
* Server may advise client peer to use sync file
|
||||
* while serving his request. This results
|
||||
*/
|
||||
class RsNxsSyncGrp : public RsNxsItem {
|
||||
|
||||
public:
|
||||
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
static const uint8_t FLAG_ONLY_CURRENT; // only send most current version of grps / ignores sync hash
|
||||
|
||||
RsNxsSyncGrp(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP) { clear(); return;}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
uint8_t flag; // advises whether to use sync hash
|
||||
uint32_t syncAge; // how far back to sync data
|
||||
std::string syncHash; // use to determine if changes that have occured since last hash
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* This RsNxsItem is for use in enabling transactions
|
||||
* in order to guaranttee a collection of item have been
|
||||
* received
|
||||
*/
|
||||
class RsNxsTransac : public RsNxsItem {
|
||||
|
||||
public:
|
||||
|
||||
static const uint16_t FLAG_STATE_MASK = 0xff;
|
||||
static const uint16_t FLAG_TYPE_MASK = 0xff00;
|
||||
|
||||
/** transaction state **/
|
||||
static const uint16_t FLAG_BEGIN_P1;
|
||||
static const uint16_t FLAG_BEGIN_P2;
|
||||
static const uint16_t FLAG_END_SUCCESS;
|
||||
static const uint16_t FLAG_CANCEL;
|
||||
static const uint16_t FLAG_END_FAIL_NUM;
|
||||
static const uint16_t FLAG_END_FAIL_TIMEOUT;
|
||||
static const uint16_t FLAG_END_FAIL_FULL;
|
||||
|
||||
|
||||
/** transaction type **/
|
||||
static const uint16_t FLAG_TYPE_GRP_LIST_RESP;
|
||||
static const uint16_t FLAG_TYPE_MSG_LIST_RESP;
|
||||
static const uint16_t FLAG_TYPE_GRP_LIST_REQ;
|
||||
static const uint16_t FLAG_TYPE_MSG_LIST_REQ;
|
||||
static const uint16_t FLAG_TYPE_GRPS;
|
||||
static const uint16_t FLAG_TYPE_MSGS;
|
||||
|
||||
RsNxsTransac(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_TRANS) { clear(); return; }
|
||||
virtual ~RsNxsTransac() { return ; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
uint16_t transactFlag;
|
||||
uint32_t nItems;
|
||||
uint32_t timestamp;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Use to send to peer list of grps
|
||||
* held by server peer
|
||||
*/
|
||||
class RsNxsSyncGrpItem : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint8_t FLAG_REQUEST;
|
||||
static const uint8_t FLAG_RESPONSE;
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
|
||||
RsNxsSyncGrpItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM) { clear(); return ; }
|
||||
virtual ~RsNxsSyncGrpItem() { return; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
|
||||
uint8_t flag; // request or response
|
||||
|
||||
uint32_t publishTs; // to compare to Ts of receiving peer's grp of same id
|
||||
|
||||
/// grpId of grp held by sending peer
|
||||
std::string grpId;
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Contains serialised group items
|
||||
* Each item corresponds to a group which needs to be
|
||||
* deserialised
|
||||
*/
|
||||
class RsNxsGrp : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsNxsGrp(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP), grp(servtype), meta(servtype),
|
||||
metaData(NULL) { clear(); return; }
|
||||
virtual ~RsNxsGrp() { if(metaData) delete metaData; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
std::string grpId; /// group Id, needed to complete version Id (ncvi)
|
||||
|
||||
RsTlvBinaryData grp; /// actual group data
|
||||
|
||||
/*!
|
||||
* This should contains all the data
|
||||
* which is not specific to the Gxs service data
|
||||
*/
|
||||
RsTlvBinaryData meta;
|
||||
|
||||
// deserialised metaData, this is not serialised
|
||||
RsGxsGrpMetaData* metaData;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Use to request list of msg held by peer
|
||||
* for a given group
|
||||
*/
|
||||
class RsNxsSyncMsg : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
|
||||
RsNxsSyncMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG) { clear(); return; }
|
||||
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
std::string grpId;
|
||||
uint8_t flag;
|
||||
uint32_t syncAge;
|
||||
std::string syncHash;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Use to send list msgs for a group held by
|
||||
* a peer
|
||||
*/
|
||||
class RsNxsSyncMsgItem : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
static const uint8_t FLAG_REQUEST;
|
||||
static const uint8_t FLAG_RESPONSE;
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
RsNxsSyncMsgItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM) { clear(); return; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
uint8_t flag; // response/req
|
||||
std::string grpId;
|
||||
std::string msgId;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Used to respond to a RsGrpMsgsReq
|
||||
* with message items satisfying request
|
||||
*/
|
||||
class RsNxsMsg : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG), msg(servtype), meta(servtype) { clear(); return; }
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
std::string grpId; /// group id, forms part of version id
|
||||
std::string msgId; /// msg id
|
||||
|
||||
/*!
|
||||
* This should contains all the data
|
||||
* which is not specific to the Gxs service data
|
||||
*/
|
||||
RsTlvBinaryData meta;
|
||||
|
||||
/*!
|
||||
* This contains Gxs specific data
|
||||
* only client of API knows who to decode this
|
||||
*/
|
||||
RsTlvBinaryData msg;
|
||||
|
||||
RsGxsMsgMetaData* metaData;
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Used to request a search of user data
|
||||
*/
|
||||
class RsNxsSearchReq : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchReq(uint16_t servtype): RsNxsItem(servtype, RS_PKT_SUBTYPE_EXT_SEARCH_REQ), serviceSearchItem(servtype) { return; }
|
||||
virtual ~RsNxsSearchReq() { return;}
|
||||
|
||||
virtual void clear() { return;}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) { return out; }
|
||||
|
||||
uint8_t nHops; /// how many peers to jump to
|
||||
uint32_t token; // search token
|
||||
RsTlvBinaryData serviceSearchItem; // service aware of item class
|
||||
uint32_t expiration; // expiration date
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* used to extend data types processed
|
||||
*/
|
||||
class RsNxsExtended : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsNxsExtended(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_EXTENDED), extData(servtype) { return; }
|
||||
virtual ~RsNxsExtended() { return; }
|
||||
|
||||
virtual void clear() {}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
RsTlvBinaryData extData;
|
||||
uint32_t type;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Used to respond to a RsGrpSearchReq
|
||||
* with grpId/MsgIds that satisfy search request
|
||||
*/
|
||||
class RsNxsSearchResultMsg
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchResultMsg() : context(0) { return;}
|
||||
void clear() {}
|
||||
std::ostream &print(std::ostream &out, uint16_t indent) { return out; }
|
||||
|
||||
uint32_t token; // search token to be redeemed
|
||||
RsTlvBinaryData context; // used by client service
|
||||
std::string msgId;
|
||||
std::string grpId;
|
||||
RsTlvKeySignature idSign;
|
||||
|
||||
uint32_t expiration; // expiration date
|
||||
};
|
||||
|
||||
/*!
|
||||
* Used to respond to a RsGrpSearchReq
|
||||
* with grpId/MsgIds that satisfy search request
|
||||
*/
|
||||
class RsNxsSearchResultGrp
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchResultGrp();
|
||||
void clear() {}
|
||||
std::ostream &print(std::ostream &out, uint16_t indent) { return out; }
|
||||
|
||||
uint32_t token; // search token to be redeemed
|
||||
|
||||
RsTlvBinaryData context; // used by client service
|
||||
|
||||
std::string grpId;
|
||||
RsTlvKeySignature adminSign;
|
||||
|
||||
uint32_t expiration; // expiration date
|
||||
};
|
||||
|
||||
|
||||
class RsNxsDeleteMsg
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsDeleteMsg() { return; }
|
||||
|
||||
std::string msgId;
|
||||
std::string grpId;
|
||||
RsTlvKeySignature deleteSign; // ( msgId + grpId + msg data ) sign //TODO: add warning not to place msgId+grpId in msg!
|
||||
|
||||
};
|
||||
|
||||
class RsNxsDeleteGrp
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsDeleteGrp() { return;}
|
||||
|
||||
std::string grpId;
|
||||
RsTlvKeySignature idSign;
|
||||
RsTlvKeySignature deleteSign; // (grpId + grp data) sign // TODO: add warning not to place grpId in msg
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RsNxsSerialiser : public RsSerialType
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSerialiser(uint16_t servtype) :
|
||||
RsSerialType(RS_PKT_VERSION_SERVICE, servtype), SERVICE_TYPE(servtype) { return; }
|
||||
|
||||
virtual ~RsNxsSerialiser() { return; }
|
||||
|
||||
virtual uint32_t size(RsItem *item);
|
||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size);
|
||||
virtual RsItem* deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/* for RS_PKT_SUBTYPE_SYNC_GRP */
|
||||
|
||||
virtual uint32_t sizeNxsSyncGrp(RsNxsSyncGrp* item);
|
||||
virtual bool serialiseNxsSyncGrp(RsNxsSyncGrp *item, void *data, uint32_t *size);
|
||||
virtual RsNxsSyncGrp* deserialNxsSyncGrp(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_SYNC_GRP_ITEM */
|
||||
|
||||
virtual uint32_t sizeNxsSyncGrpItem(RsNxsSyncGrpItem* item);
|
||||
virtual bool serialiseNxsSyncGrpItem(RsNxsSyncGrpItem *item, void *data, uint32_t *size);
|
||||
virtual RsNxsSyncGrpItem* deserialNxsSyncGrpItem(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_NXS_GRP */
|
||||
|
||||
virtual uint32_t sizeNxsGrp(RsNxsGrp* item);
|
||||
virtual bool serialiseNxsGrp(RsNxsGrp *item, void *data, uint32_t *size);
|
||||
virtual RsNxsGrp* deserialNxsGrp(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_SYNC_MSG */
|
||||
|
||||
virtual uint32_t sizeNxsSyncMsg(RsNxsSyncMsg* item);
|
||||
virtual bool serialiseNxsSyncMsg(RsNxsSyncMsg *item, void *data, uint32_t *size);
|
||||
virtual RsNxsSyncMsg* deserialNxsSyncMsg(void *data, uint32_t *size);
|
||||
|
||||
/* RS_PKT_SUBTYPE_SYNC_MSG_ITEM */
|
||||
|
||||
virtual uint32_t sizeNxsSyncMsgItem(RsNxsSyncMsgItem* item);
|
||||
virtual bool serialiseNxsSynMsgItem(RsNxsSyncMsgItem* item, void *data, uint32_t* size);
|
||||
virtual RsNxsSyncMsgItem* deserialNxsSyncMsgItem(void *data, uint32_t *size);
|
||||
|
||||
/* RS_PKT_SUBTYPE_NXS_MSG */
|
||||
|
||||
virtual uint32_t sizeNxsMsg(RsNxsMsg* item);
|
||||
virtual bool serialiseNxsMsg(RsNxsMsg* item, void* data, uint32_t* size);
|
||||
virtual RsNxsMsg* deserialNxsMsg(void *data, uint32_t *size);
|
||||
|
||||
/* RS_PKT_SUBTYPE_NXS_TRANS */
|
||||
virtual uint32_t sizeNxsTrans(RsNxsTransac* item);
|
||||
virtual bool serialiseNxsTrans(RsNxsTransac* item, void* data, uint32_t* size);
|
||||
virtual RsNxsTransac* deserialNxsTrans(void* data, uint32_t *size);
|
||||
|
||||
/* RS_PKT_SUBTYPE_EXTENDED */
|
||||
virtual RsNxsExtended* deserialNxsExtended(void* data, uint32_t *size);
|
||||
virtual uint32_t sizeNxsExtended(RsNxsExtended* item);
|
||||
virtual bool serialiseNxsExtended(RsNxsExtended* item, void* data, uint32_t* size);
|
||||
|
||||
private:
|
||||
|
||||
const uint16_t SERVICE_TYPE;
|
||||
};
|
||||
|
||||
|
||||
#endif // RSNXSITEMS_H
|
45
libretroshare/src/serialiser/rsphotov2items.cc
Normal file
45
libretroshare/src/serialiser/rsphotov2items.cc
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* rsphotov2items.cc
|
||||
*
|
||||
* Created on: 22 Jul 2012
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
#include "rsphotov2items.h"
|
||||
|
||||
|
||||
|
||||
|
||||
uint32_t RsGxsPhotoSerialiser::size(RsItem* item) {
|
||||
|
||||
}
|
||||
|
||||
bool RsGxsPhotoSerialiser::serialise(RsItem* item, void* data, uint32_t* size) {
|
||||
}
|
||||
|
||||
RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size) {
|
||||
}
|
||||
|
||||
uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item, void* data,
|
||||
uint32_t* size) {
|
||||
}
|
||||
|
||||
RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* data,
|
||||
uint32_t* size) {
|
||||
}
|
||||
|
||||
uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item) {
|
||||
}
|
||||
|
||||
bool RsGxsPhotoSerialiser::serialiseGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item, void* data,
|
||||
uint32_t* size) {
|
||||
}
|
||||
|
||||
RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* data,
|
||||
uint32_t* size) {
|
||||
}
|
80
libretroshare/src/serialiser/rsphotov2items.h
Normal file
80
libretroshare/src/serialiser/rsphotov2items.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* libretroshare/src/retroshare: rsphoto.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Christopher Evi-Parker, Robert Fernie
|
||||
*
|
||||
* 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".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RSPHOTOV2ITEMS_H_
|
||||
#define RSPHOTOV2ITEMS_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
|
||||
#include "rsgxsitems.h"
|
||||
#include "retroshare/rsphotoV2.h"
|
||||
|
||||
|
||||
class RsGxsPhotoAlbumItem : public RsGxsGrpItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsGxsPhotoAlbumItem() {}
|
||||
RsPhotoAlbum album;
|
||||
};
|
||||
|
||||
class RsGxsPhotoPhotoItem : public RsGxsMsgItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsGxsPhotoPhotoItem() {}
|
||||
RsPhotoPhoto photo;
|
||||
};
|
||||
|
||||
class RsGxsPhotoSerialiser : public RsSerialType
|
||||
{
|
||||
RsGxsPhotoSerialiser()
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PHOTO)
|
||||
{ return; }
|
||||
virtual ~RsGxsPhotoSerialiser() { return; }
|
||||
|
||||
uint32_t size(RsItem *item);
|
||||
bool serialise (RsItem *item, void *data, uint32_t *size);
|
||||
RsItem * deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
uint32_t sizeGxsPhotoAlbumItem(RsGxsPhotoAlbumItem *item);
|
||||
bool serialiseGxsPhotoAlbumItem (RsGxsPhotoAlbumItem *item, void *data, uint32_t *size);
|
||||
RsGxsPhotoAlbumItem * deserialiseGxsPhotoAlbumItem(void *data, uint32_t *size);
|
||||
|
||||
uint32_t sizeGxsPhotoPhotoItem(RsGxsPhotoPhotoItem *item);
|
||||
bool serialiseGxsPhotoPhotoItem (RsGxsPhotoPhotoItem *item, void *data, uint32_t *size);
|
||||
RsGxsPhotoPhotoItem * deserialiseGxsPhotoPhotoItem(void *data, uint32_t *size);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* RSPHOTOV2ITEMS_H_ */
|
|
@ -61,7 +61,11 @@ const uint16_t RS_SERVICE_TYPE_CHANNEL_SOCKET = 0xf140;
|
|||
/* Status - Service only */
|
||||
const uint16_t RS_SERVICE_TYPE_STATUS = 0xf020;
|
||||
|
||||
/* Combined Cache/Service ids */
|
||||
/***************** IDS ALLOCATED FOR PLUGINS ******************/
|
||||
|
||||
const uint16_t RS_SERVICE_TYPE_PLUGIN_ARADO_ID = 0x0401;
|
||||
const uint16_t RS_SERVICE_TYPE_PLUGIN_QCHESS_ID = 0x0402;
|
||||
|
||||
|
||||
/****************** BELOW ARE ONLY THEORETICAL (CAN BE CHANGED) *****/
|
||||
/*
|
||||
|
@ -85,12 +89,17 @@ const uint16_t RS_SERVICE_TYPE_STATUS = 0xf020;
|
|||
/*! for Qblog service (Cache Only) */
|
||||
const uint16_t RS_SERVICE_TYPE_QBLOG = 0xf010;
|
||||
|
||||
/* TEST VOIP - Service only */
|
||||
// NOT SURE WHATS HAPPENING WITH THIS ONE?
|
||||
// SHOULD BE DEFINED IN PLUGIN SECTION!
|
||||
//const uint16_t RS_SERVICE_TYPE_VOIP = 0xf011;
|
||||
|
||||
/* Status - Service only */
|
||||
//const uint16_t RS_SERVICE_TYPE_STATUS = 0xf020;
|
||||
|
||||
/* Proxy - Service only */
|
||||
const uint16_t RS_SERVICE_TYPE_PROXY = 0xf030;
|
||||
|
||||
/* Photo - Cache Only */
|
||||
const uint16_t RS_SERVICE_TYPE_PHOTO = 0xf040;
|
||||
|
||||
/* DSDV Testing at the moment - Service Only */
|
||||
const uint16_t RS_SERVICE_TYPE_DSDV = 0xf050;
|
||||
|
||||
|
@ -98,6 +107,19 @@ const uint16_t RS_SERVICE_TYPE_DSDV = 0xf050;
|
|||
const uint16_t RS_SERVICE_TYPE_BWCTRL = 0xf060;
|
||||
|
||||
|
||||
/* New Cache Services */
|
||||
const uint16_t RS_SERVICE_TYPE_IDENTITY = 0xf100;
|
||||
const uint16_t RS_SERVICE_TYPE_PHOTO = 0xf101;
|
||||
const uint16_t RS_SERVICE_TYPE_WIKI = 0xf102;
|
||||
const uint16_t RS_SERVICE_TYPE_WIRE = 0xf103;
|
||||
const uint16_t RS_SERVICE_TYPE_FORUMSV2 = 0xf104;
|
||||
const uint16_t RS_SERVICE_TYPE_POSTED = 0xf105;
|
||||
|
||||
//const uint16_t RS_SERVICE_TYPE_DISTRIB = 0xf110;
|
||||
//const uint16_t RS_SERVICE_TYPE_FORUM = 0xf120;
|
||||
//const uint16_t RS_SERVICE_TYPE_CHANNEL = 0xf130;
|
||||
//const uint16_t RS_SERVICE_TYPE_CHANNEL_SOCKET = 0xf140;
|
||||
|
||||
/* Games/External Apps - Service Only */
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_LAUNCHER = 0xf200;
|
||||
const uint16_t RS_SERVICE_TYPE_PORT = 0xf201;
|
||||
|
@ -111,8 +133,17 @@ const uint16_t RS_SERVICE_TYPE_GAME_QGO = 0xf212;
|
|||
const uint16_t RS_SERVICE_TYPE_GAME_BIGTWO = 0xf213;
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_POKER = 0xf214;
|
||||
|
||||
/* Rs Network Exchange Service */
|
||||
const uint16_t RS_SERVICE_TYPE_NXS = 0xf300;
|
||||
|
||||
|
||||
/***************** IDS ALLOCATED FOR PLUGINS ******************/
|
||||
|
||||
const uint16_t RS_SERVICE_TYPE_PLUGIN_ARADO_TEST_ID1 = 0xf401;
|
||||
const uint16_t RS_SERVICE_TYPE_PLUGIN_QCHESS_TEST_ID1 = 0xf402;
|
||||
|
||||
// test
|
||||
const uint16_t RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM = 0xf403;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -76,11 +76,22 @@ RsTlvBinaryData::RsTlvBinaryData(uint16_t t)
|
|||
return;
|
||||
}
|
||||
|
||||
RsTlvBinaryData::RsTlvBinaryData(const RsTlvBinaryData &b)
|
||||
: tlvtype(b.tlvtype), bin_data(NULL), bin_len(0) {
|
||||
|
||||
setBinData(b.bin_data, b.bin_len);
|
||||
}
|
||||
|
||||
RsTlvBinaryData::~RsTlvBinaryData()
|
||||
{
|
||||
TlvClear();
|
||||
}
|
||||
|
||||
void RsTlvBinaryData::operator =(const RsTlvBinaryData& b){
|
||||
|
||||
setBinData(b.bin_data, b.bin_len);
|
||||
tlvtype = b.tlvtype;
|
||||
}
|
||||
|
||||
/// used to allocate memory andinitialize binary data member
|
||||
bool RsTlvBinaryData::setBinData(const void *data, uint32_t size)
|
||||
|
|
|
@ -65,7 +65,9 @@ class RsTlvBinaryData: public RsTlvItem
|
|||
{
|
||||
public:
|
||||
RsTlvBinaryData(uint16_t t);
|
||||
virtual ~RsTlvBinaryData();
|
||||
RsTlvBinaryData(const RsTlvBinaryData& b); // as per rule of three
|
||||
void operator=(const RsTlvBinaryData& b); // as per rule of three
|
||||
virtual ~RsTlvBinaryData(); // as per rule of three
|
||||
virtual uint32_t TlvSize();
|
||||
virtual void TlvClear(); /*! Initialize fields to empty legal values ( "0", "", etc) */
|
||||
virtual void TlvShallowClear(); /*! Don't delete the binary data */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue