hsdns-1.7: Asynchronous DNS Resolver

Copyright(c) 2008 Peter Simons
LicenseLGPL
Maintainersimons@cryp.to
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

ADNS

Description

An asynchronous DNS resolver based on GNU ADNS http://www.gnu.org/software/adns/. You should link your program with the threaded runtime-system when using this module. In GHC, this is accomplished by specifying -threaded on the command-line.

Synopsis

Documentation

type HostName = String #

Either a host name e.g., "haskell.org" or a numeric host address string consisting of a dotted decimal IPv4 address or an IPv6 address e.g., "192.168.0.1".

type HostAddress = Word32 #

The raw network byte order number is read using host byte order. Therefore on little-endian architectures the byte order is swapped. For example 127.0.0.1 is represented as 0x0100007f on little-endian hosts and as 0x7f000001 on big-endian hosts.

For direct manipulation prefer hostAddressToTuple and tupleToHostAddress.

type Resolver = String -> RRType -> [QueryFlag] -> IO (MVar Answer) Source #

A Resolver is an IO computation which -- given the name and type of the record to query -- returns an MVar that will eventually contain the Answer from the Domain Name System.

initResolver :: [InitFlag] -> (Resolver -> IO a) -> IO a Source #

Run the given IO computation with an Initialized Resolver. Note that resolver functions can be shared, and should be shared between any number of IO threads. You may use multiple resolvers, of course, but doing so defeats the purpose of an asynchronous resolver.

data InitFlag Source #

Constructors

NoEnv

do not look at environment

NoErrPrint

never print output to stderr (Debug overrides)

NoServerWarn

do not warn to stderr about duff nameservers etc

Debug

enable all output to stderr plus Debug msgs

LogPid

include process id in diagnostic output

NoAutoSys

do not make syscalls at every opportunity

Eintr

allow adnsSynch to return eINTR

NoSigPipe

application has SIGPIPE set to SIG_IGN, do not protect

CheckC_EntEx

do consistency checks on entry/exit to adns functions

CheckC_Freq

do consistency checks very frequently (slow!)

querySRV :: Resolver -> HostName -> IO (Maybe [(HostName, PortID)]) Source #

For quering SRV records. Result is the list of tuples (host, port).

dummyDNS :: Resolver Source #

Use this function to disable DNS resolving. It will always return (Answer sSYSTEMFAIL Nothing (Just host) (-1) []).