예제 #1
0
void
SMsgDirG2UpdateExtendBase::PackExtended(void)
{
	WTRACE("SMsgDirG2UpdateExtendBase::PackExtended");
	WDBG_LL("SMsgDirG2UpdateExtendBase::PackExtended enableDataObjects=" << mEnableDataObjects << " enableACLs=" << mEnableACLs);

	if (mEnableDataObjects)
	{
		WDBG_LL("SMsgDirG2UpdateExtendBase::PackExtended Writing " << mDataObjects.size() << " data objects.");
		AppendShort(mDataObjects.size());
		DataObjectTypeSet::iterator anItr(mDataObjects.begin());
		for (; anItr != mDataObjects.end(); anItr++)
		{
			unsigned char aTypeLen = anItr->GetDataType().size();
			AppendByte(aTypeLen);
			if (aTypeLen > 0)
				AppendBytes(aTypeLen, anItr->GetDataType().data());

			unsigned short aDataLen = anItr->GetData().size();
			AppendShort(aDataLen);
			if (aDataLen > 0)
				AppendBytes(aDataLen, anItr->GetData().data());
		}
	}

	if (mEnableACLs)
	{
		WDBG_LL("SMsgDirG2UpdateExtendBase::PackExtended Writing " << mACLs.size() << " ACLs.");
		AppendShort(mACLs.size());

		DirACLList::const_iterator anACLItr(mACLs.begin());
		for (; anACLItr != mACLs.end(); anACLItr++)
		{
			AppendByte(anACLItr->mType);
			AppendShort(anACLItr->mACL.size());
			PermissionACL::const_iterator aPermItr(anACLItr->mACL.begin());
			for (; aPermItr != anACLItr->mACL.end(); aPermItr++)
			{
				AppendLong(aPermItr->mUserId);
				AppendLong(aPermItr->mCommunityId);
				AppendShort(aPermItr->mTrustLevel);
			}
		}
	}
}
예제 #2
0
void
DirEntity::PackACLs(BaseMessage& theMsgR) const
{
	WTRACE("DirEntity::PackACLs");
	WDBG_LL("DirEntity::PackACLs Packing ACLs, size=" << mACLs.size());
	theMsgR.AppendShort(mACLs.size());

	DirACLList::const_iterator anACLItr(mACLs.begin());
	for (; anACLItr != mACLs.end(); anACLItr++)
	{
		theMsgR.AppendByte(anACLItr->mType);
		theMsgR.AppendShort(anACLItr->mACL.size());
		PermissionACL::const_iterator aPermItr(anACLItr->mACL.begin());
		for (; aPermItr != anACLItr->mACL.end(); aPermItr++)
		{
			theMsgR.AppendLong(aPermItr->mUserId);
			theMsgR.AppendLong(aPermItr->mCommunityId);
			theMsgR.AppendShort(aPermItr->mTrustLevel);
		}
	}
}