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.

209 lines
4.7 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1998 - 1999
  3. Module Name:
  4. dnscmn.h
  5. Abstract:
  6. Domain Name System (DNS) Client
  7. Routines used to verify the DNS registration for a client
  8. Author:
  9. Elena Apreutesei (elenaap) 10/22/98
  10. Revision History:
  11. --*/
  12. #ifndef _DNSCOMMON_H_
  13. #define _DNSCOMMON_H_
  14. #include <dnslib.h>
  15. #define MAX_NAME_SERVER_COUNT (20)
  16. #define MAX_ADDRS (35)
  17. #define DNS_QUERY_DATABASE (0x200)
  18. #define IP_ARRAY_SIZE(a) (sizeof(DWORD) + (a)*sizeof(IP_ADDRESS))
  19. // Use dnslib memory routines
  20. #define ALLOCATE_HEAP(iSize) Dns_Alloc(iSize)
  21. #define ALLOCATE_HEAP_ZERO(iSize) Dns_AllocZero(iSize)
  22. #define REALLOCATE_HEAP(pMem,iSize) Dns_Realloc((pMem),(iSize))
  23. #define FREE_HEAP(pMem) Dns_Free(pMem)
  24. typedef struct
  25. {
  26. PVOID pNext;
  27. char szDomainName[DNS_MAX_NAME_BUFFER_LENGTH];
  28. char szAuthoritativeZone[DNS_MAX_NAME_BUFFER_LENGTH];
  29. DWORD dwAuthNSCount;
  30. IP_ADDRESS AuthoritativeNS[MAX_NAME_SERVER_COUNT];
  31. DWORD dwIPCount;
  32. IP_ADDRESS IPAddresses[MAX_ADDRS];
  33. DNS_STATUS AllowUpdates;
  34. }
  35. REGISTRATION_INFO, *PREGISTRATION_INFO;
  36. BOOL
  37. SameAuthoritativeServers(
  38. PREGISTRATION_INFO pCurrent,
  39. PIP_ARRAY pNS
  40. );
  41. DNS_STATUS
  42. ComputeExpectedRegistration(
  43. LPSTR pszHostName,
  44. LPSTR pszPrimaryDomain,
  45. PDNS_NETINFO pNetworkInfo,
  46. PREGISTRATION_INFO *ppExpectedRegistration,
  47. NETDIAG_PARAMS* pParams,
  48. NETDIAG_RESULT* pResults
  49. );
  50. void
  51. AddToExpectedRegistration(
  52. LPSTR pszDomain,
  53. PDNS_ADAPTER pAdapterInfo,
  54. PDNS_NETINFO pFazResult,
  55. PIP_ARRAY pNS,
  56. PREGISTRATION_INFO *ppExpectedRegistration
  57. );
  58. HRESULT
  59. VerifyDnsRegistration(
  60. LPSTR pszHostName,
  61. PREGISTRATION_INFO pExpectedRegistration,
  62. NETDIAG_PARAMS* pParams,
  63. NETDIAG_RESULT* pResults
  64. );
  65. HRESULT
  66. CheckDnsRegistration(
  67. PDNS_NETINFO pNetworkInfo,
  68. NETDIAG_PARAMS* pParams,
  69. NETDIAG_RESULT* pResults
  70. );
  71. void
  72. CompareCachedAndRegistryNetworkInfo(
  73. PDNS_NETINFO pNetworkInfo
  74. );
  75. PIP_ARRAY
  76. ServerInfoToIpArray(
  77. DWORD cServerCount,
  78. DNS_SERVER_INFO * ServerArray
  79. );
  80. DNS_STATUS
  81. DnsFindAuthoritativeZone(
  82. IN LPCSTR pszName,
  83. IN DWORD dwFlags,
  84. IN PIP_ARRAY aipQueryServers,
  85. OUT PDNS_NETINFO * ppNetworkInfo
  86. );
  87. DNS_STATUS
  88. DnsFindAllPrimariesAndSecondaries(
  89. IN LPSTR pszName,
  90. IN DWORD dwFlags,
  91. IN PIP_ARRAY aipQueryServers,
  92. OUT PDNS_NETINFO * ppNetworkInfo,
  93. OUT PIP_ARRAY * ppNameServers,
  94. OUT PIP_ARRAY * ppPrimaries //optional
  95. );
  96. PIP_ARRAY
  97. GrabNameServersIp(
  98. PDNS_RECORD pDnsRecord
  99. );
  100. DNS_STATUS
  101. IsDnsServerPrimaryForZone_UTF8(
  102. IP_ADDRESS ip,
  103. LPSTR zone
  104. );
  105. DNS_STATUS
  106. IsDnsServerPrimaryForZone_W(
  107. IP_ADDRESS ip,
  108. LPWSTR zone
  109. );
  110. DNS_STATUS
  111. DnsUpdateAllowedTest_A(
  112. IN HANDLE hContextHandle OPTIONAL,
  113. LPSTR pszName,
  114. LPSTR pszAuthZone,
  115. PIP_ARRAY pAuthDnsServers
  116. );
  117. DNS_STATUS
  118. DnsUpdateAllowedTest_UTF8(
  119. IN HANDLE hContextHandle OPTIONAL,
  120. LPSTR pszName,
  121. LPSTR pszAuthZone,
  122. PIP_ARRAY pAuthDnsServers
  123. );
  124. DNS_STATUS
  125. DnsUpdateAllowedTest_W(
  126. IN HANDLE hContextHandle OPTIONAL,
  127. LPWSTR pwszName,
  128. LPWSTR pwszAuthZone,
  129. PIP_ARRAY pDnsServers
  130. );
  131. DNS_STATUS
  132. DnsQueryAndCompare(
  133. IN LPSTR lpstrName,
  134. IN WORD wType,
  135. IN DWORD fOptions,
  136. IN PIP_ARRAY aipServers OPTIONAL,
  137. IN OUT PDNS_RECORD * ppQueryResultsSet OPTIONAL,
  138. IN OUT PVOID * pReserved OPTIONAL,
  139. IN PDNS_RECORD pExpected OPTIONAL,
  140. IN BOOL bInclusionOk,
  141. IN BOOL bUnicode,
  142. IN OUT PDNS_RECORD * ppDiff1 OPTIONAL,
  143. IN OUT PDNS_RECORD * ppDiff2 OPTIONAL
  144. );
  145. BOOLEAN
  146. DnsCompareRRSet_W (
  147. IN PDNS_RECORD pRRSet1,
  148. IN PDNS_RECORD pRRSet2,
  149. OUT PDNS_RECORD * ppDiff1,
  150. OUT PDNS_RECORD * ppDiff2
  151. );
  152. DNS_STATUS
  153. QueryDnsServerDatabase(
  154. LPSTR szName,
  155. WORD type,
  156. IP_ADDRESS serverIp,
  157. PDNS_RECORD *ppDnsRecord,
  158. BOOL bUnicode,
  159. BOOL *pIsLocal
  160. );
  161. BOOL
  162. GetAnswerTtl(
  163. PDNS_RECORD pRec,
  164. PDWORD pTtl
  165. );
  166. DNS_STATUS
  167. GetAllDnsServersFromRegistry(
  168. PDNS_NETINFO pNetworkInfo,
  169. PIP_ARRAY *pIpArray
  170. );
  171. LPSTR
  172. UTF8ToAnsi(
  173. LPSTR szuStr
  174. );
  175. #endif