Struct c_ares::Channel
[−]
[src]
pub struct Channel { // some fields omitted }
A channel for name service lookups.
Methods
impl Channel
[src]
fn new(options: Options) -> Result<Channel, AresError>
Create a new channel for name service lookups.
fn process_fd(&mut self, read_fd: RawFd, write_fd: RawFd)
Handle input, output, and timeout events associated with the specified file descriptors (sockets).
Providing a value for read_fd
indicates that the identified socket
is readable; likewise providing a value for write_fd
indicates that
the identified socket is writable. Use INVALID_FD
for "no action".
fn get_sock(&self) -> GetSock
Retrieve the set of socket descriptors which the calling application should wait on for reading and / or writing.
fn set_servers(&mut self, servers: &[&str]) -> Result<&mut Self, AresError>
Set the list of servers to contact, instead of the servers specified in resolv.conf or the local named.
String format is host[:port]
. IPv6 addresses with ports require
square brackets eg [2001:4860:4860::8888]:53
.
fn set_local_ipv4(&mut self, ipv4: &Ipv4Addr) -> &mut Self
Set the local IPv4 address from which to make queries.
fn set_local_ipv6(&mut self, ipv6: &Ipv6Addr) -> &mut Self
Set the local IPv6 address from which to make queries.
fn set_local_device(&mut self, device: &str) -> &mut Self
Set the local device from which to make queries.
fn query_a<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<AResults, AresError>) + 'static
Look up the A records associated with name
.
On completion, handler
is called with the result.
fn query_aaaa<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<AAAAResults, AresError>) + 'static
Look up the AAAA records associated with name
.
On completion, handler
is called with the result.
fn query_cname<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<CNameResult, AresError>) + 'static
Look up the CNAME record associated with name
.
On completion, handler
is called with the result.
fn query_mx<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<MXResults, AresError>) + 'static
Look up the MX records associated with name
.
On completion, handler
is called with the result.
fn query_naptr<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<NAPTRResults, AresError>) + 'static
Look up the NAPTR records associated with name
.
On completion, handler
is called with the result.
fn query_ns<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<NSResults, AresError>) + 'static
Look up the NS records associated with name
.
On completion, handler
is called with the result.
fn query_ptr<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<PTRResults, AresError>) + 'static
Look up the PTR records associated with name
.
On completion, handler
is called with the result.
fn query_srv<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<SRVResults, AresError>) + 'static
Look up the SRV records associated with name
.
On completion, handler
is called with the result.
fn query_txt<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<TXTResults, AresError>) + 'static
Look up the TXT records associated with name
.
On completion, handler
is called with the result.
fn query_soa<F>(&mut self, name: &str, handler: F) where F: FnOnce(Result<SOAResult, AresError>) + 'static
Look up the SOA records associated with name
.
On completion, handler
is called with the result.
fn get_host_by_address<F>(&mut self, address: &IpAddr, handler: F) where F: FnOnce(Result<HostResults, AresError>) + 'static
Perform a host query by address.
On completion, handler
is called with the result.
fn get_host_by_name<F>(&mut self, name: &str, family: AddressFamily, handler: F) where F: FnOnce(Result<HostResults, AresError>) + 'static
Perform a host query by name.
On completion, handler
is called with the result.
fn get_name_info<F>(&mut self, address: &SocketAddr, flags: NIFlags, handler: F) where F: FnOnce(Result<NameInfoResult, AresError>) + 'static
Address-to-nodename translation in protocol-independent manner.
The valid values for flags
are documented
here.
On completion, handler
is called with the result.
fn cancel(&mut self)
Cancel all requests made on this Channel
.
Callbacks will be invoked for each pending query, passing a result
Err(AresError::ECANCELLED)
.