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.

1012 lines
21 KiB

  1. /*++
  2. Copyright (c) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. local.h
  5. Abstract:
  6. Domain Name System (DNS) API
  7. Dns API local include file
  8. Author:
  9. Jim Gilroy (jamesg) May 1997
  10. Revision History:
  11. --*/
  12. #ifndef _DNSAPILOCAL_INCLUDED_
  13. #define _DNSAPILOCAL_INCLUDED_
  14. #define UNICODE 1
  15. #define _UNICODE 1
  16. #include <nt.h> // build for Win95 compatibility
  17. #include <ntrtl.h>
  18. #include <nturtl.h>
  19. #include <windows.h>
  20. // headers are messed up
  21. // neither ntdef.h nor winnt.h brings in complete set, so depending
  22. // on whether you include nt.h or not you end up with different set
  23. #define MINCHAR 0x80
  24. #define MAXCHAR 0x7f
  25. #define MINSHORT 0x8000
  26. #define MAXSHORT 0x7fff
  27. #define MINLONG 0x80000000
  28. #define MAXLONG 0x7fffffff
  29. #define MAXBYTE 0xff
  30. #define MAXUCHAR 0xff
  31. #define MAXWORD 0xffff
  32. #define MAXUSHORT 0xffff
  33. #define MAXDWORD 0xffffffff
  34. #define MAXULONG 0xffffffff
  35. #include <winsock2.h>
  36. #include <ws2tcpip.h>
  37. #include <iptypes.h>
  38. #include <basetyps.h>
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41. #include <limits.h>
  42. #include <align.h> // Alignment macros
  43. #include <windns.h> // SDK DNS definitions
  44. #define DNS_INTERNAL
  45. #define DNSAPI_INTERNAL
  46. #define DNSAPI_NETDIAG
  47. #include <dnsapi.h>
  48. #include "dnsrslvr.h" // Resolver RPC definitions
  49. #include <rpcasync.h> // Exception filter
  50. #include "dnslibp.h" // DNS library
  51. #include "registry.h"
  52. #include "message.h" // dnslib message def
  53. //#include "dnsrslvr.h" // Resolver RPC definitions
  54. #include "dnsapip.h" // Private DNS definitions
  55. #include "queue.h"
  56. #include "rtlstuff.h" // Handy macros from NT RTL
  57. #include "trace.h"
  58. #include "heapdbg.h" // dnslib debug heap
  59. //
  60. // Use winsock2
  61. //
  62. #define DNS_WINSOCK_VERSION (0x0202) // Winsock 2.2
  63. //
  64. // Dll instance handle
  65. //
  66. extern HINSTANCE g_hInstanceDll;
  67. //
  68. // General CS
  69. // protects initialization and available for other random needs
  70. //
  71. CRITICAL_SECTION g_GeneralCS;
  72. #define LOCK_GENERAL() EnterCriticalSection( &g_GeneralCS )
  73. #define UNLOCK_GENERAL() LeaveCriticalSection( &g_GeneralCS )
  74. //
  75. // Init Levels
  76. //
  77. #define INITLEVEL_ZERO (0)
  78. #define INITLEVEL_BASE (0x00000001)
  79. #define INITLEVEL_DEBUG (0x00000010)
  80. #define INITLEVEL_QUERY (0x00000100)
  81. #define INITLEVEL_REGISTRATION (0x00001000)
  82. #define INITLEVEL_SECURE_UPDATE (0x00010000)
  83. // Combined
  84. #define INITLEVEL_ALL (0xffffffff)
  85. //
  86. // Limit on update adapters
  87. //
  88. #define UPDATE_ADAPTER_LIMIT (100)
  89. //
  90. // Limit on search list entries
  91. //
  92. #define MAX_SEARCH_LIST_ENTRIES (50)
  93. //
  94. // Event logging
  95. // - currently set to disable in any code we pick up from server
  96. //
  97. VOID
  98. DnsLogEvent(
  99. IN DWORD MessageId,
  100. IN WORD EventType,
  101. IN DWORD NumberOfSubStrings,
  102. IN PWSTR * SubStrings,
  103. IN DWORD ErrorCode
  104. );
  105. #define DNS_LOG_EVENT(a,b,c,d)
  106. //
  107. // Debug
  108. //
  109. #ifdef ASSERT
  110. #undef ASSERT
  111. #endif
  112. #define ASSERT(a) DNS_ASSERT(a)
  113. // standard -- unflagged ASSERT()
  114. // - defintion directly from ntrtl.h
  115. // this should have been plain vanilla ASSERT(), but
  116. // it is used too often
  117. #if DBG
  118. #define RTL_ASSERT(exp) \
  119. ((!(exp)) ? \
  120. (RtlAssert( #exp, __FILE__, __LINE__, NULL ),FALSE) : \
  121. TRUE)
  122. #else
  123. #define RTL_ASSERT(exp)
  124. #endif
  125. //
  126. // IP6 support
  127. //
  128. #define RUNNING_IP6() (TRUE)
  129. //
  130. // Handy hack
  131. //
  132. #define SOCKADDR_IS_LOOPBACK(psa) DnsAddr_IsLoopback( (PDNS_ADDR)(psa), 0 )
  133. //
  134. // Single async socket for internal use
  135. //
  136. // If want async socket i/o then can create single async socket, with
  137. // corresponding event and always use it. Requires winsock 2.2
  138. //
  139. extern SOCKET DnsSocket;
  140. extern OVERLAPPED DnsSocketOverlapped;
  141. extern HANDLE hDnsSocketEvent;
  142. //
  143. // App shutdown flag
  144. //
  145. extern BOOLEAN fApplicationShutdown;
  146. //
  147. // Global config -- From DnsLib
  148. // -- set in DnsRegInit()
  149. // OR in DnsReadRegistryGlobals()
  150. // -- declaration in registry.h
  151. //
  152. //
  153. // Runtime globals (dnsapi.c)
  154. //
  155. extern DWORD g_NetFailureTime;
  156. extern DNS_STATUS g_NetFailureStatus;
  157. //extern IP4_ADDRESS g_LastDNSServerUpdated;
  158. //
  159. // Heap operations
  160. //
  161. #define ALLOCATE_HEAP(size) Dns_AllocZero( size )
  162. #define ALLOCATE_HEAP_ZERO(size) Dns_AllocZero( size )
  163. #define REALLOCATE_HEAP(p,size) Dns_Realloc( (p), (size) )
  164. #define FREE_HEAP(p) Dns_Free( p )
  165. //
  166. // RPC Exception filters
  167. //
  168. #define DNS_RPC_EXCEPTION_FILTER I_RpcExceptionFilter( RpcExceptionCode() )
  169. //
  170. // During setup need to cleanup after winsock
  171. //
  172. #define GUI_MODE_SETUP_WS_CLEANUP( _mode ) \
  173. { \
  174. if ( _mode ) \
  175. { \
  176. Socket_CleanupWinsock(); \
  177. } \
  178. }
  179. //
  180. // Server status
  181. //
  182. #define SRVSTATUS_NEW ((DNS_STATUS)(-1))
  183. #define TEST_SERVER_VALID_RECV(pserver) ((LONG)(pserver)->Status >= 0 )
  184. //
  185. // Server state
  186. //
  187. // Note, server state is currently completely "per query", meaning
  188. // only pertaining to a particular name query.
  189. //
  190. // As such it has two components:
  191. // 1) query -- state for entire query
  192. // 2) retry -- state only valid for given retry
  193. //
  194. #define SRVFLAG_NEW (0x00000000)
  195. #define SRVFLAG_SENT (0x00000001)
  196. #define SRVFLAG_RECV (0x00000002)
  197. #define SRVFLAG_SENT_OPT (0x00000011)
  198. #define SRVFLAG_RECV_OPT (0x00000020)
  199. #define SRVFLAG_TIMEOUT_OPT (0x00000040)
  200. #define SRVFLAG_SENT_NON_OPT (0x00000101)
  201. #define SRVFLAG_RECV_NON_OPT (0x00000200)
  202. #define SRVFLAG_TIMEOUT_NON_OPT (0x00000400)
  203. #define SRVFLAG_QUERY_MASK (0x0000ffff)
  204. #define SRVFLAG_SENT_THIS_RETRY (0x00010000)
  205. #define SRVFLAG_RETRY_MASK (0x00010000)
  206. #define SRVFLAG_RUNTIME_MASK (0x000fffff)
  207. #define TEST_SERVER_STATE(pserver, state) (((pserver)->Flags & (state)) == (state))
  208. #define SET_SERVER_STATE(pserver, state) ((pserver)->Flags |= state)
  209. #define CLEAR_SERVER_STATE(pserver, state) ((pserver)->Flags &= ~(state))
  210. #define TEST_SERVER_NEW(pserver) ((pserver)->Flags == SRVFLAG_NEW)
  211. #define CLEAR_SERVER_RETRY_STATE( pserver ) CLEAR_SERVER_STATE( pserver, SRVFLAG_RETRY_MASK )
  212. //
  213. // Server priority
  214. //
  215. // Note, these values are tuned to do the following
  216. // => loopback DNS keeps getting action through a fair amount of
  217. // timeouts, but is pushed aside if no DNS
  218. // => otherwise response priority beats default setup
  219. // => IP6 default DNS are assumed to be non-functional relative to
  220. // other DNS servers, several timeouts on other servers before they
  221. // go first
  222. //
  223. #define SRVPRI_LOOPBACK (200)
  224. #define SRVPRI_RESPONSE (10)
  225. #define SRVPRI_DEFAULT (0)
  226. #define SRVPRI_IP6_DEFAULT (-30)
  227. #define SRVPRI_NO_DNS (-200)
  228. #define SRVPRI_SERVFAIL_DROP (1)
  229. #define SRVPRI_TIMEOUT_DROP (10)
  230. #define SRVPRI_NO_DNS_DROP (200)
  231. //
  232. // Local Prototypes
  233. //
  234. // Routines shared between dnsapi.dll modules, but not exported
  235. //
  236. // Note, i've included some other functions in here because the external
  237. // definition seems help "encourage" the creation of symbols in retail
  238. // builds
  239. //
  240. //
  241. // Config stuff
  242. //
  243. BOOL
  244. DnsApiInit(
  245. IN DWORD InitLevel
  246. );
  247. DWORD
  248. Reg_ReadRegistryGlobal(
  249. IN DNS_REGID GlobalId
  250. );
  251. //
  252. // DHCP server (dynreg.c)
  253. //
  254. VOID
  255. DhcpSrv_Cleanup(
  256. VOID
  257. );
  258. //
  259. // DHCP client (asyncreg.c)
  260. //
  261. VOID
  262. Dhcp_RegCleanupForUnload(
  263. VOID
  264. );
  265. //
  266. // Query (query.c)
  267. //
  268. DNS_STATUS
  269. WINAPI
  270. Query_PrivateExW(
  271. IN PCWSTR pwsName,
  272. IN WORD wType,
  273. IN DWORD Options,
  274. IN PADDR_ARRAY pServerList OPTIONAL,
  275. IN PIP4_ARRAY pServerList4 OPTIONAL,
  276. OUT PDNS_RECORD * ppResultSet OPTIONAL,
  277. IN OUT PDNS_MSG_BUF * ppMessageResponse OPTIONAL
  278. );
  279. DNS_STATUS
  280. WINAPI
  281. Query_Private(
  282. IN PCWSTR pszName,
  283. IN WORD wType,
  284. IN DWORD Options,
  285. IN PADDR_ARRAY pServerList OPTIONAL,
  286. OUT PDNS_RECORD * ppResultSet OPTIONAL
  287. );
  288. BOOL
  289. IsEmptyDnsResponse(
  290. IN PDNS_RECORD pRecordList
  291. );
  292. BOOL
  293. ValidateQueryTld(
  294. IN PWSTR pTld
  295. );
  296. BOOL
  297. ValidateQueryName(
  298. IN PQUERY_BLOB pBlob,
  299. IN PWSTR pName,
  300. IN PWSTR pDomain
  301. );
  302. PWSTR
  303. getNextQueryName(
  304. OUT PWSTR pNameBuffer,
  305. IN DWORD QueryCount,
  306. IN PWSTR pszName,
  307. IN DWORD NameLength,
  308. IN DWORD NameAttributes,
  309. IN PDNS_NETINFO pNetInfo,
  310. OUT PDWORD pSuffixFlags
  311. );
  312. PWSTR
  313. Query_GetNextName(
  314. IN OUT PQUERY_BLOB pBlob
  315. );
  316. //
  317. // FAZ (faz.c)
  318. //
  319. DNS_STATUS
  320. Faz_Private(
  321. IN PWSTR pszName,
  322. IN DWORD dwFlags,
  323. IN PADDR_ARRAY pServers, OPTIONAL
  324. OUT PDNS_NETINFO * ppNetworkInfo
  325. );
  326. DNS_STATUS
  327. DoQuickFAZ(
  328. OUT PDNS_NETINFO * ppNetworkInfo,
  329. IN PWSTR pszName,
  330. IN PADDR_ARRAY pServers
  331. );
  332. DWORD
  333. GetDnsServerListsForUpdate(
  334. IN OUT PADDR_ARRAY* DnsServerListArray,
  335. IN DWORD ArrayLength,
  336. IN DWORD Flags
  337. );
  338. DNS_STATUS
  339. CollapseDnsServerListsForUpdate(
  340. IN OUT PADDR_ARRAY* DnsServerListArray,
  341. OUT PDNS_NETINFO * NetworkInfoArray,
  342. IN OUT PDWORD pNetCount,
  343. IN PWSTR pszUpdateName
  344. );
  345. PADDR_ARRAY
  346. GetNameServersListForDomain(
  347. IN PWSTR pDomainName,
  348. IN PADDR_ARRAY pServerList
  349. );
  350. BOOL
  351. ValidateZoneNameForUpdate(
  352. IN PWSTR pszZone
  353. );
  354. BOOL
  355. WINAPI
  356. Faz_AreServerListsInSameNameSpace(
  357. IN PWSTR pszDomainName,
  358. IN PADDR_ARRAY pServerList1,
  359. IN PADDR_ARRAY pServerList2
  360. );
  361. BOOL
  362. WINAPI
  363. CompareMultiAdapterSOAQueries(
  364. IN PWSTR pszDomainName,
  365. IN PIP4_ARRAY pDnsServerList1,
  366. IN PIP4_ARRAY pDnsServerList2
  367. );
  368. BOOL
  369. WINAPI
  370. Faz_CompareTwoAdaptersForSameNameSpace(
  371. IN PADDR_ARRAY pDnsServerList1,
  372. IN PDNS_NETINFO pNetworkInfo1,
  373. IN OUT PDNS_RECORD * ppNsRecord1,
  374. IN PADDR_ARRAY pDnsServerList2,
  375. IN PDNS_NETINFO pNetworkInfo2,
  376. IN OUT PDNS_RECORD * ppNsRecord2,
  377. IN BOOL bDoNsCheck
  378. );
  379. //
  380. // Status (dnsapi.c)
  381. //
  382. BOOL
  383. IsKnownNetFailure(
  384. VOID
  385. );
  386. VOID
  387. SetKnownNetFailure(
  388. IN DNS_STATUS Status
  389. );
  390. BOOL
  391. IsLocalIpAddress(
  392. IN IP4_ADDRESS IpAddress
  393. );
  394. PDNS_NETINFO
  395. GetAdapterListFromCache(
  396. VOID
  397. );
  398. //
  399. // IP Help API (iphelp.c)
  400. //
  401. VOID
  402. IpHelp_Cleanup(
  403. VOID
  404. );
  405. PIP_ADAPTER_ADDRESSES
  406. IpHelp_GetAdaptersAddresses(
  407. IN ULONG Family,
  408. IN DWORD Flags
  409. );
  410. DNS_STATUS
  411. IpHelp_ReadAddrsFromList(
  412. IN PVOID pAddrList,
  413. IN BOOL fUnicast,
  414. IN DWORD ScreenMask, OPTIONAL
  415. IN DWORD ScreenFlags, OPTIONAL
  416. OUT PDNS_ADDR_ARRAY * ppComboArray, OPTIONAL
  417. OUT PDNS_ADDR_ARRAY * pp6OnlyArray, OPTIONAL
  418. OUT PDNS_ADDR_ARRAY * pp4OnlyArray, OPTIONAL
  419. OUT PDWORD pCount6, OPTIONAL
  420. OUT PDWORD pCount4 OPTIONAL
  421. );
  422. DNS_STATUS
  423. IpHelp_GetAdaptersInfo(
  424. OUT PIP_ADAPTER_INFO * ppAdapterInfo
  425. );
  426. DNS_STATUS
  427. IpHelp_GetPerAdapterInfo(
  428. IN DWORD AdapterIndex,
  429. OUT PIP_PER_ADAPTER_INFO * ppPerAdapterInfo
  430. );
  431. DNS_STATUS
  432. IpHelp_GetBestInterface(
  433. IN IP4_ADDRESS Ip4Addr,
  434. OUT PDWORD pdwInterfaceIndex
  435. );
  436. DNS_STATUS
  437. IpHelp_ParseIpAddressString(
  438. IN OUT PIP4_ARRAY pIpArray,
  439. IN PIP_ADDR_STRING pIpAddrString,
  440. IN BOOL fGetSubnetMask,
  441. IN BOOL fReverse
  442. );
  443. //
  444. // Private registry\config (regfig.c)
  445. //
  446. BOOL
  447. Reg_ReadDwordEnvar(
  448. IN DWORD dwFlag,
  449. OUT PENVAR_DWORD_INFO pEnvar
  450. );
  451. DNS_STATUS
  452. Reg_DefaultAdapterInfo(
  453. OUT PREG_ADAPTER_INFO pBlob,
  454. IN PREG_GLOBAL_INFO pRegInfo,
  455. IN PIP_ADAPTER_ADDRESSES pIpAdapter
  456. );
  457. //
  458. // Hosts file reading (hostfile.c)
  459. //
  460. BOOL
  461. HostsFile_Query(
  462. IN OUT PQUERY_BLOB pBlob
  463. );
  464. //
  465. // Heap (memory.c)
  466. //
  467. DNS_STATUS
  468. Heap_Initialize(
  469. VOID
  470. );
  471. VOID
  472. Heap_Cleanup(
  473. VOID
  474. );
  475. //
  476. // Type specific config routines (config.c)
  477. //
  478. PADDR_ARRAY
  479. Config_GetDnsServerList(
  480. IN PWSTR pwsAdapterName,
  481. IN DWORD AddrFamily,
  482. IN BOOL fForce
  483. );
  484. PIP4_ARRAY
  485. Config_GetDnsServerListIp4(
  486. IN PWSTR pwsAdapterName,
  487. IN BOOL fForce
  488. );
  489. PDNS_GLOBALS_BLOB
  490. Config_GetDwordGlobals(
  491. IN DWORD Flag,
  492. IN DWORD AcceptLocalCacheTime OPTIONAL
  493. );
  494. //
  495. // Network info (netinfo.c)
  496. //
  497. BOOL
  498. InitNetworkInfo(
  499. VOID
  500. );
  501. VOID
  502. CleanupNetworkInfo(
  503. VOID
  504. );
  505. PWSTR
  506. SearchList_GetNextName(
  507. IN OUT PSEARCH_LIST pSearchList,
  508. IN BOOL fReset,
  509. OUT PDWORD pdwSuffixFlags OPTIONAL
  510. );
  511. PADDR_ARRAY
  512. NetInfo_ConvertToAddrArray(
  513. IN PDNS_NETINFO pNetInfo,
  514. IN PWSTR pwsAdapterName,
  515. IN DWORD Family OPTIONAL
  516. );
  517. PDNS_NETINFO
  518. NetInfo_CreateForUpdate(
  519. IN PWSTR pszZone,
  520. IN PWSTR pszServerName,
  521. IN PDNS_ADDR_ARRAY pServerArray,
  522. IN DWORD dwFlags
  523. );
  524. PDNS_NETINFO
  525. NetInfo_CreateFromAddrArray(
  526. IN PADDR_ARRAY pDnsServers,
  527. IN PDNS_ADDR pServerIp,
  528. IN BOOL fSearchInfo,
  529. IN PDNS_NETINFO pNetInfo OPTIONAL
  530. );
  531. PWSTR
  532. NetInfo_UpdateZoneName(
  533. IN PDNS_NETINFO pNetInfo
  534. );
  535. PWSTR
  536. NetInfo_UpdateServerName(
  537. IN PDNS_NETINFO pNetInfo
  538. );
  539. BOOL
  540. NetInfo_IsForUpdate(
  541. IN PDNS_NETINFO pNetInfo
  542. );
  543. VOID
  544. NetInfo_MarkDirty(
  545. VOID
  546. );
  547. //
  548. // Adapter access
  549. //
  550. PDNS_ADAPTER
  551. NetInfo_GetNextAdapter(
  552. IN OUT PDNS_NETINFO pNetInfo
  553. );
  554. #define NetInfo_AdapterLoopStart( pni ) ((pni)->AdapterIndex = 0)
  555. //
  556. // Netinfo_Get flags
  557. //
  558. #define NIFLAG_GET_LOCAL_ADDRS (0x10000000)
  559. #define NIFLAG_FORCE_REGISTRY_READ (0x00000001)
  560. #define NIFLAG_READ_RESOLVER_FIRST (0x00000010)
  561. #define NIFLAG_READ_RESOLVER (0x00000020)
  562. #define NIFLAG_READ_PROCESS_CACHE (0x00000100)
  563. PDNS_NETINFO
  564. NetInfo_Get(
  565. IN DWORD Flags,
  566. IN DWORD AcceptLocalCacheTime OPTIONAL
  567. );
  568. // Default Use
  569. // - need local addrs
  570. // - accept from cache
  571. // - try resolver
  572. #define GetNetworkInfo() \
  573. NetInfo_Get( \
  574. NIFLAG_GET_LOCAL_ADDRS | \
  575. NIFLAG_READ_RESOLVER | \
  576. NIFLAG_READ_PROCESS_CACHE, \
  577. 0 )
  578. // Delete
  579. PIP4_ARRAY
  580. NetInfo_ConvertToIp4Array(
  581. IN PDNS_NETINFO pNetInfo
  582. );
  583. // Delete
  584. PDNS_NETINFO
  585. NetInfo_CreateFromIp4Array(
  586. IN PIP4_ARRAY pDnsServers,
  587. IN IP4_ADDRESS ServerIp,
  588. IN BOOL fSearchInfo,
  589. IN PDNS_NETINFO pNetInfo OPTIONAL
  590. );
  591. // Delete
  592. PDNS_NETINFO
  593. NetInfo_CreateForUpdateIp4(
  594. IN PWSTR pszZone,
  595. IN PWSTR pszServerName,
  596. IN PIP4_ARRAY pServ4Array,
  597. IN DWORD dwFlags
  598. );
  599. //
  600. // Local address config from netinfo
  601. //
  602. #define DNS_CONFIG_FLAG_ADDR_PUBLIC (0x00000001)
  603. #define DNS_CONFIG_FLAG_ADDR_PRIVATE (0x00000002)
  604. #define DNS_CONFIG_FLAG_ADDR_CLUSTER (0x00000004)
  605. #define DNS_CONFIG_FLAG_ADDR_NON_CLUSTER (0x00000003)
  606. #define DNS_CONFIG_FLAG_ADDR_ALL (0x00000007)
  607. #define DNS_CONFIG_FLAG_READ_CLUSTER_ENVAR (0x00100000)
  608. PADDR_ARRAY
  609. NetInfo_CreateLocalAddrArray(
  610. IN PDNS_NETINFO pNetInfo,
  611. IN PWSTR pwsAdapterName, OPTIONAL
  612. IN PDNS_ADAPTER pAdapter, OPTIONAL
  613. IN DWORD Family, OPTIONAL
  614. IN DWORD AddrFlags OPTIONAL
  615. );
  616. PDNS_ADDR_ARRAY
  617. NetInfo_GetLocalAddrArray(
  618. IN PDNS_NETINFO pNetInfo,
  619. IN PWSTR pwsAdapterName, OPTIONAL
  620. IN DWORD Family, OPTIONAL
  621. IN DWORD AddrFlags, OPTIONAL
  622. IN BOOL fForce
  623. );
  624. PIP4_ARRAY
  625. NetInfo_GetLocalAddrArrayIp4(
  626. IN PWSTR pwsAdapterName, OPTIONAL
  627. IN DWORD AddrFlags,
  628. IN BOOL fForce
  629. );
  630. // Private but used in servlist.c
  631. DNS_STATUS
  632. AdapterInfo_Copy(
  633. OUT PDNS_ADAPTER pCopy,
  634. IN PDNS_ADAPTER pAdapter
  635. );
  636. PDNS_NETINFO
  637. NetInfo_Alloc(
  638. IN DWORD AdapterCount
  639. );
  640. BOOL
  641. NetInfo_AddAdapter(
  642. IN OUT PDNS_NETINFO pNetInfo,
  643. IN PDNS_ADAPTER pAdapter
  644. );
  645. //
  646. // Public config blob routines
  647. //
  648. VOID
  649. DnsSearchList_Free(
  650. IN PDNS_SEARCH_LIST pSearchList
  651. );
  652. PDNS_SEARCH_LIST
  653. DnsSearchList_Get(
  654. IN DNS_CHARSET CharSet
  655. );
  656. VOID
  657. DnsAdapterInfo_Free(
  658. IN OUT PDNS_ADAPTER_INFO pAdapter,
  659. IN BOOL fFreeAdapter
  660. );
  661. VOID
  662. DnsNetworkInfo_Free(
  663. IN OUT PDNS_NETWORK_INFO pNetInfo
  664. );
  665. PDNS_NETWORK_INFO
  666. DnsNetworkInfo_Get(
  667. IN DNS_CHARSET CharSet
  668. );
  669. //
  670. // Routine for the old public structures:
  671. // DNS_NETWORK_INFORMATION
  672. // DNS_SEARCH_INFORMATION
  673. // DNS_ADAPTER_INFORMATION
  674. //
  675. VOID
  676. DnsSearchInformation_Free(
  677. IN PDNS_SEARCH_INFORMATION pSearchList
  678. );
  679. PDNS_SEARCH_INFORMATION
  680. DnsSearchInformation_Get(
  681. VOID
  682. );
  683. VOID
  684. DnsAdapterInformation_Free(
  685. IN OUT PDNS_ADAPTER_INFORMATION pAdapter
  686. );
  687. VOID
  688. DnsNetworkInformation_Free(
  689. IN OUT PDNS_NETWORK_INFORMATION pNetInfo
  690. );
  691. PDNS_NETWORK_INFORMATION
  692. DnsNetworkInformation_Get(
  693. VOID
  694. );
  695. //
  696. // local IP info (localip.c)
  697. //
  698. PIP4_ARRAY
  699. LocalIp_GetIp4Array(
  700. VOID
  701. );
  702. PADDR_ARRAY
  703. LocalIp_GetArray(
  704. VOID
  705. );
  706. BOOL
  707. LocalIp_IsAddrLocal(
  708. IN PDNS_ADDR pAddr,
  709. IN PDNS_ADDR_ARRAY pLocalArray, OPTIONAL
  710. IN PDNS_NETINFO pNetInfo OPTIONAL
  711. );
  712. //
  713. // send utils (send.c)
  714. //
  715. VOID
  716. Send_CleanupOptList(
  717. VOID
  718. );
  719. //
  720. // socket utils (socket.c)
  721. //
  722. SOCKET
  723. Socket_CreateMessageSocket(
  724. IN OUT PDNS_MSG_BUF pMsg
  725. );
  726. SOCKET
  727. Socket_GetUdp(
  728. IN INT Family
  729. );
  730. VOID
  731. Socket_ReturnUdp(
  732. IN SOCKET Socket,
  733. IN INT Family
  734. );
  735. //
  736. // Message parsing (packet.c)
  737. //
  738. VOID
  739. Dns_FreeParsedMessageFields(
  740. IN OUT PDNS_PARSED_MESSAGE pParse
  741. );
  742. //
  743. // Extra info (util.c)
  744. //
  745. PDNS_EXTRA_INFO
  746. ExtraInfo_FindInList(
  747. IN OUT PDNS_EXTRA_INFO pExtraList,
  748. IN DWORD Id
  749. );
  750. BOOL
  751. ExtraInfo_SetBasicResults(
  752. IN OUT PDNS_EXTRA_INFO pExtraList,
  753. IN PBASIC_RESULTS pResults
  754. );
  755. PDNS_ADDR_ARRAY
  756. ExtraInfo_GetServerList(
  757. IN PDNS_EXTRA_INFO pExtraList
  758. );
  759. PDNS_ADDR_ARRAY
  760. ExtraInfo_GetServerListPossiblyImbedded(
  761. IN PIP4_ARRAY pList
  762. );
  763. VOID
  764. Util_SetBasicResults(
  765. OUT PBASIC_RESULTS pResults,
  766. IN DWORD Status,
  767. IN DWORD Rcode,
  768. IN PDNS_ADDR pServerAddr
  769. );
  770. PDNS_ADDR_ARRAY
  771. Util_GetAddrArray(
  772. OUT PDWORD fCopy,
  773. IN PDNS_ADDR_ARRAY pServList,
  774. IN PIP4_ARRAY pServList4,
  775. IN PDNS_EXTRA_INFO pExtra
  776. );
  777. VOID
  778. Util_GetActiveProtocols(
  779. OUT PBOOL pfRunning6,
  780. OUT PBOOL pfRunning4
  781. );
  782. #endif // _DNSAPILOCAL_INCLUDED_