~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to lib/ts/ink_resolver.h

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-05-09 01:00:04 UTC
  • mto: (1.1.11) (5.3.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20130509010004-9fqq9n0adseg3f8w
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
 
103
103
/*%
104
104
 *  * Resolver options (keep these in synch with res_debug.c, please)
 
105
 [amc] Most of these are never used. AFAICT it's RECURSE and DEBUG only.
105
106
 *   */
106
107
#define INK_RES_INIT        0x00000001      /*%< address initialized */
107
108
#define INK_RES_DEBUG       0x00000002      /*%< print debug messages */
147
148
#define INK_NS_TYPE_ELT  0x40 /*%< EDNS0 extended label type */
148
149
#define INK_DNS_LABELTYPE_BITSTRING 0x41
149
150
 
 
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
 
158
};
 
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];
 
171
 
 
172
/// IP family to use in a DNS query for a host address.
 
173
/// Used during DNS query operations.
 
174
enum HostResStyle{
 
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.
 
180
};
 
181
 
 
182
/// Strings for host resolution styles
 
183
extern char const* const HOST_RES_STYLE_STRING[];
 
184
 
 
185
/// Caclulate the effective resolution preferences.
 
186
extern HostResStyle
 
187
ats_host_res_from(
 
188
                   int family, ///< Connection family
 
189
                   HostResPreferenceOrder ///< Preference ordering.
 
190
                   );
 
191
/// Calculate the host resolution style to force a family match to @a addr.
 
192
extern HostResStyle
 
193
ats_host_res_match(sockaddr const* addr);
 
194
 
 
195
/** Parse a host resolution configuration string.
 
196
 */
 
197
extern void
 
198
parse_host_res_preferences(
 
199
                           char const* value, ///< [in] Configuration string.
 
200
                           HostResPreferenceOrder order /// [out] Order to update.
 
201
                           );
 
202
 
150
203
#ifndef NS_GET16
151
204
#define NS_GET16(s, cp) do { \
152
205
        register const u_char *t_cp = (const u_char *)(cp); \
237
290
 
238
291
int ink_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz);
239
292
 
 
293
/** Initialize global values for HttpProxyPort / Host Resolution.
 
294
 */
 
295
void ts_host_res_global_init();
 
296
 
 
297
/** Generate a string representation of a host resolution preference ordering.
 
298
    @return The length of the string.
 
299
 */
 
300
int
 
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.
 
305
                            );
 
306
 
240
307
#endif   /* _ink_resolver_h_ */
241
308