Example #1
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();
}
// TMsgAuth1LoginBase::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgAuth1LoginBase::Unpack(void)
{
	WTRACE("TMsgAuth1LoginBase::Unpack");
	TMsgAuthRawBufferBase::Unpack();

	WDBG_LL("TMsgAuth1LoginBase::Unpack Reading message data");
	mKeyBlockId = ReadShort();
	mNeedKey    = (ReadByte() ? true : false);
	ReadWString(mLoginName);
	ReadWString(mCommunityName);
	ReadWString(mNicknameKey);
}
// SMsgDirG2GetNumEntities::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2GetNumEntities::Unpack(void)
{
	WTRACE("SMsgDirG2GetNumEntities::Unpack");
	SmallMessage::Unpack();

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

	WDBG_LL("SMsgDirG2GetNumEntities::Unpack Reading message data");
	unsigned short aPathCt = ReadShort();

	WDBG_LL("SMsgDirG2GetNumEntities::Unpack Reading " << aPathCt << " entries.");
	mPaths.clear();
	for (int i=0; i < aPathCt; i++)
	{
		DirPathData anEntry;
		mPaths.push_back(anEntry);
		ReadWString(mPaths.back().mPath);
		mPaths.back().mMode = static_cast<DirGetMode>(ReadShort());
	}
}
// TMsgCommPingReply::unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgCommQueryOptReply::Unpack(void)
{
	WTRACE("TMsgCommQueryOptReply::Unpack");
	mOptionMap.clear();
	TMessage::Unpack();

	if ((GetServiceType() != WONMsg::CommonService) ||
	    (GetMessageType() != WONMsg::CommQueryOptionsReply))
	{
		WDBG_AH("TMsgCommQueryOptReply::Unpack Not a CommQueryOptionsReply message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a CommQueryOptionsReply message.");
	}

	unsigned short aCt = ReadShort();
	WDBG_LL("TMsgCommQueryOptReply::Unpack reading " << aCt << " entries");

	for (int i=0; i < aCt; i++)
	{
		OptionDef aDef;
		string    anOpt;
		ReadString(anOpt);
		aDef.first  = static_cast<OptionStatus>(ReadByte());
		ReadWString(aDef.second);
		mOptionMap[anOpt] = aDef;
	}

	if (BytesLeftToRead() >= 2)
		mStatus = static_cast<WONMsg::ServerStatus>(static_cast<short>(ReadShort()));
}
Example #5
0
// MMsgObsSubscribeById::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsSubscribeById::Unpack(void)
{
	WTRACE("MMsgObsSubscribeById::Unpack");
	MiniMessage::Unpack();

	if ((GetServiceType() != WONMsg::MiniObsServer) ||
	    (GetMessageType() != WONMsg::ObsMsg_SubscribeById))
	{
		WDBG_AH("MMsgObsSubscribeById::Unpack Not a ObsSubscribeById message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a ObsSubscribeById message.");
	}

	WDBG_LL("MMsgObsSubscribeById::Unpack Reading message data");

	mPublicationId = ReadLong();
	mSubscriberId = ReadLong();
	if (!mSubscriberId) // Optional parameters follow
	{
		ReadString(mSubscriberName);
		ReadWString(mSubscriberDescription);
		mConnectionType = (ConnectionTypeEnum)ReadShort();
		ReadString(mSubscriberAddress);
	}
}
// TMsgDirFindServiceReply::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirFindServiceReply::Unpack(void)
{
	WTRACE("TMsgDirFindServiceReply::Unpack");
	TMessage::Unpack();

	if ((GetServiceType() != WONMsg::DirServer) ||
	    (GetMessageType() != WONMsg::DirFindServiceReply))
	{
		WDBG_AH("TMsgDirFindServiceReply::Unpack Not a DirFindServiceReply message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirFindServiceReply message.");
	}

	WDBG_LL("TMsgDirFindServiceReply::Unpack Reading message data");
	mStatus = static_cast<ServerStatus>(static_cast<short>(ReadShort()));

	// Service data only present if status is success
	if (mStatus == WONMsg::StatusCommon_Success)
	{
		mService.mType = DirServerEntry::EntryTypeService;
		ReadWString(mService.mPath);
		ReadWString(mService.mName);
		ReadWString(mService.mDisplayName);
		ReadWString(mService.mVersion);
		ReadWString(mService.mProtoName);
		ReadWString(mService.mProtoVersion);
		ReadWString(mService.mNetAddress);
		mService.mLifespan = ReadLong();
		mService.mCreated  = ReadLong();

		unsigned short aLen = ReadShort();
		mService.SetBlob(ReadBytes(aLen), aLen);
	}
}
void
TMsgDirGetDirContentsReply::UnpackEntry(DirServerEntry& theEntry)
{
	WTRACE("TMsgDirGetDirContentsReply::UnpackEntry");
	WDBG_LL("TMsgDirGetDirContentsReply::UnpackEntry Unpacking entry");
	theEntry.mType = ReadByte();
	ReadWString(theEntry.mPath);
	ReadWString(theEntry.mName);
	ReadWString(theEntry.mDisplayName);
	theEntry.mLifespan = ReadLong();
	theEntry.mCreated  = ReadLong();

	if (theEntry.mType == DirServerEntry::EntryTypeDirectory)
	{
		theEntry.mVisible = (ReadByte() == 0 ? false : true);
	}
	else if (theEntry.mType == DirServerEntry::EntryTypeService)
	{
		ReadWString(theEntry.mVersion);
		ReadWString(theEntry.mProtoName);
		ReadWString(theEntry.mProtoVersion);
		ReadWString(theEntry.mNetAddress);
		theEntry.mBlobLen = ReadShort();
		theEntry.SetBlob(ReadBytes(theEntry.mBlobLen), theEntry.mBlobLen);
	}
}
void SMsgUsrRegisterDataSource::Unpack(void)
	{
	WTRACE("SMsgUsrRegisterDataSource::Unpack");

	SmallMessage::Unpack();

	if ((GetServiceType() != USER_SEARCH_SERVER_TYPE) ||
		(GetMessageType() != SMsgUsrRegisterDataSourceTYPE))
		{
		WDBG_AH("SMsgUsrRegisterDataSource::Unpack Not a EUserSearchGetNumUsers message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
									  "Not a EUserSearchGetNumUsers message.");
		}

	WDBG_LL("SMsgUsrRegisterDataSource::Unpack Reading message data");

	// Get category name from packed message data

	ReadWString(m_s_category_name);

	// Get type name from packed message data

	ReadWString(m_s_type_name);
	}
