Exemplo n.º 1
0
void CIFXMetaData::SetStringValueX(const IFXString& rKey, const IFXString& rValue)
{
	IFXString key = rKey;
	IFXSubattributes sa;
	UnpackKey(key, sa);

	U32 index;
	IFXMetaDataContainer* ExistingMD = FindTheKey(key, &index);

	if (ExistingMD) {
		ExistingMD->Subattributes = sa;
		if (ExistingMD->Attribute & IFXMETADATAATTRIBUTE_BINARY)
			delete [] (U8*)ExistingMD->pBuffer;
		else 
			delete (IFXString*)ExistingMD->pBuffer;
		ExistingMD->pBuffer = new IFXString;
		(*(IFXString*)(ExistingMD->pBuffer)) = rValue;
		ExistingMD->Attribute = (IFXMetaDataAttribute)(ExistingMD->Attribute & ~IFXMETADATAATTRIBUTE_BINARY);
		ExistingMD->Persistence = IFX_TRUE;
	} else {
		m_pEmptyMetaData->Key = key;
		m_pEmptyMetaData->Subattributes = sa;
		m_pEmptyMetaData->pBuffer = new IFXString;
		(*(IFXString*)(m_pEmptyMetaData->pBuffer)) = rValue;
		m_pEmptyMetaData->Attribute = (IFXMetaDataAttribute)(m_pEmptyMetaData->Attribute & ~IFXMETADATAATTRIBUTE_BINARY);
		m_pEmptyMetaData->Persistence = IFX_TRUE;

		m_pEmptyMetaData->pNext = new(IFXMetaDataContainer);
		m_pEmptyMetaData->pNext->pPrev = m_pEmptyMetaData;
		m_pEmptyMetaData = m_pEmptyMetaData->pNext;

		m_uMDCount++;
	}
}
Exemplo n.º 2
0
// SMsgDirG2ModifyService::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2ModifyService::Unpack(void)
{
	WTRACE("SMsgDirG2ModifyService::Unpack");
	SetKeyType(KT_SERVICE);
	SetExtended((GetMessageType() != WONMsg::DirG2ModifyService), (GetMessageType() == WONMsg::DirG2ModifyServiceEx));
	SMsgDirG2UpdateExtendBase::Unpack();

	if ((GetServiceType() != WONMsg::SmallDirServerG2) ||
	    ((GetMessageType() != WONMsg::DirG2ModifyService) &&
	     (GetMessageType() != WONMsg::DirG2ModifyServiceEx) &&
		 (GetMessageType() != WONMsg::DirG2ModifyServiceExObsolete)))
	{
		WDBG_AH("SMsgDirG2ModifyService::Unpack Not a DirG2ModifyService(Ex) message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirG2ModifyService(Ex) message.");
	}

	mEntityFlags = ReadByte();
	UnpackKey(*this);
	ReadWString(mNewName);

	unsigned char aLen = ReadByte();
	WDBG_LL("SMsgDirG2ModifyService::Unpack Read New Addr len=" << aLen);
	if (aLen > 0)
		mNewNetAddress.assign(reinterpret_cast<const unsigned char*>(ReadBytes(aLen)), aLen);

	ReadWString(mNewDisplayName);
	mNewLifespan = ReadLong();
	UnpackExtended();
	UnpackPeerData();
}
// SMsgDirG2ClearDataObjects::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2ClearDataObjects::Unpack(void)
{
	WTRACE("SMsgDirG2ClearDataObjects::Unpack");
	mClearTypes.clear();
	mKeyType = (GetMessageType() == WONMsg::DirG2ServiceClearDataObjects ? KT_SERVICE : KT_DIRECTORY);
	SMsgDirG2UpdateBase::Unpack();

	if ((GetServiceType() != WONMsg::SmallDirServerG2) ||
	    ((GetMessageType() != WONMsg::DirG2DirectoryClearDataObjects) &&
	     (GetMessageType() != WONMsg::DirG2ServiceClearDataObjects)))
	{
		WDBG_AH("SMsgDirG2ClearDataObjects::Unpack Not a DirG2ClearDataObjects message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirG2ClearDataObjects message.");
	}

	UnpackKey(*this);
	unsigned short aCt = ReadShort();
	WDBG_LL("SMsgDirG2ClearDataObjects::Unpack Reading " << aCt << " entries.");

	for (int i=0; i < aCt; i++)
	{
		DataObject anObj;
		unsigned char aLen = ReadByte();
		if (aLen > 0)
			anObj.GetDataType().assign(reinterpret_cast<const unsigned char*>(ReadBytes(aLen)), aLen);
		mClearTypes.insert(anObj);
	}

	UnpackPeerData();
}
Exemplo n.º 4
0
// SMsgDirG2SetDataObjects::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2SetDataObjects::Unpack(void)
{
	WTRACE("SMsgDirG2SetDataObjects::Unpack");
	mKeyType  = (GetMessageType() == WONMsg::DirG2ServiceSetDataObjects ? KT_SERVICE : KT_DIRECTORY);
	SetExtended(true, false);
	SMsgDirG2UpdateExtendBase::Unpack();

	if ((GetServiceType() != WONMsg::SmallDirServerG2) ||
	    ((GetMessageType() != WONMsg::DirG2DirectorySetDataObjects) &&
	     (GetMessageType() != WONMsg::DirG2ServiceSetDataObjects)))
	{
		WDBG_AH("SMsgDirG2SetDataObjects::Unpack Not a DirG2SetDataObjects message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirG2SetDataObjects message.");
	}

	mSetMode = static_cast<WONMsg::DirG2DataObjectSetMode>(ReadByte());
	UnpackKey(*this);
	UnpackExtended();
	UnpackPeerData();
}
// SMsgDirG2ExplicitSetDataObjects::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2ExplicitSetDataObjects::Unpack(void)
{
	WTRACE("SMsgDirG2ExplicitSetDataObjects::Unpack");
	mObjects.clear();
	mKeyType = (GetMessageType() == WONMsg::DirG2ServiceExplicitSetDataObjects ? KT_SERVICE : KT_DIRECTORY);
	SMsgDirG2UpdateBase::Unpack();

	if ((GetServiceType() != WONMsg::SmallDirServerG2) ||
	    ((GetMessageType() != WONMsg::DirG2DirectoryExplicitSetDataObjects) &&
	     (GetMessageType() != WONMsg::DirG2ServiceExplicitSetDataObjects)))
	{
		WDBG_AH("SMsgDirG2ExplicitSetDataObjects::Unpack Not a DirG2ExplicitSetDataObjects message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirG2ExplicitSetDataObjects message.");
	}

	UnpackKey(*this);
	unsigned short aCt = ReadShort();
	WDBG_LL("SMsgDirG2ExplicitSetDataObjects::Unpack Reading " << aCt << " objects.");

	for (int i=0; i < aCt; i++)
	{
		ExplicitDOInfo anObj;
		anObj.mSetMode = static_cast<WONMsg::DirG2DataObjectSetMode>(ReadByte());

		unsigned char aTypeLen = ReadByte();
		if (aTypeLen > 0)
			anObj.mData.GetDataType().assign(reinterpret_cast<const unsigned char*>(ReadBytes(aTypeLen)), aTypeLen);

		unsigned short aDataLen = ReadShort();
		if (aDataLen > 0)
			anObj.mData.GetData().assign(reinterpret_cast<const unsigned char*>(ReadBytes(aDataLen)), aDataLen);

		mObjects.push_back(anObj);
	}

	UnpackPeerData();
}
Exemplo n.º 6
0
void CIFXMetaData::SetBinaryValueX(const IFXString& rKey, U32 size, const U8* pData)
{
	IFXString key = rKey;
	IFXSubattributes sa;
	UnpackKey(key, sa);

	U32 index;
	IFXMetaDataContainer* ExistingMD = FindTheKey(key, &index);

	if (ExistingMD) {
		ExistingMD->Subattributes = sa;
		if (ExistingMD->Attribute & IFXMETADATAATTRIBUTE_BINARY)
			delete [] (U8*)ExistingMD->pBuffer;
		else 
			delete (IFXString*)ExistingMD->pBuffer;
		ExistingMD->pBuffer = (U8*)new U8[size];
		memcpy(ExistingMD->pBuffer, pData, size);
		ExistingMD->Size = size;
		ExistingMD->Attribute = (IFXMetaDataAttribute)(ExistingMD->Attribute | IFXMETADATAATTRIBUTE_BINARY);
		ExistingMD->Persistence = IFX_TRUE;
	} else {
		m_pEmptyMetaData->Key = key;
		m_pEmptyMetaData->Subattributes = sa;
		m_pEmptyMetaData->pBuffer = (U8*)new U8[size];
		memcpy(m_pEmptyMetaData->pBuffer, pData, size);
		m_pEmptyMetaData->Size = size;
		m_pEmptyMetaData->Attribute = (IFXMetaDataAttribute)(m_pEmptyMetaData->Attribute | IFXMETADATAATTRIBUTE_BINARY);
		m_pEmptyMetaData->Persistence = IFX_TRUE;

		m_pEmptyMetaData->pNext = new(IFXMetaDataContainer);
		m_pEmptyMetaData->pNext->pPrev = m_pEmptyMetaData;
		m_pEmptyMetaData = m_pEmptyMetaData->pNext;

		m_uMDCount++;
	}
}