Crate c_ares [−] [src]
A safe wrapper for the c-ares
library.
Usage is as follows:
Create a
Channel
, providing a callback which will be used to notify you whenc-ares
wants you to listen for read or write events on its behalf.When this callback is invoked, do what it asks!
When a file descriptor becomes readable or writable, call
process_fd()
on the channel to tellc-ares
what has happened.c-ares
doesn't create any threads of its own. So if you have queries pending and don't see events happening, you still need to callprocess_fd()
at some point anyway - to givec-ares
an opportunity to process any requests that have timed out.Make queries on the channel. Queries all take callbacks, which will be called when the query completes.
This model is a good fit for an event loop - as provided by
mio
, for example.
Complete examples showing how to use the library can be found here.
Modules
flags |
Structs
AAAAResult |
The result of a successful lookup for an AAAA record. |
AResult |
The result of a successful lookup for an A record. |
CNameResult |
The result of a successful lookup for a CNAME record. |
Channel |
A channel for name service lookups. |
Options |
Used to configure the behaviour of the name resolver. |
Enums
AresError |
Error codes that the library might return. Use |
Constants
INVALID_FD |
An invalid file descriptor. Use this to represent 'no action' when calling
|
Functions
str_error |
Get the description of an AresError. |