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.

195 lines
5.2 KiB

  1. /*++
  2. Intel Corporation Proprietary Information
  3. Copyright (c) 1995 Intel Corporation
  4. This listing is supplied under the terms of a license agreement with
  5. Intel Corporation and may not be used, copied, nor disclosed except in
  6. accordance with the terms of that agreeement.
  7. Module Name:
  8. nsquery.h
  9. Abstract:
  10. This module gives the class definition for the NSQUERY object type. The
  11. NSQUERY object holds all the state information regarding a
  12. WSALookup{Begin/Next/End} series of operations. It supplies member
  13. functions that implement the API-level operations in terms of the SPI-level
  14. operations.
  15. Author:
  16. Paul Drews (drewsxpa@ashland.intel.com) 09-November-1995
  17. Notes:
  18. $Revision: 1.8 $
  19. $Modtime: 15 Feb 1996 16:54:32 $
  20. Revision History:
  21. most-recent-revision-date email-name
  22. description
  23. 09-November-1995 drewsxpa@ashland.intel.com
  24. created
  25. --*/
  26. #ifndef _NSQUERY_
  27. #define _NSQUERY_
  28. #include "winsock2.h"
  29. #include <windows.h>
  30. #include "classfwd.h"
  31. #define QUERYSIGNATURE 0xbeadface
  32. // A signature bit pattern used to validate an object of this type is still
  33. // valid.
  34. class NSQUERY
  35. {
  36. public:
  37. NSQUERY();
  38. INT
  39. Initialize(
  40. );
  41. BOOL
  42. ValidateAndReference();
  43. ~NSQUERY();
  44. INT
  45. WINAPI
  46. LookupServiceBegin(
  47. IN LPWSAQUERYSETW lpqsRestrictions,
  48. IN DWORD dwControlFlags,
  49. IN PNSCATALOG NsCatalog
  50. );
  51. INT
  52. WINAPI
  53. LookupServiceNext(
  54. IN DWORD dwControlFlags,
  55. IN OUT LPDWORD lpdwBufferLength,
  56. IN OUT LPWSAQUERYSETW lpqsResults
  57. );
  58. INT
  59. WINAPI
  60. Ioctl(
  61. IN DWORD dwControlCode,
  62. IN LPVOID lpvInBuffer,
  63. IN DWORD cbInBuffer,
  64. OUT LPVOID lpvOutBuffer,
  65. IN DWORD cbOutBuffer,
  66. OUT LPDWORD lpcbBytesReturned,
  67. IN LPWSACOMPLETION lpCompletion,
  68. IN LPWSATHREADID lpThreadId
  69. );
  70. INT
  71. WINAPI
  72. LookupServiceEnd();
  73. VOID
  74. WINAPI
  75. Dereference();
  76. BOOL
  77. RemoveProvider(
  78. PNSPROVIDER pNamespaceProvider
  79. );
  80. BOOL
  81. AddProvider(
  82. PNSPROVIDER pNamespaceProvider
  83. );
  84. private:
  85. PNSPROVIDERSTATE
  86. NextProvider(
  87. PNSPROVIDERSTATE Provider
  88. );
  89. PNSPROVIDERSTATE
  90. PreviousProvider(
  91. PNSPROVIDERSTATE Provider
  92. );
  93. volatile DWORD m_signature;
  94. // The signature of the object.
  95. volatile LONG m_reference_count;
  96. // The number of threads currently using the object. Used to determine
  97. // when the object can be deleted.
  98. volatile BOOL m_shutting_down;
  99. // True when LookupEnd has been called. Tells other thread that may
  100. // still be enumerating to get out ASAP.
  101. LIST_ENTRY m_provider_list;
  102. // The ordered list of remaining providers to which the LookupNext
  103. // operation can be directed. A provider is deleted from the front of
  104. // the list as WSA_E_NOMORE is first encountered from the provider.
  105. // The actual type of the list entries is private to the
  106. // implementation.
  107. PNSPROVIDERSTATE m_current_provider;
  108. // This keeps track of the sequence number of the current first
  109. // provider in the provider list. When a LookupNext encounters
  110. // WSA_E_NOMORE, this number is compared against the number that was at
  111. // the start of the operation. The provider list is updated only if
  112. // these two numbers are equal. This covers the case where several
  113. // threads are doing concurrent LookupNext operations.
  114. CRITICAL_SECTION m_members_guard;
  115. // This critical section must be entered when updating the values of
  116. // any of the member variables of the NSQUERY object. This keeps the
  117. // values consistent even though there may be concurrent threads using
  118. // the object with LookupServiceNext or LookupServiceEnd operations.
  119. // Do not keep this critical section entered while calling through to a
  120. // service provider.
  121. BOOL m_change_ioctl_succeeded;
  122. // For providers which support Ioctl, after a change notification the
  123. // list of providers can be reset so that further calls to
  124. // LookupServiceNext will succeed with change information.
  125. #ifdef RASAUTODIAL
  126. LPWSAQUERYSETW m_query_set;
  127. // The LPWSAQUERYSET structure passed in to LookupServiceBegin, in case
  128. // we need to restart the query (call LookupServiceBegin).
  129. DWORD m_control_flags;
  130. // The control flags of the query, in case we have to restart the query
  131. // (call LookupServiceBegin) due to an autodial attempt.
  132. PNSCATALOG m_catalog;
  133. // The catalog of the original query, in case we have to restart the
  134. // query (call LookupServiceBegin), due to an autodial attempt.
  135. BOOL m_restartable;
  136. // TRUE if no results have been returned for this query; FALSE
  137. // otherwise.
  138. #endif // RASAUTODIAL
  139. }; // class NSQUERY
  140. #endif // _NSQUERY_