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.

233 lines
3.9 KiB

  1. /*++
  2. Microsoft Windows NT RPC Name Service
  3. Copyright (C) Microsoft Corporation, 1995 - 1999
  4. Module Name:
  5. brodcast.hxx
  6. Abstract:
  7. This header file defines two classes of broadcast handles which are used
  8. to gather information via mailslot broadcasts. The information so obtained
  9. is cached in special cache entries in the local database.
  10. Author:
  11. Satish Thatte (SatishT) 10/21/95 Created all the code below except where
  12. otherwise indicated.
  13. --*/
  14. #ifndef _BRODCAST_HXX_
  15. #define _BRODCAST_HXX_
  16. /*++
  17. Class Definition:
  18. CBroadcastLookupHandle
  19. Abstract:
  20. This is the NS handle class for binding handle lookup via Mailslot broadcast.
  21. --*/
  22. class CBroadcastLookupHandle : public CRemoteLookupHandle {
  23. void initialize();
  24. public:
  25. CBroadcastLookupHandle(
  26. UNSIGNED32 EntryNameSyntax,
  27. STRING_T EntryName,
  28. CGUIDVersion * pGVInterface,
  29. CGUIDVersion * pGVTransferSyntax,
  30. CGUID * pIDobject,
  31. unsigned long ulVectorSize,
  32. unsigned long ulCacheAge
  33. );
  34. };
  35. /*++
  36. Class Definition:
  37. CBroadcastObjectInqHandle
  38. Abstract:
  39. This is the NS handle class for object inquiries performed via Mailslot broadcast.
  40. --*/
  41. class CBroadcastObjectInqHandle : public CRemoteObjectInqHandle {
  42. void initialize();
  43. public:
  44. CBroadcastObjectInqHandle(
  45. STRING_T szEntryName,
  46. ULONG ulCacheAge
  47. );
  48. };
  49. /*++
  50. Class Definition:
  51. CBroadcastQueryPacket
  52. Abstract:
  53. This wraps query packets and defines a notion of subsumption which
  54. is used to avoid repeated broadcasts for the same information.
  55. --*/
  56. struct CBroadcastQueryPacket : public IDataItem {
  57. ULONG ulBroadcastTime;
  58. CGUID Object;
  59. CGUIDVersion Interface;
  60. CStringW swEntryName;
  61. CBroadcastQueryPacket(QueryPacket& NetQuery)
  62. : Object(NetQuery.Object),
  63. Interface(NetQuery.Interface),
  64. swEntryName(NetQuery.EntryName)
  65. {
  66. ulBroadcastTime = CurrentTime();
  67. }
  68. ~CBroadcastQueryPacket() {
  69. DBGOUT(MEM2, "CBroadcastQueryPacket for " << ulBroadcastTime << " Destroyed\n\n");
  70. }
  71. BOOL subsumes(QueryPacket& NewQuery, ULONG tolerance);
  72. BOOL isCurrent(ULONG tolerance) {
  73. ULONG ulCurrentTime = CurrentTime();
  74. // too stale?
  75. if (ulCurrentTime - ulBroadcastTime > tolerance) return FALSE;
  76. else return TRUE;
  77. }
  78. };
  79. typedef TCSafeLinkListIterator<CBroadcastQueryPacket> TSLLBroadcastQPIter;
  80. typedef TCSafeLinkList<CBroadcastQueryPacket> TSLLBroadcastQP;
  81. /*++
  82. Class Definition:
  83. CServerMailSlotReplyHandle
  84. Abstract:
  85. This defines handles based on local (owned) server entries for use
  86. in marshalling replies to broadcast queries.
  87. --*/
  88. class CServerMailSlotReplyHandle : public CMailSlotReplyHandle {
  89. TMSRIIterator *pmsriIterator;
  90. public:
  91. CServerMailSlotReplyHandle(
  92. TMSRILinkList * pmsrill
  93. );
  94. virtual ~CServerMailSlotReplyHandle();
  95. CMailSlotReplyItem *next() {
  96. return pmsriIterator->next();
  97. }
  98. int finished() {
  99. return pmsriIterator->finished();
  100. }
  101. };
  102. /*++
  103. Class Definition:
  104. CIndexMailSlotReplyHandle
  105. Abstract:
  106. Similar to CIndexLookupHandle, except that it returns mailslot reply items.
  107. --*/
  108. class CIndexMailSlotReplyHandle : public CMailSlotReplyHandle {
  109. /* search parameters */
  110. CGUIDVersion * pGVInterface;
  111. CGUID * pIDobject;
  112. /* Iterator for entries in the group */
  113. TEntryIterator *pEIterator;
  114. /* handle for the currently active entry */
  115. CMailSlotReplyHandle * pCurrentHandle;
  116. void advanceCurrentHandle(); // look for next nonempty entry handle
  117. public:
  118. CIndexMailSlotReplyHandle(
  119. CGUIDVersion * pGVInterface,
  120. CGUID * pIDobject,
  121. TEntryIterator * pEI
  122. );
  123. virtual ~CIndexMailSlotReplyHandle() {
  124. delete pEIterator;
  125. delete pCurrentHandle;
  126. }
  127. CMailSlotReplyItem *next();
  128. int finished();
  129. };
  130. #endif // _BRODCAST_HXX_