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.

193 lines
4.5 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: QueuedMsg.h
  6. * Content: Queued Message Object Header File
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 07/31/00 mjn Created
  12. * 09/12/00 mjn Added m_OpType
  13. *@@END_MSINTERNAL
  14. *
  15. ***************************************************************************/
  16. #ifndef __QUEUED_MSG_H__
  17. #define __QUEUED_MSG_H__
  18. //**********************************************************************
  19. // Constant definitions
  20. //**********************************************************************
  21. #define QUEUED_MSG_FLAG_VOICE 0x0001
  22. //**********************************************************************
  23. // Macro definitions
  24. //**********************************************************************
  25. //**********************************************************************
  26. // Structure definitions
  27. //**********************************************************************
  28. typedef enum
  29. {
  30. UNKNOWN,
  31. RECEIVE,
  32. ADD_PLAYER_TO_GROUP,
  33. REMOVE_PLAYER_FROM_GROUP,
  34. UPDATE_INFO
  35. } QUEUED_MSG_TYPE;
  36. class CAsyncOp;
  37. typedef struct _DIRECTNETOBJECT DIRECTNETOBJECT;
  38. //**********************************************************************
  39. // Variable definitions
  40. //**********************************************************************
  41. //**********************************************************************
  42. // Function prototypes
  43. //**********************************************************************
  44. //**********************************************************************
  45. // Class prototypes
  46. //**********************************************************************
  47. // class for Queued Messages
  48. class CQueuedMsg
  49. {
  50. public:
  51. #undef DPF_MODNAME
  52. #define DPF_MODNAME "CQueuedMsg::FPMAlloc"
  53. static BOOL FPMAlloc( void* pvItem, void* pvContext )
  54. {
  55. CQueuedMsg* pQueuedMsg = (CQueuedMsg*)pvItem;
  56. pQueuedMsg->m_Sig[0] = 'Q';
  57. pQueuedMsg->m_Sig[1] = 'M';
  58. pQueuedMsg->m_Sig[2] = 'S';
  59. pQueuedMsg->m_Sig[3] = 'G';
  60. pQueuedMsg->m_bilinkQueuedMsgs.Initialize();
  61. return(TRUE);
  62. };
  63. #undef DPF_MODNAME
  64. #define DPF_MODNAME "CQueuedMsg::FPMInitialize"
  65. static void FPMInitialize( void* pvItem, void* pvContext )
  66. {
  67. CQueuedMsg* pQueuedMsg = (CQueuedMsg*)pvItem;
  68. pQueuedMsg->m_pdnObject = static_cast<DIRECTNETOBJECT*>(pvContext);
  69. pQueuedMsg->m_OpType = UNKNOWN;
  70. pQueuedMsg->m_dwFlags = 0;
  71. pQueuedMsg->m_pBuffer = NULL;
  72. pQueuedMsg->m_dwBufferSize = 0;
  73. pQueuedMsg->m_hCompletionOp = 0;
  74. pQueuedMsg->m_pAsyncOp = NULL;
  75. DNASSERT(pQueuedMsg->m_bilinkQueuedMsgs.IsEmpty());
  76. };
  77. #undef DPF_MODNAME
  78. #define DPF_MODNAME "CQueuedMsg::FPMRelease"
  79. static void FPMRelease(void* pvItem)
  80. {
  81. const CQueuedMsg* pQueuedMsg = (CQueuedMsg*)pvItem;
  82. DNASSERT(pQueuedMsg->m_bilinkQueuedMsgs.IsEmpty());
  83. };
  84. void ReturnSelfToPool( void )
  85. {
  86. g_QueuedMsgPool.Release( this );
  87. };
  88. void SetOpType( const QUEUED_MSG_TYPE OpType )
  89. {
  90. m_OpType = OpType;
  91. };
  92. QUEUED_MSG_TYPE GetOpType( void ) const
  93. {
  94. return( m_OpType );
  95. };
  96. #ifndef DPNBUILD_NOVOICE
  97. void MakeVoiceMessage( void )
  98. {
  99. m_dwFlags |= QUEUED_MSG_FLAG_VOICE;
  100. };
  101. BOOL IsVoiceMessage( void ) const
  102. {
  103. if (m_dwFlags & QUEUED_MSG_FLAG_VOICE)
  104. {
  105. return( TRUE );
  106. }
  107. return( FALSE );
  108. };
  109. #endif // DPNBUILD_NOVOICE
  110. void SetBuffer( BYTE *const pBuffer )
  111. {
  112. m_pBuffer = pBuffer;
  113. };
  114. BYTE *GetBuffer( void )
  115. {
  116. return( m_pBuffer );
  117. };
  118. void SetBufferSize( const DWORD dwBufferSize )
  119. {
  120. m_dwBufferSize = dwBufferSize;
  121. };
  122. DWORD GetBufferSize( void ) const
  123. {
  124. return( m_dwBufferSize );
  125. };
  126. void SetCompletionOp( const DPNHANDLE hCompletionOp)
  127. {
  128. m_hCompletionOp = hCompletionOp;
  129. };
  130. DPNHANDLE GetCompletionOp( void ) const
  131. {
  132. return( m_hCompletionOp );
  133. };
  134. void CQueuedMsg::SetAsyncOp( CAsyncOp *const pAsyncOp );
  135. CAsyncOp *GetAsyncOp( void )
  136. {
  137. return( m_pAsyncOp );
  138. };
  139. CBilink m_bilinkQueuedMsgs;
  140. private:
  141. BYTE m_Sig[4]; // Signature
  142. QUEUED_MSG_TYPE m_OpType;
  143. DWORD volatile m_dwFlags;
  144. BYTE *m_pBuffer;
  145. DWORD m_dwBufferSize;
  146. DPNHANDLE m_hCompletionOp;
  147. CAsyncOp *m_pAsyncOp;
  148. DIRECTNETOBJECT *m_pdnObject;
  149. };
  150. #undef DPF_MODNAME
  151. #endif // __QUEUED_MSG_H__