// TMsgDirFindServiceReply::Pack
// Virtual method from TMessage.  Packs data into message buffer and
// sets the new message length.
void*
TMsgDirFindServiceReply::Pack(void)
{
	WTRACE("TMsgDirFindServiceReply::Pack");
	SetServiceType(WONMsg::DirServer);
	SetMessageType(WONMsg::DirFindServiceReply);
	TMessage::Pack();

	WDBG_LL("TMsgDirFindServiceReply::Pack Appending message data");
	AppendShort(static_cast<short>(mStatus));

	// Service info only sent if status is ok
	if (mStatus == WONMsg::StatusCommon_Success)
	{
		Append_PW_STRING(mService.mPath);
		Append_PW_STRING(mService.mName);
		Append_PW_STRING(mService.mDisplayName);
		Append_PW_STRING(mService.mVersion);
		Append_PW_STRING(mService.mProtoName);
		Append_PW_STRING(mService.mProtoVersion);
		Append_PW_STRING(mService.mNetAddress);
		AppendLong(mService.mLifespan);
		AppendLong(mService.mCreated);
		AppendShort(mService.mBlobLen);
		AppendBytes(mService.mBlobLen, mService.mBlob);
	}

	return GetDataPtr();
}
void
TMsgDirGetDirContentsReply::PackEntry(const DirServerEntry& theEntry)
{
	WTRACE("TMsgDirGetDirContentsReply::PackEntry");
	WDBG_LL("TMsgDirGetDirContentsReply::PackEntry Packing entry");

	AppendByte(theEntry.mType);
	Append_PW_STRING(theEntry.mPath);
	Append_PW_STRING(theEntry.mName);
	Append_PW_STRING(theEntry.mDisplayName);
	AppendLong(theEntry.mLifespan);
	AppendLong(theEntry.mCreated);

	if (theEntry.mType == DirServerEntry::EntryTypeDirectory)
	{
		AppendByte(theEntry.mVisible ? 1 : 0);
	}
	else if (theEntry.mType == DirServerEntry::EntryTypeService)
	{
		Append_PW_STRING(theEntry.mVersion);
		Append_PW_STRING(theEntry.mProtoName);
		Append_PW_STRING(theEntry.mProtoVersion);
		Append_PW_STRING(theEntry.mNetAddress);
		AppendShort(theEntry.mBlobLen);
		AppendBytes(theEntry.mBlobLen, theEntry.mBlob);
	}
}
static uint8_t* AppendEncryptedSignature(SecOTRSessionRef session,
                                         const cc_unit* s,
                                         bool usePrime,
                                         CFMutableDataRef appendTo)
{
    CFMutableDataRef signature = CFDataCreateMutable(kCFAllocatorDefault, 0);
    CFMutableDataRef mbData = CFDataCreateMutable(kCFAllocatorDefault, 0);
    CFMutableDataRef mb = CFDataCreateMutable(kCFAllocatorDefault, 0);

    SecFDHKAppendPublicSerialization(session->_myKey, mbData);
    SecPDHKAppendSerialization(session->_theirKey, mbData);
    
    CFIndex publicKeyOffset = CFDataGetLength(mbData);

    SecOTRPublicIdentityRef myPublic = SecOTRPublicIdentityCopyFromPrivate(kCFAllocatorDefault, session->_me, NULL);
    AppendPublicKey(mbData, myPublic);
    CFReleaseNull(myPublic);

    AppendLong(mbData, session->_keyID);
    
    DeriveAndAppendSHA256HMAC(mb,
                              kExponentiationUnits, s,
                              usePrime ? kM1Prime : kM1,
                              (size_t)CFDataGetLength(mbData), CFDataGetBytePtr(mbData));
    
    CFDataDeleteBytes(mbData, CFRangeMake(0, publicKeyOffset));

    CFMutableDataRef xb = mbData; mbData = NULL;
    SecOTRFIAppendSignature(session->_me, mb, signature, NULL);
    CFReleaseNull(mb);

    AppendCFDataAsDATA(xb, signature);
    CFReleaseNull(signature);

    CFIndex dataLength = CFDataGetLength(xb);

    CFIndex signatureStartIndex = CFDataGetLength(appendTo);
    /* 64 bits cast: We are appending the signature we just generated, which is never bigger than 2^32 bytes. */
    assert(((unsigned long)dataLength)<=UINT32_MAX); /* debug check, correct as long as CFIndex is a signed long */
    AppendLong(appendTo, (uint32_t)dataLength);
    uint8_t *destination = CFDataIncreaseLengthAndGetMutableBytes(appendTo, dataLength);

    uint8_t c[kOTRAuthKeyBytes];
    DeriveOTR128BitPairFromS(kCs, kExponentiationUnits, s,
                             sizeof(c), usePrime ? NULL : c,
                             sizeof(c), usePrime ? c : NULL);

    AES_CTR_IV0_Transform(sizeof(c), c,
                          (size_t)dataLength, CFDataGetBytePtr(xb),
                          destination);
    bzero(c, sizeof(c));
    CFReleaseNull(xb);
    
    return CFDataGetMutableBytePtr(appendTo) + signatureStartIndex;
}
示例#4
0
// SMsgDirG2PeerDataBase::PackPeerData
// Hook to pack the peer data if needed.  Only appends peer data if peer
// data is defined.
void
SMsgDirG2PeerDataBase::PackPeerData(void)
{
	WTRACE("SMsgDirG2PeerDataBase::PackPeerData");
	if (mPeerKey.size() > 0)
	{
		WDBG_LL("SMsgDirG2PeerDataBase::PackPeerData Appending peer data.");
		Append_PA_STRING(mPeerKey);
		AppendLong(mPeerIndex);
		AppendLong(mPeerUser);
	}
	else
		WDBG_LL("SMsgDirG2PeerDataBase::PackPeerData No peer data to append.");
}
示例#5
0
// SMsgDirG2ModifyService::Pack
// Virtual method from SmallMessage.  Packs data into message buffer.
void*
SMsgDirG2ModifyService::Pack(void)
{
	WTRACE("SMsgDirG2ModifyService::Pack");
	SetKeyType(KT_SERVICE);
	SetServiceType(WONMsg::SmallDirServerG2);
	if (IsExtended())
	{
		SetMessageType(WONMsg::DirG2ModifyServiceEx);
		SetExtended(true, true);
	}
	else
		SetMessageType(WONMsg::DirG2ModifyService);

	SMsgDirG2UpdateExtendBase::Pack();
	AppendByte(mEntityFlags);
	PackKey(*this);
	Append_PW_STRING(mNewName);

	unsigned char aLen = mNewNetAddress.size();
	AppendByte(aLen);
	if (aLen > 0)
		AppendBytes(aLen, mNewNetAddress.data());

	Append_PW_STRING(mNewDisplayName);
	AppendLong(mNewLifespan);
	PackExtended();
	PackPeerData();

	return GetDataPtr();
}
// MMsgObsCancelSubscription::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsCancelSubscription::Pack(void)
{
	WTRACE("MMsgObsCancelSubscription::Pack");

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

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

	AppendLong(mPublicationId);
	AppendLong(mSubscriberId);
	
	return GetDataPtr();
}
void* SMsgFactStreamFile::Pack(void)
{
	WTRACE("SMsgFactStreamFile::Pack");

	SetServiceType(WONMsg::SmallFactoryServer);
	SetMessageType(WONMsg::FactStreamFile);
	SmallMessage::Pack();

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

	Append_PA_STRING(mFilePath);
	AppendByte(mCompress?1:0);
	AppendLong(mModifyTime.dwHighDateTime);
	AppendLong(mModifyTime.dwLowDateTime);
	return GetDataPtr();
}
示例#8
0
// MMsgCommGetNetStatReply::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgCommGetNetStatReply::Pack(void)
{
	WTRACE("MMsgCommGetNetStatReply::Pack");
	SetServiceType(WONMsg::MiniCommonService);
	SetMessageType(WONMsg::MiniCommGetNetStatReply);
	MiniMessage::Pack();

	AppendLong(mNumSockets);

	AppendShort(mTCPListenSockets.size());
	std::list<unsigned short>::iterator anItr = mTCPListenSockets.begin();
	while(anItr!=mTCPListenSockets.end())
	{
		AppendShort(*anItr);
		++anItr;
	}

	AppendShort(mUDPListenSockets.size());
	anItr = mUDPListenSockets.begin();
	while(anItr!=mUDPListenSockets.end())
	{
		AppendShort(*anItr);
		++anItr;
	}


	AppendLong(mConnectToListenSocketCount);
	AppendShort(mLastAcceptTimes.size());
	std::list<DWORD>::iterator anItr2;
	anItr2 = mLastAcceptTimes.begin();
	while(anItr2!=mLastAcceptTimes.end())
	{
		AppendLong(*anItr2);
		++anItr2;
	}

	AppendShort(mPendingAccepts.size());
	anItr2 = mPendingAccepts.begin();
	while(anItr2!=mPendingAccepts.end())
	{
		AppendLong(*anItr2);
		++anItr2;
	}

	return GetDataPtr();
}
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);
			}
		}
	}
}
示例#10
0
// TMsgCommPingReply::Pack
// Virtual method from TMessage.  Packs data into message buffer and
// sets the new message length.
void*
TMsgCommPingReply::Pack(void)
{
	WTRACE("TMsgCommPingReply::Pack");
	SetServiceType(WONMsg::CommonService);
	SetMessageType(WONMsg::CommPingReply);
	TMessage::Pack();

#ifdef WIN32
	// Build image if needed
	if (mImage.empty())
	{
		char aFileNameStr[_MAX_PATH+1];
		GetModuleFileName(NULL, aFileNameStr, _MAX_PATH+1);
		mImage = aFileNameStr;
	}

	// Fetch version if needed
	if (mVersion == 0)
	{
		struct _stat aStat;
		mVersion = (_stat(mImage.c_str(), &aStat) == -1 ? 0 : aStat.st_mtime);
	}
#endif

#if defined(macintosh) && (macintosh == 1)
#else
		// Fetch PID if needed
		if (mPID == 0)
			mPID = getpid();
#endif

	WDBG_LL("TMsgCommPingReply::Pack Appending message data");
	Append_PA_STRING(mAppName);
	Append_PA_STRING(mLogicalName);
	AppendLong(mStartTick);
	AppendLong(mVersion);
	Append_PA_STRING(mImage);
	AppendLong(mPID);
	Append_PA_STRING(mPorts);

	return GetDataPtr();
}
void SecOTRAppendDHMessage(SecOTRSessionRef session,
                           CFMutableDataRef appendTo)
{
    //
    // Message Type: kDHMessage (0x02)
    // AES_CTR(r, 0) of G^X MPI
    // SHA256(gxmpi)
    //
    
    if(!session) return;
    CFMutableDataRef gxmpi = CFDataCreateMutable(kCFAllocatorDefault, 0);
    if(!gxmpi) return;

    AppendHeader(appendTo, kDHMessage);

    SecFDHKAppendPublicSerialization(session->_myKey, gxmpi);

    size_t gxmpiSize = (size_t)CFDataGetLength(gxmpi);
    if(gxmpiSize == 0) {
        CFReleaseNull(gxmpi);
        return;
    }
    const uint8_t* gxmpiLocation = CFDataGetBytePtr(gxmpi);

    /* 64 bits cast: gxmpiSize is the size of the EC public key, which is hardcoded and never more than 2^32 bytes. */
    assert(gxmpiSize<UINT32_MAX); /* debug check only */
    AppendLong(appendTo, (uint32_t)gxmpiSize);
    assert(gxmpiSize<INT32_MAX);
    uint8_t* encGxmpiLocation = CFDataIncreaseLengthAndGetMutableBytes(appendTo, (CFIndex)gxmpiSize);
    AES_CTR_IV0_Transform(sizeof(session->_r), session->_r, gxmpiSize, gxmpiLocation, encGxmpiLocation);
    
    AppendLong(appendTo, CCSHA256_OUTPUT_SIZE);
    uint8_t* hashLocation = CFDataIncreaseLengthAndGetMutableBytes(appendTo, CCSHA256_OUTPUT_SIZE);

#ifdef USECOMMONCRYPTO
    (void) CC_SHA256(gxmpiLocation, (uint32_t)gxmpiSize, hashLocation);
#else
    ccdigest(ccsha256_di(), gxmpiSize, gxmpiLocation, hashLocation);
#endif
    CFReleaseNull(gxmpi);
}
示例#12
0
// MMsgObsSubscribeReply::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsSubscribeReply::Pack(void)
{
	WTRACE("MMsgObsSubscribeReply::Pack");
	SetServiceType(WONMsg::MiniObsServer);
	SetMessageType(WONMsg::ObsMsg_SubscribeReply);
	MiniMessage::Pack();

	WDBG_LL("MMsgObsSubscribeReply::Pack Appending message data");
	AppendShort((short)(mStatus));
	AppendLong(mPublicationId);
	AppendLong(mSubscriberId);
	AppendShort(mDataLength);
	if (mDataLength > 0)
	{
		AppendBytes(mDataLength, mDataP);
	}
	Append_PA_STRING(mPeerRedirection);

	return GetDataPtr();
}
// TMsgCommTimeout::Pack
// Virtual method from TMessage.  Packs data into message buffer and
// sets the new message length.
void*
TMsgCommTimeout::Pack(void)
{
	WTRACE("TMsgCommTimeout::Pack");
	SetServiceType(WONMsg::CommonService);
	SetMessageType(WONMsg::CommMsgTimeout);
	TMessage::Pack();

	WDBG_LL("TMsgCommTimeout::Pack Appending message data");
	AppendLong(mTimeout > 0 ? mTimeout : -1);

	return GetDataPtr();
}
void SMsgUsrPushedUserList::pack_multiple_message_specific_data()
	{
	// Sanity check that the output user array has been set to a non-null value

	if (m_p_output_userarray_for_unpacking)
		{
		// Append the data source id

		AppendLong(m_i_data_source_id);

		// Append the data source specific status information

		AppendShort(static_cast<short>(m_data_source_specific_status));

		// Append the issue number

		AppendLong(m_i_issue_number);

		// Append the number of users found

		AppendLong(get_number_of_users());

		// Cycle through the vector of users, and append each user

		for (unsigned long counter = m_user_objects_begin;
		     counter < m_user_objects_end;
			 counter++)
			{
			// Pack the user data

			((*m_p_output_userarray_for_unpacking)[counter]).m_user.pack_data(*this);

			// Pack the purpose

			AppendLong(((*m_p_output_userarray_for_unpacking)[counter]).m_update_purpose);
			}
		}
	}
