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);
			}
		}
	}
}
bool DisplayPlaneManager::initialize()
{
    int i, j;

    if (mInitialized) {
        WTRACE("object has been initialized");
        return true;
    }


    // calculate total plane number and free plane bitmaps
    mPlaneCount[DisplayPlane::PLANE_SPRITE] = mSpritePlaneCount;
    mPlaneCount[DisplayPlane::PLANE_OVERLAY] = mOverlayPlaneCount;
    mPlaneCount[DisplayPlane::PLANE_PRIMARY] = mPrimaryPlaneCount;
    mPlaneCount[DisplayPlane::PLANE_CURSOR] = mCursorPlaneCount;

    mTotalPlaneCount = mSpritePlaneCount+ mOverlayPlaneCount+ mPrimaryPlaneCount + mCursorPlaneCount;
    if (mTotalPlaneCount == 0) {
        ETRACE("plane count is not initialized");
        return false;
    }

    for (i = 0; i < DisplayPlane::PLANE_MAX; i++) {
        mFreePlanes[i] = ((1 << mPlaneCount[i]) - 1);
    }

    // allocate plane pools
    for (i = 0; i < DisplayPlane::PLANE_MAX; i++) {
        if (mPlaneCount[i]) {
            mPlanes[i].setCapacity(mPlaneCount[i]);

            for (j = 0; j < mPlaneCount[i]; j++) {
                DisplayPlane* plane = allocPlane(j, i);
                if (!plane) {
                    ETRACE("failed to allocate plane %d, type %d", j, i);
                    DEINIT_AND_RETURN_FALSE();
                }
                mPlanes[i].push_back(plane);
            }
        }
    }

    mInitialized = true;
    return true;
}
// TMsgDirSynchDirTree::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirSynchDirTree::Unpack(void)
{
	WTRACE("TMsgDirSynchDirTree::Unpack");
	TMessage::Unpack();

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

	WDBG_LL("TMsgDirSynchDirTree::Unpack Reading message data");
	ReadString(mServIP);
	mServPort = ReadShort();
}
// TMsgDirFindService::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirFindService::Unpack(void)
{
	WTRACE("TMsgDirFindService::Unpack");
	TMsgDirServiceBase::Unpack();

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

	WDBG_LL("TMsgDirFindService::Unpack Reading message data");
	mFindMask  = ReadByte();
	mRecursive = (ReadByte() == 0 ? false : true);
}
示例#5
0
// MMsgObsGetDataPool::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsGetDataPool::Unpack(void)
{
    WTRACE("MMsgObsGetDataPool::Unpack");
    MiniMessage::Unpack();

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

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

    mDataPoolId = ReadLong();
}
示例#6
0
// MMsgObsPublishRequested::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsPublishRequested::Unpack(void)
{
	WTRACE("MMsgObsPublishRequested::Unpack");
	MiniMessage::Unpack();

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

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

	ReadString(mPublicationName);
}
// MMsgCommGetNumUsers::unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgCommGetNumUsers::Unpack(void)
{
	WTRACE("MMsgCommGetNumUsers::Unpack");
	MiniMessage::Unpack();

	if (GetServiceType() != WONMsg::MiniCommonService ||
		GetMessageType() != WONMsg::MiniCommGetNumUsers)
	{
		WDBG_AH("MMsgCommGetNumUsers::Unpack Not a CommGetNumUsers message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not a CommGetNumUsers message.");
	}

	// Read attributes
	WDBG_LL("MMsgCommGetNumUsers::Unpack Reading message data");
	mTag = ReadShort();
}
示例#8
0
void* MMsgRoutingPeerData::Pack(void)
{
	WTRACE("MMsgRoutingPeerData::Pack");

	SetServiceType(WONMsg::MiniRoutingServer);
	SetMessageType(WONMsg::RoutingPeerData);
	RoutingServerMessage::Pack();

	WDBG_LL("MMsgRoutingPeerData::Pack Appending message data");

	// append the client id
	AppendClientId(mClientId);

	// append the data
	AppendBytes(mData.size(), mData.data());

	return GetDataPtr();
}
void SMsgFactSaveConfigFile::Unpack(void)
{
	WTRACE("SMsgFactSaveConfigFile::Unpack");
	SmallMessage::Unpack();

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

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

	ReadString(mConfigName);
	ReadString(mFilePath);
	ReadRawString(mBlob);
}
void ThreadBase::startThread()
{
   WTRACE("ThreadBase::startThread");
   if (!hThread)
   {
      WDBG_LM("ThreadBase::startThread Creating thread");
      ResetEvent( hStop );                      //force to non-signaled
	  ResetEvent( hRehup );
      hThread = (HANDLE)_beginthreadex(NULL, 0, ThreadRoutine, this, CREATE_SUSPENDED, (unsigned int*)&threadId );

      if (hThread)
      {
         WDBG_LL("ThreadBase::startThread Set thread priority and resume thread");
         SetThreadPriority( hThread, priority );
         ResumeThread( hThread );   
      }
   }
}
示例#11
0
void* MMsgRoutingRemoveFromGroup::Pack(void)
{
	WTRACE("MMsgRoutingRemoveFromGroup::Pack");

	SetServiceType(WONMsg::MiniRoutingServer);
	SetMessageType(WONMsg::RoutingRemoveFromGroup);
	RoutingServerMessage::Pack();

	WDBG_LL("MMsgRoutingRemoveFromGroup::Pack Appending message data");

	// append group id
	AppendGroupId(mGroupId);

	// append client id
	AppendClientId(mClientId);

	return GetDataPtr();
}
// 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();
}
示例#13
0
bool
Auth1PublicKeyBlock::VerifyRawBuffer(const unsigned char* theSigP, unsigned long theSigLen,
                                     const unsigned char* theMsgP, unsigned long theMsgLen) const
{
	WTRACE("Auth1PublicKeyBlock::VerifyRawBuffer");
	WDBG_LM("Auth1PublicKeyBlock::VerifyRawBuffer Verify Buffer, SigLen=" << theSigLen << " Msglen=" << theMsgLen);
	if (! IsValid()) return false;

	PublicKeyList::const_iterator anItr(mKeyList.begin());
	for (; anItr != mKeyList.end(); anItr++)
	{
		WDBG_LL("Auth1PublicKeyBlock::VerifyFamilyBuffer Verify with key=" << *anItr);
		if (anItr->Verify(theSigP, theSigLen, theMsgP, theMsgLen)) break;
	}

	WDBG_LM("Auth1PublicKeyBlock::VerifyRawBuffer Verify Result=" << (anItr != mKeyList.end()));
	return (anItr != mKeyList.end());
}
示例#14
0
// Auth1Certificate::Compare
// Compares two Auth1Certificate objects.  Performs base class compare.  If equal,
// compares (in this order) userId, communityId, and PublicKey.  Note that TrustLevel
// is ignored for purposes of compare.
int
Auth1Certificate::Compare(const AuthFamilyBuffer& theBufR) const
{
	WTRACE("Auth1Certificate::Compare");
	int aRet = AuthCertificateBase::Compare(theBufR);
	if (aRet != 0) return aRet;

	// If not of same type, have to PUNT
	const Auth1Certificate* aCmpP = dynamic_cast<const Auth1Certificate*>(&theBufR);
	if (! aCmpP) return aRet;

	// Compare userid and communityid
	aRet = LenientCompare(*aCmpP);
	if (aRet != 0) return aRet;

	// Compare publicKey
	return (mPubKey <  aCmpP->mPubKey ? -1 : (mPubKey == aCmpP->mPubKey ? 0 : 1));
}
// MMsgObsAddPublisherReply::Unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgObsAddPublisherReply::Unpack(void)
{
	WTRACE("MMsgObsAddPublisherReply::Unpack");
	MiniMessage::Unpack();

	if ((GetServiceType() != WONMsg::MiniObsServer) ||
	    (GetMessageType() != WONMsg::ObsMsg_AddPublisherReply))
	{
		WDBG_AH("MMsgObsAddPublisherReply::Unpack Not an ObsAddPublisherReply message!");
		throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
		                              "Not an ObsAddPublisherReply message.");
	}

	WDBG_LL("MMsgObsAddPublisherReply::Unpack Reading message data");
	mStatus = (WONMsg::ServerStatus)(short)(ReadShort());
	mPublisherId = ReadLong();
}
// ClientCDKey::BufferFromFields
// Build 8 byte raw form from internal fields.  Light check is byte 3, key is bytes
// 0-2 and 4-7.
__int64
ClientCDKey::BufferFromFields() const
{
	WTRACE("ClientCDKey::BufferFromFields");
	__int64        aRet = 0;
	unsigned char* aP   = reinterpret_cast<unsigned char*>(&aRet);

	// Put lightCheck, byte 3
	WDBG_LL("ClientCDKey::BufferFromFields lightCheck=" << hex << mLightCheck << dec);
	*(aP+3) = mLightCheck;

	// Put key, bytes 0-2, 4-7
	memcpy(aP, mKey.data(), 3);
	memcpy(aP+4, mKey.data()+3, 4);

	WDBG_LL("ClientCDKey::FieldsFromBuffer Buffer=" << hex << aRet << dec);
	return aRet;
}
// 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);
}
// ClientCDKey::Save
// Saves CD-Key to WON standard location in registry.  Entry is saved to registry as
// the enrypted binary form.  Calls AsBinary().
bool
ClientCDKey::Save() const
{
	WTRACE("ClientCDKey::Save");
	WDBG_LM("ClientCDKey::Save Save encrypted key to registry.");

	// Open registry key
	RegKey aRegKey(REG_CDKEY_PATH, HKEY_LOCAL_MACHINE, true);
	if (! aRegKey.IsOpen())
	{
		WDBG_LH("ClientCDKey::Save Fail open registry key: " << REG_CDKEY_PATH);
		return false;
	}

	// Build encrypted binary form if needed and write to registry
	AsBinary();
	return aRegKey.SetValue(mProduct.c_str(), mBinKey.data(), mBinKey.size());
}
// MMsgObsPublishStream::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsPublishStream::Pack(void)
{
	WTRACE("MMsgObsPublishStream::Pack");

	SetServiceType(WONMsg::MiniObsServer);
	SetMessageType(WONMsg::ObsMsg_PublishStream);
	MiniMessage::Pack();

	WDBG_LL("MMsgObsPublishStream::Pack Appending message data");

	AppendLong(mPublisherId);
	Append_PA_STRING(mPublicationName);
	Append_PW_STRING(mPublicationDescription);
	AppendByte((char)mSubscriptionNotification);

	return GetDataPtr();
}
// ClientCDKey::BuildNChar
// Extracts a N from buffer starting at offset theOffset.  Extracted N is appened
// to mStrKey.  Ns use 32 bits.  Value of theOffset is incremented by 3.
void
ClientCDKey::BuildNChar(const __int64& theBuf, unsigned int& theOffset) const
{
	WTRACE("ClientCDKey::BuildNChar");
	WDBG_LL("ClientCDKey::BuildNChar offset=" << theOffset);
	char aChar = ValFromBits(theBuf, theOffset, 3) + '0' + 2;

#ifdef _DEBUG
	if ((aChar < '2') || (aChar > '9'))
		throw WONCommon::WONException(WONCommon::ExSoftwareFail, __LINE__, __FILE__,
			                          "ClientCDKey::BuildNChar ValFromBits returned invalid char!");
#endif

	// Add char to buf and update offset
	WDBG_LL("ClientCDKey::BuildNChar Char=" << aChar);
	mStrKey   += aChar;
	theOffset += 3;
}
// TMsgDirDumpTree::Unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgDirDumpTree::Unpack(void)
{
	WTRACE("TMsgDirDumpTree::Unpack");
	TMessage::Unpack();

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

	WDBG_LL("TMsgDirDumpTree::Unpack Reading message data");
	ReadString(mFilePath);
	ReadString(mFileName);
}
void SMsgFactRunProcess::Unpack(void)
{
	WTRACE("SMsgFactRunProcess::Unpack");
	SmallMessage::Unpack();

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

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

	ReadString(mCommandLine);
	ReadString(mWorkingDirectory);
	mRunDetached = ReadByte()!=0;
}
示例#23
0
// Auth1PrivateKeyBlock::ComputeBufSize
// Determines number of bytes required in buffer for PACK and UNPACK operations.
// For PACK, returns base class total + fixed size + length of public keys.  For
// UNPACK, returns base class total + fixed size.
RawBuffer::size_type
Auth1PrivateKeyBlock::ComputeBufSize(SizeComputeMode theMode) const
{
	WTRACE("Auth1PrivateKeyBlock::ComputeBufSize");
	RawBuffer::size_type aRet = AuthPublicKeyBlockBase::ComputeBufSize(theMode) + BLOCK_MINLEN;
	if (theMode == PACK)
	{
		WDBG_LL("Auth1PrivateKeyBlock::ComputeBufSize Add size of each key (" << mKeyList.size() << ')');
		PrivateKeyList::const_iterator anItr(mKeyList.begin());
		for (; anItr != mKeyList.end(); anItr++)
			aRet += sizeof(unsigned short) + (*anItr)->GetKeyLen();

        aRet += sizeof(unsigned short);
        aRet += sizeof(unsigned short) * mKeyMap.size();
	}

	return aRet;
}
// TMsgCommTimeout::unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgCommTimeout::Unpack(void)
{
	WTRACE("TMsgCommTimeout::Unpack");
	TMessage::Unpack();

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

	WDBG_LL("TMsgCommTimeout::Unpack Reading message data");
	mTimeout = ReadLong();
	if (mTimeout <= 0) mTimeout = INFINITE;
}
示例#25
0
// TMsgCommPing::unpack
// Virtual method from TMessage.  Extracts data from message buffer.
void
TMsgCommPing::Unpack(void)
{
	WTRACE("TMsgCommPing::Unpack");
	TMessage::Unpack();

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

	// Read attributes
	WDBG_LL("TMsgCommPing::Unpack Reading message data");
	mStartTick = ReadLong();
}
示例#26
0
// Auth1PublicKeyBlock::UnpackData
// Unpacks member data from raw buffer in base class.  Returns true on success and
// false on failure.  Reads number of keys and then reads each key in turn.  Will
// abort if buffer size is exceeded.
bool
Auth1PublicKeyBlock::UnpackData()
{
	WTRACE("Auth1PublicKeyBlock::UnpackData");
	if (! AuthPublicKeyBlockBase::UnpackData()) return false;

	// Get data pointer (skip header data)
	WDBG_LL("Auth1PublicKeyBlock::UnpackData Unpack fixed fields.");
	const unsigned char* aDataP = mRawBuf.data() + mDataLen;

	// Read number of keys
	unsigned short aNumKeys = *(reinterpret_cast<const unsigned short*>(aDataP));
	makeLittleEndian(aNumKeys);
	aDataP   += sizeof(aNumKeys);
	mDataLen += BLOCK_MINLEN;

	// Read each key
	int i;
	for (i=0; i < aNumKeys; i++)
	{
		// Make sure key len can be read
		mDataLen += sizeof(unsigned short);
		if (mRawBuf.size() < mDataLen) break;

		// Read key len
		WDBG_LL("Auth1PublicKeyBlock::UnpackData Read key length.");
		unsigned short aKeyLen = *(reinterpret_cast<const unsigned short*>(aDataP));
		makeLittleEndian(aKeyLen);
		aDataP += sizeof(aKeyLen);

		// Make sure key can be read
		mDataLen += aKeyLen;
		if (mRawBuf.size() < mDataLen) break;

		// Read key and add to key set
		WDBG_LL("Auth1PublicKeyBlock::UnpackData Read key.");
		EGPublicKey aKey(aKeyLen, aDataP);
		aDataP += aKeyLen;
		mKeyList.push_back(aKey);
	}

	// Return true if all keys were read
	return (i == aNumKeys);
}
示例#27
0
// Auth1Certificate::UnpackData
// Unpacks member data from raw buffer in base class.  Returns true on success and
// false on failure.  Verifies raw data length, reads memeber data, sets mDatalen.
bool
Auth1Certificate::UnpackData()
{
	WTRACE("Auth1Certificate::UnpackData");
	if (! AuthCertificateBase::UnpackData()) return false;

	// Get data pointer (skip header data)
	WDBG_LL("Auth1Certificate::UnpackData Unpack fixed fields.");
	const unsigned char* aDataP = mRawBuf.data() + mDataLen;

	// Read UserId
	mUserId = *(reinterpret_cast<const unsigned long*>(aDataP));
	makeLittleEndian(mUserId);
	aDataP += sizeof(mUserId);

	// Read CommunityId
	unsigned long aCommunityId = *(reinterpret_cast<const unsigned long*>(aDataP));
	SetCommunityId(aCommunityId);
	makeLittleEndian(aCommunityId);
	aDataP += sizeof(aCommunityId);

	// Read TrustLeve
	unsigned short aTrustLevel = *(reinterpret_cast<const unsigned short*>(aDataP));
	SetTrustLevel(aTrustLevel);
	makeLittleEndian(aTrustLevel);
	aDataP += sizeof(aTrustLevel);

	// Read length of Pubkey and set mDataLen.  Verify there's enough data left
	// to read PubKey
	unsigned short aKeyLen = *(reinterpret_cast<const unsigned short*>(aDataP));
	makeLittleEndian(aKeyLen);
	aDataP   += sizeof(aKeyLen);
	mDataLen += CERT_MINLEN + aKeyLen;
	if (mRawBuf.size() < mDataLen)
	{
		WDBG_LH("Auth1Certificate::UnpackData Raw buf len to short for PubKey read (" << mRawBuf.size() << " < " << (CERT_MINLEN + aKeyLen) << ')');
		return false;
	}

	// Read PubKey
	WDBG_LL("Auth1Certificate::UnpackData Unpack PubKey and set dataLen.");
	mPubKey.Create(aKeyLen, aDataP);
	return true;
}
// MMsgObsAddPublisher::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsAddPublisher::Pack(void)
{
	WTRACE("MMsgObsAddPublisher::Pack");

	SetServiceType(WONMsg::MiniObsServer);
	SetMessageType(WONMsg::ObsMsg_AddPublisher);
	MiniMessage::Pack();

	WDBG_LL("MMsgObsAddPublisher::Pack Appending message data");
	Append_PA_STRING(mPublisherName);
	Append_PW_STRING(mPublisherDescription);
	AppendShort((short)mConnectionType);
	Append_PA_STRING(mNetAddress);
	AppendByte((char)mAccessPubsByName);
	AppendByte((char)mOnDemandPublishing);
	
	return GetDataPtr();
}
示例#29
0
// MMsgCommMRTGRequest::unpack
// Virtual method from MiniMessage.  Extracts data from message buffer.
void
MMsgCommMRTGRequest::Unpack(void)
{
    WTRACE("MMsgCommMRTGRequest::Unpack");
    MiniMessage::Unpack();

    if ((GetServiceType() != WONMsg::MiniCommonService) ||
            (GetMessageType() != WONMsg::MiniCommMRTGRequest))
    {
        WDBG_AH("MMsgCommMRTGRequest::Unpack Not a MiniCommMRTGRequest message!");
        throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
                                      "Not a MiniCommMRTGRequest message.");
    }
    WDBG_LL("MMsgCommMRTGRequest::Unpack Reading message data");
    mPrimaryID = ReadShort();
    mSecondaryID = ReadShort();
    ReadRawString(mPrimaryOption);
    ReadRawString(mSecondaryOption);
}
void* MMsgRoutingDeleteDataObject::Pack(void)
{
	WTRACE("MMsgRoutingDeleteDataObject::Pack");

	SetServiceType(WONMsg::MiniRoutingServer);
	SetMessageType(WONMsg::RoutingDeleteDataObject);
	RoutingServerMessage::Pack();

	WDBG_LL("MMsgRoutingDeleteDataObject::Pack Appending message data");

	// append the client/group id
	AppendClientOrGroupId(mLinkId);

	// append the datatype length followed by the datatype itself
	AppendByte(mDataType.size());
	AppendBytes(mDataType.size(), mDataType.data());

	return GetDataPtr();
}