mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
changed serialisation methods to use c++ in rsnxsitems, added two new items for encrypted data, renamed classes RsNxsSyncGrp and RsNxsSyncMsg to RsNxsSyncGrp/MsgReqItem
This commit is contained in:
parent
0769dabb2e
commit
225e8f130b
@ -92,9 +92,9 @@ public:
|
||||
uint32_t mMaxVisibleCount ;
|
||||
};
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;
|
||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsNxsMsg*> > NxsMsgRelatedDataResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > GxsMsgResult; // <grpId, msgs>
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > GxsMsgResult; // <grpId, msgs>
|
||||
|
||||
/*!
|
||||
* The main role of GDS is the preparation and handing out of messages requested from
|
||||
|
@ -255,7 +255,7 @@ void RsGxsNetService::syncWithPeers()
|
||||
const RsGxsGrpUpdateItem *gui = cit->second;
|
||||
updateTS = gui->grpUpdateTS;
|
||||
}
|
||||
RsNxsSyncGrp *grp = new RsNxsSyncGrp(mServType);
|
||||
RsNxsSyncGrpReqItem *grp = new RsNxsSyncGrpReqItem(mServType);
|
||||
grp->clear();
|
||||
grp->PeerId(*sit);
|
||||
grp->updateTS = updateTS;
|
||||
@ -345,7 +345,7 @@ void RsGxsNetService::syncWithPeers()
|
||||
updateTS = cit2->second.time_stamp;
|
||||
}
|
||||
|
||||
RsNxsSyncMsg* msg = new RsNxsSyncMsg(mServType);
|
||||
RsNxsSyncMsgReqItem* msg = new RsNxsSyncMsgReqItem(mServType);
|
||||
msg->clear();
|
||||
msg->PeerId(peerId);
|
||||
msg->grpId = grpId;
|
||||
@ -945,9 +945,9 @@ void RsGxsNetService::recvNxsItemQueue()
|
||||
|
||||
switch(ni->PacketSubType())
|
||||
{
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP: handleRecvSyncGroup (dynamic_cast<RsNxsSyncGrp*>(ni)) ; break ;
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG: handleRecvSyncMessage (dynamic_cast<RsNxsSyncMsg*>(ni)) ; break ;
|
||||
case RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY: handleRecvPublishKeys (dynamic_cast<RsNxsGroupPublishKeyItem*>(ni)) ; break ;
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM: handleRecvSyncGroup (dynamic_cast<RsNxsSyncGrpReqItem*>(ni)) ; break ;
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM: handleRecvSyncMessage (dynamic_cast<RsNxsSyncMsgReqItem*>(ni)) ; break ;
|
||||
case RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM: handleRecvPublishKeys (dynamic_cast<RsNxsGroupPublishKeyItem*>(ni)) ; break ;
|
||||
default:
|
||||
std::cerr << "Unhandled item subtype " << (uint32_t) ni->PacketSubType() << " in RsGxsNetService: " << std::endl; break;
|
||||
}
|
||||
@ -978,7 +978,7 @@ bool RsGxsNetService::handleTransaction(RsNxsItem* item)
|
||||
|
||||
const RsPeerId& peer = item->PeerId();
|
||||
|
||||
RsNxsTransac* transItem = dynamic_cast<RsNxsTransac*>(item);
|
||||
RsNxsTransacItem* transItem = dynamic_cast<RsNxsTransacItem*>(item);
|
||||
|
||||
// if this is a RsNxsTransac item process
|
||||
if(transItem)
|
||||
@ -1020,7 +1020,7 @@ bool RsGxsNetService::handleTransaction(RsNxsItem* item)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RsGxsNetService::locked_processTransac(RsNxsTransac* item)
|
||||
bool RsGxsNetService::locked_processTransac(RsNxsTransacItem *item)
|
||||
{
|
||||
|
||||
/*!
|
||||
@ -1042,7 +1042,7 @@ bool RsGxsNetService::locked_processTransac(RsNxsTransac* item)
|
||||
RsPeerId peer;
|
||||
|
||||
// for outgoing transaction use own id
|
||||
if(item->transactFlag & (RsNxsTransac::FLAG_BEGIN_P2 | RsNxsTransac::FLAG_END_SUCCESS))
|
||||
if(item->transactFlag & (RsNxsTransacItem::FLAG_BEGIN_P2 | RsNxsTransacItem::FLAG_END_SUCCESS))
|
||||
peer = mOwnId;
|
||||
else
|
||||
peer = item->PeerId();
|
||||
@ -1069,7 +1069,7 @@ bool RsGxsNetService::locked_processTransac(RsNxsTransac* item)
|
||||
}
|
||||
|
||||
// initiating an incoming transaction
|
||||
if(item->transactFlag & RsNxsTransac::FLAG_BEGIN_P1)
|
||||
if(item->transactFlag & RsNxsTransacItem::FLAG_BEGIN_P1)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " initiating Incoming transaction." << std::endl;
|
||||
@ -1105,7 +1105,7 @@ bool RsGxsNetService::locked_processTransac(RsNxsTransac* item)
|
||||
return true;
|
||||
// commencement item for outgoing transaction
|
||||
}
|
||||
else if(item->transactFlag & RsNxsTransac::FLAG_BEGIN_P2)
|
||||
else if(item->transactFlag & RsNxsTransacItem::FLAG_BEGIN_P2)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " initiating outgoign transaction." << std::endl;
|
||||
@ -1130,7 +1130,7 @@ bool RsGxsNetService::locked_processTransac(RsNxsTransac* item)
|
||||
return true;
|
||||
// end transac item for outgoing transaction
|
||||
}
|
||||
else if(item->transactFlag & RsNxsTransac::FLAG_END_SUCCESS)
|
||||
else if(item->transactFlag & RsNxsTransacItem::FLAG_END_SUCCESS)
|
||||
{
|
||||
|
||||
#ifdef NXS_NET_DEBUG
|
||||
@ -1423,9 +1423,9 @@ void RsGxsNetService::processTransactions()
|
||||
#endif
|
||||
|
||||
// send completion msg
|
||||
RsNxsTransac* trans = new RsNxsTransac(mServType);
|
||||
RsNxsTransacItem* trans = new RsNxsTransacItem(mServType);
|
||||
trans->clear();
|
||||
trans->transactFlag = RsNxsTransac::FLAG_END_SUCCESS;
|
||||
trans->transactFlag = RsNxsTransacItem::FLAG_END_SUCCESS;
|
||||
trans->transactionNumber = transN;
|
||||
trans->PeerId(tr->mTransaction->PeerId());
|
||||
sendItem(trans);
|
||||
@ -1448,10 +1448,10 @@ void RsGxsNetService::processTransactions()
|
||||
std::cerr << " setting state to Receiving" << std::endl;
|
||||
#endif
|
||||
// send item to tell peer your are ready to start
|
||||
RsNxsTransac* trans = new RsNxsTransac(mServType);
|
||||
RsNxsTransacItem* trans = new RsNxsTransacItem(mServType);
|
||||
trans->clear();
|
||||
trans->transactFlag = RsNxsTransac::FLAG_BEGIN_P2 |
|
||||
(tr->mTransaction->transactFlag & RsNxsTransac::FLAG_TYPE_MASK);
|
||||
trans->transactFlag = RsNxsTransacItem::FLAG_BEGIN_P2 |
|
||||
(tr->mTransaction->transactFlag & RsNxsTransacItem::FLAG_TYPE_MASK);
|
||||
trans->transactionNumber = transN;
|
||||
trans->PeerId(tr->mTransaction->PeerId());
|
||||
sendItem(trans);
|
||||
@ -1539,7 +1539,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
#endif
|
||||
// for a completed list response transaction
|
||||
// one needs generate requests from this
|
||||
if(flag & RsNxsTransac::FLAG_TYPE_MSG_LIST_RESP)
|
||||
if(flag & RsNxsTransacItem::FLAG_TYPE_MSG_LIST_RESP)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " type = msg list response." << std::endl;
|
||||
@ -1548,7 +1548,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
// generate request based on a peers response
|
||||
locked_genReqMsgTransaction(tr);
|
||||
|
||||
}else if(flag & RsNxsTransac::FLAG_TYPE_GRP_LIST_RESP)
|
||||
}else if(flag & RsNxsTransacItem::FLAG_TYPE_GRP_LIST_RESP)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " type = grp list response." << std::endl;
|
||||
@ -1557,7 +1557,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
locked_genReqGrpTransaction(tr);
|
||||
}
|
||||
// you've finished receiving request information now gen
|
||||
else if(flag & RsNxsTransac::FLAG_TYPE_MSG_LIST_REQ)
|
||||
else if(flag & RsNxsTransacItem::FLAG_TYPE_MSG_LIST_REQ)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " type = msg list request." << std::endl;
|
||||
@ -1565,7 +1565,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
#endif
|
||||
locked_genSendMsgsTransaction(tr);
|
||||
}
|
||||
else if(flag & RsNxsTransac::FLAG_TYPE_GRP_LIST_REQ)
|
||||
else if(flag & RsNxsTransacItem::FLAG_TYPE_GRP_LIST_REQ)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " type = grp list request." << std::endl;
|
||||
@ -1573,7 +1573,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
#endif
|
||||
locked_genSendGrpsTransaction(tr);
|
||||
}
|
||||
else if(flag & RsNxsTransac::FLAG_TYPE_GRPS)
|
||||
else if(flag & RsNxsTransacItem::FLAG_TYPE_GRPS)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " type = groups." << std::endl;
|
||||
@ -1630,7 +1630,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
|
||||
|
||||
}
|
||||
else if(flag & RsNxsTransac::FLAG_TYPE_MSGS)
|
||||
else if(flag & RsNxsTransacItem::FLAG_TYPE_MSGS)
|
||||
{
|
||||
|
||||
std::vector<RsNxsMsg*> msgs;
|
||||
@ -1699,7 +1699,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
return;
|
||||
}
|
||||
|
||||
void RsGxsNetService::locked_doMsgUpdateWork(const RsNxsTransac *nxsTrans, const RsGxsGroupId &grpId)
|
||||
void RsGxsNetService::locked_doMsgUpdateWork(const RsNxsTransacItem *nxsTrans, const RsGxsGroupId &grpId)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << "updating MsgUpdate time stamps for peerId=" << nxsTrans->PeerId() << ", grpId=" << grpId << std::endl;
|
||||
@ -1755,33 +1755,33 @@ void RsGxsNetService::locked_processCompletedOutgoingTrans(NxsTransaction* tr)
|
||||
{
|
||||
// for a completed list response transaction
|
||||
// one needs generate requests from this
|
||||
if(flag & RsNxsTransac::FLAG_TYPE_MSG_LIST_RESP)
|
||||
if(flag & RsNxsTransacItem::FLAG_TYPE_MSG_LIST_RESP)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " complete Sending Msg List Response, transN: " << tr->mTransaction->transactionNumber << std::endl;
|
||||
#endif
|
||||
}else if(flag & RsNxsTransac::FLAG_TYPE_GRP_LIST_RESP)
|
||||
}else if(flag & RsNxsTransacItem::FLAG_TYPE_GRP_LIST_RESP)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " complete Sending Grp Response, transN: " << tr->mTransaction->transactionNumber << std::endl;
|
||||
#endif
|
||||
}
|
||||
// you've finished sending a request so don't do anything
|
||||
else if( (flag & RsNxsTransac::FLAG_TYPE_MSG_LIST_REQ) ||
|
||||
(flag & RsNxsTransac::FLAG_TYPE_GRP_LIST_REQ) )
|
||||
else if( (flag & RsNxsTransacItem::FLAG_TYPE_MSG_LIST_REQ) ||
|
||||
(flag & RsNxsTransacItem::FLAG_TYPE_GRP_LIST_REQ) )
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " complete Sending Msg/Grp Request, transN: " << tr->mTransaction->transactionNumber << std::endl;
|
||||
#endif
|
||||
|
||||
}else if(flag & RsNxsTransac::FLAG_TYPE_GRPS)
|
||||
}else if(flag & RsNxsTransacItem::FLAG_TYPE_GRPS)
|
||||
{
|
||||
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " complete Sending Grp Data, transN: " << tr->mTransaction->transactionNumber << std::endl;
|
||||
#endif
|
||||
|
||||
}else if(flag & RsNxsTransac::FLAG_TYPE_MSGS)
|
||||
}else if(flag & RsNxsTransacItem::FLAG_TYPE_MSGS)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG
|
||||
std::cerr << " complete Sending Msg Data, transN: " << tr->mTransaction->transactionNumber << std::endl;
|
||||
@ -1808,9 +1808,9 @@ void RsGxsNetService::locked_pushMsgTransactionFromList(std::list<RsNxsItem*>& r
|
||||
std::cerr << " peerId = " << peerId << std::endl;
|
||||
std::cerr << " transN = " << transN << std::endl;
|
||||
#endif
|
||||
RsNxsTransac* transac = new RsNxsTransac(mServType);
|
||||
transac->transactFlag = RsNxsTransac::FLAG_TYPE_MSG_LIST_REQ
|
||||
| RsNxsTransac::FLAG_BEGIN_P1;
|
||||
RsNxsTransacItem* transac = new RsNxsTransacItem(mServType);
|
||||
transac->transactFlag = RsNxsTransacItem::FLAG_TYPE_MSG_LIST_REQ
|
||||
| RsNxsTransacItem::FLAG_BEGIN_P1;
|
||||
transac->timestamp = 0;
|
||||
transac->nItems = reqList.size();
|
||||
transac->PeerId(peerId);
|
||||
@ -1821,7 +1821,7 @@ void RsGxsNetService::locked_pushMsgTransactionFromList(std::list<RsNxsItem*>& r
|
||||
newTrans->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
// create transaction copy with your id to indicate
|
||||
// its an outgoing transaction
|
||||
newTrans->mTransaction = new RsNxsTransac(*transac);
|
||||
newTrans->mTransaction = new RsNxsTransacItem(*transac);
|
||||
newTrans->mTransaction->PeerId(mOwnId);
|
||||
sendItem(transac);
|
||||
|
||||
@ -2116,9 +2116,9 @@ void RsGxsNetService::locked_pushGrpTransactionFromList(
|
||||
std::cerr << " peerId = " << peerId << std::endl;
|
||||
std::cerr << " transN = " << transN << std::endl;
|
||||
#endif
|
||||
RsNxsTransac* transac = new RsNxsTransac(mServType);
|
||||
transac->transactFlag = RsNxsTransac::FLAG_TYPE_GRP_LIST_REQ
|
||||
| RsNxsTransac::FLAG_BEGIN_P1;
|
||||
RsNxsTransacItem* transac = new RsNxsTransacItem(mServType);
|
||||
transac->transactFlag = RsNxsTransacItem::FLAG_TYPE_GRP_LIST_REQ
|
||||
| RsNxsTransacItem::FLAG_BEGIN_P1;
|
||||
transac->timestamp = 0;
|
||||
transac->nItems = reqList.size();
|
||||
transac->PeerId(peerId);
|
||||
@ -2127,7 +2127,7 @@ void RsGxsNetService::locked_pushGrpTransactionFromList(
|
||||
newTrans->mItems = reqList;
|
||||
newTrans->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM;
|
||||
newTrans->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
newTrans->mTransaction = new RsNxsTransac(*transac);
|
||||
newTrans->mTransaction = new RsNxsTransacItem(*transac);
|
||||
newTrans->mTransaction->PeerId(mOwnId);
|
||||
sendItem(transac);
|
||||
if (!locked_addTransaction(newTrans))
|
||||
@ -2334,15 +2334,15 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
|
||||
if(mGrpServerUpdateItem)
|
||||
updateTS = mGrpServerUpdateItem->grpUpdateTS;
|
||||
|
||||
RsNxsTransac* ntr = new RsNxsTransac(mServType);
|
||||
RsNxsTransacItem* ntr = new RsNxsTransacItem(mServType);
|
||||
ntr->transactionNumber = transN;
|
||||
ntr->transactFlag = RsNxsTransac::FLAG_BEGIN_P1 |
|
||||
RsNxsTransac::FLAG_TYPE_GRPS;
|
||||
ntr->transactFlag = RsNxsTransacItem::FLAG_BEGIN_P1 |
|
||||
RsNxsTransacItem::FLAG_TYPE_GRPS;
|
||||
ntr->updateTS = updateTS;
|
||||
ntr->nItems = grps.size();
|
||||
ntr->PeerId(tr->mTransaction->PeerId());
|
||||
|
||||
newTr->mTransaction = new RsNxsTransac(*ntr);
|
||||
newTr->mTransaction = new RsNxsTransacItem(*ntr);
|
||||
newTr->mTransaction->PeerId(mOwnId);
|
||||
newTr->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
|
||||
@ -2530,15 +2530,15 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
|
||||
if(cit != mServerMsgUpdateMap.end())
|
||||
updateTS = cit->second->msgUpdateTS;
|
||||
|
||||
RsNxsTransac* ntr = new RsNxsTransac(mServType);
|
||||
RsNxsTransacItem* ntr = new RsNxsTransacItem(mServType);
|
||||
ntr->transactionNumber = transN;
|
||||
ntr->transactFlag = RsNxsTransac::FLAG_BEGIN_P1 |
|
||||
RsNxsTransac::FLAG_TYPE_MSGS;
|
||||
ntr->transactFlag = RsNxsTransacItem::FLAG_BEGIN_P1 |
|
||||
RsNxsTransacItem::FLAG_TYPE_MSGS;
|
||||
ntr->updateTS = updateTS;
|
||||
ntr->nItems = msgSize;
|
||||
ntr->PeerId(peerId);
|
||||
|
||||
newTr->mTransaction = new RsNxsTransac(*ntr);
|
||||
newTr->mTransaction = new RsNxsTransacItem(*ntr);
|
||||
newTr->mTransaction->PeerId(mOwnId);
|
||||
newTr->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
|
||||
@ -2603,15 +2603,15 @@ void RsGxsNetService::locked_pushGrpRespFromList(std::list<RsNxsItem*>& respList
|
||||
tr->mItems = respList;
|
||||
|
||||
tr->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM;
|
||||
RsNxsTransac* trItem = new RsNxsTransac(mServType);
|
||||
trItem->transactFlag = RsNxsTransac::FLAG_BEGIN_P1
|
||||
| RsNxsTransac::FLAG_TYPE_GRP_LIST_RESP;
|
||||
RsNxsTransacItem* trItem = new RsNxsTransacItem(mServType);
|
||||
trItem->transactFlag = RsNxsTransacItem::FLAG_BEGIN_P1
|
||||
| RsNxsTransacItem::FLAG_TYPE_GRP_LIST_RESP;
|
||||
trItem->nItems = respList.size();
|
||||
trItem->timestamp = 0;
|
||||
trItem->PeerId(peer);
|
||||
trItem->transactionNumber = transN;
|
||||
// also make a copy for the resident transaction
|
||||
tr->mTransaction = new RsNxsTransac(*trItem);
|
||||
tr->mTransaction = new RsNxsTransacItem(*trItem);
|
||||
tr->mTransaction->PeerId(mOwnId);
|
||||
tr->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
// signal peer to prepare for transaction
|
||||
@ -2619,7 +2619,7 @@ void RsGxsNetService::locked_pushGrpRespFromList(std::list<RsNxsItem*>& respList
|
||||
locked_addTransaction(tr);
|
||||
}
|
||||
|
||||
bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncGrp *item)
|
||||
bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncGrpReqItem *item)
|
||||
{
|
||||
// don't sync if you have no new updates for this peer
|
||||
|
||||
@ -2638,7 +2638,7 @@ bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncGrp *item)
|
||||
return true;
|
||||
}
|
||||
|
||||
void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrp* item)
|
||||
void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
@ -2971,7 +2971,7 @@ bool RsGxsNetService::checkCanRecvMsgFromPeer(const RsPeerId& sslId, const RsGxs
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsg *item)
|
||||
bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsgReqItem *item)
|
||||
{
|
||||
ServerMsgMap::const_iterator cit = mServerMsgUpdateMap.find(item->grpId);
|
||||
|
||||
@ -2990,7 +2990,7 @@ bool RsGxsNetService::locked_CanReceiveUpdate(const RsNxsSyncMsg *item)
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item)
|
||||
void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
@ -3106,15 +3106,15 @@ void RsGxsNetService::locked_pushMsgRespFromList(std::list<RsNxsItem*>& itemL, c
|
||||
NxsTransaction* tr = new NxsTransaction();
|
||||
tr->mItems = itemL;
|
||||
tr->mFlag = NxsTransaction::FLAG_STATE_WAITING_CONFIRM;
|
||||
RsNxsTransac* trItem = new RsNxsTransac(mServType);
|
||||
trItem->transactFlag = RsNxsTransac::FLAG_BEGIN_P1 | RsNxsTransac::FLAG_TYPE_MSG_LIST_RESP;
|
||||
RsNxsTransacItem* trItem = new RsNxsTransacItem(mServType);
|
||||
trItem->transactFlag = RsNxsTransacItem::FLAG_BEGIN_P1 | RsNxsTransacItem::FLAG_TYPE_MSG_LIST_RESP;
|
||||
trItem->nItems = itemL.size();
|
||||
trItem->timestamp = 0;
|
||||
trItem->PeerId(sslId);
|
||||
trItem->transactionNumber = transN;
|
||||
|
||||
// also make a copy for the resident transaction
|
||||
tr->mTransaction = new RsNxsTransac(*trItem);
|
||||
tr->mTransaction = new RsNxsTransacItem(*trItem);
|
||||
tr->mTransaction->PeerId(mOwnId);
|
||||
tr->mTimeOut = time(NULL) + mTransactionTimeOut;
|
||||
|
||||
|
@ -212,7 +212,7 @@ private:
|
||||
* @param item the transaction item to process
|
||||
* @return false ownership of item left with callee
|
||||
*/
|
||||
bool locked_processTransac(RsNxsTransac* item);
|
||||
bool locked_processTransac(RsNxsTransacItem* item);
|
||||
|
||||
/*!
|
||||
* This adds a transaction
|
||||
@ -315,13 +315,13 @@ private:
|
||||
* of groups held by user
|
||||
* @param item contains grp sync info
|
||||
*/
|
||||
void handleRecvSyncGroup(RsNxsSyncGrp* item);
|
||||
void handleRecvSyncGroup(RsNxsSyncGrpReqItem* item);
|
||||
|
||||
/*!
|
||||
* Handles an nxs item for msgs synchronisation
|
||||
* @param item contaims msg sync info
|
||||
*/
|
||||
void handleRecvSyncMessage(RsNxsSyncMsg* item);
|
||||
void handleRecvSyncMessage(RsNxsSyncMsgReqItem* item);
|
||||
|
||||
/*!
|
||||
* Handles an nxs item for group publish key
|
||||
@ -365,12 +365,12 @@ private:
|
||||
|
||||
void processExplicitGroupRequests();
|
||||
|
||||
void locked_doMsgUpdateWork(const RsNxsTransac* nxsTrans, const RsGxsGroupId& grpId);
|
||||
void locked_doMsgUpdateWork(const RsNxsTransacItem* nxsTrans, const RsGxsGroupId& grpId);
|
||||
|
||||
void updateServerSyncTS();
|
||||
|
||||
bool locked_CanReceiveUpdate(const RsNxsSyncGrp* item);
|
||||
bool locked_CanReceiveUpdate(const RsNxsSyncMsg* item);
|
||||
bool locked_CanReceiveUpdate(const RsNxsSyncGrpReqItem *item);
|
||||
bool locked_CanReceiveUpdate(const RsNxsSyncMsgReqItem* item);
|
||||
|
||||
private:
|
||||
|
||||
@ -454,8 +454,8 @@ private:
|
||||
/*** transactions ***/
|
||||
|
||||
/*** synchronisation ***/
|
||||
std::list<RsNxsSyncGrp*> mSyncGrp;
|
||||
std::list<RsNxsSyncMsg*> mSyncMsg;
|
||||
std::list<RsNxsSyncGrpItem*> mSyncGrp;
|
||||
std::list<RsNxsSyncMsgItem*> mSyncMsg;
|
||||
/*** synchronisation ***/
|
||||
|
||||
RsNxsObserver* mObserver;
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
* c timeout set for this transaction
|
||||
* c and itemCount
|
||||
*/
|
||||
RsNxsTransac* mTransaction;
|
||||
RsNxsTransacItem* mTransaction;
|
||||
std::list<RsNxsItem*> mItems; // items received or sent
|
||||
};
|
||||
|
||||
|
@ -5,73 +5,42 @@
|
||||
* #define RSSERIAL_DEBUG 1
|
||||
***/
|
||||
|
||||
const uint8_t RsNxsSyncGrpItem::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsNxsSyncGrpItem::FLAG_RESPONSE = 0x002;
|
||||
const uint8_t RsNxsSyncGrpItem::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsNxsSyncGrpItem::FLAG_RESPONSE = 0x002;
|
||||
|
||||
const uint8_t RsNxsSyncMsgItem::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsNxsSyncMsgItem::FLAG_RESPONSE = 0x002;
|
||||
const uint8_t RsNxsSyncMsgItem::FLAG_REQUEST = 0x001;
|
||||
const uint8_t RsNxsSyncMsgItem::FLAG_RESPONSE = 0x002;
|
||||
|
||||
const uint8_t RsNxsSyncGrp::FLAG_USE_SYNC_HASH = 0x001;
|
||||
const uint8_t RsNxsSyncMsg::FLAG_USE_SYNC_HASH = 0x001;
|
||||
const uint8_t RsNxsSyncGrpItem::FLAG_USE_SYNC_HASH = 0x001;
|
||||
const uint8_t RsNxsSyncMsgItem::FLAG_USE_SYNC_HASH = 0x001;
|
||||
|
||||
/** transaction state **/
|
||||
const uint16_t RsNxsTransac::FLAG_BEGIN_P1 = 0x0001;
|
||||
const uint16_t RsNxsTransac::FLAG_BEGIN_P2 = 0x0002;
|
||||
const uint16_t RsNxsTransac::FLAG_END_SUCCESS = 0x0004;
|
||||
const uint16_t RsNxsTransac::FLAG_CANCEL = 0x0008;
|
||||
const uint16_t RsNxsTransac::FLAG_END_FAIL_NUM = 0x0010;
|
||||
const uint16_t RsNxsTransac::FLAG_END_FAIL_TIMEOUT = 0x0020;
|
||||
const uint16_t RsNxsTransac::FLAG_END_FAIL_FULL = 0x0040;
|
||||
const uint16_t RsNxsTransacItem::FLAG_BEGIN_P1 = 0x0001;
|
||||
const uint16_t RsNxsTransacItem::FLAG_BEGIN_P2 = 0x0002;
|
||||
const uint16_t RsNxsTransacItem::FLAG_END_SUCCESS = 0x0004;
|
||||
const uint16_t RsNxsTransacItem::FLAG_CANCEL = 0x0008;
|
||||
const uint16_t RsNxsTransacItem::FLAG_END_FAIL_NUM = 0x0010;
|
||||
const uint16_t RsNxsTransacItem::FLAG_END_FAIL_TIMEOUT = 0x0020;
|
||||
const uint16_t RsNxsTransacItem::FLAG_END_FAIL_FULL = 0x0040;
|
||||
|
||||
|
||||
/** transaction type **/
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_GRP_LIST_RESP = 0x0100;
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_MSG_LIST_RESP = 0x0200;
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_GRP_LIST_REQ = 0x0400;
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_MSG_LIST_REQ = 0x0800;
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_GRPS = 0x1000;
|
||||
const uint16_t RsNxsTransac::FLAG_TYPE_MSGS = 0x2000;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_GRP_LIST_RESP = 0x0100;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_MSG_LIST_RESP = 0x0200;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_GRP_LIST_REQ = 0x0400;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_MSG_LIST_REQ = 0x0800;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_GRPS = 0x1000;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_MSGS = 0x2000;
|
||||
const uint16_t RsNxsTransacItem::FLAG_TYPE_ENCRYPTED_DATA = 0x4000;
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::size(RsItem *item) {
|
||||
|
||||
RsNxsGrp* ngp;
|
||||
RsNxsMsg* nmg;
|
||||
RsNxsSyncGrp* sg;
|
||||
RsNxsSyncGrpItem* sgl;
|
||||
RsNxsSyncMsg* sgm;
|
||||
RsNxsSyncMsgItem* sgml;
|
||||
RsNxsTransac* ntx;
|
||||
RsNxsGroupPublishKeyItem* npk;
|
||||
|
||||
|
||||
if((npk = dynamic_cast<RsNxsGroupPublishKeyItem*>(item)) != NULL)
|
||||
uint32_t RsNxsSerialiser::size(RsItem *item)
|
||||
{
|
||||
RsNxsItem *nxs_item = dynamic_cast<RsNxsItem*>(item) ;
|
||||
|
||||
if(nxs_item != NULL)
|
||||
return nxs_item->serial_size() ;
|
||||
else
|
||||
{
|
||||
return sizeNxsGroupPublishKeyItem(npk);
|
||||
} else if((sg = dynamic_cast<RsNxsSyncGrp*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsSyncGrp(sg);
|
||||
|
||||
}else if(( ntx = dynamic_cast<RsNxsTransac*>(item)) != NULL){
|
||||
return sizeNxsTrans(ntx);
|
||||
}
|
||||
else if ((sgl = dynamic_cast<RsNxsSyncGrpItem*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsSyncGrpItem(sgl);
|
||||
|
||||
}else if ((sgm = dynamic_cast<RsNxsSyncMsg*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsSyncMsg(sgm);
|
||||
}else if ((sgml = dynamic_cast<RsNxsSyncMsgItem*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsSyncMsgItem(sgml);
|
||||
}else if((ngp = dynamic_cast<RsNxsGrp*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsGrp(ngp);
|
||||
}else if((nmg = dynamic_cast<RsNxsMsg*>(item)) != NULL)
|
||||
{
|
||||
return sizeNxsMsg(nmg);
|
||||
}else{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::size(): Could not find appropriate size function"
|
||||
<< std::endl;
|
||||
@ -80,10 +49,8 @@ uint32_t RsNxsSerialiser::size(RsItem *item) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) {
|
||||
|
||||
|
||||
RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size)
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialise()" << std::endl;
|
||||
#endif
|
||||
@ -99,22 +66,16 @@ RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) {
|
||||
switch(getRsItemSubType(rstype))
|
||||
{
|
||||
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP:
|
||||
return deserialNxsSyncGrp(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM:
|
||||
return deserialNxsSyncGrpItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG:
|
||||
return deserialNxsSyncMsg(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM:
|
||||
return deserialNxsSyncMsgItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_GRP:
|
||||
return deserialNxsGrp(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_MSG:
|
||||
return deserialNxsMsg(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_TRANS:
|
||||
return deserialNxsTrans(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY:
|
||||
return deserialNxsGroupPublishKeyItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM: return deserialNxsSyncGrpReqItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM: return deserialNxsSyncGrpItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM: return deserialNxsSyncMsgItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM: return deserialNxsSyncMsgItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_GRP_ITEM: return deserialNxsGrpItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_MSG_ITEM: return deserialNxsMsgItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM: return deserialNxsTransacItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM:return deserialNxsGroupPublishKeyItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM: return deserialNxsSessionKeyItem(data, size);
|
||||
case RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM: return deserialNxsEncryptedDataItem(data, size);
|
||||
default:
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -129,87 +90,61 @@ RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) {
|
||||
|
||||
|
||||
|
||||
bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size){
|
||||
bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size)
|
||||
{
|
||||
RsNxsItem *nxs_item = dynamic_cast<RsNxsItem*>(item) ;
|
||||
|
||||
RsNxsGrp* ngp;
|
||||
RsNxsMsg* nmg;
|
||||
RsNxsSyncGrp* sg;
|
||||
RsNxsSyncGrpItem* sgl;
|
||||
RsNxsSyncMsg* sgm;
|
||||
RsNxsSyncMsgItem* sgml;
|
||||
RsNxsTransac* ntx;
|
||||
RsNxsGroupPublishKeyItem* gpk;
|
||||
|
||||
if((sg = dynamic_cast<RsNxsSyncGrp*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsSyncGrp(sg, data, size);
|
||||
|
||||
}else if ((ntx = dynamic_cast<RsNxsTransac*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsTrans(ntx, data, size);
|
||||
|
||||
}else if ((sgl = dynamic_cast<RsNxsSyncGrpItem*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsSyncGrpItem(sgl, data, size);
|
||||
|
||||
}else if ((sgm = dynamic_cast<RsNxsSyncMsg*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsSyncMsg(sgm, data, size);
|
||||
}else if ((sgml = dynamic_cast<RsNxsSyncMsgItem*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsSynMsgItem(sgml, data, size);
|
||||
}else if((ngp = dynamic_cast<RsNxsGrp*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsGrp(ngp, data, size);
|
||||
}else if((nmg = dynamic_cast<RsNxsMsg*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsMsg(nmg, data, size);
|
||||
}else if((gpk = dynamic_cast<RsNxsGroupPublishKeyItem*>(item)) != NULL)
|
||||
{
|
||||
return serialiseNxsGroupPublishKeyItem(gpk, data, size);
|
||||
}
|
||||
|
||||
#ifdef NXS_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialise() item does not caste to know type"
|
||||
<< std::endl;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
if(nxs_item != NULL)
|
||||
return nxs_item->serialise(data,*size) ;
|
||||
else
|
||||
{
|
||||
std::cerr << "RsNxsSerialiser::serialise(): Not an RsNxsItem!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool RsNxsItem::serialise_header(void *data,uint32_t& pktsize,uint32_t& tlvsize, uint32_t& offset) const
|
||||
{
|
||||
tlvsize = serial_size() ;
|
||||
offset = 0;
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsSynMsgItem(RsNxsSyncMsgItem *item, void *data, uint32_t *size){
|
||||
if (pktsize < tlvsize)
|
||||
return false; /* not enough space */
|
||||
|
||||
pktsize = tlvsize;
|
||||
|
||||
if(!setRsItemHeader(data, tlvsize, PacketId(), tlvsize))
|
||||
{
|
||||
std::cerr << "RsFileTransferItem::serialise_header(): ERROR. Not enough size!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsFileItemSerialiser::serialiseData() Header: " << ok << std::endl;
|
||||
#endif
|
||||
offset += 8;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool RsNxsSyncMsgItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSynMsgItem()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsSyncMsgItem(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSynMsgItem()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* RsNxsSyncMsgItem */
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= item->grpId.serialise(data, *size, offset);
|
||||
ok &= item->msgId.serialise(data, *size, offset);
|
||||
ok &= item->authorId.serialise(data, *size, offset);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, flag);
|
||||
ok &= grpId.serialise(data, size, offset);
|
||||
ok &= msgId.serialise(data, size, offset);
|
||||
ok &= authorId.serialise(data, size, offset);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -229,38 +164,20 @@ bool RsNxsSerialiser::serialiseNxsSynMsgItem(RsNxsSyncMsgItem *item, void *data,
|
||||
}
|
||||
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsMsg(RsNxsMsg *item, void *data, uint32_t *size)
|
||||
bool RsNxsMsg::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsMsg()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsMsg(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsMsg()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->pos);
|
||||
ok &= item->msgId.serialise(data, *size, offset);
|
||||
ok &= item->grpId.serialise(data, *size, offset);
|
||||
ok &= item->msg.SetTlv(data, tlvsize, &offset);
|
||||
ok &= item->meta.SetTlv(data, *size, &offset);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, pos);
|
||||
ok &= msgId.serialise(data, size, offset);
|
||||
ok &= grpId.serialise(data, size, offset);
|
||||
ok &= msg.SetTlv(data, tlvsize, &offset);
|
||||
ok &= meta.SetTlv(data, size, &offset);
|
||||
|
||||
|
||||
if(offset != tlvsize){
|
||||
@ -281,37 +198,20 @@ bool RsNxsSerialiser::serialiseNxsMsg(RsNxsMsg *item, void *data, uint32_t *size
|
||||
}
|
||||
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsGrp(RsNxsGrp *item, void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsGrp()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsGrp(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsGrp()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool RsNxsGrp::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
// grp id
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->pos);
|
||||
ok &= item->grpId.serialise(data, *size, offset);
|
||||
ok &= item->grp.SetTlv(data, tlvsize, &offset);
|
||||
ok &= item->meta.SetTlv(data, *size, &offset);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, pos);
|
||||
ok &= grpId.serialise(data, size, offset);
|
||||
ok &= grp.SetTlv(data, tlvsize, &offset);
|
||||
ok &= meta.SetTlv(data, size, &offset);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -330,37 +230,19 @@ bool RsNxsSerialiser::serialiseNxsGrp(RsNxsGrp *item, void *data, uint32_t *size
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsSyncGrp(RsNxsSyncGrp *item, void *data, uint32_t *size)
|
||||
bool RsNxsSyncGrpReqItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncGrp()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsSyncGrp(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncGrp()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->createdSince);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->updateTS);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, flag);
|
||||
ok &= setRawUInt32(data, size, &offset, createdSince);
|
||||
ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_HASH_SHA1, syncHash);
|
||||
ok &= setRawUInt32(data, size, &offset, updateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -380,37 +262,18 @@ bool RsNxsSerialiser::serialiseNxsSyncGrp(RsNxsSyncGrp *item, void *data, uint32
|
||||
}
|
||||
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsTrans(RsNxsTransac *item, void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsTrans()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsTrans(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsTrans() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool RsNxsTransacItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt16(data, *size, &offset, item->transactFlag);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->nItems);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->updateTS);
|
||||
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt16(data, size, &offset, transactFlag);
|
||||
ok &= setRawUInt32(data, size, &offset, nItems);
|
||||
ok &= setRawUInt32(data, size, &offset, updateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -429,38 +292,21 @@ bool RsNxsSerialiser::serialiseNxsTrans(RsNxsTransac *item, void *data, uint32_t
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsSyncGrpItem(RsNxsSyncGrpItem *item, void *data, uint32_t *size)
|
||||
bool RsNxsSyncGrpItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncGrpItem()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsSyncGrpItem(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncm() size do not match" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* RsNxsSyncm */
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= item->grpId.serialise(data, *size, offset);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->publishTs);
|
||||
ok &= item->authorId.serialise(data, *size, offset);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, flag);
|
||||
ok &= grpId.serialise(data, size, offset);
|
||||
ok &= setRawUInt32(data, size, &offset, publishTs);
|
||||
ok &= authorId.serialise(data, size, offset);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -479,36 +325,20 @@ bool RsNxsSerialiser::serialiseNxsSyncGrpItem(RsNxsSyncGrpItem *item, void *data
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsSyncMsg(RsNxsSyncMsg *item, void *data, uint32_t *size){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncMsg()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsSyncMsg(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncMsg()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool RsNxsSyncMsgReqItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->createdSince);
|
||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
||||
ok &= item->grpId.serialise(data, *size, offset);
|
||||
ok &= setRawUInt32(data, *size, &offset, item->updateTS);
|
||||
ok &= setRawUInt32(data, size, &offset, transactionNumber);
|
||||
ok &= setRawUInt8(data, size, &offset, flag);
|
||||
ok &= setRawUInt32(data, size, &offset, createdSince);
|
||||
ok &= SetTlvString(data, size, &offset, TLV_TYPE_STR_HASH_SHA1, syncHash);
|
||||
ok &= grpId.serialise(data, size, offset);
|
||||
ok &= setRawUInt32(data, size, &offset, updateTS);
|
||||
|
||||
if(offset != tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
@ -528,32 +358,16 @@ bool RsNxsSerialiser::serialiseNxsSyncMsg(RsNxsSyncMsg *item, void *data, uint32
|
||||
}
|
||||
|
||||
|
||||
bool RsNxsSerialiser::serialiseNxsGroupPublishKeyItem(RsNxsGroupPublishKeyItem *item, void *data, uint32_t *size){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncMsg()" << std::endl;
|
||||
#endif
|
||||
|
||||
uint32_t tlvsize = sizeNxsGroupPublishKeyItem(item);
|
||||
uint32_t offset = 0;
|
||||
|
||||
if(*size < tlvsize){
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::serialiseNxsSyncMsg()" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = tlvsize;
|
||||
|
||||
bool RsNxsGroupPublishKeyItem::serialise(void *data, uint32_t& size) const
|
||||
{
|
||||
uint32_t tlvsize,offset=0;
|
||||
bool ok = true;
|
||||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
if(!serialise_header(data,size,tlvsize,offset))
|
||||
return false ;
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
ok &= item->grpId.serialise(data, *size, offset) ;
|
||||
ok &= item->key.SetTlv(data, *size, &offset) ;
|
||||
ok &= grpId.serialise(data, size, offset) ;
|
||||
ok &= key.SetTlv(data, size, &offset) ;
|
||||
|
||||
if(offset != tlvsize)
|
||||
{
|
||||
@ -569,8 +383,8 @@ bool RsNxsSerialiser::serialiseNxsGroupPublishKeyItem(RsNxsGroupPublishKeyItem *
|
||||
|
||||
/*** deserialisation ***/
|
||||
|
||||
|
||||
RsNxsGrp* RsNxsSerialiser::deserialNxsGrp(void *data, uint32_t *size){
|
||||
RsNxsGrp* RsNxsSerialiser::deserialNxsGrpItem(void *data, uint32_t *size)
|
||||
{
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsGrp()" << std::endl;
|
||||
@ -583,7 +397,7 @@ RsNxsGrp* RsNxsSerialiser::deserialNxsGrp(void *data, uint32_t *size){
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_GRP != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_GRP_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsGrp() FAIL wrong type" << std::endl;
|
||||
@ -638,7 +452,7 @@ RsNxsGrp* RsNxsSerialiser::deserialNxsGrp(void *data, uint32_t *size){
|
||||
}
|
||||
|
||||
|
||||
RsNxsMsg* RsNxsSerialiser::deserialNxsMsg(void *data, uint32_t *size){
|
||||
RsNxsMsg* RsNxsSerialiser::deserialNxsMsgItem(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsMsg()" << std::endl;
|
||||
@ -652,7 +466,7 @@ RsNxsMsg* RsNxsSerialiser::deserialNxsMsg(void *data, uint32_t *size){
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_MSG != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_MSG_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsMsg() FAIL wrong type" << std::endl;
|
||||
@ -708,7 +522,7 @@ RsNxsMsg* RsNxsSerialiser::deserialNxsMsg(void *data, uint32_t *size){
|
||||
}
|
||||
|
||||
|
||||
RsNxsSyncGrp* RsNxsSerialiser::deserialNxsSyncGrp(void *data, uint32_t *size){
|
||||
RsNxsSyncGrpReqItem* RsNxsSerialiser::deserialNxsSyncGrpReqItem(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsSyncGrp()" << std::endl;
|
||||
@ -722,7 +536,7 @@ RsNxsSyncGrp* RsNxsSerialiser::deserialNxsSyncGrp(void *data, uint32_t *size){
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_SYNC_GRP != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsSyncGrp() FAIL wrong type" << std::endl;
|
||||
@ -743,7 +557,7 @@ RsNxsSyncGrp* RsNxsSerialiser::deserialNxsSyncGrp(void *data, uint32_t *size){
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsNxsSyncGrp* item = new RsNxsSyncGrp(getRsItemService(rstype));
|
||||
RsNxsSyncGrpReqItem* item = new RsNxsSyncGrpReqItem(getRsItemService(rstype));
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
@ -843,7 +657,7 @@ RsNxsSyncGrpItem* RsNxsSerialiser::deserialNxsSyncGrpItem(void *data, uint32_t *
|
||||
return item;
|
||||
}
|
||||
|
||||
RsNxsTransac* RsNxsSerialiser::deserialNxsTrans(void *data, uint32_t *size){
|
||||
RsNxsTransacItem* RsNxsSerialiser::deserialNxsTransacItem(void *data, uint32_t *size){
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsTrans()" << std::endl;
|
||||
@ -857,7 +671,7 @@ RsNxsTransac* RsNxsSerialiser::deserialNxsTrans(void *data, uint32_t *size){
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_TRANS != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsTrans() FAIL wrong type" << std::endl;
|
||||
@ -881,7 +695,7 @@ RsNxsTransac* RsNxsSerialiser::deserialNxsTrans(void *data, uint32_t *size){
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsNxsTransac* item = new RsNxsTransac(SERVICE_TYPE);
|
||||
RsNxsTransacItem* item = new RsNxsTransacItem(SERVICE_TYPE);
|
||||
|
||||
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
||||
ok &= getRawUInt16(data, *size, &offset, &(item->transactFlag));
|
||||
@ -980,7 +794,7 @@ RsNxsSyncMsgItem* RsNxsSerialiser::deserialNxsSyncMsgItem(void *data, uint32_t *
|
||||
}
|
||||
|
||||
|
||||
RsNxsSyncMsg* RsNxsSerialiser::deserialNxsSyncMsg(void *data, uint32_t *size)
|
||||
RsNxsSyncMsgReqItem* RsNxsSerialiser::deserialNxsSyncMsgReqItem(void *data, uint32_t *size)
|
||||
{
|
||||
|
||||
|
||||
@ -996,7 +810,7 @@ RsNxsSyncMsg* RsNxsSerialiser::deserialNxsSyncMsg(void *data, uint32_t *size)
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_SYNC_MSG != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsSyncMsg() FAIL wrong type" << std::endl;
|
||||
@ -1017,7 +831,7 @@ RsNxsSyncMsg* RsNxsSerialiser::deserialNxsSyncMsg(void *data, uint32_t *size)
|
||||
|
||||
bool ok = true;
|
||||
|
||||
RsNxsSyncMsg* item = new RsNxsSyncMsg(getRsItemService(rstype));
|
||||
RsNxsSyncMsgReqItem* item = new RsNxsSyncMsgReqItem(getRsItemService(rstype));
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
@ -1066,7 +880,7 @@ RsNxsGroupPublishKeyItem* RsNxsSerialiser::deserialNxsGroupPublishKeyItem(void *
|
||||
|
||||
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
||||
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM != getRsItemSubType(rstype)))
|
||||
{
|
||||
std::cerr << "RsNxsSerialiser::deserialNxsGroupPublishKeyItem() FAIL wrong type" << std::endl;
|
||||
return NULL; /* wrong type */
|
||||
@ -1113,76 +927,86 @@ RsNxsGroupPublishKeyItem* RsNxsSerialiser::deserialNxsGroupPublishKeyItem(void *
|
||||
return item;
|
||||
}
|
||||
|
||||
RsNxsSessionKeyItem *RsNxsSerialiser::deserialNxsSessionKeyItem(void* data, uint32_t *size)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": Not implemented!" << std::endl;
|
||||
return NULL ;
|
||||
}
|
||||
RsNxsEncryptedDataItem *RsNxsSerialiser::deserialNxsEncryptedDataItem(void* data, uint32_t *size)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": Not implemented!" << std::endl;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
/*** size functions ***/
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsMsg(RsNxsMsg *item)
|
||||
uint32_t RsNxsMsg::serial_size()const
|
||||
{
|
||||
|
||||
uint32_t s = 8; //header size
|
||||
|
||||
s += 4; // transaction number
|
||||
s += 1; // pos
|
||||
s += item->grpId.serial_size();
|
||||
s += item->msgId.serial_size();
|
||||
s += item->msg.TlvSize();
|
||||
s += item->meta.TlvSize();
|
||||
s += grpId.serial_size();
|
||||
s += msgId.serial_size();
|
||||
s += msg.TlvSize();
|
||||
s += meta.TlvSize();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsGrp(RsNxsGrp *item)
|
||||
uint32_t RsNxsGrp::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 4; // transaction number
|
||||
s += 1; // pos
|
||||
s += item->grpId.serial_size();
|
||||
s += item->grp.TlvSize();
|
||||
s += item->meta.TlvSize();
|
||||
s += grpId.serial_size();
|
||||
s += grp.TlvSize();
|
||||
s += meta.TlvSize();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsGroupPublishKeyItem(RsNxsGroupPublishKeyItem *item)
|
||||
uint32_t RsNxsGroupPublishKeyItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += item->grpId.serial_size() ;
|
||||
s += item->key.TlvSize();
|
||||
s += grpId.serial_size() ;
|
||||
s += key.TlvSize();
|
||||
|
||||
return s;
|
||||
}
|
||||
uint32_t RsNxsSerialiser::sizeNxsSyncGrp(RsNxsSyncGrp *item)
|
||||
uint32_t RsNxsSyncGrpReqItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 4; // transaction number
|
||||
s += 1; // flag
|
||||
s += 4; // sync age
|
||||
s += GetTlvStringSize(item->syncHash);
|
||||
s += GetTlvStringSize(syncHash);
|
||||
s += 4; // updateTS
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsSyncGrpItem(RsNxsSyncGrpItem *item)
|
||||
uint32_t RsNxsSyncGrpItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 4; // transaction number
|
||||
s += 4; // publishTs
|
||||
s += 1; // flag
|
||||
s += item->grpId.serial_size();
|
||||
s += item->authorId.serial_size();
|
||||
s += grpId.serial_size();
|
||||
s += authorId.serial_size();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsSyncMsg(RsNxsSyncMsg *item)
|
||||
uint32_t RsNxsSyncMsgReqItem::serial_size() const
|
||||
{
|
||||
|
||||
uint32_t s = 8;
|
||||
@ -1190,29 +1014,29 @@ uint32_t RsNxsSerialiser::sizeNxsSyncMsg(RsNxsSyncMsg *item)
|
||||
s += 4; // transaction number
|
||||
s += 1; // flag
|
||||
s += 4; // age
|
||||
s += item->grpId.serial_size();
|
||||
s += GetTlvStringSize(item->syncHash);
|
||||
s += grpId.serial_size();
|
||||
s += GetTlvStringSize(syncHash);
|
||||
s += 4; // updateTS
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsSyncMsgItem(RsNxsSyncMsgItem *item)
|
||||
uint32_t RsNxsSyncMsgItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 4; // transaction number
|
||||
s += 1; // flag
|
||||
s += item->grpId.serial_size();
|
||||
s += item->msgId.serial_size();
|
||||
s += item->authorId.serial_size();
|
||||
s += grpId.serial_size();
|
||||
s += msgId.serial_size();
|
||||
s += authorId.serial_size();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
uint32_t RsNxsSerialiser::sizeNxsTrans(RsNxsTransac *item){
|
||||
|
||||
uint32_t RsNxsTransacItem::serial_size() const
|
||||
{
|
||||
uint32_t s = 8; // header size
|
||||
|
||||
s += 4; // transaction number
|
||||
@ -1241,7 +1065,7 @@ void RsNxsGrp::clear()
|
||||
meta.TlvClear();
|
||||
}
|
||||
|
||||
void RsNxsSyncGrp::clear()
|
||||
void RsNxsSyncGrpReqItem::clear()
|
||||
{
|
||||
flag = 0;
|
||||
createdSince = 0;
|
||||
@ -1252,7 +1076,7 @@ void RsNxsGroupPublishKeyItem::clear()
|
||||
{
|
||||
key.TlvClear();
|
||||
}
|
||||
void RsNxsSyncMsg::clear()
|
||||
void RsNxsSyncMsgReqItem::clear()
|
||||
{
|
||||
grpId.clear();
|
||||
flag = 0;
|
||||
@ -1277,14 +1101,14 @@ void RsNxsSyncMsgItem::clear()
|
||||
authorId.clear();
|
||||
}
|
||||
|
||||
void RsNxsTransac::clear(){
|
||||
void RsNxsTransacItem::clear(){
|
||||
transactFlag = 0;
|
||||
nItems = 0;
|
||||
updateTS = 0;
|
||||
timestamp = 0;
|
||||
transactionNumber = 0;
|
||||
}
|
||||
std::ostream& RsNxsSyncGrp::print(std::ostream &out, uint16_t indent)
|
||||
std::ostream& RsNxsSyncGrpReqItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
|
||||
printRsItemBase(out, "RsNxsSyncGrp", indent);
|
||||
@ -1320,7 +1144,7 @@ std::ostream& RsNxsGroupPublishKeyItem::print(std::ostream &out, uint16_t indent
|
||||
}
|
||||
|
||||
|
||||
std::ostream& RsNxsSyncMsg::print(std::ostream &out, uint16_t indent)
|
||||
std::ostream& RsNxsSyncMsgReqItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsNxsSyncMsg", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
@ -1431,7 +1255,7 @@ std::ostream& RsNxsMsg::print(std::ostream &out, uint16_t indent){
|
||||
}
|
||||
|
||||
|
||||
std::ostream& RsNxsTransac::print(std::ostream &out, uint16_t indent){
|
||||
std::ostream& RsNxsTransacItem::print(std::ostream &out, uint16_t indent){
|
||||
|
||||
printRsItemBase(out, "RsNxsTransac", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
@ -37,14 +37,16 @@
|
||||
#include "gxs/rsgxsdata.h"
|
||||
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_GRP = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM = 0x0001; // cyril: these numbers look like flags, but they are not.
|
||||
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_GRP_ITEM = 0x0004;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM = 0x0005;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM = 0x0006;
|
||||
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;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY = 0x0080;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM = 0x0010;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_MSG_ITEM = 0x0020;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM = 0x0040;
|
||||
const uint8_t RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM = 0x0080;
|
||||
|
||||
|
||||
// possibility create second service to deal with this functionality
|
||||
@ -53,7 +55,7 @@ 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;
|
||||
const uint8_t RS_PKT_SUBTYPE_EXT_SEARCH_REQ = 0x0010;
|
||||
|
||||
|
||||
/*!
|
||||
@ -73,11 +75,15 @@ public:
|
||||
setPriorityLevel(QOS_PRIORITY_RS_GXS_NET);
|
||||
return;
|
||||
}
|
||||
virtual ~RsNxsItem(){ return; }
|
||||
|
||||
virtual ~RsNxsItem(){}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const = 0 ;
|
||||
virtual uint32_t serial_size() const = 0 ;
|
||||
virtual void clear() = 0;
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0) = 0;
|
||||
|
||||
bool serialise_header(void *data,uint32_t& pktsize,uint32_t& tlvsize, uint32_t& offset) const;
|
||||
|
||||
uint32_t transactionNumber; // set to zero if this is not a transaction item
|
||||
};
|
||||
|
||||
@ -87,24 +93,25 @@ public:
|
||||
* Server may advise client peer to use sync file
|
||||
* while serving his request. This results
|
||||
*/
|
||||
class RsNxsSyncGrp : public RsNxsItem {
|
||||
|
||||
class RsNxsSyncGrpReqItem : 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
|
||||
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 createdSince; // how far back to sync data
|
||||
uint32_t updateTS; // time of last group update
|
||||
std::string syncHash; // use to determine if changes that have occured since last hash
|
||||
RsNxsSyncGrpReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM) { clear(); return;}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const ;
|
||||
|
||||
uint8_t flag; // advises whether to use sync hash
|
||||
uint32_t createdSince; // how far back to sync data
|
||||
uint32_t updateTS; // time of last group update
|
||||
std::string syncHash; // use to determine if changes that have occured since last hash
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -115,11 +122,14 @@ public:
|
||||
class RsNxsGroupPublishKeyItem : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
RsNxsGroupPublishKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY) { clear(); return;}
|
||||
RsNxsGroupPublishKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM) { clear(); return;}
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
RsGxsGroupId grpId ;
|
||||
RsTlvSecurityKey key ;
|
||||
};
|
||||
@ -131,7 +141,7 @@ public:
|
||||
* in order to guaranttee a collection of item have been
|
||||
* received
|
||||
*/
|
||||
class RsNxsTransac : public RsNxsItem {
|
||||
class RsNxsTransacItem: public RsNxsItem {
|
||||
|
||||
public:
|
||||
|
||||
@ -155,10 +165,14 @@ public:
|
||||
static const uint16_t FLAG_TYPE_MSG_LIST_REQ;
|
||||
static const uint16_t FLAG_TYPE_GRPS;
|
||||
static const uint16_t FLAG_TYPE_MSGS;
|
||||
static const uint16_t FLAG_TYPE_ENCRYPTED_DATA;
|
||||
|
||||
RsNxsTransac(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_TRANS) { clear(); return; }
|
||||
virtual ~RsNxsTransac() { return ; }
|
||||
RsNxsTransacItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM) { clear(); return; }
|
||||
virtual ~RsNxsTransacItem() { return ; }
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const ;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
@ -174,7 +188,7 @@ public:
|
||||
* Use to send to peer list of grps
|
||||
* held by server peer
|
||||
*/
|
||||
class RsNxsSyncGrpItem : public RsNxsItem
|
||||
class RsNxsSyncGrpItem: public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
@ -186,6 +200,9 @@ public:
|
||||
RsNxsSyncGrpItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM) { clear(); return ; }
|
||||
virtual ~RsNxsSyncGrpItem() { return; }
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
@ -200,6 +217,52 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* Use to send to peer list of grps
|
||||
* held by server peer
|
||||
*/
|
||||
class RsNxsSessionKeyItem : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsNxsSessionKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM),encrypted_key_data(servtype) { clear(); }
|
||||
virtual ~RsNxsSessionKeyItem() {}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
/// grpId of grp held by sending peer
|
||||
///
|
||||
RsTlvBinaryData encrypted_key_data ;
|
||||
};
|
||||
/*!
|
||||
* Use to send to peer list of grps
|
||||
* held by server peer
|
||||
*/
|
||||
class RsNxsEncryptedDataItem : public RsNxsItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
RsNxsEncryptedDataItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM),aes_encrypted_data(servtype) { clear(); }
|
||||
virtual ~RsNxsEncryptedDataItem() {}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
/// grpId of grp held by sending peer
|
||||
///
|
||||
RsTlvBinaryData aes_encrypted_data ;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Contains serialised group items
|
||||
* Each item corresponds to a group which needs to be
|
||||
@ -210,7 +273,7 @@ class RsNxsGrp : public RsNxsItem
|
||||
|
||||
public:
|
||||
|
||||
RsNxsGrp(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP), grp(servtype), meta(servtype),
|
||||
RsNxsGrp(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_ITEM), grp(servtype), meta(servtype),
|
||||
metaData(NULL) { clear();
|
||||
//std::cout << "\nGrp refcount++ : " << ++refcount << std::endl;
|
||||
return; }
|
||||
@ -220,6 +283,9 @@ public:
|
||||
|
||||
RsNxsGrp* clone() const;
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
@ -243,15 +309,18 @@ public:
|
||||
* Use to request list of msg held by peer
|
||||
* for a given group
|
||||
*/
|
||||
class RsNxsSyncMsg : public RsNxsItem
|
||||
class RsNxsSyncMsgReqItem : 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; }
|
||||
RsNxsSyncMsgReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM) { clear(); return; }
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
@ -276,6 +345,9 @@ public:
|
||||
static const uint8_t FLAG_USE_SYNC_HASH;
|
||||
RsNxsSyncMsgItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM) { clear(); return; }
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
@ -295,7 +367,7 @@ class RsNxsMsg : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG), meta(servtype), msg(servtype),
|
||||
RsNxsMsg(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG_ITEM), meta(servtype), msg(servtype),
|
||||
metaData(NULL) {
|
||||
// std::cout << "\nrefcount++ : " << ++refcount << std::endl;
|
||||
clear(); return;
|
||||
@ -309,6 +381,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear();
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
@ -337,13 +412,16 @@ public:
|
||||
/*!
|
||||
* Used to request a search of user data
|
||||
*/
|
||||
class RsNxsSearchReq : public RsNxsItem
|
||||
class RsNxsSearchReqItem : public RsNxsItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchReq(uint16_t servtype): RsNxsItem(servtype, RS_PKT_SUBTYPE_EXT_SEARCH_REQ), serviceSearchItem(servtype) { return; }
|
||||
virtual ~RsNxsSearchReq() { return;}
|
||||
RsNxsSearchReqItem(uint16_t servtype): RsNxsItem(servtype, RS_PKT_SUBTYPE_EXT_SEARCH_REQ), serviceSearchItem(servtype) { return; }
|
||||
virtual ~RsNxsSearchReqItem() { return;}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
virtual void clear() { return;}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t /*indent*/) { return out; }
|
||||
|
||||
@ -358,11 +436,15 @@ public:
|
||||
* Used to respond to a RsGrpSearchReq
|
||||
* with grpId/MsgIds that satisfy search request
|
||||
*/
|
||||
class RsNxsSearchResultMsg
|
||||
class RsNxsSearchResultMsgItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchResultMsg() : context(0) { return;}
|
||||
RsNxsSearchResultMsgItem() : context(0) { return;}
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
void clear() {}
|
||||
std::ostream &print(std::ostream &out, uint16_t /*indent*/) { return out; }
|
||||
|
||||
@ -379,11 +461,15 @@ public:
|
||||
* Used to respond to a RsGrpSearchReq
|
||||
* with grpId/MsgIds that satisfy search request
|
||||
*/
|
||||
class RsNxsSearchResultGrp
|
||||
class RsNxsSearchResultGrpItem
|
||||
{
|
||||
public:
|
||||
|
||||
RsNxsSearchResultGrp();
|
||||
RsNxsSearchResultGrpItem();
|
||||
|
||||
virtual bool serialise(void *data,uint32_t& size) const;
|
||||
virtual uint32_t serial_size() const;
|
||||
|
||||
void clear() {}
|
||||
std::ostream &print(std::ostream &out, uint16_t /*indent*/) { return out; }
|
||||
|
||||
@ -398,6 +484,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#ifndef UNUSED_CODE
|
||||
class RsNxsDeleteMsg
|
||||
{
|
||||
public:
|
||||
@ -420,7 +507,7 @@ public:
|
||||
RsTlvKeySignature idSign;
|
||||
RsTlvKeySignature deleteSign; // (grpId + grp data) sign // TODO: add warning not to place grpId in msg
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
class RsNxsSerialiser : public RsSerialType
|
||||
@ -437,56 +524,16 @@ public:
|
||||
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_NXS_GRP_PUBLISH_KEY */
|
||||
virtual uint32_t sizeNxsGroupPublishKeyItem(RsNxsGroupPublishKeyItem* item);
|
||||
virtual bool serialiseNxsGroupPublishKeyItem(RsNxsGroupPublishKeyItem* item, void* data, uint32_t* size);
|
||||
virtual RsNxsGroupPublishKeyItem* deserialNxsGroupPublishKeyItem(void* data, uint32_t *size);
|
||||
|
||||
|
||||
private:
|
||||
virtual RsNxsSyncGrpReqItem *deserialNxsSyncGrpReqItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_SYNC_GRP */
|
||||
virtual RsNxsSyncGrpItem *deserialNxsSyncGrpItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_SYNC_GRP_ITEM */
|
||||
virtual RsNxsSyncMsgReqItem *deserialNxsSyncMsgReqItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_SYNC_MSG */
|
||||
virtual RsNxsSyncMsgItem *deserialNxsSyncMsgItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_SYNC_MSG_ITEM */
|
||||
virtual RsNxsGrp *deserialNxsGrpItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_GRP */
|
||||
virtual RsNxsMsg *deserialNxsMsgItem(void *data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_MSG */
|
||||
virtual RsNxsTransacItem *deserialNxsTransacItem(void* data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_TRANS */
|
||||
virtual RsNxsGroupPublishKeyItem *deserialNxsGroupPublishKeyItem(void* data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY */
|
||||
virtual RsNxsSessionKeyItem *deserialNxsSessionKeyItem(void* data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM */
|
||||
virtual RsNxsEncryptedDataItem *deserialNxsEncryptedDataItem(void* data, uint32_t *size); /* RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM */
|
||||
|
||||
const uint16_t SERVICE_TYPE;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user