Exemplo n.º 1
0
void
DirEntity::UnpackACLs(BaseMessage& theMsgR)
{
	WTRACE("DirEntity::UnpackACLs");
	unsigned short anACLCt = theMsgR.ReadShort();
	WDBG_LL("DirEntity::UnpackACLs Unpacking ACLs, size=" << anACLCt);
	mACLs.clear();

	for (int i=0; i < anACLCt; i++)
	{
		DirACL anACL;
		anACL.mType = static_cast<WONMsg::DirG2ACLType>(theMsgR.ReadByte());

		unsigned short aPermCt = theMsgR.ReadShort();
		for (int j=0; j < aPermCt; j++)
		{
			Permission aPerm;
			aPerm.mUserId      = theMsgR.ReadLong();
			aPerm.mCommunityId = theMsgR.ReadLong();
			aPerm.mTrustLevel  = theMsgR.ReadShort();
			anACL.mACL.insert(aPerm);
		}

		mACLs.push_back(anACL);
	}
}
Exemplo n.º 2
0
void
DirEntity::UnpackDataObjects(BaseMessage& theMsgR, DataObjectTypeSet& theSetR,
                             unsigned long theFlags)
{
	WTRACE("DirEntity::UnpackDataObjects");
	unsigned short aCt = theMsgR.ReadShort();
	WDBG_LL("DirEntity::UnpackDataObjects Unpacking data objects, size=" << aCt);
	theSetR.clear();

	bool unpackType = ((theFlags & WONMsg::GF_ADDDOTYPE) != 0);
	bool unpackData = ((theFlags & WONMsg::GF_ADDDODATA) != 0);
	for (int i=0; i < aCt; i++)
	{
		DataObject anObj;
		if (unpackType)
		{
			unsigned char aLen = theMsgR.ReadByte();
			anObj.GetDataType().assign(reinterpret_cast<const unsigned char*>(theMsgR.ReadBytes(aLen)), aLen);
		}
		else
			anObj.GetDataType().assign(reinterpret_cast<const unsigned char*>(&i), sizeof(i));

		if (unpackData)
		{
			unsigned short aLen = theMsgR.ReadShort();
			anObj.GetData().assign(reinterpret_cast<const unsigned char*>(theMsgR.ReadBytes(aLen)), aLen);
		}

		theSetR.insert(anObj);
	}
}