host.c File Reference

#include <config.h>
#include <stdlib.h>
#include <limits.h>
#include <isc/app.h>
#include <isc/commandline.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>
#include <isc/task.h>
#include <dns/byaddr.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
#include <dns/rdatastruct.h>
#include <dig/dig.h>

Go to the source code of this file.

Data Structures

struct  rtype

Functions

static char * rcode_totext (dns_rcode_t rcode)
static
ISC_PLATFORM_NORETURN_PRE void 
show_usage (void)
void dighost_shutdown (void)
void received (int bytes, isc_sockaddr_t *from, dig_query_t *query)
 Print a message about where and when the response was received from, like the final comment in the output of "dig".
void trying (char *frm, dig_lookup_t *lookup)
static void say_message (dns_name_t *name, const char *msg, dns_rdata_t *rdata, dig_query_t *query)
static isc_result_t printsection (dns_message_t *msg, dns_section_t sectionid, const char *section_name, isc_boolean_t headers, dig_query_t *query)
static isc_result_t printrdata (dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, const char *set_name, isc_boolean_t headers)
static void chase_cnamechain (dns_message_t *msg, dns_name_t *qname)
isc_result_t printmessage (dig_query_t *query, dns_message_t *msg, isc_boolean_t headers)
 Print the final result of the lookup.
static void version (void)
 version
static void pre_parse_args (int argc, char **argv)
static void parse_args (isc_boolean_t is_batchfile, int argc, char **argv)
int main (int argc, char **argv)

Variables

static isc_boolean_t short_form = ISC_TRUE
static isc_boolean_t listed_server = ISC_FALSE
static isc_boolean_t default_lookups = ISC_TRUE
static int seen_error = -1
static isc_boolean_t list_addresses = ISC_TRUE
static dns_rdatatype_t list_type = dns_rdatatype_a
static isc_boolean_t printed_server = ISC_FALSE
static const char * opcodetext []
static const char * rcodetext []
struct rtype rtypes []
static const char * optstring = "46ac:dilnm:rst:vVwCDN:R:TW:"


Detailed Description

Definition in file host.c.


Function Documentation

static char* rcode_totext ( dns_rcode_t  rcode  )  [static]

Definition at line 126 of file host.c.

References rcodetext.

static ISC_PLATFORM_NORETURN_PRE void show_usage ( void   )  [static]

Definition at line 143 of file host.c.

Referenced by parse_args(), and pre_parse_args().

void dighost_shutdown ( void   ) 

Definition at line 173 of file host.c.

References isc_app_shutdown().

void received ( int  bytes,
isc_sockaddr_t from,
dig_query_t query 
)

Print a message about where and when the response was received from, like the final comment in the output of "dig".

Definition at line 178 of file host.c.

References isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_time_microdiff(), now, short_form, TIME_NOW, and dig_query::time_sent.

void trying ( char *  frm,
dig_lookup_t lookup 
)

Definition at line 193 of file host.c.

References short_form, and UNUSED.

static void say_message ( dns_name_t name,
const char *  msg,
dns_rdata_t rdata,
dig_query_t query 
) [static]

Definition at line 201 of file host.c.

References isc_region::base, check_result(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_rdata_totext(), isc_buffer_allocate(), isc_buffer_free(), isc_buffer_usedregion, ISC_R_NOSPACE, isc_region::length, dig_query::lookup, mctx, r, and dig_query::servname.

static isc_result_t printsection ( dns_message_t msg,
dns_section_t  sectionid,
const char *  section_name,
isc_boolean_t  headers,
dig_query_t query 
) [static]

Definition at line 246 of file host.c.

References isc_region::base, dns_message_currentname(), dns_message_firstname(), dns_message_nextname(), dns_name_init(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), dns_rdataset_totext(), dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, DNS_SECTION_QUESTION, isc_buffer_init, isc_buffer_usedregion, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, list_addresses, list_type, dig_query::lookup, name, r, say_message(), short_form, rtype::text, dns_rdata::type, rtype::type, dns_rdataset::type, and UNUSED.

Referenced by printmessage().

static isc_result_t printrdata ( dns_message_t msg,
dns_rdataset_t rdataset,
dns_name_t owner,
const char *  set_name,
isc_boolean_t  headers 
) [static]

Definition at line 366 of file host.c.

References isc_region::base, dns_rdataset_totext(), isc_buffer_init, isc_buffer_usedregion, ISC_FALSE, ISC_R_SUCCESS, isc_region::length, r, and UNUSED.

Referenced by detailsection(), printmessage(), and printsection().

static void chase_cnamechain ( dns_message_t msg,
dns_name_t qname 
) [static]

Definition at line 391 of file host.c.

References check_result(), dns_message::counts, dns_message_findname(), dns_name_copy(), dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), DNS_SECTION_ANSWER, and ISC_R_SUCCESS.

Referenced by printmessage().

isc_result_t printmessage ( dig_query_t query,
dns_message_t msg,
isc_boolean_t  headers 
)

Print the final result of the lookup.

Definition at line 417 of file host.c.

