val_res_query - Man Page

DNSSEC-validated resolution of DNS queries


  #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);


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

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

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

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

Return Values

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


Abhijit Hayatnagarkar, Suresh Krishnaswamy, Robert Story.

See Also


get_context(3), val_getaddrinfo(3), val_gethostbyname(3)


Referenced By

dt-getquery(1), val_getaddrinfo(3), val_gethostbyname(3), val_get_rrset(3).

The man pages val_free_response(3) and val_res_search(3) are aliases of val_res_query(3).

2013-03-08 perl v5.12.4 Programmer's Manual