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.

147 lines
3.6 KiB

  1. //****************************************************************************
  2. //
  3. // Module: ULS.DLL
  4. // File: request.h
  5. // Content: Declaration CReqMgr and CRequest classes
  6. //
  7. // Copyright (c) Microsoft Corporation 1996-1997
  8. //
  9. //****************************************************************************
  10. #ifndef _REQUEST_H_
  11. #define _REQUEST_H_
  12. typedef struct tagRequestInfo {
  13. DWORD dwSignature;
  14. ULONG uReqType;
  15. ULONG uMsgID;
  16. ULONG uReqID;
  17. // LPVOID pv;
  18. // LPARAM lParam;
  19. DWORD dwFlags;
  20. CIlsServer *pServer;
  21. CIlsMain *pMain;
  22. CIlsUser *pUser;
  23. CLocalProt *pProtocol;
  24. #ifdef ENABLE_MEETING_PLACE
  25. CIlsMeetingPlace *pMeeting;
  26. #endif
  27. } COM_REQ_INFO;
  28. #define REQ_INFO_SIGNATURE 0x123456UL
  29. VOID inline ReqInfo_Init ( COM_REQ_INFO *p )
  30. {
  31. ZeroMemory (p, sizeof (*p));
  32. p->dwSignature = REQ_INFO_SIGNATURE;
  33. }
  34. BOOL inline ReqInfo_IsValid ( COM_REQ_INFO *p )
  35. {
  36. return (p->dwSignature == REQ_INFO_SIGNATURE);
  37. }
  38. enum
  39. {
  40. REQ_INFO_F_SERVER = 0x01, REQ_INFO_F_MAIN = 0x02,
  41. REQ_INFO_F_USER = 0x04, REQ_INFO_F_PROTOCOL = 0x08,
  42. REQ_INFO_F_MEETING = 0x10
  43. };
  44. VOID inline ReqInfo_SetServer ( COM_REQ_INFO *p, CIlsServer *pServer )
  45. {
  46. ASSERT (p->pServer == NULL);
  47. p->dwFlags |= REQ_INFO_F_SERVER;
  48. p->pServer = pServer;
  49. }
  50. VOID inline ReqInfo_SetServer ( COM_REQ_INFO *p, IIlsServer *pServer )
  51. {
  52. ReqInfo_SetServer (p, (CIlsServer *) pServer);
  53. }
  54. VOID inline ReqInfo_SetMain ( COM_REQ_INFO *p, CIlsMain *pMain )
  55. {
  56. ASSERT (p->pMain == NULL);
  57. p->dwFlags |= REQ_INFO_F_MAIN;
  58. p->pMain = pMain;
  59. }
  60. VOID inline ReqInfo_SetUser ( COM_REQ_INFO *p, CIlsUser *pUser )
  61. {
  62. ASSERT (p->pUser == NULL);
  63. p->dwFlags |= REQ_INFO_F_USER;
  64. p->pUser = pUser;
  65. }
  66. VOID inline ReqInfo_SetProtocol ( COM_REQ_INFO *p, CLocalProt *pProtocol )
  67. {
  68. ASSERT (p->pProtocol == NULL);
  69. p->dwFlags |= REQ_INFO_F_PROTOCOL;
  70. p->pProtocol = pProtocol;
  71. }
  72. VOID inline ReqInfo_SetProtocol ( COM_REQ_INFO *p, IIlsProtocol *pProtocol )
  73. {
  74. ReqInfo_SetProtocol (p, (CLocalProt *) pProtocol);
  75. }
  76. #ifdef ENABLE_MEETING_PLACE
  77. VOID inline ReqInfo_SetMeeting ( COM_REQ_INFO *p, CIlsMeetingPlace *pMeeting )
  78. {
  79. ASSERT (p->pMeeting == NULL);
  80. p->dwFlags |= REQ_INFO_F_MEETING;
  81. p->pMeeting = pMeeting;
  82. }
  83. #endif
  84. CIlsServer inline *ReqInfo_GetServer ( COM_REQ_INFO *p )
  85. {
  86. return ((p->dwFlags & REQ_INFO_F_SERVER) ? p->pServer : NULL);
  87. }
  88. CIlsMain inline *ReqInfo_GetMain ( COM_REQ_INFO *p )
  89. {
  90. return ((p->dwFlags & REQ_INFO_F_MAIN) ? p->pMain : NULL);
  91. }
  92. CIlsUser inline *ReqInfo_GetUser ( COM_REQ_INFO *p )
  93. {
  94. return ((p->dwFlags & REQ_INFO_F_USER) ? p->pUser : NULL);
  95. }
  96. CLocalProt inline *ReqInfo_GetProtocol ( COM_REQ_INFO *p )
  97. {
  98. return ((p->dwFlags & REQ_INFO_F_PROTOCOL) ? p->pProtocol : NULL);
  99. }
  100. #ifdef ENABLE_MEETING_PLACE
  101. CIlsMeetingPlace inline *ReqInfo_GetMeeting ( COM_REQ_INFO *p )
  102. {
  103. return ((p->dwFlags & REQ_INFO_F_MEETING) ? p->pMeeting : NULL);
  104. }
  105. #endif
  106. //****************************************************************************
  107. // CReqMgr definition
  108. //****************************************************************************
  109. //
  110. #define REQUEST_ID_INIT 1
  111. class CReqMgr
  112. {
  113. private:
  114. CList ReqList;
  115. ULONG uNextReqID;
  116. HRESULT FindRequest (COM_REQ_INFO *pri, BOOL fRemove);
  117. public:
  118. CReqMgr (void);
  119. ~CReqMgr (void);
  120. HRESULT NewRequest (COM_REQ_INFO *pri);
  121. HRESULT RequestDone (COM_REQ_INFO *pri) {return FindRequest(pri,TRUE);}
  122. HRESULT GetRequestInfo (COM_REQ_INFO *pri) {return FindRequest(pri,FALSE);}
  123. };
  124. #endif // _REQUEST_H_