References chase_cnamechain(), clone_lookup(), dns_message::counts, default_lookups, dns_fixedname_init, dns_fixedname_name, dns_message_getopt(), dns_message_gettsig(), DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_QR, DNS_MESSAGEFLAG_RA, DNS_MESSAGEFLAG_RD, DNS_MESSAGEFLAG_TC, dns_name_copy(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_rcode_nxdomain, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, fixed, dns_message::flags, dns_message::id, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_R_SUCCESS, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, ISC_TF, ISC_TRUE, listed_server, dig_query::lookup, lookup_list, name, dns_message::opcode, opcodetext, POST, printed_server, printrdata(), printsection(), dns_message::rcode, rcode_totext(), dns_rdataset::rdclass, dns_message::sections, seen_error, dig_query::servname, short_form, dig_query::sockaddr, tries, dns_rdataset::ttl, UNUSED, and dig_query::userarg.

static void version ( void   )  [static]

version

Definition at line 608 of file host.c.

References VERSION.

static void pre_parse_args ( int  argc,
char **  argv 
) [static]

Definition at line 613 of file host.c.

References debugging, debugtiming, isc_commandline_argument, isc_commandline_index, isc_commandline_parse(), isc_commandline_reset, isc_mem_debugging, ISC_MEM_DEBUGRECORD, ISC_MEM_DEBUGTRACE, ISC_MEM_DEBUGUSAGE, ISC_TRUE, memdebugging, show_usage(), and version.

Referenced by main().

static void parse_args ( isc_boolean_t  is_batchfile,
int  argc,
char **  argv 
) [static]

Definition at line 666 of file host.c.

References isc_textregion::base, check_ra, debug, default_lookups, dns_rdataclass_fromtext(), dns_rdatatype_fromtext(), fatal(), fatalexit, get_reverse(), have_ipv4, have_ipv6, isc_commandline_argument, isc_commandline_index, isc_commandline_parse(), ISC_FALSE, ISC_LIST_APPEND, isc_net_disableipv4(), isc_net_disableipv6(), ISC_R_SUCCESS, ISC_TRUE, isc_textregion::length, list_addresses, list_type, listed_server, lookup_list, make_empty_lookup(), MXNAME, ndots, rdclass, serial, set_nameserver(), short_form, show_usage(), timeout, tries, UNUSED, usesearch, and verbose.

int main ( int  argc,
char **  argv 
)

Definition at line 877 of file host.c.

References cancel_all(), check_result(), debug, destroy_libs(), fatalexit, global_task, isc_app_finish(), isc_app_onrun(), isc_app_run(), isc_app_start(), ISC_FALSE, ISC_LIST_INIT, keyfile, keysecret, lookup_list, mctx, onrun_callback(), parse_args(), pre_parse_args(), progname, search_list, seen_error, server_list, setup_file_key(), setup_libs(), setup_system(), setup_text_key(), and tries.


Variable Documentation

isc_boolean_t short_form = ISC_TRUE [static]

Definition at line 56 of file host.c.

isc_boolean_t listed_server = ISC_FALSE [static]

Definition at line 56 of file host.c.

Referenced by parse_args(), and printmessage().

isc_boolean_t default_lookups = ISC_TRUE [static]

Definition at line 57 of file host.c.

Referenced by parse_args(), and printmessage().

int seen_error = -1 [static]

Definition at line 58 of file host.c.

Referenced by main(), and printmessage().

isc_boolean_t list_addresses = ISC_TRUE [static]

Definition at line 59 of file host.c.

Referenced by parse_args(), and printsection().

dns_rdatatype_t list_type = dns_rdatatype_a [static]

Definition at line 60 of file host.c.

Referenced by parse_args(), and printsection().

isc_boolean_t printed_server = ISC_FALSE [static]

Definition at line 61 of file host.c.

Referenced by printmessage().

const char* opcodetext[] [static]

Initial value:

 {
        "QUERY",
        "IQUERY",
        "STATUS",
        "RESERVED3",
        "NOTIFY",
        "UPDATE",
        "RESERVED6",
        "RESERVED7",
        "RESERVED8",
        "RESERVED9",
        "RESERVED10",
        "RESERVED11",
        "RESERVED12",
        "RESERVED13",
        "RESERVED14",
        "RESERVED15"
}

Definition at line 63 of file host.c.

const char* rcodetext[] [static]

Initial value:

 {
        "NOERROR",
        "FORMERR",
        "SERVFAIL",
        "NXDOMAIN",
        "NOTIMP",
        "REFUSED",
        "YXDOMAIN",
        "YXRRSET",
        "NXRRSET",
        "NOTAUTH",
        "NOTZONE",
        "RESERVED11",
        "RESERVED12",
        "RESERVED13",
        "RESERVED14",
        "RESERVED15",
        "BADVERS"
}

Definition at line 82 of file host.c.

struct rtype rtypes[]

Initial value:

 {
        { 1,    "has address" },
        { 2,    "name server" },
        { 5,    "is an alias for" },
        { 11,   "has well known services" },
        { 12,   "domain name pointer" },
        { 13,   "host information" },
        { 15,   "mail is handled by" },
        { 16,   "descriptive text" },
        { 19,   "x25 address" },
        { 20,   "ISDN address" },
        { 24,   "has signature" },
        { 25,   "has key" },
        { 28,   "has IPv6 address" },
        { 29,   "location" },
        { 0, NULL }
}

Definition at line 107 of file host.c.

const char* optstring = "46ac:dilnm:rst:vVwCDN:R:TW:" [static]

Definition at line 604 of file host.c.


Generated on Tue Apr 28 17:41:06 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha