|
ADNS.Base | Portability | ForeignFunctionInterface | Stability | provisional | Maintainer | simons@cryp.to |
|
|
|
|
|
Description |
This module provides bindings to GNU ADNS, a domain name
resolver library written in C. ADNS is available from
http://www.gnu.org/software/adns/.
You will most likely not need this module directly: ADNS
provides a simpler API for the Haskell world; this module
contains mostly marshaling code.
|
|
Synopsis |
|
|
|
|
Marshaled ADNS Data Types
|
|
|
|
|
|
|
|
|
|
|
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!)
|
| Instances | |
|
|
|
Constructors | Search | use the searchlist
| UseVC | use a virtual circuit (TCP connection)
| Owner | fill in the owner field in the answer
| QuoteOk_Query | allow special chars in query domain
| QuoteOk_CName | allow special chars in CNAME we go via (default)
| QuoteOk_AnsHost | allow special chars in things supposed to be hostnames
| QuoteFail_CName | refuse if quote-req chars in CNAME we go via
| CName_Loose | allow refs to CNAMEs - without, get _s_cname
| CName_Forbid | don't follow CNAMEs, instead give _s_cname
|
| Instances | |
|
|
|
The record types we support.
| Constructors | A | | CNAME | | MX | | NS | | PTR | | NSEC | | RRType Int | |
| Instances | |
|
|
|
The status codes recognized by ADNS vary in different
versions of the library. So instead of providing an
Enum, the Status type contains the numeric value as
returned by ADNS itself. For common status codes, helper
functions like sOK or sNXDOMAIN are provided. The
functions adnsErrTypeAbbrev, adnsErrAbbrev, and
adnsStrerror can also be used to map these codes into
human readable strings.
| Constructors | | Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Original definition:
typedef struct {
int len;
union {
struct sockaddr sa;
struct sockaddr_in inet;
} addr;
} adns_rr_addr;
Note: Anything but sockaddr_in will cause peek to call fail,
when marshaling this structure. poke is not defined.
|
|
|
|
|
|
|
|
|
|
|
|
|
Constructors | | Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Original definition:
typedef struct {
char *host;
adns_status astatus;
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
HostAddress rather than RRAddr. I'm using the former
only because it has nicer output with show. poke is
not defined.
| Constructors | | Instances | |
|
|
|
Original definition:
typedef struct {
int i;
adns_rr_hostaddr ha;
} adns_rr_inthostaddr;
| Constructors | | Instances | |
|
|
|
Original definition:
typedef struct {
int len;
unsigned char *data;
} adns_rr_byteblock;
| Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
This function parses the Response union found in
Answer. It cannot be defined via Storable because it
needs to know the type of the record to expect. This is,
by the way, the function to look at, if you want to add
support for additional RRType records.
|
|
|
This function parses a FQDN in uncompressed wire format and advances
the pointer to the next byte after the parsed name.
|
|
ADNS Library Functions
|
|
|
Run the given IO computation with an initialized
resolver. As of now, the diagnose stream is always set to
System.IO.stderr. Initialize the library with NoErrPrint if you
don't wont to see any error output. All resources are
freed when adnsInit returns.
|
|
|
Similar to adnsInit, 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.
Additionally, these non-standard commands may be used:
- clearnameservers: Clears the list of nameservers.
- include filename: The specified file will be read.
|
|
|
Perform 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 Status code
in the Answer will signify that.
|
|
|
Submit an asynchronous query. The returned Query can
be tested for completion with adnsCheck.
|
|
|
Check the status of an asynchronous query. If the query
is complete, the Answer will be returned. The Query
becomes invalid after that.
|
|
|
Wait for a response to arrive. The returned Query is
invalid and must not be passed to ADNS again. If Nothing is
returned, the resolver is empty.
|
|
|
Cancel an open Query.
|
|
|
Wait for the next Query to become available.
|
|
|
Return the list of all currently open queries.
|
|
|
Map a Status code to a human-readable error
description. For example:
*ADNS> adnsStrerror sNXDOMAIN >>= print
"No such domain"
Use this function with great care: It will crash the
process when called with a status code that ADNS doesn't
know about. So use it only to print values you got from
the resolver!
|
|
|
Map a Status code to a short error name. Don't use
this function to print a status code unless you've
obtained it from the resolver!
|
|
|
Map a Status 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!
|
|
Unmarshaled Low-Level C Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Helper Functions
|
|
|
Internel 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 (Enum types) into a CInt
suitable for adns calls.
|
|
Produced by Haddock version 2.3.0 |