Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.5 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999, 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: fwdserver.cpp
  6. * Content: Implements the forwarding server portion of the server class
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 11/01/2000 rodtoll Split out from dvsereng.cpp
  12. * 02/28/2002 rodtoll WINBUG #549959 - SECURITY: DPVOICE: Voice server trusts client's target list
  13. * - Update receive path to use server's copy of client target list when server controlled targetting enabled
  14. *
  15. ***************************************************************************/
  16. #include "dxvoicepch.h"
  17. #undef DPF_MODNAME
  18. #define DPF_MODNAME "CDirectVoiceServerEngine::StartupMulticast"
  19. //
  20. // StartupMulticast
  21. //
  22. // This function is called to initialize the multicast portion of the server
  23. // object.
  24. //
  25. // Called By:
  26. // - StartSession
  27. //
  28. // Locks Required:
  29. // - None
  30. //
  31. HRESULT CDirectVoiceServerEngine::StartupMulticast()
  32. {
  33. return DV_OK;
  34. }
  35. #undef DPF_MODNAME
  36. #define DPF_MODNAME "CDirectVoiceServerEngine::ShutdownMulticast"
  37. //
  38. // ShutdownMulticast
  39. //
  40. // This function is called to shutdown the multicast portion of the server
  41. // object.
  42. //
  43. // Called By:
  44. // - StartSession
  45. //
  46. // Locks Required:
  47. // - None
  48. //
  49. HRESULT CDirectVoiceServerEngine::ShutdownMulticast()
  50. {
  51. return DV_OK;
  52. }
  53. HRESULT CDirectVoiceServerEngine::HandleForwardingReceive( CVoicePlayer *pTargetPlayer, PDVPROTOCOLMSG_SPEECHWITHTARGET pdvSpeechWithtarget, DWORD dwSpeechSize, PBYTE pbSpeechData )
  54. {
  55. HRESULT hr;
  56. PDVTRANSPORT_BUFFERDESC pBufferDesc;
  57. PDVPROTOCOLMSG_SPEECHWITHFROM pdvSpeechWithFrom;
  58. PVOID pvSendContext;
  59. DWORD dwTransmitSize = sizeof( DVPROTOCOLMSG_SPEECHWITHFROM ) + dwSpeechSize;
  60. DNASSERT( dwTransmitSize <= m_lpdvfCompressionInfo->dwFrameLength + sizeof( DVPROTOCOLMSG_SPEECHWITHFROM ) );
  61. pBufferDesc = GetTransmitBuffer( dwTransmitSize, &pvSendContext );
  62. if( pBufferDesc == NULL )
  63. {
  64. DPFX(DPFPREP, DVF_ERRORLEVEL, "Error allocating memory" );
  65. pTargetPlayer->Release();
  66. return FALSE;
  67. }
  68. pdvSpeechWithFrom = (PDVPROTOCOLMSG_SPEECHWITHFROM) pBufferDesc->pBufferData;
  69. pdvSpeechWithFrom->dvHeader.dwType = DVMSGID_SPEECHWITHFROM;
  70. pdvSpeechWithFrom->dvHeader.bMsgNum = pdvSpeechWithtarget->dvHeader.bMsgNum;
  71. pdvSpeechWithFrom->dvHeader.bSeqNum = pdvSpeechWithtarget->dvHeader.bSeqNum;
  72. pdvSpeechWithFrom->dvidFrom = pTargetPlayer->GetPlayerID();
  73. memcpy( &pdvSpeechWithFrom[1], pbSpeechData, dwSpeechSize );
  74. // With server controlled targetting, ignore client specified target list and send to the server's current
  75. // view of the client's list. (Which is also the most accurate). Prevents client hacks from overriding
  76. // target lists.
  77. if( m_dvSessionDesc.dwFlags & DVSESSION_SERVERCONTROLTARGET )
  78. {
  79. // Lock player so that the target list doesn't change before it's copied.
  80. pTargetPlayer->Lock();
  81. hr = m_lpSessionTransport->SendToIDS( (PDVID) pTargetPlayer->GetTargetList(), pTargetPlayer->GetNumTargets(), pBufferDesc, pvSendContext, 0 );
  82. pTargetPlayer->UnLock();
  83. }
  84. else
  85. {
  86. hr = m_lpSessionTransport->SendToIDS( (PDVID) &pdvSpeechWithtarget[1], pdvSpeechWithtarget->dwNumTargets, pBufferDesc, pvSendContext, 0 );
  87. }
  88. if( hr == DVERR_PENDING )
  89. {
  90. hr = DV_OK;
  91. }
  92. else if( FAILED( hr ) )
  93. {
  94. DPFX(DPFPREP, DVF_ERRORLEVEL, "Failed sending to ID hr=0x%x", hr );
  95. }
  96. return hr;
  97. }