示例#15
0
// TMsgCommPing::Pack
// Virtual method from TMessage.  Packs data into message buffer and
// sets the new message length.
void*
TMsgCommPing::Pack(void)
{
	WTRACE("TMsgCommPing::Pack");
	SetServiceType(WONMsg::CommonService);
	SetMessageType(WONMsg::CommPing);
	TMessage::Pack();

	// Generate and pack in startTick
	WDBG_LL("TMsgCommPing::Pack Appending message data");
	AppendLong(GetTickCount());

	return GetDataPtr();
}
示例#16
0
// MMsgObsSubscribeById::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsSubscribeById::Pack(void)
{
	WTRACE("MMsgObsSubscribeById::Pack");

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

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

	AppendLong(mPublicationId);
	AppendLong(mSubscriberId);
	if (!mSubscriberId) // Optional parameters follow
	{
		Append_PA_STRING(mSubscriberName);
		Append_PW_STRING(mSubscriberDescription);
		AppendShort(mConnectionType);
		Append_PA_STRING(mSubscriberAddress);
	}
	
	return GetDataPtr();
}
void SMsgUsrGetPolledUserListReplyEx::pack_multiple_message_specific_data()
	{
	// Append the data source id

	AppendLong(m_i_data_source_id);

	// Append the data source specific status information

	AppendShort(static_cast<short>(m_data_source_specific_status));

	// Append the number of users found

	AppendLong(get_number_of_users());

	// Cycle through the vector of users, and append each user

	for (UserArray::const_iterator user_iterator = m_a_users.begin();
		 user_iterator != m_a_users.end();
		 user_iterator++)
		{
		user_iterator->pack_data(*this);
		}
	}
