=pod

=head1 NAME

I<val_res_query()>, I<val_res_search()> - DNSSEC-validated resolution of DNS queries

=head1 SYNOPSIS

  #include <validator/validator.h>

  int val_res_query(const val_context_t *ctx,
		    const char *dname,
		    int class,
		    int type,
		    unsigned char *answer,
		    int anslen,
		    val_status_t *val_status);

  int val_res_search(val_context_t * ctx,
            const char *dname,
            int class_h,
            int type,
            unsigned char * answer,
            int anslen,
            val_status_t * val_status);

=head1 DESCRIPTION

The I<val_res_query()> function performs DNSSEC validation
of DNS queries.  It is a DNSSEC-aware substitute for the I<res_query(3)> legacy function.
I<val_res_search()> performs an operation similar to I<val_res_query()>.
In addition, it uses the search paths specified within the B</etc/resolv.conf>
file to create the fully qualified domain name.
I<val_res_search()> is a DNSSEC-aware substitute for the I<res_search(3)> function.

The I<ctx> parameter is the validator context and can be set to NULL for
default settings.  More information about this field can be found in
I<libval(3)>.

The I<dname> parameter specifies the domain name, I<class> specifies the
DNS class and I<type> specifies the DNS type.

The validation status values for I<val_res_query()> and I<val_res_search()>
functions are returned in their respective I<val_status> fields.
I<p_val_status()> returns a brief
string description of the error code.  I<val_istrusted()> determines if the
status code indicates that the response can be trusted and
I<val_isvalidated()> determines if the status code indicates that the response
was validated.  (See I<libval(3)> for further information).


=head1 RETURN VALUES

I<val_res_query()> and I<val_res_search()> return the number of bytes received
on success and -1 on failure.

=head1 COPYRIGHT

Copyright 2004-2013 SPARTA, Inc.  All rights reserved.
See the COPYING file included with the DNSSEC-Tools package for details.

=head1 AUTHORS

Abhijit Hayatnagarkar, Suresh Krishnaswamy, Robert Story.

=head1 SEE ALSO

I<res_query(3)>

I<get_context(3)>, I<val_getaddrinfo(3)>, I<val_gethostbyname(3)>

I<libval(3)>

http://www.dnssec-tools.org

=cut
