コード例 #1
0
bool Auth2Certificate::UnpackHook(ReadBuffer &theData)
{
	if(!AuthBase::UnpackHook(theData))
		return false;

	unsigned short aDataCount = theData.ReadShort();
	for(int i=0; i<aDataCount; i++)
	{
		unsigned short aTypeId = theData.ReadShort();
		unsigned short aDataLen = theData.ReadShort();
		int aPos = theData.pos();
		switch(aTypeId)
		{

			case 0:  // standard login data
			{
				mUserId = theData.ReadLong();
				unsigned short aKeyLen = theData.ReadShort();
				if(!mPubKey.SetPublicKey(theData.ReadBytes(aKeyLen),aKeyLen))
					return false;

				theData.ReadWString(mUserName);
				unsigned char aCommunityCount = theData.ReadByte();
				for(int i=0; i<aCommunityCount; i++)
					mCommunityTrustMap[theData.ReadLong()] = theData.ReadShort();
 
			}
			break;

			case 1: // user data
			{
				DWORD aCommunityId = theData.ReadLong();
				mUserDataMap[aCommunityId] = theData.ReadBuf(2);
			}
			break;

			case 2:	// nickname
			{
				wstring aKey, aVal;
				theData.ReadWString(aKey);
				theData.ReadWString(aVal);
				mNicknameMap[aKey] = aVal;
			}
			break;

			case 3: // KeyId data block
			{
				DWORD aCommunityId = theData.ReadLong();
				DWORD aKeyId = theData.ReadLong();
				mKeyIdMap[aCommunityId] = aKeyId;
			}
			break;
		}

		theData.ReadBytes(aDataLen - (theData.pos() - aPos));
	}

	return true;
}
コード例 #2
0
void RoutingGetGroupListOp::ParseReplyExceptForStatus(ReadBuffer &theMsg)
{
	mGroupMap.clear();

	mFlags = theMsg.ReadShort();
	unsigned short aNumGroups = theMsg.ReadShort();
	for(int i=0; i<aNumGroups; i++)
	{
		unsigned short aLen = theMsg.ReadShort();
		unsigned long aBeginPos = theMsg.pos();

		RoutingGroupInfoPtr anInfo = GetNewGroupInfo();
		anInfo->mId = theMsg.ReadShort();
		if (HasGroupName())
			theMsg.ReadWString(anInfo->mName);
		if (HasCaptainId())
			anInfo->mCaptainId = theMsg.ReadShort();
		if (HasMaxPlayers())
			anInfo->mMaxPlayers = theMsg.ReadShort();
		if (HasGroupFlags())
			anInfo->mFlags = theMsg.ReadLong();
		if (HasAsyncFlags())
			anInfo->mAsyncFlags = theMsg.ReadLong();
		if (HasObserverCount())
			anInfo->mObserverCount = theMsg.ReadShort();
		if (HasMemberCount())
			anInfo->mMemberCount = theMsg.ReadShort();
	
		if (HasMembers())
		{
			for(int j=0; j<anInfo->mMemberCount; j++)
			{
				RoutingMemberInfoPtr aMemberInfo = GetNewMemberInfo();
				aMemberInfo->mClientId = theMsg.ReadShort();
				aMemberInfo->mFlags = theMsg.ReadByte();
				anInfo->mMemberMap[aMemberInfo->mClientId] = aMemberInfo;
			}
		}

	//	if (theMsg.HasMoreBytes())
	//		anInfo->mParentId = theMsg.ReadShort();

		mGroupMap[anInfo->mId] = anInfo;
		
		theMsg.ReadBytes(aLen - (theMsg.pos() - aBeginPos));
	}

	if(HasClientCount() && theMsg.HasMoreBytes())
		mClientCount = theMsg.ReadShort();

}
コード例 #3
0
bool AuthCertificate::UnpackHook(ReadBuffer &theData)
{
	if(!AuthBase::UnpackHook(theData))
		return false;

	mUserId = theData.ReadLong();
	mCommunityId = theData.ReadLong();
	mTrustLevel = theData.ReadShort();

	unsigned short aKeyLen = theData.ReadShort();
	if(!mPubKey.SetPublicKey(theData.ReadBytes(aKeyLen),aKeyLen))
		return false;

	return true;
}
コード例 #4
0
WONStatus RoutingRegisterClientOp::HandleReply(unsigned char theMsgType, ReadBuffer &theMsg)
{
	WONStatus aStatus;

	if(theMsgType==RoutingGetClientListReply || theMsgType==RoutingGetClientListReplyEx)
	{
		if(!(mRegisterFlags&RoutingRegisterClientFlag_GetClientListEx)) // clientlistex includes clientlist ( == 0x14)
			return WS_RoutingOp_DontWantReply;

		RoutingGetClientListOpPtr anOp = new RoutingGetClientListOp(mConnection);
		aStatus = anOp->HandleReply(theMsgType,theMsg);
		mClientMap = anOp->GetClientMap();
		mReplyCount++;
	}
	else if(theMsgType==RoutingRegisterClientReply)
	{
		aStatus = (WONStatus)theMsg.ReadShort();
		if(aStatus==WS_Success)
		{
			mClientId = theMsg.ReadShort();
			theMsg.ReadWString(mClientName);
			mReconnectId = theMsg.ReadLong();
		}
		mReplyCount++;
	}
	else
		return WS_RoutingOp_DontWantReply;

	if(aStatus!=WS_Success || mReplyCount==mNumRepliesNeeded)
		return aStatus;
	else
		return WS_RoutingOp_NeedMoreReplies;
}
コード例 #5
0
WONStatus RoutingYouWereBannedOp::HandleReply(unsigned char theMsgType, ReadBuffer &theMsg)
{
	if(theMsgType!=RoutingYouWereBanned)
		return WS_RoutingOp_DontWantReply;

	mGroupId = theMsg.ReadShort();
	mAmBanned = theMsg.ReadBool();
	theMsg.ReadWString(mBanComment);
	mBanTime = theMsg.ReadLong();

	return WS_Success;
}
コード例 #6
0
WONStatus RoutingGetMembersOfGroupOp::HandleReply(unsigned char theMsgType, ReadBuffer &theMsg)
{
	if(theMsgType!=RoutingGetMembersOfGroupReply)
		return WS_RoutingOp_DontWantReply;

	WONStatus aStatus = (WONStatus)theMsg.ReadShort();
	unsigned short aGroupId = theMsg.ReadShort();
	if(aGroupId!=mGroupId)
		return WS_RoutingOp_DontWantReply;

	if(aStatus==WS_Success)
	{
		unsigned char aFlags = theMsg.ReadByte();
		mHasClientNames = ((aFlags & RoutingGroupAsyncFlag_DistributeClientName) != 0);
		mHasClientFlags = ((aFlags & RoutingGroupAsyncFlag_DistributeClientFlags) != 0);
		mObserverCount = theMsg.ReadShort();
		unsigned short aNumMembers = theMsg.ReadShort();
		for(int j=0; j<aNumMembers; j++)
		{
			unsigned short aLen = theMsg.ReadShort();
			unsigned long aBeginPos = theMsg.pos();

			RoutingMemberInfoPtr aMemberInfo = GetNewMemberInfo();
			aMemberInfo->mClientId = theMsg.ReadShort();
			aMemberInfo->mFlags = theMsg.ReadByte();
			mMemberMap[aMemberInfo->mClientId] = aMemberInfo;

			if(aFlags!=0)
				aMemberInfo->mClientInfo = GetNewClientInfo();

			if(mHasClientNames)  
				theMsg.ReadWString(aMemberInfo->mClientInfo->mName);

			if(mHasClientFlags)
				aMemberInfo->mClientInfo->mFlags = theMsg.ReadLong();

			theMsg.ReadBytes(aLen - (theMsg.pos() - aBeginPos));
		}			
	}

	return aStatus;
}