Ÿë        <  <  è  4„       u  ¡      B„  ¡      L„       b„      l„     w„     ‚„     ‘„     ž„     ­„      ½„  @   Ë„  €   Ú„     ç„     ù„     …       …      #…     5…     G…     c…     ‚…     ”…     õÒ        öÒ               ÷Ò        øÒ  …    ð    Ó     ‰Y  Ó @   ¯…  'z  €   ·…  (z  À   ‰ Ó    ”• ½           €  	ý     À  Í…    à  À…        Ç…        ”6    @  Ó…     `  øî    €  Ý…        è…     À  ñ…  Ç     ˆ� É     ÷…  É  @  ý…     €  †        †  Ó À  †  ôÒ À  �#  W      &†  W   @  0†     úÒ        ûÒ              üÒ               ýÒ B†    €   Ó     K†     @   O†  ¨  €   T†     €  _†             À  g†     à  v†        ˆ†        —†     @   †  óÒ `  «†  Ó €  ³†  Ó @  R6  #Ó  &  ¾†      ê  Î†     ÿÒ         Ó              üÒ     o          Ý†     Ó        Ó               üÒ     o   ð†       ü†       ‡     	‡              5m        q#                 9         +8         ‡                 :R    @   kQ    H    ‡     P   ,‡     X   6‡     `   ?‡     h   H‡     p       Ó x   Xh    €   Q‡     ˆ   V‡     �   [‡     ˜   R6             Ó ¨   `‡     À          
Ó j‡    x   v‡  W       YB W   @   ‡  W   €   Š‡  W   À   —‡  W      ¢‡  W   @  ¬‡  W   €  ¶‡  W   À  °º
 W      À‡  W   @  ;×	 W   €  Ì‡  W   À  Û‡  W      ä‡  W   @  ï‡  W   €  ø‡    p   V  à       ‰Y  §  @   | æf  €   ˆ     À   	ˆ     à   �#  W      •   Ó @       €  †  ü  À  ˆ  ù      ˆ  t      "ˆ  Ó @  Œ Ó €  2ˆ  >  ð  Fˆ  (Ó     Oˆ  (Ó @   _ˆ  *Ó €   gˆ  ,Ó À   pˆ  õÒ    |ˆ  .Ó @  Œˆ  0Ó €  ™ˆ  2Ó À  ¥ˆ  4Ó    ±ˆ  4Ó @  üé 7Ó €  G :Ó À  ½ˆ  <Ó    Â·  >Ó @  É·  >Ó €  Èˆ  ùÒ À  Ñˆ  þÒ    Ûˆ  þÒ @  åˆ  Ó €  ïˆ  ùÒ À  üˆ  þÒ    
