2012-05-01 16:52:07 -04:00
|
|
|
#include "rsnxsitems.h"
|
2012-05-05 15:55:24 -04:00
|
|
|
#include "rsbaseserial.h"
|
2012-05-01 16:52:07 -04:00
|
|
|
|
2012-05-24 18:38:59 -04:00
|
|
|
#define RSSERIAL_DEBUG
|
2012-05-05 15:55:24 -04:00
|
|
|
const uint8_t RsSyncGrpList::FLAG_REQUEST = 0x001;
|
|
|
|
const uint8_t RsSyncGrpList::FLAG_RESPONSE = 0x002;
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-05-05 15:55:24 -04:00
|
|
|
const uint8_t RsSyncGrpMsgList::FLAG_REQUEST = 0x001;
|
|
|
|
const uint8_t RsSyncGrpMsgList::FLAG_RESPONSE = 0x002;
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-05-05 15:55:24 -04:00
|
|
|
const uint8_t RsSyncGrp::FLAG_USE_SYNC_HASH = 0x001;
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-05-05 15:55:24 -04:00
|
|
|
const uint8_t RsSyncGrpMsg::FLAG_USE_SYNC_HASH = 0x001;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RsNxsSerialiser::size(RsItem *item) {
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsGrp* ngp;
|
|
|
|
RsNxsMsg* nmg;
|
2012-05-03 17:49:55 -04:00
|
|
|
RsSyncGrp* sg;
|
|
|
|
RsSyncGrpList* sgl;
|
|
|
|
RsSyncGrpMsg* sgm;
|
|
|
|
RsSyncGrpMsgList* sgml;
|
2012-06-05 10:46:18 -04:00
|
|
|
RsNxsTransac* ntx;
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
|
|
|
|
if((sg = dynamic_cast<RsSyncGrp*>(item)) != NULL)
|
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeSyncGrp(sg);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
}else if(( ntx = dynamic_cast<RsNxsTransac*>(item)) != NULL){
|
|
|
|
return sizeNxsTrans(ntx);
|
|
|
|
}
|
|
|
|
else if ((sgl = dynamic_cast<RsSyncGrpList*>(item)) != NULL)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeSyncGrpList(sgl);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
}else if ((sgm = dynamic_cast<RsSyncGrpMsg*>(item)) != NULL)
|
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeSyncGrpMsg(sgm);
|
2012-05-03 17:49:55 -04:00
|
|
|
}else if ((sgml = dynamic_cast<RsSyncGrpMsgList*>(item)) != NULL)
|
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeSyncGrpMsgList(sgml);
|
2012-05-21 18:07:43 -04:00
|
|
|
}else if((ngp = dynamic_cast<RsNxsGrp*>(item)) != NULL)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeNxsGrp(ngp);
|
2012-05-21 18:07:43 -04:00
|
|
|
}else if((nmg = dynamic_cast<RsNxsMsg*>(item)) != NULL)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
2012-06-05 10:46:18 -04:00
|
|
|
return sizeNxsMsg(nmg);
|
2012-05-03 17:49:55 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) {
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-06 10:29:50 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialise()" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)))
|
|
|
|
{
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
switch(getRsItemSubType(rstype))
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_SYNC_GRP:
|
2012-05-03 17:49:55 -04:00
|
|
|
return deserialSyncGrp(data, size);
|
2012-06-07 16:43:12 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM:
|
2012-05-05 15:55:24 -04:00
|
|
|
return deserialSyncGrpList(data, size);
|
2012-06-07 16:43:12 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_SYNC_MSG:
|
2012-05-05 15:55:24 -04:00
|
|
|
return deserialSyncGrpMsg(data, size);
|
2012-06-07 16:43:12 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM:
|
2012-05-05 15:55:24 -04:00
|
|
|
return deserialSyncGrpMsgList(data, size);
|
2012-05-21 18:07:43 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_GRP:
|
|
|
|
return deserialNxsGrp(data, size);
|
|
|
|
case RS_PKT_SUBTYPE_NXS_MSG:
|
|
|
|
return deserialNxsMsg(data, size);
|
2012-06-05 10:46:18 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_TRANS:
|
|
|
|
return deserialNxsTrans(data, size);
|
2012-05-21 18:07:43 -04:00
|
|
|
case RS_PKT_SUBTYPE_NXS_EXTENDED:
|
|
|
|
return deserialNxsExtended(data, size);
|
2012-05-03 17:49:55 -04:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
#ifdef NXS_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialise() : data has no type"
|
2012-05-03 17:49:55 -04:00
|
|
|
<< std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size){
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsGrp* ngp;
|
|
|
|
RsNxsMsg* nmg;
|
2012-05-03 17:49:55 -04:00
|
|
|
RsSyncGrp* sg;
|
|
|
|
RsSyncGrpList* sgl;
|
|
|
|
RsSyncGrpMsg* sgm;
|
|
|
|
RsSyncGrpMsgList* sgml;
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsExtended* nxt;
|
2012-06-05 10:46:18 -04:00
|
|
|
RsNxsTransac* ntx;
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if((sg = dynamic_cast<RsSyncGrp*>(item)) != NULL)
|
|
|
|
{
|
|
|
|
return serialiseSyncGrp(sg, data, size);
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
}else if ((ntx = dynamic_cast<RsNxsTransac*>(item)) != NULL)
|
|
|
|
{
|
|
|
|
return serialiseNxsTrans(ntx, data, size);
|
|
|
|
|
2012-05-03 17:49:55 -04:00
|
|
|
}else if ((sgl = dynamic_cast<RsSyncGrpList*>(item)) != NULL)
|
|
|
|
{
|
|
|
|
return serialiseSyncGrpList(sgl, data, size);
|
|
|
|
|
|
|
|
}else if ((sgm = dynamic_cast<RsSyncGrpMsg*>(item)) != NULL)
|
|
|
|
{
|
|
|
|
return serialiseSyncGrpMsg(sgm, data, size);
|
|
|
|
}else if ((sgml = dynamic_cast<RsSyncGrpMsgList*>(item)) != NULL)
|
|
|
|
{
|
|
|
|
return serialiseSynGrpMsgList(sgml, data, size);
|
2012-05-21 18:07:43 -04:00
|
|
|
}else if((ngp = dynamic_cast<RsNxsGrp*>(item)) != NULL)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
return serialiseNxsGrp(ngp, data, size);
|
|
|
|
}else if((nmg = dynamic_cast<RsNxsMsg*>(item)) != NULL)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
return serialiseNxsMsg(nmg, data, size);
|
|
|
|
}else if((nxt = dynamic_cast<RsNxsExtended*>(item)) != NULL){
|
2012-05-03 17:49:55 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
return serialiseNxsExtended(nxt, data, size);
|
|
|
|
}
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
#ifdef NXS_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialise() item does not caste to know type"
|
|
|
|
<< std::endl;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool RsNxsSerialiser::serialiseSynGrpMsgList(RsSyncGrpMsgList *item, void *data, uint32_t *size){
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSynGrpMsgList()" << std::endl;
|
|
|
|
#endif
|
|
|
|
|
2012-05-05 15:55:24 -04:00
|
|
|
uint32_t tlvsize = sizeSyncGrpMsgList(item);
|
2012-05-03 17:49:55 -04:00
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSynGrpMsgList()" << std::endl;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* RsSyncGrpMsgList */
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, item->msgId);
|
|
|
|
ok &= item->idSign.SetTlv(data, *size, &offset);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSynGrpMsgList() FAIL Size Error! " << std::endl;
|
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSynGrpMsgList() NOK" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
bool RsNxsSerialiser::serialiseNxsMsg(RsNxsMsg *item, void *data, uint32_t *size)
|
2012-05-03 17:49:55 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsMsg()" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
uint32_t tlvsize = sizeNxsMsg(item);
|
2012-05-03 17:49:55 -04:00
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsMsg()" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSGID, item->msgId);
|
|
|
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->identity);
|
|
|
|
ok &= setRawUInt32(data, tlvsize, &offset, item->timeStamp);
|
|
|
|
ok &= setRawUInt32(data, tlvsize, &offset, item->msgFlag);
|
|
|
|
ok &= item->idSign.SetTlv(data, tlvsize, &offset);
|
|
|
|
ok &= item->publishSign.SetTlv(data, tlvsize, &offset);
|
|
|
|
ok &= item->msg.SetTlv(data, tlvsize, &offset);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsMsg() FAIL Size Error! " << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsMsg() NOK" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
bool RsNxsSerialiser::serialiseNxsGrp(RsNxsGrp *item, void *data, uint32_t *size){
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsGrp()" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
uint32_t tlvsize = sizeNxsGrp(item);
|
2012-05-03 17:49:55 -04:00
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsGrp()" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
// grp id
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-05-21 18:07:43 -04:00
|
|
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->identity);
|
|
|
|
ok &= setRawUInt32(data, tlvsize, &offset, item->grpFlag);
|
|
|
|
ok &= setRawUInt32(data, tlvsize, &offset, item->timeStamp);
|
|
|
|
ok &= item->idSign.SetTlv(data, tlvsize, &offset);
|
|
|
|
ok &= item->adminSign.SetTlv(data, tlvsize, &offset);
|
|
|
|
ok &= item->keys.SetTlv(data, tlvsize, &offset);
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= item->grp.SetTlv(data, tlvsize, &offset);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsGrp() FAIL Size Error! " << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsGrp() NOK" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RsNxsSerialiser::serialiseSyncGrp(RsSyncGrp *item, void *data, uint32_t *size)
|
2012-05-01 16:52:07 -04:00
|
|
|
{
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrp()" << std::endl;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uint32_t tlvsize = sizeSyncGrp(item);
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrp()" << std::endl;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->syncAge);
|
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrp() FAIL Size Error! " << std::endl;
|
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrp() NOK" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
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 ok = true;
|
|
|
|
|
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRawUInt16(data, *size, &offset, item->transactFlag);
|
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->nItems);
|
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->timeout);
|
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsTrans() FAIL Size Error! " << std::endl;
|
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseNxsTrans() NOK" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2012-05-03 17:49:55 -04:00
|
|
|
bool RsNxsSerialiser::serialiseSyncGrpList(RsSyncGrpList *item, void *data, uint32_t *size)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpList()" << std::endl;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uint32_t tlvsize = sizeSyncGrpList(item);
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-06 10:29:50 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpList() size do not match" << std::endl;
|
2012-05-03 17:49:55 -04:00
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* RsSyncGrpList */
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= item->adminSign.SetTlv(data, *size, &offset);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpList( FAIL Size Error! " << std::endl;
|
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpList() NOK" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool RsNxsSerialiser::serialiseSyncGrpMsg(RsSyncGrpMsg *item, void *data, uint32_t *size){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpMsg()" << std::endl;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uint32_t tlvsize = sizeSyncGrpMsg(item);
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if(*size < tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpMsg()" << std::endl;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = tlvsize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->transactionId);
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
|
|
|
ok &= setRawUInt32(data, *size, &offset, item->syncAge);
|
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
|
|
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
2012-05-03 17:49:55 -04:00
|
|
|
|
|
|
|
if(offset != tlvsize){
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpMsg() FAIL Size Error! " << std::endl;
|
|
|
|
#endif
|
|
|
|
ok = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
std::cerr << "RsNxsSerialiser::serialiseSyncGrpMsg( NOK" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
|
|
|
|
bool RsNxsSerialiser::serialiseNxsExtended(RsNxsExtended *item, void *data, uint32_t *size){
|
|
|
|
|
2012-05-03 17:49:55 -04:00
|
|
|
return false;
|
2012-05-01 16:52:07 -04:00
|
|
|
}
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
/*** deserialisation ***/
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsGrp* RsNxsSerialiser::deserialNxsGrp(void *data, uint32_t *size){
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-24 18:38:59 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsGrp()" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
2012-05-21 18:07:43 -04:00
|
|
|
(RS_PKT_SUBTYPE_NXS_GRP != getRsItemSubType(rstype)))
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsGrp() FAIL wrong type" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsGrp() FAIL wrong size" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsGrp* item = new RsNxsGrp(SERVICE_TYPE);
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-21 18:07:43 -04:00
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->identity);
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->grpFlag));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->timeStamp));
|
|
|
|
ok &= item->idSign.GetTlv(data, *size, &offset);
|
|
|
|
ok &= item->adminSign.GetTlv(data, *size, &offset);
|
|
|
|
ok &= item->keys.GetTlv(data, *size, &offset);
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= item->grp.GetTlv(data, *size, &offset);
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsGrp() FAIL size mismatch" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsGrp() NOK" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsMsg* RsNxsSerialiser::deserialNxsMsg(void *data, uint32_t *size){
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsMsg()" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
2012-05-21 18:07:43 -04:00
|
|
|
(RS_PKT_SUBTYPE_NXS_MSG != getRsItemSubType(rstype)))
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsMsg() FAIL wrong type" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsMsg() FAIL wrong size" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsMsg* item = new RsNxsMsg(getRsItemService(rstype));
|
2012-05-06 10:29:50 -04:00
|
|
|
/* skip the header */
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
offset += 8;
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-21 18:07:43 -04:00
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, item->msgId);
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->identity);
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->timeStamp));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->msgFlag));
|
|
|
|
ok &= item->idSign.GetTlv(data, *size, &offset);
|
|
|
|
ok &= item->publishSign.GetTlv(data, *size, &offset);
|
|
|
|
ok &= item->msg.GetTlv(data, *size, &offset);;
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsMsg() FAIL size mismatch" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
2012-05-21 18:07:43 -04:00
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsMsg() NOK" << std::endl;
|
2012-05-05 15:55:24 -04:00
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RsSyncGrp* RsNxsSerialiser::deserialSyncGrp(void *data, uint32_t *size){
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp()" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
2012-06-07 16:43:12 -04:00
|
|
|
(RS_PKT_SUBTYPE_NXS_SYNC_GRP != getRsItemSubType(rstype)))
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL wrong type" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL wrong size" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
RsSyncGrp* item = new RsSyncGrp(getRsItemService(rstype));
|
2012-05-06 10:29:50 -04:00
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->syncAge));
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp() FAIL size mismatch" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp() NOK" << std::endl;
|
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RsSyncGrpList* RsNxsSerialiser::deserialSyncGrpList(void *data, uint32_t *size){
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpList()" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
2012-06-07 16:43:12 -04:00
|
|
|
(RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM != getRsItemSubType(rstype)))
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL wrong type" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL wrong size" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
RsSyncGrpList* item = new RsSyncGrpList(SERVICE_TYPE);
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
ok &= item->adminSign.GetTlv(data, *size, &offset);
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() FAIL size mismatch" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpList() NOK" << std::endl;
|
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
RsNxsTransac* RsNxsSerialiser::deserialNxsTrans(void *data, uint32_t *size){
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsTrans()" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
|
|
|
(RS_PKT_SUBTYPE_NXS_TRANS != getRsItemSubType(rstype)))
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsTrans() FAIL wrong type" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList( FAIL wrong size" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
RsNxsTransac* item = new RsNxsTransac(SERVICE_TYPE);
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-06-05 10:46:18 -04:00
|
|
|
ok &= getRawUInt16(data, *size, &offset, &(item->transactFlag));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->nItems));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->timeout));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionId));
|
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsTrans() FAIL size mismatch" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialNxsTrans() NOK" << std::endl;
|
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
RsSyncGrpMsgList* RsNxsSerialiser::deserialSyncGrpMsgList(void *data, uint32_t *size){
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList()" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
|
|
|
(RS_PKT_SUBTYPE_SYNC_MSG_LIST != getRsItemSubType(rstype)))
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() FAIL wrong type" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList( FAIL wrong size" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
RsSyncGrpMsgList* item = new RsSyncGrpMsgList(getRsItemService(rstype));
|
2012-05-06 10:29:50 -04:00
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
2012-05-24 18:38:59 -04:00
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_MSGID, item->msgId);
|
|
|
|
ok &= item->idSign.GetTlv(data, *size, &offset);
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() FAIL size mismatch" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsgList() NOK" << std::endl;
|
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RsSyncGrpMsg* RsNxsSerialiser::deserialSyncGrpMsg(void *data, uint32_t *size)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrp()" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* get the type and size */
|
|
|
|
uint32_t rstype = getRsItemId(data);
|
|
|
|
uint32_t rssize = getRsItemSize(data);
|
|
|
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
|
|
|
|
(SERVICE_TYPE != getRsItemService(rstype)) ||
|
|
|
|
(RS_PKT_SUBTYPE_SYNC_MSG != getRsItemSubType(rstype)))
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL wrong type" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* wrong type */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size < rssize) /* check size */
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL wrong size" << std::endl;
|
|
|
|
#endif
|
|
|
|
return NULL; /* not enough data */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the packet length */
|
|
|
|
*size = rssize;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
RsSyncGrpMsg* item = new RsSyncGrpMsg(getRsItemService(rstype));
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
/* skip the header */
|
|
|
|
offset += 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
2012-05-05 15:55:24 -04:00
|
|
|
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
|
|
|
ok &= getRawUInt32(data, *size, &offset, &(item->syncAge));
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_HASH_SHA1, item->syncHash);
|
|
|
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, item->grpId);
|
|
|
|
|
|
|
|
if (offset != rssize)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() FAIL size mismatch" << std::endl;
|
|
|
|
#endif
|
|
|
|
/* error */
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
#ifdef RSSERIAL_DEBUG
|
|
|
|
std::cerr << "RsNxsSerialiser::deserialSyncGrpMsg() NOK" << std::endl;
|
|
|
|
#endif
|
|
|
|
delete item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
RsNxsExtended* RsNxsSerialiser::deserialNxsExtended(void *data, uint32_t *size){
|
2012-05-05 15:55:24 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** size functions ***/
|
|
|
|
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
uint32_t RsNxsSerialiser::sizeNxsMsg(RsNxsMsg *item)
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t s = 8; //header size
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
s += GetTlvStringSize(item->grpId);
|
|
|
|
s += GetTlvStringSize(item->msgId);
|
|
|
|
s += GetTlvStringSize(item->identity);
|
|
|
|
s += 4; // msgFlag
|
|
|
|
s += 4; // timeStamp
|
|
|
|
s += item->publishSign.TlvSize();
|
|
|
|
s += item->idSign.TlvSize();
|
|
|
|
s += item->msg.TlvSize();
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
uint32_t RsNxsSerialiser::sizeNxsGrp(RsNxsGrp *item)
|
2012-05-05 15:55:24 -04:00
|
|
|
{
|
|
|
|
uint32_t s = 8; // header size
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
s += 4; // transaction number
|
2012-05-21 18:07:43 -04:00
|
|
|
s += GetTlvStringSize(item->grpId);
|
|
|
|
s += GetTlvStringSize(item->identity);
|
|
|
|
s += 4; // grpFlag
|
|
|
|
s += 4; // timestamp
|
|
|
|
s += item->adminSign.TlvSize();
|
|
|
|
s += item->idSign.TlvSize();
|
|
|
|
s += item->keys.TlvSize();
|
|
|
|
s += item->grp.TlvSize();
|
2012-05-05 15:55:24 -04:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RsNxsSerialiser::sizeSyncGrp(RsSyncGrp *item)
|
|
|
|
{
|
|
|
|
uint32_t s = 8; // header size
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
s += 4; // transaction number
|
2012-05-05 15:55:24 -04:00
|
|
|
s += 1; // flag
|
|
|
|
s += 4; // sync age
|
|
|
|
s += GetTlvStringSize(item->syncHash);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RsNxsSerialiser::sizeSyncGrpList(RsSyncGrpList *item)
|
|
|
|
{
|
|
|
|
uint32_t s = 8; // header size
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
s += 4; // transaction number
|
2012-05-05 15:55:24 -04:00
|
|
|
s += 1; // flag
|
2012-05-24 18:38:59 -04:00
|
|
|
s += GetTlvStringSize(item->grpId);
|
|
|
|
s += item->adminSign.TlvSize();
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
return s;
|
2012-05-05 15:55:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RsNxsSerialiser::sizeSyncGrpMsg(RsSyncGrpMsg *item)
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t s = 8;
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
s += 4; // transaction number
|
2012-05-05 15:55:24 -04:00
|
|
|
s += 1; // flag
|
|
|
|
s += 4; // age
|
|
|
|
s += GetTlvStringSize(item->grpId);
|
|
|
|
s += GetTlvStringSize(item->syncHash);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RsNxsSerialiser::sizeSyncGrpMsgList(RsSyncGrpMsgList *item)
|
|
|
|
{
|
|
|
|
uint32_t s = 8; // header size
|
|
|
|
|
2012-06-07 16:43:12 -04:00
|
|
|
s += 4; // transaction number
|
2012-05-05 15:55:24 -04:00
|
|
|
s += 1; // flag
|
|
|
|
s += GetTlvStringSize(item->grpId);
|
2012-05-24 18:38:59 -04:00
|
|
|
s += GetTlvStringSize(item->msgId);
|
|
|
|
s += item->idSign.TlvSize();
|
2012-05-05 15:55:24 -04:00
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
return s;
|
2012-05-05 15:55:24 -04:00
|
|
|
}
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
uint32_t RsNxsSerialiser::sizeNxsTrans(RsNxsTransac *item){
|
|
|
|
|
|
|
|
uint32_t s = 8; // header size
|
2012-06-07 16:43:12 -04:00
|
|
|
|
|
|
|
s += 4; // transaction number
|
2012-06-05 10:46:18 -04:00
|
|
|
s += 2; // flag
|
|
|
|
s += 4; // nMsgs
|
|
|
|
s += 4; // timeout
|
|
|
|
s += 4; // transaction id
|
|
|
|
|
|
|
|
return s;
|
2012-05-05 15:55:24 -04:00
|
|
|
}
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-24 18:38:59 -04:00
|
|
|
uint32_t RsNxsSerialiser::sizeNxsExtended(RsNxsExtended *item){
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
|
|
|
|
/** print and clear functions **/
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
void RsNxsMsg::clear()
|
2012-05-06 10:29:50 -04:00
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
msg.TlvClear();
|
|
|
|
grpId.clear();
|
|
|
|
msgId.clear();
|
|
|
|
msgFlag = 0;
|
|
|
|
timeStamp = 0;
|
|
|
|
publishSign.TlvClear();
|
|
|
|
idSign.TlvClear();
|
|
|
|
identity.clear();
|
2012-05-06 10:29:50 -04:00
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
void RsNxsGrp::clear()
|
2012-05-06 10:29:50 -04:00
|
|
|
{
|
2012-05-21 18:07:43 -04:00
|
|
|
grpId.clear();
|
|
|
|
timeStamp = 0;
|
|
|
|
grp.TlvClear();
|
|
|
|
adminSign.TlvClear();
|
|
|
|
keys.TlvClear();
|
|
|
|
identity.clear();
|
|
|
|
grpFlag = 0;
|
|
|
|
idSign.TlvClear();
|
2012-05-06 10:29:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void RsSyncGrp::clear()
|
|
|
|
{
|
|
|
|
flag = 0;
|
|
|
|
syncAge = 0;
|
|
|
|
syncHash.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RsSyncGrpMsg::clear()
|
|
|
|
{
|
|
|
|
grpId.clear();
|
|
|
|
flag = 0;
|
|
|
|
syncAge = 0;
|
|
|
|
syncHash.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RsSyncGrpList::clear()
|
|
|
|
{
|
|
|
|
flag = 0;
|
2012-05-24 18:38:59 -04:00
|
|
|
adminSign.TlvClear();
|
|
|
|
grpId.clear();
|
2012-05-06 10:29:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void RsSyncGrpMsgList::clear()
|
|
|
|
{
|
|
|
|
flag = 0;
|
2012-05-24 18:38:59 -04:00
|
|
|
msgId.clear();
|
|
|
|
idSign.TlvClear();
|
|
|
|
grpId.clear();
|
2012-05-06 10:29:50 -04:00
|
|
|
}
|
|
|
|
|
2012-06-05 10:46:18 -04:00
|
|
|
void RsNxsTransac::clear(){
|
|
|
|
transactFlag = 0;
|
|
|
|
nItems = 0;
|
|
|
|
timeout = 0;
|
|
|
|
transactionId = 0;
|
|
|
|
}
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
std::ostream& RsSyncGrp::print(std::ostream &out, uint16_t indent)
|
|
|
|
{
|
|
|
|
|
|
|
|
printRsItemBase(out, "RsSyncGrp", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "Hash: " << syncHash << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "Sync Age: " << syncAge << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "flag" << flag << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
printRsItemEnd(out ,"RsSyncGrp", indent);
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
std::ostream& RsNxsExtended::print(std::ostream &out, uint16_t indent){
|
|
|
|
printRsItemBase(out, "RsNxsExtended", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "type: " << type << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
extData.print(out, indent);
|
|
|
|
|
|
|
|
printRsItemEnd(out ,"RsNxsExtended", indent);
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
std::ostream& RsSyncGrpMsg::print(std::ostream &out, uint16_t indent)
|
|
|
|
{
|
|
|
|
printRsItemBase(out, "RsSyncGrpMsg", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "GrpId: " << grpId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "syncAge: " << syncAge << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "syncHash: " << syncHash << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "flag: " << flag << std::endl;
|
|
|
|
|
|
|
|
printRsItemEnd(out, "RsSyncGrpMsg", indent);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream& RsSyncGrpList::print(std::ostream &out, uint16_t indent)
|
|
|
|
{
|
|
|
|
printRsItemBase(out, "RsSyncGrpList", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "flag: " << flag << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
2012-05-24 18:38:59 -04:00
|
|
|
out << "grpId: " << grpId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
adminSign.print(out, indent);
|
|
|
|
printIndent(out , int_Indent);
|
2012-05-06 10:29:50 -04:00
|
|
|
|
|
|
|
printRsItemEnd(out , "RsSyncGrpList", indent);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
|
|
|
|
|
2012-05-06 10:29:50 -04:00
|
|
|
std::ostream& RsSyncGrpMsgList::print(std::ostream &out, uint16_t indent)
|
|
|
|
{
|
|
|
|
printRsItemBase(out, "RsSyncGrpMsgList", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "flag: " << flag << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "grpId: " << grpId << std::endl;
|
2012-05-24 18:38:59 -04:00
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "msgId: " << msgId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
idSign.print(out, indent);
|
|
|
|
printIndent(out , int_Indent);
|
2012-05-06 10:29:50 -04:00
|
|
|
|
|
|
|
printRsItemEnd(out ,"RsSyncGrpMsgList", indent);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
std::ostream& RsNxsGrp::print(std::ostream &out, uint16_t indent){
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
printRsItemBase(out, "RsNxsGrp", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
out << "grpId: " << grpId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "timeStamp: " << timeStamp << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "identity: " << identity << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "grpFlag: " << grpFlag << std::endl;
|
|
|
|
out << "adminSign: " << std::endl;
|
|
|
|
adminSign.print(out, indent);
|
|
|
|
out << "idSign: " << std::endl;
|
|
|
|
idSign.print(out, indent);
|
|
|
|
out << "keys: " << std::endl;
|
|
|
|
keys.print(out, indent);
|
|
|
|
|
|
|
|
printRsItemEnd(out, "RsNxsGrp", indent);
|
2012-05-06 10:29:50 -04:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
std::ostream& RsNxsMsg::print(std::ostream &out, uint16_t indent){
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
printRsItemBase(out, "RsNxsMsg", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
out << "msgId: " << msgId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "grpId: " << grpId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "msgFlag: " << msgFlag << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "identity: " << identity << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "timeStamp: " << timeStamp << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "pub sign: " << std::endl;
|
|
|
|
publishSign.print(out, indent);
|
|
|
|
out << "id sign: " << std::endl;
|
|
|
|
idSign.print(out, indent);
|
2012-05-06 10:29:50 -04:00
|
|
|
|
2012-05-21 18:07:43 -04:00
|
|
|
printRsItemEnd(out ,"RsNxsMsg", indent);
|
2012-05-06 10:29:50 -04:00
|
|
|
return out;
|
|
|
|
}
|
2012-06-05 10:46:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
std::ostream& RsNxsTransac::print(std::ostream &out, uint16_t indent){
|
|
|
|
|
|
|
|
printRsItemBase(out, "RsNxsTransac", indent);
|
|
|
|
uint16_t int_Indent = indent + 2;
|
|
|
|
|
|
|
|
out << "transactFlag: " << transactFlag << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "nItems: " << nItems << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "timeout: " << timeout << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
out << "transactionId: " << transactionId << std::endl;
|
|
|
|
printIndent(out , int_Indent);
|
|
|
|
|
|
|
|
printRsItemEnd(out ,"RsNxsTransac", indent);
|
|
|
|
return out;
|
|
|
|
}
|