// TMsgAuth1NewLoginRequest::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgAuth1NewLoginRequest::Unpack(void)
{
	WTRACE("TMsgAuth1NewLoginRequest::Unpack");
	TMsgAuth1LoginBase::Unpack();

	if ((GetServiceType() != WONMsg::Auth1Login) ||
	    (GetMessageType() != WONMsg::Auth1NewLoginRequest))
	{
		WDBG_AH("TMsgAuth1NewLoginRequest::Unpack Not a Auth1NewLoginRequest message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a Auth1NewLoginRequest message.");
	}

	WDBG_LL("TMsgAuth1NewLoginRequest::Unpack Reading message data");
	ReadWString(mNickname);
	UnpackRawBuf();
}
// TMsgDirGetDirContents::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirGetDirContents::Unpack(void)
{
	WTRACE("TMsgDirGetDirContents::Unpack");
	TMessage::Unpack();

	if ((GetServiceType() != WONMsg::DirServer) ||
	    (GetMessageType() != WONMsg::DirGetDirContents))
	{
		WDBG_AH("TMsgDirGetDirContents::Unpack Not a DirGetDirContents message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirGetDirContents message.");
	}

	WDBG_LL("TMsgDirGetDirContents::Unpack Reading message data");
	ReadWString(mDirectoryPath);
	mRecursive = (ReadByte() == 0 ? false : true);
}
// MMsgObsAddSubscriber::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsAddSubscriber::Unpack(void)
{
	WTRACE("MMsgObsAddSubscriber::Unpack");
	MiniMessage::Unpack();

	if ((GetServiceType() != WONMsg::MiniObsServer) ||
	    (GetMessageType() != WONMsg::ObsMsg_AddSubscriber))
	{
		WDBG_AH("MMsgObsAddSubscriber::Unpack Not a ObsAddSubscriber message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a ObsAddSubscriber message.");
	}

	WDBG_LL("MMsgObsAddSubscriber::Unpack Reading message data");
	ReadString(mSubscriberName);
	ReadWString(mSubscriberDescription);
	mConnectionType			= (ConnectionTypeEnum)ReadShort();
	ReadString(mNetAddress);
}
// MMsgObsPublishStream::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsPublishStream::Unpack(void)
{
	WTRACE("MMsgObsPublishStream::Unpack");
	MiniMessage::Unpack();

	if ((GetServiceType() != WONMsg::MiniObsServer) ||
	    (GetMessageType() != WONMsg::ObsMsg_PublishStream))
	{
		WDBG_AH("MMsgObsPublishStream::Unpack Not a ObsPublishStream message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a ObsPublishStream message.");
	}

	WDBG_LL("MMsgObsPublishStream::Unpack Reading message data");

	mPublisherId = ReadLong();
	ReadString(mPublicationName);
	ReadWString(mPublicationDescription);
	mSubscriptionNotification = ReadByte()?true:false;
}
Example #13
0
void RoutingServerMessage::ReadPassword(Password& theBufR) const
{ ReadWString(theBufR); }