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.

234 lines
7.5 KiB

  1. // IDL source for WINSSNAP DLLs
  2. //
  3. #ifndef _WINSDB_IDL_
  4. #define _WINSDB_IDL_
  5. import "wtypes.idl";
  6. typedef BYTE * PBYTE;
  7. typedef PBYTE HROW;
  8. typedef HROW * LPHROW;
  9. // valid states for the database
  10. typedef enum _WINSDB_STATE
  11. {
  12. WINSDB_NORMAL = 0x0001,
  13. WINSDB_LOADING = 0x0002,
  14. WINSDB_SORTING = 0x0003,
  15. WINSDB_FILTERING = 0x0004
  16. } WINSDB_STATE;
  17. // possible sort types for the database
  18. typedef enum _WINSDB_SORT_TYPE
  19. {
  20. WINSDB_SORT_BY_NAME,
  21. WINSDB_SORT_BY_IP,
  22. WINSDB_SORT_BY_VERSION,
  23. WINSDB_SORT_BY_TYPE,
  24. WINSDB_SORT_BY_EXPIRATION,
  25. WINSDB_SORT_BY_STATE,
  26. WINSDB_SORT_BY_STATIC,
  27. WINSDB_SORT_BY_OWNER
  28. } WINSDB_SORT_TYPE;
  29. // possilble views for the database
  30. typedef enum _WINSDB_VIEW_TYPE
  31. {
  32. WINSDB_VIEW_ENTIRE_DATABASE,
  33. WINSDB_VIEW_FILTERED_DATABASE
  34. } WINSDB_VIEW_TYPE;
  35. typedef enum _WINSDB_SORT_OPTIONS
  36. {
  37. WINSDB_SORT_DESCENDING = 0x00,
  38. WINSDB_SORT_ASCENDING = 0x01
  39. } WINSDB_SORT_OPTIONS;
  40. // possible Filter types for the database
  41. typedef enum _WINSDB_FILTER_TYPE
  42. {
  43. WINSDB_FILTER_BY_TYPE,
  44. WINSDB_FILTER_BY_OWNER,
  45. WINSDB_FILTER_BY_IPADDR,
  46. WINSDB_FILTER_BY_NAME
  47. } WINSDB_FILTER_TYPE;
  48. const ULONG WINS_RECNAME_MAX = 256;
  49. #define MAX_IP_ADDRS 100
  50. const ULONG WINSDB_MAX_NO_IPADDRS = MAX_IP_ADDRS;
  51. // predefined
  52. interface IWinsDatabase;
  53. typedef IWinsDatabase * LPWINSDATABASE;
  54. // flags for the dwState field
  55. typedef enum _WINSDB_REC_TYPE
  56. {
  57. WINSDB_REC_ACTIVE = 0x00000001,
  58. WINSDB_REC_STATIC = 0x00000002,
  59. WINSDB_REC_TOMBSTONE = 0x00000004,
  60. WINSDB_REC_RELEASED = 0x00000008,
  61. WINSDB_REC_DELETED = 0x00000010,
  62. WINSDB_REC_MULT_ADDRS = 0x00000020,
  63. WINSDB_REC_UNIQUE = 0x00000040,
  64. WINSDB_REC_NORM_GROUP = 0x00000080,
  65. WINSDB_REC_SPEC_GROUP = 0x00000100,
  66. WINSDB_REC_MULTIHOMED = 0x00000200,
  67. WINSDB_REC_INTERNET_GROUP=0x00000400
  68. } WINSDB_REC_TYPE;
  69. // NOTE: the dwType field is broken up as follows:
  70. // HIWORD(dwType) = record type defined in WINSINTF_RECTYPE_E
  71. // LOBYTE(LOWORD(dwType)) = machine type (ie. 1B, 1C, etc)
  72. typedef struct _WinsRecord
  73. {
  74. char szRecordName [WINS_RECNAME_MAX];
  75. DWORD_PTR dwExpiration;
  76. DWORD dwIpAdd[MAX_IP_ADDRS]; // extra space, just in case
  77. DWORD dwNoOfAddrs;
  78. LARGE_INTEGER liVersion;
  79. DWORD dwNameLen;
  80. DWORD dwOwner;
  81. DWORD dwState;
  82. DWORD dwType;
  83. } WinsRecord, * LPWINSRECORD;
  84. /*---------------------------------------------------------------------------
  85. IWinsDatabase
  86. ---------------------------------------------------------------------------*/
  87. [
  88. object,
  89. uuid(7B0C8BBF-3117-11d1-B981-00C04FBF914A),
  90. local,
  91. pointer_default(unique),
  92. ]
  93. //----------------------------------------------------------------------------
  94. // Struct: WinsRecord
  95. //
  96. // Contains information applying to a particular Wins Record
  97. //----------------------------------------------------------------------------
  98. interface IWinsDatabase :IUnknown
  99. {
  100. import "unknwn.idl";
  101. // all these need no parameters
  102. HRESULT Init();
  103. HRESULT Start();
  104. HRESULT Stop();
  105. HRESULT Clear();
  106. // SortBy can be by record name, IP Address, Type, Expiration date,
  107. // Version
  108. HRESULT Sort([in] WINSDB_SORT_TYPE dwSortBy, [in] DWORD dwSortOptions);
  109. // returns the pointer to the first record in the rows
  110. // requested for
  111. HRESULT GetRows([in] ULONG uNumberOfRows,
  112. [in] ULONG uStartPos,
  113. [out] LPHROW ppHRow,
  114. [out] int * nNumberOfRowsReturned);
  115. // fills in the WinsRecord structure
  116. HRESULT GetData([in] HROW hRow,
  117. [out] LPWINSRECORD pRecordData);
  118. // fills in the row index in the chunk of memory
  119. // finds the specified computer name
  120. HRESULT FindRow([in, string] LPCOLESTR pszName,
  121. [in] HROW hrowStart,
  122. [out] LPHROW hRow);
  123. // just places the handle at that point in the DB records
  124. HRESULT GetHRow([in] UINT uIndex,
  125. [in] LPHROW hRow);
  126. HRESULT GetTotalCount([out] int * pTotalCount);
  127. HRESULT GetCurrentCount([out] int * pCurrentCount);
  128. HRESULT GetCurrentScanned([out] int * pCurrentScanned);
  129. HRESULT AddRecord([in] const LPWINSRECORD RecordData);
  130. HRESULT DeleteRecord([in] HROW hrowRecord);
  131. HRESULT GetCurrentState( [out] WINSDB_STATE * pState);
  132. HRESULT FilterRecords([in] WINSDB_FILTER_TYPE FilterType,
  133. [in] DWORD dwParam1,
  134. [in] DWORD dwParam2);
  135. HRESULT AddFilter( [in] WINSDB_FILTER_TYPE FilterType,
  136. [in] DWORD dwData1,
  137. [in] DWORD dwData2,
  138. [in] LPCOLESTR strData3);
  139. HRESULT ClearFilter([in] WINSDB_FILTER_TYPE FilterType);
  140. HRESULT Initialize([in, string] LPCOLESTR pszName,
  141. [in, string] LPCOLESTR pszIP);
  142. HRESULT GetName([out, string] LPOLESTR pszName,
  143. [in] UINT cchMax);
  144. HRESULT GetIP([out, string] LPOLESTR pszIP,
  145. [in] UINT cchMax);
  146. HRESULT GetLastError([out] HRESULT * pLastError);
  147. HRESULT SetActiveView([in] WINSDB_VIEW_TYPE ViewType);
  148. HRESULT SetApiInfo([in] DWORD dwOwner, [in] LPCOLESTR strPrefix, [in] BOOL bCache);
  149. HRESULT GetCachingFlag([out] BOOL *pbCache);
  150. HRESULT ReloadSuggested([in] DWORD dwOwner, [in] LPCOLESTR strPrefix, [out] BOOL *pbReload);
  151. };
  152. // a macro to help declare all of the methods
  153. cpp_quote("#define DeclareIWinsDatabaseMembers(IPURE) \\")
  154. cpp_quote(" STDMETHOD(Init)(THIS) IPURE; \\")
  155. cpp_quote(" STDMETHOD(Start)(THIS) IPURE; \\")
  156. cpp_quote(" STDMETHOD(Stop)(THIS) IPURE; \\")
  157. cpp_quote(" STDMETHOD(Clear)(THIS) IPURE; \\")
  158. cpp_quote(" STDMETHOD(GetLastError)(THIS_ HRESULT * pLastError) IPURE; \\")
  159. cpp_quote(" STDMETHOD(Sort)(THIS_ WINSDB_SORT_TYPE SortBy, DWORD dwSortOptions) IPURE; \\")
  160. cpp_quote(" STDMETHOD(GetRows)(THIS_ ULONG uNumberOfRows,ULONG uStartPos, HROW* ppHRow, int* nNumberOfRowsReturned) IPURE; \\")
  161. cpp_quote(" STDMETHOD(GetData)(THIS_ HROW hRow, WinsRecord* ppRecordData) IPURE; \\")
  162. cpp_quote(" STDMETHOD(FindRow)(THIS_ LPCOLESTR pszName, HROW hrowStart,HROW* hRow) IPURE; \\")
  163. cpp_quote(" STDMETHOD(GetHRow)(THIS_ UINT uIndex,HROW* hRow) IPURE; \\")
  164. cpp_quote(" STDMETHOD(GetTotalCount)(THIS_ int* pTotalCount) IPURE; \\")
  165. cpp_quote(" STDMETHOD(GetCurrentCount)(THIS_ int* pCurrentCount) IPURE; \\")
  166. cpp_quote(" STDMETHOD(GetCurrentScanned)(THIS_ int* pCurrentScanned) IPURE; \\")
  167. cpp_quote(" STDMETHOD(AddRecord)(THIS_ const LPWINSRECORD RecordData) IPURE; \\")
  168. cpp_quote(" STDMETHOD(DeleteRecord)(THIS_ HROW hrowRecord) IPURE; \\")
  169. cpp_quote(" STDMETHOD(GetCurrentState)(THIS_ WINSDB_STATE * pState) IPURE; \\")
  170. cpp_quote(" STDMETHOD(FilterRecords)(THIS_ WINSDB_FILTER_TYPE FilterType, DWORD dwParam1, DWORD dwParam2) IPURE; \\")
  171. cpp_quote(" STDMETHOD(AddFilter)(THIS_ WINSDB_FILTER_TYPE FilterType, DWORD dwParam1, DWORD dwParam2, LPCOLESTR strParam3) IPURE; \\")
  172. cpp_quote(" STDMETHOD(ClearFilter)(THIS_ WINSDB_FILTER_TYPE FilterType) IPURE; \\")
  173. cpp_quote(" STDMETHOD(Initialize)(THIS_ LPCOLESTR pszName, LPCOLESTR pszIP) IPURE; \\")
  174. cpp_quote(" STDMETHOD(GetName)(THIS_ LPOLESTR pszName, UINT cchMax) IPURE; \\")
  175. cpp_quote(" STDMETHOD(GetIP)(THIS_ LPOLESTR pszIP, UINT cchMax) IPURE; \\")
  176. cpp_quote(" STDMETHOD(SetActiveView)(THIS_ WINSDB_VIEW_TYPE ViewType) IPURE; \\")
  177. cpp_quote(" STDMETHOD(SetApiInfo)(THIS_ DWORD dwOwner, LPCOLESTR strPrefix, BOOL bCache) IPURE; \\")
  178. cpp_quote(" STDMETHOD(GetCachingFlag)(THIS_ BOOL *pbCache) IPURE; \\")
  179. cpp_quote(" STDMETHOD(ReloadSuggested)(THIS_ DWORD dwOwner, LPCOLESTR strPrefix, BOOL *pbReload) IPURE; \\")
  180. cpp_quote("")
  181. #endif // _WINSDB__