macosx-header.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. diff --git a/src/lib/thirdparty/apple/dnsinfo.h b/src/lib/thirdparty/apple/dnsinfo.h
  2. new file mode 100644
  3. index 0000000..e6a9ed1
  4. --- /dev/null
  5. +++ b/src/lib/thirdparty/apple/dnsinfo.h
  6. @@ -0,0 +1,128 @@
  7. +/*
  8. + * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015-2018 Apple Inc. All rights reserved.
  9. + *
  10. + * @APPLE_LICENSE_HEADER_START@
  11. + *
  12. + * This file contains Original Code and/or Modifications of Original Code
  13. + * as defined in and that are subject to the Apple Public Source License
  14. + * Version 2.0 (the 'License'). You may not use this file except in
  15. + * compliance with the License. Please obtain a copy of the License at
  16. + * http://www.opensource.apple.com/apsl/ and read it before using this
  17. + * file.
  18. + *
  19. + * The Original Code and all software distributed under the License are
  20. + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  21. + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  22. + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  23. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  24. + * Please see the License for the specific language governing rights and
  25. + * limitations under the License.
  26. + *
  27. + * @APPLE_LICENSE_HEADER_END@
  28. + */
  29. +
  30. +#ifndef __DNSINFO_H__
  31. +#define __DNSINFO_H__
  32. +
  33. +/*
  34. + * These routines provide access to the systems DNS configuration
  35. + */
  36. +
  37. +#include <os/availability.h>
  38. +#include <sys/cdefs.h>
  39. +#include <stdint.h>
  40. +#include <sys/types.h>
  41. +#include <sys/socket.h>
  42. +#include <netinet/in.h>
  43. +
  44. +#define DNSINFO_VERSION 20170629
  45. +
  46. +#define DEFAULT_SEARCH_ORDER 200000 /* search order for the "default" resolver domain name */
  47. +
  48. +#define DNS_PTR(type, name) \
  49. + union { \
  50. + type name; \
  51. + uint64_t _ ## name ## _p; \
  52. + }
  53. +
  54. +#define DNS_VAR(type, name) \
  55. + type name
  56. +
  57. +
  58. +#pragma pack(4)
  59. +typedef struct {
  60. + struct in_addr address;
  61. + struct in_addr mask;
  62. +} dns_sortaddr_t;
  63. +#pragma pack()
  64. +
  65. +
  66. +#pragma pack(4)
  67. +typedef struct {
  68. + DNS_PTR(char *, domain); /* domain */
  69. + DNS_VAR(int32_t, n_nameserver); /* # nameserver */
  70. + DNS_PTR(struct sockaddr **, nameserver);
  71. + DNS_VAR(uint16_t, port); /* port (in host byte order) */
  72. + DNS_VAR(int32_t, n_search); /* # search */
  73. + DNS_PTR(char **, search);
  74. + DNS_VAR(int32_t, n_sortaddr); /* # sortaddr */
  75. + DNS_PTR(dns_sortaddr_t **, sortaddr);
  76. + DNS_PTR(char *, options); /* options */
  77. + DNS_VAR(uint32_t, timeout); /* timeout */
  78. + DNS_VAR(uint32_t, search_order); /* search_order */
  79. + DNS_VAR(uint32_t, if_index);
  80. + DNS_VAR(uint32_t, flags);
  81. + DNS_VAR(uint32_t, reach_flags); /* SCNetworkReachabilityFlags */
  82. + DNS_VAR(uint32_t, service_identifier);
  83. + DNS_PTR(char *, cid); /* configuration identifer */
  84. + DNS_PTR(char *, if_name); /* if_index interface name */
  85. +} dns_resolver_t;
  86. +#pragma pack()
  87. +
  88. +
  89. +#define DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS 0x0002 /* always requesting for A dns records in queries */
  90. +#define DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS 0x0004 /* always requesting for AAAA dns records in queries */
  91. +
  92. +#define DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS \
  93. + (DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS | DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS)
  94. +
  95. +#define DNS_RESOLVER_FLAGS_SCOPED 0x1000 /* configuration is for scoped questions */
  96. +#define DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC 0x2000 /* configuration is service-specific */
  97. +#define DNS_RESOLVER_FLAGS_SUPPLEMENTAL 0x4000 /* supplemental match configuration */
  98. +
  99. +
  100. +#pragma pack(4)
  101. +typedef struct {
  102. + DNS_VAR(int32_t, n_resolver); /* resolver configurations */
  103. + DNS_PTR(dns_resolver_t **, resolver);
  104. + DNS_VAR(int32_t, n_scoped_resolver); /* "scoped" resolver configurations */
  105. + DNS_PTR(dns_resolver_t **, scoped_resolver);
  106. + DNS_VAR(uint64_t, generation);
  107. + DNS_VAR(int32_t, n_service_specific_resolver);
  108. + DNS_PTR(dns_resolver_t **, service_specific_resolver);
  109. + DNS_VAR(uint32_t, version);
  110. +} dns_config_t;
  111. +#pragma pack()
  112. +
  113. +
  114. +__BEGIN_DECLS
  115. +
  116. +/*
  117. + * DNS configuration access APIs
  118. + */
  119. +const char *
  120. +dns_configuration_notify_key (void) API_AVAILABLE(macos(10.4), ios(2.0));
  121. +
  122. +dns_config_t *
  123. +dns_configuration_copy (void) API_AVAILABLE(macos(10.4), ios(2.0));
  124. +
  125. +void
  126. +dns_configuration_free (dns_config_t *config) API_AVAILABLE(macos(10.4), ios(2.0));
  127. +
  128. +void
  129. +_dns_configuration_ack (dns_config_t *config,
  130. + const char *bundle_id) API_AVAILABLE(macos(10.8), ios(6.0));
  131. +
  132. +__END_DECLS
  133. +
  134. +#endif /* __DNSINFO_H__ */
  135. \ No newline at end of file