147
148
#define INK_NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
148
149
#define INK_DNS_LABELTYPE_BITSTRING 0x41
151
/// IP family preference for DNS resolution.
152
/// Used for configuration.
153
enum HostResPreference {
154
HOST_RES_PREFER_NONE = 0, ///< Invalid / init value.
155
HOST_RES_PREFER_CLIENT, ///< Prefer family of client connection.
156
HOST_RES_PREFER_IPV4, ///< Prefer IPv4.
157
HOST_RES_PREFER_IPV6 ///< Prefer IPv6
159
/// # of preference values.
160
static int const N_HOST_RES_PREFERENCE = HOST_RES_PREFER_IPV6+1;
161
/// # of entries in a preference ordering.
162
static int const N_HOST_RES_PREFERENCE_ORDER = 3;
163
/// Storage for preference ordering.
164
typedef HostResPreference HostResPreferenceOrder[N_HOST_RES_PREFERENCE_ORDER];
165
/// Global, hard wired default value for preference ordering.
166
extern HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER;
167
/// Global (configurable) default.
168
extern HostResPreferenceOrder host_res_default_preference_order;
169
/// String versions of @c FamilyPreference
170
extern char const* const HOST_RES_PREFERENCE_STRING[N_HOST_RES_PREFERENCE];
172
/// IP family to use in a DNS query for a host address.
173
/// Used during DNS query operations.
175
HOST_RES_NONE = 0, ///< No preference / unspecified / init value.
176
HOST_RES_IPV4, ///< Use IPv4 if possible.
177
HOST_RES_IPV4_ONLY, ///< Resolve on IPv4 addresses.
178
HOST_RES_IPV6, ///< Use IPv6 if possible.
179
HOST_RES_IPV6_ONLY ///< Resolve only IPv6 addresses.
182
/// Strings for host resolution styles
183
extern char const* const HOST_RES_STYLE_STRING[];
185
/// Caclulate the effective resolution preferences.
188
int family, ///< Connection family
189
HostResPreferenceOrder ///< Preference ordering.
191
/// Calculate the host resolution style to force a family match to @a addr.
193
ats_host_res_match(sockaddr const* addr);
195
/** Parse a host resolution configuration string.
198
parse_host_res_preferences(
199
char const* value, ///< [in] Configuration string.
200
HostResPreferenceOrder order /// [out] Order to update.
151
204
#define NS_GET16(s, cp) do { \
152
205
register const u_char *t_cp = (const u_char *)(cp); \
238
291
int ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz);
293
/** Initialize global values for HttpProxyPort / Host Resolution.
295
void ts_host_res_global_init();
297
/** Generate a string representation of a host resolution preference ordering.
298
@return The length of the string.
301
ts_host_res_order_to_string(
302
HostResPreferenceOrder const& order, ///< order to print
303
char* out, ///< Target buffer for string.
304
int size ///< Size of buffer.
240
307
#endif /* _ink_resolver_h_ */