unsigned int __stdcall ThreadBase::ThreadRoutine( void* param ) 
{
	ThreadBase *pTB = (ThreadBase *)param;

	WDBG_THREADSTART(pTB->mName.c_str());
	WTRACE("ThreadBase::ThreadRoutine");
   
	// anything not caught in the derived thread will eventually end up here.
	// this is the bottom of our threads execution stack
	int aRet = 0;
	try
	{
		aRet = pTB->threadProcess();
	}
	catch (WONCommon::WONException& ex)
	{
		WDBG_AH("WONException caught in ThreadRoutine!");

		// set error code
		// WONException may set this to zero if undefined, so reset to -1 in that case
		pTB->mLastError = (ex.GetCode() != 0 ? ex.GetCode() : -1); 
		ex.GetStream() << "Exception caught in Thread main.  Thread terminated!";

		// Set the exception event if needed
		if (pTB->hExceptionNotify) SetEvent(pTB->hExceptionNotify);
		aRet = pTB->mLastError;
	}

#ifndef _NO_TOPLEVEL_CATCH
	catch (...)
	{
		WDBG_AH("Unhandled exception caught in ThreadRoutine!");

		// Error code is unknown, set to (-1)
		if(! pTB->mLastError) pTB->mLastError = -1;

		// Log an error to event log
		WONCommon::EventLog aLog;
		aLog.Log("Unhandled Exception propogated to Thread main.  Thread terminated!");

		// Set the exception event if needed
		if (pTB->hExceptionNotify) SetEvent(pTB->hExceptionNotify);
		aRet = pTB->mLastError;
	}
#endif

	WDBG_THREADSTOP;
	return aRet;
}
// EGPublicKey::CopyFromPrivateKey
// Copies public key from a private key.  Existing key (if any) is replaced.  This
// method takes the binary rep of the private key and drops the private portion
// to generate the public key.
void
EGPublicKey::CopyFromPrivateKey(const EGPrivateKey& theKeyR)
{
	ClearLocal();

	try
	{
		ByteQueue aPrivQueue;
		aPrivQueue.Put(theKeyR.GetKey(), theKeyR.GetKeyLen());
		aPrivQueue.Close();

		ElGamalVerifier aKey(aPrivQueue);
		ByteQueue       aPubQueue;
		aKey.DEREncode(aPubQueue);
		aPubQueue.Close();

		AllocKeyBuf(aPubQueue.MaxRetrieveable());
		aPubQueue.Get(mKey, mKeyLen);
	}
	catch (Exception& anEx)
	{
		WDBG_AH("EGPublicKey::CopyFromPrivateKey Caught CryptoLib exception: " << anEx.what());
#ifndef _WONCRYPT_NOEXCEPTIONS
		throw WONCrypt::CryptException(WONCommon::ExCryptoLib, __LINE__, __FILE__, anEx.what());
#else
		Invalidate();
#endif
	}
}
// 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();
}
// EGPublicKey::Dump
// Streaming method.  Outputs key to specfied stream.  Outputs key length followed
// by each factor of the key.
void
EGPublicKey::Dump(std::ostream& os) const
{
	// Output KeyLen followed by P, G, and Y
	try
	{
		ByteQueue aQueue;
		aQueue.Put(mKey, mKeyLen);
		aQueue.Close();

		Integer            p, q, g, y;
		BERSequenceDecoder aDecoder(aQueue);
		p.BERDecode(aDecoder);
		q.BERDecode(aDecoder);
		g.BERDecode(aDecoder);
		y.BERDecode(aDecoder);
		os << "(Len=" << mKeyLen << " P=" << p << " Q=" << q << " G=" << g
		   << " Y=" << y << ')';
	}
	catch (Exception& anEx)
	{
		WDBG_AH("EGPublicKey::Dump Caught CryptoLib exception: " << anEx.what());
		os << "(EGPublicKey Exception: " << anEx.what() << ')';
	}
}
// SMsgDirG2GetNumEntitiesReply::Unpack
// Virtual method from SmallMessage.  Extracts data from message buffer.
void
SMsgDirG2GetNumEntitiesReply::Unpack(void)
{
	WTRACE("SMsgDirG2GetNumEntitiesReply::Unpack");
	SmallMessage::Unpack();

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

	WDBG_LL("SMsgDirG2GetNumEntitiesReply::Unpack Reading message data");
	unsigned short anEntryCt = ReadShort();

	WDBG_LL("SMsgDirG2GetNumEntitiesReply::Unpack Reading " << anEntryCt << " entries.");
	mEntries.clear();
	for (int i=0; i < anEntryCt; i++)
	{
		NumEntriesData anEntry;
		mEntries.push_back(anEntry);
		mEntries.back().first  = static_cast<short>(ReadShort());
		mEntries.back().second = ReadShort();
	}
}
// TMsgDirGetDirContents::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirGetDirContentsReply::Unpack(void)
{
	WTRACE("TMsgDirGetDirContentsReply::Unpack");
	TMessage::Unpack();

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

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

	WDBG_LL("TMsgDirGetDirContentsReply::Unpack Reading " << anEntryCt << "entries.");
	mEntries.clear();
	for (int i=0; i < anEntryCt; i++)
	{
		DirServerEntry anEntry;
		UnpackEntry(anEntry);
		mEntries.push_back(anEntry);
	}
}
void MMsgRoutingSendData::Unpack(void)
{
	WTRACE("MMsgRoutingSendData::Unpack");
	RoutingServerMessage::Unpack();

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

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

	// read in the flags
	unsigned char aFlags = ReadByte();
	mShouldSendReply     = ((aFlags & 0x01) != 0);
	mIncludeExcludeFlag  = ((aFlags & 0x02) != 0);

	// read in the message data
	unsigned short aDataSize = ReadShort();
	mData.assign(reinterpret_cast<const unsigned char*>(ReadBytes(aDataSize)), aDataSize);

	// read in the address list
	ReadAddresseeList(this);
}
// 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);
	}
}
// TMsgCommQueryOptions::unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgCommQueryOptions::Unpack(void)
{
	WTRACE("TMsgCommQueryOptions::Unpack");
	mOptionList.clear();
	TMessage::Unpack();

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

	// Get num options
	unsigned short aCt = ReadShort();

	WDBG_LL("TMsgCommQueryOptions::Unpack Reading " << aCt << "entries.");
	for (int i=0; i < aCt; i++)
	{
		string aBuf;
		ReadString(aBuf);
		mOptionList.push_back(aBuf);
	}
}
void MMsgRoutingModifyDataObject::Unpack(void)
{
	WTRACE("MMsgRoutingModifyDataObject::Unpack");
	RoutingServerMessage::Unpack();

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

	// read in the client/group id
	mLinkId = ReadClientOrGroupId();
	
	// read in the datatype size and then the datatype itself
	unsigned char aDataTypeSize = ReadByte();
	mDataType.assign((unsigned char*)ReadBytes(aDataTypeSize), aDataTypeSize);

	// read in the offset
	mOffset = ReadShort();

	// read in the IsInsert flag
	mIsInsert = ReadBool();
	
	// read in the data length followed by the data itself
	unsigned short aDataSize = ReadShort();
	mData.assign((unsigned char*)ReadBytes(aDataSize), aDataSize);

	WDBG_LL("MMsgRoutingModifyDataObject::Unpack Reading message data");
}
Esempio n. 11
0
void MMsgRoutingGetUserListReply::Unpack(void)
{
	WTRACE("MMsgRoutingGetUserListReply::Unpack");
	RoutingServerMessage::Unpack();

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

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

	// read in the status
	mStatus = ReadShort();

	// read in the user count
	unsigned short aNumUsers = ReadShort();

	// read in the user list
	mUserList.clear();
	for (int iUser = 0; iUser < aNumUsers; iUser++)
	{
		UserData aUser;
		ReadUserName(aUser.mUserName);

		mUserList.push_back(aUser);
	}
}
// 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());
	}
}
Esempio n. 13
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);
	}
}
void MMsgRoutingUnsubscribeDataObject::Unpack(void)
{
	WTRACE("MMsgRoutingUnsubscribeDataObject::Unpack");
	RoutingServerMessage::Unpack();

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

	// read in the client/group id
	mLinkId = ReadClientOrGroupId();
	
	// read in the datatype length followed by the datatype itself
	unsigned char aDataTypeSize = ReadByte();
	mDataType.assign((unsigned char*)ReadBytes(aDataTypeSize), aDataTypeSize);
	
	// read in the flags
	unsigned char aFlags = ReadByte();
	mExactOrRecursiveFlag = ((aFlags & 0x01) != 0);
	mGroupOrMembersFlag   = ((aFlags & 0x02) != 0);
	
	WDBG_LL("MMsgRoutingUnsubscribeDataObject::Unpack Reading message data");
}
Esempio n. 15
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();
}
// 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()));
}
void MMsgRoutingCreateGroup::Unpack(void)
{
	WTRACE("MMsgRoutingCreateGroup::Unpack");
	RoutingServerMessage::Unpack();

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

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

	// read in group name
	ReadGroupName(mGroupName);
	
	// read in flags
	unsigned char aFlags = ReadByte();
	mIsPublic             = ((aFlags & 0x01) != 0);
	mAnnounceGroupChanges = ((aFlags & 0x02) != 0);

	// read in client count
	unsigned short aNumClients = ReadShort();

	// read in client list
	mClientList.clear();
	for (int iClient = 0; iClient < aNumClients; iClient++)
		mClientList.push_back(ReadClientId());
}
Esempio n. 18
0
void SMsgCommDumpStatistics::Unpack(void)
{
	WTRACE("SMsgCommDumpStatistics::Unpack");
	SmallMessage::Unpack();

	if (GetServiceType() != WONMsg::SmallCommonService ||
	    GetMessageType() != WONMsg::SmallCommDumpStatistics)
	{
		WDBG_AH("SMsgCommDumpStatistics::Unpack Not a SMsgCommDumpStatistics message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a SMsgCommDumpStatistics message.");
	}
}
void MMsgRoutingInviteClient::Unpack(void)
{
	WTRACE("MMsgRoutingInviteClient::Unpack");
	RoutingServerClientNameFlagMessage::Unpack();

	if (GetServiceType() != WONMsg::MiniRoutingServer || 
        GetMessageType() != WONMsg::RoutingInviteClient)
	{
		WDBG_AH("MMsgRoutingInviteClient::Unpack Not a RoutingInviteClient message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a RoutingInviteClient message.");
	}
}
Esempio n. 20
0
void MMsgRoutingBecomeModerator::Unpack(void)
{
	WTRACE("MMsgRoutingBecomeModerator::Unpack");
	RoutingServerClientIdFlagMessage::Unpack();

	if (GetServiceType() != WONMsg::MiniRoutingServer || 
        GetMessageType() != WONMsg::RoutingBecomeModerator)
	{
		WDBG_AH("MMsgRoutingBecomeModerator::Unpack Not a RoutingBecomeModerator message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a RoutingBecomeModerator message.");
	}
}
Esempio n. 21
0
// MMsgCommNoOp::unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
MMsgCommNoOp::Unpack(void)
{
	WTRACE("MMsgCommNoOp::Unpack");
	MiniMessage::Unpack();

	if ((GetServiceType() != WONMsg::MiniCommonService) ||
	    (GetMessageType() != WONMsg::MiniCommNoOp))
	{
		WDBG_AH("MMsgCommNoOp::Unpack Not a CommNoOp message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a CommNoOp message.");
	}
}
Esempio n. 22
0
void MMsgRoutingKeepAlive::Unpack(void)
{
	WTRACE("MMsgRoutingKeepAlive::Unpack");
	RoutingServerMessage::Unpack();

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

	WDBG_LL("MMsgRoutingKeepAlive::Unpack Reading message data");
}
// TMsgDirLoadFromSource::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirLoadFromSource::Unpack(void)
{
	WTRACE("TMsgDirLoadFromSource::Unpack");
	TMessage::Unpack();

	if ((GetServiceType() != WONMsg::DirServer) ||
	    (GetMessageType() != WONMsg::DirLoadFromSource))
	{
		WDBG_AH("TMsgDirLoadFromSource::Unpack Not a DirLoadFromSource message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a DirLoadFromSource message.");
	}
}
Esempio n. 24
0
// TMsgAuth1LoginRequest2::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
// Note: call ForceRawBufOwn() to force ownership of the data buffers.
void
TMsgAuth1LoginRequest2::Unpack(void)
{
	WTRACE("TMsgAuth1LoginRequest2::Unpack");
	TMsgAuth1LoginBase2::Unpack();

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

}
Esempio n. 25
0
void MMsgRoutingRemoveSuccessor::Unpack(void)
{
	WTRACE("MMsgRoutingRemoveSuccessor::Unpack");
	RoutingServerMessage::Unpack();

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

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

	mClientId = ReadClientId();
}
Esempio n. 26
0
void TMsgCommProtocolReject::Unpack()
{
    WTRACE("TMsgCommProtocolReject::Unpack");
    TMessage::Unpack();

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

    WDBG_LL("TMsgCommProtocolReject::Unpack Reading message data");
    mProtocolType  = MsgProtocolType( ReadByte() );
}
Esempio n. 27
0
void MMsgRoutingGetUserList::Unpack(void)
{
	WTRACE("MMsgRoutingGetUserList::Unpack");
	RoutingServerMessage::Unpack();

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

	mUserListType = ReadByte();
	if (mUserListType > USERLISTTYPE_MAX)
		mUserListType = USERLISTTYPE_INVALID;
}
Esempio n. 28
0
void SMsgFactGetDir::Unpack(void)
{
	WTRACE("SMsgFactGetDir::Unpack");
	SmallMessage::Unpack();

	if (GetServiceType() != WONMsg::SmallFactoryServer ||
	    GetMessageType() != WONMsg::FactGetDir)
	{
		WDBG_AH("SMsgFactGetDir::Unpack Not a FactGetDir message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a FactGetDir message!");
	}

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

	ReadString(mFilePath);
}
void MMsgRoutingClientChangeEx::Unpack(void)
{
	WTRACE("MMsgRoutingClientChangeEx::Unpack");
	RoutingServerMessage::Unpack();

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

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

	MMsgRoutingClientChange::SimpleUnpack();
	ChangeInfo::Unpack(this);
}
void MMsgRoutingCreateGroupReply::Unpack(void)
{
	WTRACE("MMsgRoutingCreateGroupReply::Unpack");
	RoutingServerMessage::Unpack();

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

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

	mStatus = ReadShort();
	mGroupId = (mStatus == WONMsg::StatusCommon_Success) ? ReadGroupId() : 0;
}