示例#18
0
// SMsgDirG2SingleEntityReply::Pack
// Virtual method from SmallMessage.  Packs data into message buffer.
void*
SMsgDirG2SingleEntityReply::Pack(void)
{
	WTRACE("SMsgDirG2SingleEntityReply::Pack");
	SetServiceType(WONMsg::SmallDirServerG2);
	SetMessageType(WONMsg::DirG2SingleEntityReply);
	SMsgDirG2EntityBase::Pack();

	WDBG_LL("SMsgDirG2SingleEntityReply::Pack Appending message data");
	AppendShort(static_cast<short>(mStatus));

	// Append flags, force AddDataObject flag if there are data types
	if (mStatus >= 0)
	{
		if (mDataTypes.empty())
			AppendLong(mFlags);
		else
			AppendLong(mFlags | GF_ADDDATAOBJECTS);

		PackEntity(mEntity);
	}

	return GetDataPtr();
}
// MMsgObsRemovePublisher::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsRemovePublisher::Pack(void)
{
	WTRACE("MMsgObsRemovePublisher::Pack");

	SetServiceType(WONMsg::MiniObsServer);
	SetMessageType(WONMsg::ObsMsg_RemovePublisher);

	MiniMessage::Pack();

	WDBG_LL("MMsgObsRemovePublisher::Pack Appending message data");
	AppendLong(mPublisherId);
	
	return GetDataPtr();
}
示例#20
0
// MMsgObsGetDataPool::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsGetDataPool::Pack(void)
{
    WTRACE("MMsgObsGetDataPool::Pack");

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

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

    AppendLong(mDataPoolId);

    return GetDataPtr();
}
// MMsgObsAddPublisherReply::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsAddPublisherReply::Pack(void)
{
	WTRACE("MMsgObsAddPublisherReply::Pack");

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

	WDBG_LL("MMsgObsAddPublisherReply::Pack Appending message data");
	AppendShort((short)(mStatus));
	AppendLong((unsigned long)(mPublisherId));

	return GetDataPtr();
}
void *SMsgUsrSubscribeToUserList::Pack(void)
	{
	WTRACE("SMsgUsrSubscribeToUserList::Pack");
	SetServiceType(USER_SEARCH_SERVER_TYPE);
	SetMessageType(SMsgUsrSubscribeToUserListTYPE);
	SmallMessage::Pack();

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

	// Append subscription to the message

	AppendLong(m_i_data_source_id);

	return GetDataPtr();
	}
