!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Haskell 2-pre provisionalsimons@cryp.to The system routine poll(2) may block, obviously; so it  is declared as a "safe" FFI call. In the threaded : runtime-system, this means that a blocking invocation of  3 will not block any other execution threads. Thus, $ you should link your programs with  -threaded when you 2 use this module. Further details can be found at   Qhttp://www.haskell.org//pipermail/glasgow-haskell-users/2005-February/007762.html. *In the non-threaded runtime-system, using  in  blocking fashion will block all other threads too.  Marshaled  representing the various poll(2)  flags. invalid request: fd not open hung up error condition writing now will not block there is urgent data to read there is data to read The marshaled version of:  struct pollfd  { + int fd; /* file descriptor */ , short events; /* requested events */ + short revents; /* returned events */  };      Haskell 2-pre provisionalsimons@cryp.to The gettimeofday(2) system call. 7Not really implemented by anyone; so we provide just a  place-holder. Pass   to  . Marshaling for C's struct timeval. Write the current time as a   . The time is 7 returned in local time, no time zone correction takes  place. Signals errors with  .      portablestablesimons@cryp.to8Definitions for byte order according to significance of - bytes from low addresses to high addresses.  byte order: 3412  byte order: 4321  byte order: 1234 4The endian of this machine, determined at run-time.  Haskell 2-pre provisionalsimons@cryp.to.Split up an IP address in network byte-order. 4Turn a 32-bit IP address into a string suitable for  Network.DNS.PTR$ lookups in the Domain Name System.  Haskell 2-pre provisionalsimons@cryp.to,!7Gives ADNS flow-of-control for a bit; intended for use  after . fds and nfds should be the results from  .  ) structs mentioning fds not belonging to  adns will be ignored. "6Find out which file descriptors ADNS is interested in 7 and when it would like to be able to time things out. ) This is in a form suitable for use with .  On entry, fds should point to at least *nfds_io 6 structs. ADNS will fill up to that many structs with  information for poll, and record in *nfds_io how many 6 entries it actually used. If the array is too small,  *nfds_io( will be set to the number required and  " will return  .  You may call " with fds==  and   *nfds_io==0-, in which case ADNS will fill in the number , of fds that it might be interested in into *nfds_io and 9 return either 0 (if it is not interested in any fds) or    (if it is). Note that (unless now# is 0) ADNS may acquire additional 0 fds from one call to the next, so you must put : adns_beforepoll in a loop, rather than assuming that the ; second call (with the buffer size requested by the first)  will not return  . ADNS only ever sets ,  and  in  its  - structs, and only ever looks at those bits.  . is required to detect TCP Urgent Data (which ; should not be used by a DNS server) so that ADNS can know % that the TCP stream is now useless.  In any case,  *timeout_io should be a timeout value as  for 0, which ADNS will modify downwards as required. , If the caller does not plan to block, then  *timeout_io & should be 0 on entry. Alternatively,  timeout_io may be  0. "( will return 0 on success, and will not 9 fail for any reason other than the fds buffer being too  small (ERANGE). &This call will never actually do any I/O. If you supply : the current time it will not change the fds that ADNS is ! using or the timeouts it wants. In any case this call won' t block. #Cancel an open R. +Status code for this query. ,Always   for CNAME/ queries (which are not supported yet anyway). - Only set if D was requested for query. .Only defined if status is V, q, or r. /,The list will be empty if an error occured. 0Original definition:  typedef struct {  int i;  adns_rr_hostaddr ha;  } adns_rr_inthostaddr; 2Original definition:   typedef struct {  char *host;  adns_status astatus; A int naddrs; /* temp fail => -1, perm fail => 0, s_ok => >0  adns_rr_addr *addrs;  } adns_rr_hostaddr; The naddrs field is not available in  RRHostAddr  because I couldn'!t see how that information wouldn't be  available in the astatus field too. If I missed  anything, please let me know. Note(: The data type should probably contain    rather than 54. I'm using the former ' only because it has nicer output with .  is  not defined. 66The status codes recognized by ADNS vary in different 5 versions of the library. So instead of providing an  , the 6$ type contains the numeric value as : returned by ADNS itself. For common status codes, helper  functions like V or q are provided. The  functions }, |, and  {* can also be used to map these codes into  human readable strings. 8The record types we support. >don''t follow CNAMEs, instead give _s_cname ?-allow refs to CNAMEs - without, get _s_cname @-refuse if quote-req chars in CNAME we go via A7allow special chars in things supposed to be hostnames B1allow special chars in CNAME we go via (default) C$allow special chars in query domain D&fill in the owner field in the answer E'use a virtual circuit (TCP connection) Fuse the searchlist H.do consistency checks very frequently (slow!) Ido consistency checks on entry/exit to adns functions J7application has SIGPIPE set to SIG_IGN, do not protect Kallow w to return   L*do not make syscalls at every opportunity M(include process id in diagnostic output N!enable all output to stderr plus N msgs O1do not warn to stderr about duff nameservers etc Pnever print output to stderr (N overrides) Qdo not look at environment gOriginal definition:   typedef struct {  int len;  union {  struct sockaddr sa; ! struct sockaddr_in inet;  } addr;  } adns_rr_addr; Note: Anything but  sockaddr_in will cause  to call , ! when marshaling this structure.  is not defined. tThis function parses the $ union found in  *). It cannot be defined via  because it : needs to know the type of the record to expect. This is, 9 by the way, the function to look at, if you want to add  support for additional 8 records. uRun the given ! computation with an initialized ; resolver. As of now, the diagnose stream is always set to  System.IO.stderr. Initialize the library with P if you  don'2t wont to see any error output. All resources are  freed when adnsInit returns. v Similar to u, but reads the resolver . configuration from a string rather than from  /etc/ resolv.conf$. Supported are the usual commands:   nameserver, search, domain, sortlist, and  options. 7Additionally, these non-standard commands may be used:  clearnameservers": Clears the list of nameservers.  include filename#: The specified file will be read. w8Perform a synchronous query for a record. In case of an  I/ O error, an System.IO.Error.IOException is thrown. + If the query fails for other reasons, the 6 code  in the *) will signify that. x+Submit an asynchronous query. The returned R can  be tested for completion with y. y8Check the status of an asynchronous query. If the query  is complete, the *) will be returned. The R  becomes invalid after that. z/Return the list of all currently open queries. {Map a 6 code to a human-readable error  description. For example:  , *ADNS> adnsStrerror sNXDOMAIN >>= print  "No such domain" 5Use this function with great care: It will crash the 7 process when called with a status code that ADNS doesn't 9 know about. So use it only to print values you got from  the resolver! |Map a 6 code to a short error name. Don't use 0 this function to print a status code unless you've  obtained it from the resolver! }Map a 6) code to a short description of the type  of error. Don'+t use this function to print a status code  unless you'"ve obtained it from the resolver! ~7Internel helper function to handle result passing from  ADNS via  Ptr (Ptr a)$, and to generate human-readable IO ! exceptions in case of an error. Map a list of flags ( types) into a   suitable for adns calls. j !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~jUTSRGQPONMLKJIH=FEDCBA@?>8<;:967VWXYZ[\]^_`abcdefghijkl45mnopqrs2301)*+,-./$('&%tuvwxy#z"!{|} ~j !"#$('&%%&'()*+,-./*+,-./0112334556778<;:99:;<= FEDCBA@?>>?@ABCDEFG QPONMLKJIHHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Haskell 2-pre provisionalsimons@cryp.to3The internal state of the resolver is stored in an  1 so that it is shared (and synchronized) between  any number of concurrent  threads. opaque ADNS state array for poll(2) size of the array currently open queries A  is an  computation which -- given the 4 name and type of the record to query -- returns an  " that will eventually contain the *) from the Domain  Name System. Run the given ! computation with an Initialized  .. Note that resolver functions can be shared,  and should! be shared between any number of  9 threads. You may use multiple resolvers, of course, but ; doing so defeats the purpose of an asynchronous resolver. Resolve a hostname's < records. Get the 9* records assigned to a host address. Note 8 that although the API allows for a record to have more  than one 9& entry, this will actually not happen ! because the GNU adns library can't handle this case and  will return g. 9Resolve the mail exchangers for a hostname. The returned 7 list may contain more than one entry per hostname, in  case the host has several < records. The records are 9 returned in the order you should try to contact them as # determined by the priority in the ' response. 0Convenience wrapper that will modify any of the   revolveXXX functions above to return   rather  than . The idea is that Nothing signifies any  sort of failure; Just [] signifies q; and  everything else signifies V. So if you aren'!t interested in getting accurate 6 5 codes in case of failures. Wrap your DNS queries as  follows: < queryA :: Resolver -> HostName -> IO (Maybe [HostAddress])  queryA = query resolveA 4Use this function to disable DNS resolving. It will  always return (*) Y Nothing (Just  host) (-1) []). 8Submit a DNS query to the resolver and check whether we  have a running  thread already. If we don't,  start one with ". Make sure you link the threaded 9 RTS so that the main loop will not block other threads. 5Loop until all open queries have been resolved. Uses  4 internally to avoid busy-polling the ADNS sockets.  Haskell 2-pre provisionalsimons@cryp.toX$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQVWXYZ[\]^_`abcdefghijklmnopqrs{|}VGQPONMLKJIH=FEDCBA@?>8<;:967452301)*+,-./$('&%VWXYZ[\]^_`abcdefghijklmnopqrs{|} !""#$%&'()*+,-./0123456789:;<=>>?@ABCDDEEFFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       hsdns-1.1System.Posix.PollSystem.Posix.GetTimeOfDay Data.EndianNetwork.IP.AddressNetwork.DNS.ADNSNetwork.DNS.PollResolverbasePrelude Foreign.PtrForeign.C.Error Data.Maybe network-2.2.1Network.Socket.Internal Text.ShowForeign.Storable Control.Monad System.IOForeign.C.TypesControl.Concurrent.MVar Data.EitherControl.Concurrent Network.DNSpollPollFlagPollNValPollHupPollErrPollOutPollPriPollInPollfd gettimeofdayTimezoneTimeval getTimeOfDayEndian PDPEndian BigEndian LittleEndian ourEndianha2tplha2ptradns_errtypeabbrevadns_errabbrev adns_strerroradns_forallqueries_nextadns_forallqueries_beginadns_synchronous adns_check adns_submit adns_finishadns_init_strcfg adns_init adnsAfterPolladnsBeforePoll adnsCancelResponseRRPTRRRNSRRMXRRAAnswerstatuscnameownerexpiresrrs RRIntHostAddr RRHostAddrRRAddrStatus StatusCodeRRTypePTRNSMXA QueryFlag CName_Forbid CName_LooseQuoteFail_CNameQuoteOk_AnsHost QuoteOk_CName QuoteOk_QueryOwnerUseVCSearchInitFlag CheckC_Freq CheckC_EntEx NoSigPipeEintr NoAutoSysLogPidDebug NoServerWarn NoErrPrintNoEnvQuery OpaqueQuery AdnsState OpaqueStatesOK sNOMEMORYsUNKNOWNRRTYPE sSYSTEMFAILsMAX_LOCALFAILsTIMEOUT sALLSERVFAIL sNORECURSEsINVALIDRESPONSEsUNKNOWNFORMATsMAX_REMOTEFAILsRCODESERVFAILsRCODEFORMATERRORsRCODENOTIMPLEMENTED sRCODEREFUSED sRCODEUNKNOWN sMAX_TEMPFAIL sINCONSISTENTsPROHIBITEDCNAMEsANSWERDOMAININVALIDsANSWERDOMAINTOOLONG sINVALIDDATAsMAX_MISCONFIGsQUERYDOMAINWRONGsQUERYDOMAININVALIDsQUERYDOMAINTOOLONG sMAX_MISQUERY sNXDOMAINsNODATA sMAX_PERMFAILpeekRespadnsInit adnsInitCfg adnsSynch adnsSubmit adnsCheck adnsQueries adnsStrerror adnsErrAbbrevadnsErrTypeAbbrevwrapAdnsmkFlags ResolverStateRStateadnspollfdscapacityqueriesResolver initResolverresolveA resolvePTR resolveMXquerydummyDNSresolve resolveLoopGHC.EnumEnumGHC.PtrnullPtr throwErrnoNetwork.Socket inet_ntoa inet_addr HostAddresseRANGENothingGHC.ShowshowpokeeINTRpeekGHC.BasefailStorable GHC.IOBaseIOCIntMVarMaybeEitherGHC.ConcforkIOHostName