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.

361 lines
8.6 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. resrpc.h
  5. Abstract:
  6. Domain Name System (DNS) Resolver
  7. Header for RPC interface to resolver.
  8. Author:
  9. Jim Gilroy (jamesg) July 2000
  10. Revision History:
  11. --*/
  12. #ifndef _RESRPC_INCLUDED_
  13. #define _RESRPC_INCLUDED_
  14. //#ifndef _DNSAPI_INCLUDED_
  15. #define DNS_INTERNAL
  16. #include <dnsapi.h>
  17. #include <dnslib.h>
  18. #include <dnsip.h>
  19. //#endif
  20. //
  21. // Resolver service info
  22. //
  23. // Note: this stuff is not required for MIDL pass generation
  24. // but it is a convenient place to put information
  25. // that will be used on both server and client sides.
  26. //
  27. #define DNS_RESOLVER_SERVICE L"dnscache"
  28. #define RESOLVER_DLL TEXT("dnsrslvr.dll")
  29. #define RESOLVER_INTERFACE_NAME_A "DNSResolver"
  30. #define RESOLVER_INTERFACE_NAME_W L"DNSResolver"
  31. #define RESOLVER_RPC_PIPE_NAME_W (L"\\PIPE\\DNSRESOLVER")
  32. #define RESOLVER_RPC_LPC_ENDPOINT_W (L"DNSResolver")
  33. #define RESOLVER_RPC_TCP_PORT_W (L"")
  34. #define RESOLVER_RPC_USE_LPC 0x1
  35. #define RESOLVER_RPC_USE_NAMED_PIPE 0x2
  36. #define RESOLVER_RPC_USE_TCPIP 0x4
  37. #define RESOLVER_RPC_USE_ALL_PROTOCOLS 0xffffffff
  38. //
  39. // Resolver proxy name (NULL by default).
  40. //
  41. // This is used in client stuffs for binding and
  42. // referenced (and settable) in dnsapi.dll caller.
  43. //
  44. #ifndef MIDL_PASS
  45. extern LPWSTR NetworkAddress;
  46. #endif
  47. //
  48. // DNS_RECORD
  49. //
  50. // Note: defintion in windns.h is not MIDL_PASS compliant
  51. // because MIDL does not like union with variable lenght types
  52. //
  53. //
  54. // MIDL is not happy about unions
  55. // Define the union explicitly with the switch
  56. //
  57. #ifdef MIDL_PASS
  58. typedef [switch_type(WORD)] union _DNS_RECORD_DATA_TYPES
  59. {
  60. [case(DNS_TYPE_A)] DNS_A_DATA A;
  61. [case(DNS_TYPE_SOA)] DNS_SOA_DATAW SOA;
  62. [case(DNS_TYPE_PTR,
  63. DNS_TYPE_NS,
  64. DNS_TYPE_CNAME,
  65. DNS_TYPE_MB,
  66. DNS_TYPE_MD,
  67. DNS_TYPE_MF,
  68. DNS_TYPE_MG,
  69. DNS_TYPE_MR)] DNS_PTR_DATAW PTR;
  70. [case(DNS_TYPE_MINFO,
  71. DNS_TYPE_RP)] DNS_MINFO_DATAW MINFO;
  72. [case(DNS_TYPE_MX,
  73. DNS_TYPE_AFSDB,
  74. DNS_TYPE_RT)] DNS_MX_DATAW MX;
  75. #if 0
  76. // RPC is not able to handle a proper TXT record definition
  77. // note: that if other types are needed they are fixed
  78. // (or semi-fixed) size and may be accomodated easily
  79. [case(DNS_TYPE_HINFO,
  80. DNS_TYPE_ISDN,
  81. DNS_TYPE_TEXT,
  82. DNS_TYPE_X25)] DNS_TXT_DATAW TXT;
  83. [case(DNS_TYPE_NULL)] DNS_NULL_DATA Null;
  84. [case(DNS_TYPE_WKS)] DNS_WKS_DATA WKS;
  85. [case(DNS_TYPE_KEY)] DNS_KEY_DATAW KEY;
  86. [case(DNS_TYPE_SIG)] DNS_SIG_DATAW SIG;
  87. [case(DNS_TYPE_TKEY)] DNS_TKEY_DATAW TKEY;
  88. [case(DNS_TYPE_TSIG)] DNS_TSIG_DATAW TSIG;
  89. [case(DNS_TYPE_WINS)] DNS_WINS_DATA WINS;
  90. [case(DNS_TYPE_NBSTAT)] DNS_WINSR_DATAW WINSR;
  91. #endif
  92. [case(DNS_TYPE_AAAA)] DNS_AAAA_DATA AAAA;
  93. [case(DNS_TYPE_SRV)] DNS_SRV_DATAW SRV;
  94. [case(DNS_TYPE_ATMA)] DNS_ATMA_DATA ATMA;
  95. //
  96. // DCR_QUESTION: need default block in record data def?
  97. //
  98. //[default] ;
  99. }
  100. DNS_RECORD_DATA_TYPES;
  101. //
  102. // Record \ RR set structure
  103. //
  104. // Note: The dwReserved flag serves to insure that the substructures
  105. // start on 64-bit boundaries. Since adding the LONGLONG to
  106. // TSIG structure the compiler wants to start them there anyway
  107. // (to 64-align). This insures that no matter what data fields
  108. // are present we are properly 64-aligned.
  109. //
  110. // Do NOT pack this structure, as the substructures to be 64-aligned
  111. // for Win64.
  112. //
  113. #undef DNS_RECORD
  114. #undef PDNS_RECORD
  115. typedef struct _DnsRecord
  116. {
  117. struct _DnsRecord * pNext;
  118. PWSTR pName;
  119. WORD wType;
  120. WORD wDataLength; // Not referenced for DNS record types
  121. // defined above.
  122. DWORD Flags;
  123. DWORD dwTtl;
  124. DWORD dwReserved;
  125. [switch_is(wType)] DNS_RECORD_DATA_TYPES Data;
  126. }
  127. DNS_RECORD, *PDNS_RECORD;
  128. //
  129. // Header or fixed size of DNS_RECORD
  130. //
  131. #define DNS_RECORD_FIXED_SIZE FIELD_OFFSET( DNS_RECORD, Data )
  132. #define SIZEOF_DNS_RECORD_HEADER DNS_RECORD_FIXED_SIZE
  133. #endif // MIDL_PASS
  134. //
  135. // RPC-able DNS type definitions
  136. //
  137. // In addition to windns.h \ dnsapi.h types.
  138. // See note below, we do have some multiple definition
  139. // problems with dnslib.h types.
  140. //
  141. //
  142. // Cache stuff -- left over from Glenn
  143. //
  144. typedef struct _DWORD_LIST_ITEM_
  145. {
  146. struct _DWORD_LIST_ITEM_ * pNext;
  147. DWORD Value1;
  148. DWORD Value2;
  149. }
  150. DWORD_LIST_ITEM, *PDWORD_LIST_ITEM;
  151. typedef struct _DNS_STATS_TABLE_
  152. {
  153. struct _DNS_STATS_TABLE_ * pNext;
  154. PDWORD_LIST_ITEM pListItem;
  155. }
  156. DNS_STATS_TABLE, *PDNS_STATS_TABLE;
  157. typedef struct _DNS_RPC_CACHE_TABLE_
  158. {
  159. struct _DNS_RPC_CACHE_TABLE_ * pNext;
  160. PWSTR Name;
  161. WORD Type1;
  162. WORD Type2;
  163. WORD Type3;
  164. }
  165. DNS_RPC_CACHE_TABLE, *PDNS_RPC_CACHE_TABLE;
  166. //
  167. // Most of the resolver interface is poorly designed or
  168. // useless. For instance there is NO reason to have
  169. // turned any of the above into linked lists.
  170. //
  171. // We simply need definitions that are MIDL_PASS aware.
  172. // This should sit in a common header and be picked up
  173. // by dnslib.h. This must wait until dnslib.h is
  174. // private again OR we separate out the private stuff
  175. // like this in some fashion.
  176. //
  177. // Note, taking this private should also involve rename,
  178. // the PUBLIC structs are obviously the one's that should
  179. // have the "DNS" tag. (Amazing.)
  180. //
  181. typedef struct _DnsAdapter
  182. {
  183. PWSTR pszAdapterGuidName;
  184. PWSTR pszAdapterDomain;
  185. PDNS_ADDR_ARRAY pLocalAddrs;
  186. PDNS_ADDR_ARRAY pDnsAddrs;
  187. DWORD InterfaceIndex;
  188. DWORD InterfaceIndex6;
  189. DWORD InfoFlags;
  190. DWORD Status;
  191. DWORD RunFlags;
  192. DWORD Site;
  193. }
  194. DNS_ADAPTER, *PDNS_ADAPTER;
  195. typedef struct _SearchName
  196. {
  197. PWSTR pszName;
  198. DWORD Flags;
  199. }
  200. SEARCH_NAME, *PSEARCH_NAME;
  201. typedef struct _SearchList
  202. {
  203. DWORD NameCount;
  204. DWORD MaxNameCount;
  205. DWORD CurrentNameIndex;
  206. DWORD ReservedPad;
  207. #ifdef MIDL_PASS
  208. [size_is(MaxNameCount)] SEARCH_NAME SearchNameArray[];
  209. #else
  210. SEARCH_NAME SearchNameArray[1];
  211. #endif
  212. }
  213. SEARCH_LIST, *PSEARCH_LIST;
  214. typedef struct _DnsNetInfo
  215. {
  216. PWSTR pszDomainName;
  217. PWSTR pszHostName;
  218. PSEARCH_LIST pSearchList;
  219. DWORD TimeStamp;
  220. DWORD InfoFlags;
  221. DWORD ReturnFlags;
  222. DWORD Tag;
  223. DWORD Reserved;
  224. DWORD AdapterIndex;
  225. DWORD AdapterCount;
  226. DWORD MaxAdapterCount;
  227. #ifdef MIDL_PASS
  228. [size_is(MaxAdapterCount)] DNS_ADAPTER AdapterArray[];
  229. #else
  230. DNS_ADAPTER AdapterArray[1];
  231. #endif
  232. }
  233. DNS_NETINFO, *PDNS_NETINFO;
  234. //
  235. // Environment variable reading (dnsapi\envar.c)
  236. //
  237. typedef struct _EnvarDwordInfo
  238. {
  239. DWORD Id;
  240. DWORD Value;
  241. BOOL fFound;
  242. }
  243. ENVAR_DWORD_INFO, *PENVAR_DWORD_INFO;
  244. //
  245. // Query blob
  246. //
  247. typedef struct _RpcQueryBlob
  248. {
  249. PWSTR pName;
  250. WORD wType;
  251. DWORD Flags;
  252. DNS_STATUS Status;
  253. PDNS_RECORD pRecords;
  254. }
  255. RPC_QUERY_BLOB, *PRPC_QUERY_BLOB;
  256. //
  257. // Cache Enumeration
  258. //
  259. typedef struct
  260. {
  261. DWORD EnumTag;
  262. DWORD MaxCount;
  263. WORD Type;
  264. DWORD Flags;
  265. PWSTR pName;
  266. PWSTR pNameFilter;
  267. }
  268. DNS_CACHE_ENUM_REQUEST, *PDNS_CACHE_ENUM_REQUEST;
  269. typedef struct _DnsCacheEntry
  270. {
  271. PWSTR pName;
  272. PDNS_RECORD pRecords;
  273. DWORD Flags;
  274. WORD wType;
  275. WORD wPad;
  276. }
  277. DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY;
  278. typedef struct _DnsCacheEnum
  279. {
  280. DWORD TotalCount;
  281. DWORD EnumTagStart;
  282. DWORD EnumTagStop;
  283. DWORD EnumCount;
  284. #ifdef MIDL_PASS
  285. [size_is(EnumCount)] DNS_CACHE_ENTRY EntryArray[];
  286. #else
  287. DNS_CACHE_ENTRY EntryArray[1];
  288. #endif
  289. }
  290. DNS_CACHE_ENUM, *PDNS_CACHE_ENUM;
  291. #endif // _RESRPC_INCLUDED_