示例#23
0
// TMsgDirRenewDirectory::Pack
// Virtual method from TMessage.  Packs data into message buffer and
// sets the new message length.
void*
TMsgDirRenewDirectory::Pack(void)
{
	WTRACE("TMsgDirRenewDirectory::Pack");
	SetServiceType(WONMsg::DirServer);
	SetMessageType(WONMsg::DirRenewDirectory);
	TMsgDirDirectoryBase::Pack();

	WDBG_LL("TMsgDirRenewDirectory::Pack Appending message data");
	AppendLong(mLifespan);

	// Pack peer data if needed
	PackPeerData();

	return GetDataPtr();
}
void SecOTRAppendRevealSignatureMessage(SecOTRSessionRef session,
                                        CFMutableDataRef appendTo)
{
    //
    // Message Type: kRevealSignatureMessage (0x11)
    // G^X Data MPI
    //
    
    AppendHeader(appendTo, kRevealSignatureMessage);
    
    AppendLong(appendTo, kOTRAuthKeyBytes);
    uint8_t* keyPosition = CFDataIncreaseLengthAndGetMutableBytes(appendTo, kOTRAuthKeyBytes);
    memcpy(keyPosition, session->_r, kOTRAuthKeyBytes);
    
    AppendMACedEncryptedSignature(session, false, appendTo);
}
// MMsgObsReestablishPersistentTCP::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsReestablishPersistentTCP::Pack(void)
{
	WTRACE("MMsgObsReestablishPersistentTCP::Pack");

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

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

	AppendLong(mClientId);
	AppendShort((short)mClientType);
	
	return GetDataPtr();
}
示例#26
0
void *SMsgUsrRemoveDataSource::Pack(void)
{
    WTRACE("SMsgUsrRegisterDataSource::Pack");

    SetServiceType(USER_SEARCH_SERVER_TYPE);
    SetMessageType(SMsgUsrRemoveDataSourceTYPE);

    SmallMessage::Pack();

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

    // Append the data source id to the message

    AppendLong(m_i_data_source_id);

    return GetDataPtr();
}
// 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();
}
void* RoutingServerGenericFlagMessage::Pack(void)
{
	WTRACE("RoutingServerGenericFlagMessage::Pack");
	RoutingServerFlagMessage::Pack();

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

	AppendByte(mContentType);
	switch (mContentType)
	{
		case CONTENTTYPE_CLIENTID:
			AppendClientId(mClientId); break;
		case CONTENTTYPE_CLIENTNAME:
			AppendClientName(mClientName); break;
		case CONTENTTYPE_WONUSERID:
			AppendLong(mWONUserId); break;
	}

	return GetDataPtr();
}
示例#29
0
// MMsgObsGetDataPoolReply::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsGetDataPoolReply::Pack(void)
{
    WTRACE("MMsgObsGetDataPoolReply::Pack");

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

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

    AppendShort((short)mStatus);
    AppendLong(mDataPoolId);
    AppendShort(mDataLength);
    if (mDataLength > 0)
    {
        AppendBytes(mDataLength, mDataP);
    }

    return GetDataPtr();
}
示例#30
0
// MMsgObsPublishDataPool::Pack
// Virtual method from MiniMessage.  Packs data into message buffer and
// sets the new message length.
void*
MMsgObsPublishDataPool::Pack(void)
{
	WTRACE("MMsgObsPublishDataPool::Pack");

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

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

	AppendLong(mPublisherId);
	Append_PA_STRING(mPublicationName);
	Append_PW_STRING(mPublicationDescription);
	AppendByte((char)mSubscriptionNotification);
	AppendShort(mDataLength);
	if (mDataLength > 0)
	{
		AppendBytes(mDataLength, mDataP);
	}

	return GetDataPtr();
}