‰  þÒ @  ‰  Ó €  K’ >Ó À  &‰  >Ó    5‰  õÒ @  G‰  >Ó €  P‰  >Ó À  W‰  @Ó    `‰  BÓ @  j‰  >Ó €  u‰  >Ó À  €‰  DÓ    ˆ‰  FÓ @  •‰  0Ó €  ¡‰  0Ó À  ¬‰  >Ó  	  ¶‰  HÓ @	  À‰  JÓ €	  Ï‰  LÓ À	  Þ‰  NÓ  
  ï‰  NÓ @
  Š  QÓ €
  Š  SÓ À
  Š  QÓ    ,Š  UÓ @  :Š  >Ó €  EŠ  WÓ À  SŠ  >Ó    aŠ  õÒ @  pŠ  õÒ €  |Š  õÒ À  ˆŠ  õÒ    “Š  NÓ @   Š  YÓ €  ¨Š  [Ó À  ±Š  ]Ó    ÂŠ  _Ó @  ÔŠ  aÓ €  éŠ  >Ó À  óŠ  >Ó    ÿŠ  bÓ @         
Ó        Ó ‹  0   C  ‹  z      •   Ó @   V  ê   €        À   
	       ‹        $‹     @  hã    `  Õº
 	Ó €  kQ    @  2‹     H  ;‹  üÒ €  M‹    À  Z‹  $Ó  	  d‹  ¤  @	  r‹     €	  {‹      	  †‹     À	  �‹     à	  ”‹  %Ó  
  ™‹     € £‹     À ph  ýÒ   ³‹  üÒ  î ¾‹     @î Ë‹  üÒ €î Ô‹  üÒ Àî ì  Ó  ï ø"  &Ó Àï ‰Y  §   ð O†  ¨  @ð Þ‹  ù   @ î‹    @	 û‹    € Œ     À Œ  L     %Œ  ÷   € /Œ     @ 8Œ    € IŒ  «  € QŒ  óÒ   cŒ    À sŒ     € ù  "  À �Œ       �#  W   @ ‘Œ  !Ó € ¡Œ  Ú  @        Ó            Ó        ¯Œ  '  @  ph  üÒ     ºŒ     @   ÀŒ     `        €   0� z  À   �#  W      ÈŒ  î  @  ÒŒ     €  O†  ¨  À  ÝŒ     À  çŒ        ù³     @  øŒ     €  �     À  �     È  �     Ð  $�     à  /�        y,       Ô•    @  r‹     `  {‹     €  †‹        ç\    À       Ð  D    à      Ó    ;�  Î   ,  I�  v  @,  \�  Ö  à,  n�     à.  |�      /  “�      /  ¬�     @/  ¿�  Ó €/  Ç�  uN  À/  Ë�     À?  Ô�  Ó  @  Ú�  uN   R         
Ó        Ó å�       ô�         Ž     @   Ž     €   Ž       !õ        †         õ›     @   %Ž      ô¼        ´µ
 Ó @              Ó        /Ž       ²         7Ž        IJ    @   LŽ     €   UŽ       aŽ         hŽ  Ó @              Ó                 q6  Ó     lŽ  )l                                 Ó qŽ  	  x   ‰Y  Ó     }Ž     @   †     `   hO     €   „Ž  ]           à   �Ž        õ[  w     ì[        šŽ  	  à   -} Ó     ©Ž  ž  À  ¯Ž  6     æ}  ]     ¿Ž     @    	   ˆÁÀ0¿¾  +   ˆl–Ým_J*e¶¥8 Z¸Ø.2ê˜´oÁ„Àß_†I|¥�+ÁÀ ?÷     /*
 * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * The original DNS code is due to Adam Langley with heavy
 * modifications by Nick Mathewson.  Adam put his DNS software in the
 * public domain.  You can find his original copyright below.  Please,
 * aware that the code as part of Libevent is governed by the 3-clause
 * BSD license above.
 *
 * This software is Public Domain. To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 * I ask and expect, but do not require, that all derivative works contain an
 * attribution similar to:
 *     Parts developed by Adam Langley <agl@imperialviolet.org>
 *
 * You may wish to replace the word "Parts" with something else depending on
 * the amount of original code.
 *
 * (Derivative works does not include programs which link against, run or include
 * the source verbatim in their source distributions)
 */

/** @file event2/dns.h
 *
 * Welcome, gentle reader
 *
 * Async DNS lookups are really a whole lot harder than they should be,
 * mostly stemming from the fact that the libc resolver has never been
 * very good at them. Before you use this library you should see if libc
 * can do the job for you with the modern async call getaddrinfo_a
 * (see http://www.imperialviolet.org/page25.html#e498). Otherwise,
 * please continue.
 *
 * The library keeps track of the state of nameservers and will avoid
 * them when they go down. Otherwise it will round robin between them.
 *
 * Quick start guide:
 *   #include "evdns.h"
 *   void callback(int result, char type, int count, int ttl,
 *		 void *addresses, void *arg);
 *   evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf");
 *   evdns_resolve("www.hostname.com", 0, callback, NULL);
 *
 * When the lookup is complete the callback function is called. The
 * first argument will be one of the DNS_ERR_* defines in evdns.h.
 * Hopefully it will be DNS_ERR_NONE, in which case type will be
 * DNS_IPv4_A, count will be the number of IP addresses, ttl is the time
 * which the data can be cached for (in seconds), addresses will point
 * to an array of uint32_t's and arg will be whatever you passed to
 * evdns_resolve.
 *
 * Searching:
 *
 * In order for this library to be a good replacement for glibc's resolver it
 * supports searching. This involves setting a list of default domains, in
 * which names will be queried for. The number of dots in the query name
 * determines the order in which this list is used.
 *
 * Searching appears to be a single lookup from the point of view of the API,
 * although many DNS queries may be generated from a single call to
 * evdns_resolve. Searching can also drastically slow down the resolution
 * of names.
 *
 * To disable searching:
 *   1. Never set it up. If you never call evdns_resolv_conf_parse or
 *   evdns_search_add then no searching will occur.
 *
 *   2. If you do call evdns_resolv_conf_parse then don't pass
 *   DNS_OPTION_SEARCH (or DNS_OPTIONS_ALL, which implies it).
 *
 *   3. When calling evdns_resolve, pass the DNS_QUERY_NO_SEARCH flag.
 *
 * The order of searches depends on the number of dots in the name. If the
 * number is greater than the ndots setting then the names is first tried
 * globally. Otherwise each search domain is appended in turn.
 *
 * The ndots setting can either be set from a resolv.conf, or by calling
 * evdns_search_ndots_set.
 *
 * For example, with ndots set to 1 (the default) and a search domain list of
 * ["myhome.net"]:
 *  Query: www
 *  Order: www.myhome.net, www.
 *
 *  Query: www.abc
 *  Order: www.abc., www.abc.myhome.net
 *
 * Internals:
 *
 * Requests are kept in two queues. The first is the inflight queue. In
 * this queue requests have an allocated transaction id and nameserver.
 * They will soon be transmitted if they haven't already been.
 *
 * The second is the waiting queue. The size of the inflight ring is
 * limited and all other requests wait in waiting queue for space. This
 * bounds the number of concurrent requests so that we don't flood the
 * nameserver. Several algorithms require a full walk of the inflight
 * queue and so bounding its size keeps thing going nicely under huge
 * (many thousands of requests) loads.
 *
 * If a nameserver loses too many requests it is considered down and we
 * try not to use it. After a while we send a probe to that nameserver
 * (a lookup for google.com) and, if it replies, we consider it working
 * again. If the nameserver fails a probe we wait longer to try again
 * with the next probe.
 */

#ifndef EVENT2_DNS_H_INCLUDED_
#define EVENT2_DNS_H_INCLUDED_

#include <event2/visibility.h>

#ifdef __cplusplus
extern "C" {
#endif

/* For integer types. */
#include <event2/util.h>

/** Error codes 0-5 are as described in RFC 1035. */
#define DNS_ERR_NONE 0
/** The name server was unable to interpret the query */
#define DNS_ERR_FORMAT 1
/** The name server was unable to process this query due to a problem with the
 * name server */
#define DNS_ERR_SERVERFAILED 2
/** The domain name does not exist */
#define DNS_ERR_NOTEXIST 3
/** The name server does not support the requested kind of query */
#define DNS_ERR_NOTIMPL 4
/** The name server refuses to reform the specified operation for policy
 * reasons */
#define DNS_ERR_REFUSED 5
/** The reply was trunca