Source code of Windows XP (NT5)
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.

423 lines
9.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_INCLUDE_
  15. #include <dnsapi.h>
  16. #endif
  17. //
  18. // Resolver service info
  19. //
  20. // Note: this stuff is not required for MIDL pass generation
  21. // but it is a convenient place to put information
  22. // that will be used on both server and client sides.
  23. //
  24. #define DNS_RESOLVER_SERVICE L"dnscache"
  25. #define RESOLVER_DLL TEXT("dnsrslvr.dll")
  26. #define RESOLVER_INTERFACE_NAME_A "DNSResolver"
  27. #define RESOLVER_INTERFACE_NAME_W L"DNSResolver"
  28. #define RESOLVER_RPC_PIPE_NAME_W (L"\\PIPE\\DNSRESOLVER")
  29. #define RESOLVER_RPC_LPC_ENDPOINT_W (L"DNSResolver")
  30. #define RESOLVER_RPC_TCP_PORT_W (L"")
  31. #define RESOLVER_RPC_USE_LPC 0x1
  32. #define RESOLVER_RPC_USE_NAMED_PIPE 0x2
  33. #define RESOLVER_RPC_USE_TCPIP 0x4
  34. #define RESOLVER_RPC_USE_ALL_PROTOCOLS 0xffffffff
  35. //
  36. // Resolver proxy name (NULL by default).
  37. //
  38. // This is used in client stuffs for binding and
  39. // referenced (and settable) in dnsapi.dll caller.
  40. //
  41. #ifndef MIDL_PASS
  42. extern LPWSTR NetworkAddress;
  43. #endif
  44. //
  45. // DNS_RECORD
  46. //
  47. // Note: defintion in windns.h is not MIDL_PASS compliant
  48. // because MIDL does not like union with variable lenght types
  49. //
  50. //
  51. // MIDL is not happy about unions
  52. // Define the union explicitly with the switch
  53. //
  54. #ifdef MIDL_PASS
  55. typedef [switch_type(WORD)] union _DNS_RECORD_DATA_TYPES
  56. {
  57. [case(DNS_TYPE_A)] DNS_A_DATA A;
  58. [case(DNS_TYPE_SOA)] DNS_SOA_DATA SOA;
  59. [case(DNS_TYPE_PTR,
  60. DNS_TYPE_NS,
  61. DNS_TYPE_CNAME,
  62. DNS_TYPE_MB,
  63. DNS_TYPE_MD,
  64. DNS_TYPE_MF,
  65. DNS_TYPE_MG,
  66. DNS_TYPE_MR)] DNS_PTR_DATA PTR;
  67. [case(DNS_TYPE_MINFO,
  68. DNS_TYPE_RP)] DNS_MINFO_DATA MINFO;
  69. [case(DNS_TYPE_MX,
  70. DNS_TYPE_AFSDB,
  71. DNS_TYPE_RT)] DNS_MX_DATA MX;
  72. #if 0
  73. // RPC is not able to handle a proper TXT record definition
  74. // note: that if other types are needed they are fixed
  75. // (or semi-fixed) size and may be accomodated easily
  76. [case(DNS_TYPE_HINFO,
  77. DNS_TYPE_ISDN,
  78. DNS_TYPE_TEXT,
  79. DNS_TYPE_X25)] DNS_TXT_DATA TXT;
  80. [case(DNS_TYPE_NULL)] DNS_NULL_DATA Null;
  81. [case(DNS_TYPE_WKS)] DNS_WKS_DATA WKS;
  82. [case(DNS_TYPE_TKEY)] DNS_TKEY_DATA TKEY;
  83. [case(DNS_TYPE_TSIG)] DNS_TSIG_DATA TSIG;
  84. [case(DNS_TYPE_WINS)] DNS_WINS_DATA WINS;
  85. [case(DNS_TYPE_NBSTAT)] DNS_WINSR_DATA WINSR;
  86. #endif
  87. [case(DNS_TYPE_AAAA)] DNS_AAAA_DATA AAAA;
  88. [case(DNS_TYPE_SRV)] DNS_SRV_DATA SRV;
  89. [case(DNS_TYPE_ATMA)] DNS_ATMA_DATA ATMA;
  90. //
  91. // DCR_QUESTION: need default block in record data def?
  92. //
  93. //[default] ;
  94. }
  95. DNS_RECORD_DATA_TYPES;
  96. //
  97. // Record \ RR set structure
  98. //
  99. // Note: The dwReserved flag serves to insure that the substructures
  100. // start on 64-bit boundaries. Since adding the LONGLONG to
  101. // TSIG structure the compiler wants to start them there anyway
  102. // (to 64-align). This insures that no matter what data fields
  103. // are present we are properly 64-aligned.
  104. //
  105. // Do NOT pack this structure, as the substructures to be 64-aligned
  106. // for Win64.
  107. //
  108. #undef PDNS_RECORD
  109. typedef struct _DnsRecord
  110. {
  111. struct _DnsRecord * pNext;
  112. LPTSTR pName;
  113. WORD wType;
  114. WORD wDataLength; // Not referenced for DNS record types
  115. // defined above.
  116. DWORD Flags;
  117. DWORD dwTtl;
  118. DWORD dwReserved;
  119. [switch_is(wType)] DNS_RECORD_DATA_TYPES Data;
  120. }
  121. DNS_RECORD, *PDNS_RECORD;
  122. //
  123. // Header or fixed size of DNS_RECORD
  124. //
  125. #define DNS_RECORD_FIXED_SIZE FIELD_OFFSET( DNS_RECORD, Data )
  126. #define SIZEOF_DNS_RECORD_HEADER DNS_RECORD_FIXED_SIZE
  127. #endif // MIDL_PASS
  128. //
  129. // RPC-able DNS type definitions
  130. //
  131. // In addition to windns.h \ dnsapi.h types.
  132. // See note below, we do have some multiple definition
  133. // problems with dnslib.h types.
  134. //
  135. //
  136. // Net adapter list structures
  137. //
  138. #ifndef ADDR_INFO_DEFINED
  139. typedef struct _DnsAddrInfo
  140. {
  141. IP4_ADDRESS IpAddr;
  142. IP4_ADDRESS SubnetMask;
  143. }
  144. DNS_ADDR_INFO, *PDNS_ADDR_INFO;
  145. typedef struct _DnsAddrArray
  146. {
  147. DWORD AddrCount;
  148. #ifdef MIDL_PASS
  149. [size_is(AddrCount)] DNS_ADDR_INFO AddrArray[];
  150. #else
  151. DNS_ADDR_INFO AddrArray[0];
  152. #endif
  153. }
  154. DNS_ADDR_ARRAY, *PDNS_ADDR_ARRAY;
  155. #define ADDR_INFO_DEFINED 1
  156. #endif
  157. #define SIZE_FOR_ADDR_ARRAY(count) \
  158. (sizeof(DNS_ADDR_ARRAY) + (count * sizeof(DNS_ADDR_INFO)))
  159. //
  160. // IP union
  161. //
  162. typedef struct _RpcIpUnion
  163. {
  164. BOOL IsIp6;
  165. IP6_ADDRESS Addr;
  166. }
  167. RPC_IP_UNION, *PRPC_IP_UNION;
  168. //
  169. // Cache stuff -- left over from Glenn
  170. //
  171. typedef struct _DWORD_LIST_ITEM_
  172. {
  173. struct _DWORD_LIST_ITEM_ * pNext;
  174. DWORD Value1;
  175. DWORD Value2;
  176. }
  177. DWORD_LIST_ITEM, *PDWORD_LIST_ITEM;
  178. typedef struct _DNS_STATS_TABLE_
  179. {
  180. struct _DNS_STATS_TABLE_ * pNext;
  181. PDWORD_LIST_ITEM pListItem;
  182. }
  183. DNS_STATS_TABLE, *PDNS_STATS_TABLE;
  184. typedef struct _DNS_RPC_CACHE_TABLE_
  185. {
  186. struct _DNS_RPC_CACHE_TABLE_ * pNext;
  187. LPWSTR Name;
  188. WORD Type1;
  189. WORD Type2;
  190. WORD Type3;
  191. }
  192. DNS_RPC_CACHE_TABLE, *PDNS_RPC_CACHE_TABLE;
  193. //
  194. // Most of the resolver interface is poorly designed or
  195. // useless. For instance there is NO reason to have
  196. // turned any of the above into linked lists.
  197. //
  198. // We simply need definitions that are MIDL_PASS aware.
  199. // This should sit in a common header and be picked up
  200. // by dnslib.h. This must wait until dnslib.h is
  201. // private again OR we separate out the private stuff
  202. // like this in some fashion.
  203. //
  204. // Note, taking this private should also involve rename,
  205. // the PUBLIC structs are obviously the one's that should
  206. // have the "DNS" tag. (Amazing.)
  207. //
  208. //
  209. // Network Info
  210. //
  211. // DCR: these merge with defs in dnslib.h (take private)
  212. //
  213. typedef struct _RpcDnsServerInfo
  214. {
  215. DNS_STATUS Status;
  216. DWORD Priority;
  217. IP_ADDRESS IpAddress;
  218. DWORD AddressPad[3];
  219. }
  220. RPC_DNS_SERVER_INFO, *PRPC_DNS_SERVER_INFO;
  221. typedef struct _RpcDnsAdapter
  222. {
  223. PSTR pszAdapterGuidName;
  224. PSTR pszAdapterDomain;
  225. PIP_ARRAY pAdapterIPAddresses;
  226. PIP_ARRAY pAdapterIPSubnetMasks;
  227. DWORD InterfaceIndex;
  228. DWORD InfoFlags;
  229. DWORD Reserved;
  230. DWORD Status;
  231. DWORD RunFlags;
  232. DWORD ServerIndex;
  233. DWORD ServerCount;
  234. DWORD MaxServerCount;
  235. #ifdef MIDL_PASS
  236. [size_is(MaxServerCount)] RPC_DNS_SERVER_INFO ServerArray[];
  237. #else
  238. RPC_DNS_SERVER_INFO ServerArray[1];
  239. #endif
  240. }
  241. RPC_DNS_ADAPTER, *PRPC_DNS_ADAPTER;
  242. typedef struct _SearchName
  243. {
  244. PSTR pszName;
  245. DWORD Flags;
  246. }
  247. RPC_SEARCH_NAME, *PRPC_SEARCH_NAME;
  248. typedef struct _RpcSearchList
  249. {
  250. PSTR pszDomainOrZoneName;
  251. DWORD NameCount; // Zero for FindAuthoritativeZone
  252. DWORD MaxNameCount; // Zero for FindAuthoritativeZone
  253. DWORD CurrentNameIndex; // 0 for pszDomainOrZoneName
  254. // 1 for first name in array below
  255. // ...
  256. #ifdef MIDL_PASS
  257. [size_is(MaxNameCount)] RPC_SEARCH_NAME SearchNameArray[];
  258. #else
  259. RPC_SEARCH_NAME SearchNameArray[1];
  260. #endif
  261. }
  262. RPC_SEARCH_LIST, *PRPC_SEARCH_LIST;
  263. typedef struct _RpcDnsNetInfo
  264. {
  265. PSTR pszDomainName;
  266. PSTR pszHostName;
  267. PRPC_SEARCH_LIST pSearchList;
  268. DWORD TimeStamp;
  269. DWORD InfoFlags;
  270. DWORD Tag;
  271. DWORD ReturnFlags;
  272. DWORD AdapterCount;
  273. DWORD MaxAdapterCount;
  274. #ifdef MIDL_PASS
  275. [size_is(MaxAdapterCount)] PRPC_DNS_ADAPTER AdapterArray[];
  276. #else
  277. PRPC_DNS_ADAPTER AdapterArray[1];
  278. #endif
  279. }
  280. RPC_DNS_NETINFO, *PRPC_DNS_NETINFO;
  281. //
  282. // Environment variable reading (dnsapi\envar.c)
  283. //
  284. typedef struct _EnvarDwordInfo
  285. {
  286. DWORD Id;
  287. DWORD Value;
  288. BOOL fFound;
  289. }
  290. ENVAR_DWORD_INFO, *PENVAR_DWORD_INFO;
  291. //
  292. // Query blob
  293. //
  294. typedef struct _RpcQueryBlob
  295. {
  296. PWSTR pName;
  297. WORD wType;
  298. DWORD Flags;
  299. DNS_STATUS Status;
  300. PDNS_RECORD pRecords;
  301. }
  302. RPC_QUERY_BLOB, *PRPC_QUERY_BLOB;
  303. //
  304. // Cache Enumeration
  305. //
  306. typedef struct
  307. {
  308. DWORD EnumTag;
  309. DWORD MaxCount;
  310. WORD Type;
  311. DWORD Flags;
  312. PWSTR pName;
  313. PWSTR pNameFilter;
  314. }
  315. DNS_CACHE_ENUM_REQUEST, *PDNS_CACHE_ENUM_REQUEST;
  316. typedef struct _DnsCacheEntry
  317. {
  318. PWSTR pName;
  319. PDNS_RECORD pRecords;
  320. DWORD Flags;
  321. WORD wType;
  322. WORD wPad;
  323. }
  324. DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY;
  325. typedef struct _DnsCacheEnum
  326. {
  327. DWORD TotalCount;
  328. DWORD EnumTagStart;
  329. DWORD EnumTagStop;
  330. DWORD EnumCount;
  331. #ifdef MIDL_PASS
  332. [size_is(EnumCount)] DNS_CACHE_ENTRY EntryArray[];
  333. #else
  334. DNS_CACHE_ENTRY EntryArray[1];
  335. #endif
  336. }
  337. DNS_CACHE_ENUM, *PDNS_CACHE_ENUM;
  338. #endif // _RESRPC_INCLUDED_