dig.h File Reference

#include <dns/rdatalist.h>
#include <dst/dst.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/bufferlist.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>

Go to the source code of this file.

Data Structures

struct  dig_lookup
 The dig_lookup structure. More...
struct  dig_query
 The dig_query structure. More...
struct  dig_server
struct  dig_searchlist

Defines

#define MXSERV   20
#define MXNAME   (DNS_NAME_MAXTEXT+1)
#define MXRD   32
#define BUFSIZE   512
 Buffer Size.
#define COMMSIZE   0xffff
#define RESOLV_CONF   "/etc/resolv.conf"
 location of resolve.conf
#define OUTPUTBUF   32767
 output buffer
#define MAXRRLIMIT   0xffffffff
 Max RR Limit.
#define MAXTIMEOUT   0xffff
#define MAXTRIES   0xffffffff
 Max number of tries.
#define MAXNDOTS   0xffff
 Max number of dots.
#define MAXPORT   0xffff
 Max number of ports.
#define MAXSERIAL   0xffffffff
 Max serial number.
#define TCP_TIMEOUT   10
 Default TCP Timeout.
#define UDP_TIMEOUT   5
 Default UDP Timeout.
#define SERVER_TIMEOUT   1
#define LOOKUP_LIMIT   64

Typedefs

typedef
typedefISC_LANG_BEGINDECLS
struct dig_lookup 
dig_lookup_t
 Lookup_limit is just a limiter, keeping too many lookups from being created. It's job is mainly to prevent the program from running away in a tight loop of constant lookups. It's value is arbitrary.
typedef struct dig_query dig_query_t
typedef struct dig_server dig_server_t
typedef struct dig_searchlist dig_searchlist_t

Functions

typedef ISC_LIST (dig_server_t) dig_serverlist_t
typedef ISC_LIST (dig_searchlist_t) dig_searchlistlist_t
typedef ISC_LIST (dig_lookup_t) dig_lookuplist_t
isc_result_t get_address (char *host, in_port_t myport, isc_sockaddr_t *sockaddr)
 Turn a name into an address, using system-supplied routines. This is used in looking up server names, etc... and needs to use system-supplied routines, since they may be using a non-DNS system for these lookups.
int getaddresses (dig_lookup_t *lookup, const char *host, isc_result_t *resultp)
isc_result_t get_reverse (char *reverse, size_t len, char *value, isc_boolean_t ip6_int, isc_boolean_t strict)
ISC_PLATFORM_NORETURN_PRE void fatal (const char *format,...) ISC_FORMAT_PRINTF(1
void debug (const char *format,...) ISC_FORMAT_PRINTF(1
void void check_result (isc_result_t result, const char *msg)
isc_boolean_t setup_lookup (dig_lookup_t *lookup)
 Setup the supplied lookup structure, making it ready to start sending queries to servers. Create and initialize the message to be sent as well as the query structures and buffer space for the replies. If the server list is empty, clone it from the system default list.
void destroy_lookup (dig_lookup_t *lookup)
void do_lookup (dig_lookup_t *lookup)
 Initiate either a TCP or UDP lookup.
void start_lookup (void)
 If we can, start the next lookup in the queue running. This assumes that the lookup on the head of the queue hasn't been started yet. It also removes the lookup from the head of the queue, setting the current_lookup pointer pointing to it.
void onrun_callback (isc_task_t *task, isc_event_t *event)
 Start everything in action upon task startup.
int dhmain (int argc, char **argv)
void setup_libs (void)
 Setup the ISC and DNS libraries for use by the system.
void setup_system (void)
 Setup the system as a whole, reading key information and resolv.conf settings.
isc_result_t parse_uint (isc_uint32_t *uip, const char *value, isc_uint32_t max, const char *desc)
isc_result_t parse_xint (isc_uint32_t *uip, const char *value, isc_uint32_t max, const char *desc)
isc_result_t parse_netprefix (isc_sockaddr_t **sap, const char *value)
void parse_hmac (const char *hmacstr)
dig_lookup_trequeue_lookup (dig_lookup_t *lookold, isc_boolean_t servers)
 Requeue a lookup for further processing, perhaps copying the server list. The new lookup structure is returned to the caller, and is queued for processing. If servers are not cloned in the requeue, they must be added before allowing the current event to complete, since the completion of the event may result in the next entry on the lookup queue getting run.
dig_lookup_tmake_empty_lookup (void)
 Create an empty lookup structure, which holds all the information needed to get an answer to a user's question. This structure contains two linked lists: the server list (servers to query) and the query list (outstanding queries which have been made to the listed servers).
dig_lookup_tclone_lookup (dig_lookup_t *lookold, isc_boolean_t servers)
 Clone a lookup, perhaps copying the server list. This does not clone the query list, since it will be regenerated by the setup_lookup() function, nor does it queue up the new lookup for processing. Caution: If you don't clone the servers, you MUST clone the server list separately from somewhere else, or construct it by hand.
dig_server_tmake_server (const char *servname, const char *userarg)
 Create a server structure, which is part of the lookup structure. This is little more than a linked list of servers to query in hopes of finding the answer the user is looking for.
void flush_server_list (void)
void set_nameserver (char *opt)
void clone_server_list (dig_serverlist_t src, dig_serverlist_t *dest)
 Produce a cloned server list. The dest list must have already had ISC_LIST_INIT applied.
void cancel_all (void)
 Make everything on the lookup queue go away. Mainly used by the SIGINT handler.
void destroy_libs (void)
 Destroy all of the libs we are using, and get everything ready for a clean shutdown.
void set_search_domain (char *domain)
 Override the search list derived from resolv.conf by 'domain'.
isc_result_t printmessage (dig_query_t *query, dns_message_t *msg, isc_boolean_t headers)
 Print the final result of the lookup.
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)
void dighost_shutdown (void)
char * next_token (char **stringp, const char *delim)
void save_opt (dig_lookup_t *lookup, char *code, char *value)
void setup_file_key (void)
void setup_text_key (void)

Variables

dig_lookuplist_t lookup_list
dig_serverlist_t server_list
dig_searchlistlist_t search_list
unsigned int extrabytes
isc_boolean_t check_ra
isc_boolean_t have_ipv4
isc_boolean_t have_ipv6
isc_boolean_t specified_source
isc_boolean_t usesearch
isc_boolean_t showsearch
isc_boolean_t qr
in_port_t port
unsigned int timeout
isc_mem_tmctx
int sendcount
int ndots
int lookup_counter
int exitcode
 Exit Codes:.
isc_sockaddr_t bind_address
char keynametext [MXNAME]
char keyfile [MXNAME]
char keysecret [MXNAME]
dns_name_thmacname
unsigned int digestbits
dns_tsigkey_tkey
isc_boolean_t validated
isc_taskmgr_ttaskmgr
isc_task_tglobal_task
isc_boolean_t free_now
isc_boolean_t debugging
isc_boolean_t debugtiming
isc_boolean_t memdebugging
isc_boolean_t keep_open
char * progname
int tries
int fatalexit
isc_boolean_t verbose
ISC_PLATFORM_NORETURN_PRE void ISC_PLATFORM_NORETURN_POST


Detailed Description

Definition in file dig.h.


Define Documentation

#define MXSERV   20

Definition at line 38 of file dig.h.

Referenced by followup_lookup().

#define MXNAME   (DNS_NAME_MAXTEXT+1)

Definition at line 39 of file dig.h.

Referenced by addlookup(), clone_lookup(), dash_option(), dighost_shutdown(), make_searchlist_entry(), make_server(), parse_args(), printgreeting(), setup_lookup(), setup_text_key(), and start_lookup().

#define MXRD   32

Definition at line 40 of file dig.h.

#define BUFSIZE   512

Buffer Size.

Definition at line 42 of file dig.h.

Referenced by signwithkey(), and start_lookup().

#define COMMSIZE   0xffff

Definition at line 43 of file dig.h.

Referenced by get_next_command(), plus_option(), recv_done(), setup_libs(), and setup_lookup().

#define RESOLV_CONF   "/etc/resolv.conf"

location of resolve.conf

Definition at line 46 of file dig.h.

Referenced by setup_system().

#define OUTPUTBUF   32767

output buffer

Definition at line 49 of file dig.h.

Referenced by printmessage().

#define MAXRRLIMIT   0xffffffff

Max RR Limit.

Definition at line 51 of file dig.h.

#define MAXTIMEOUT   0xffff

Definition at line 52 of file dig.h.

Referenced by plus_option().

#define MAXTRIES   0xffffffff

Max number of tries.

Definition at line 54 of file dig.h.

Referenced by plus_option().

#define MAXNDOTS   0xffff

Max number of dots.

Definition at line 56 of file dig.h.

Referenced by plus_option().

#define MAXPORT   0xffff

Max number of ports.

Definition at line 58 of file dig.h.

Referenced by dash_option().

#define MAXSERIAL   0xffffffff

Max serial number.

Definition at line 60 of file dig.h.

Referenced by dash_option(), and parse_args().

#define TCP_TIMEOUT   10

Default TCP Timeout.

Definition at line 63 of file dig.h.

Referenced by connect_done(), recv_done(), and send_tcp_connect().

#define UDP_TIMEOUT   5

Default UDP Timeout.

Definition at line 65 of file dig.h.

Referenced by recv_done(), and send_udp().

#define SERVER_TIMEOUT   1

Definition at line 67 of file dig.h.

Referenced by bringup_timer().

#define LOOKUP_LIMIT   64

Definition at line 69 of file dig.h.

Referenced by requeue_lookup().


Typedef Documentation

typedef typedefISC_LANG_BEGINDECLS struct dig_lookup dig_lookup_t

Lookup_limit is just a limiter, keeping too many lookups from being created. It's job is mainly to prevent the program from running away in a tight loop of constant lookups. It's value is arbitrary.

Definition at line 91 of file dig.h.

typedef struct dig_query dig_query_t

Definition at line 92 of file dig.h.

typedef struct dig_server dig_server_t

Definition at line 93 of file dig.h.

typedef struct dig_searchlist dig_searchlist_t

Definition at line 98 of file dig.h.


Function Documentation

typedef ISC_LIST ( dig_server_t   ) 

typedef ISC_LIST ( dig_searchlist_t   ) 

typedef ISC_LIST ( dig_lookup_t   ) 

isc_result_t get_address ( char *  host,
in_port_t  myport,
isc_sockaddr_t sockaddr 
)

Turn a name into an address, using system-supplied routines. This is used in looking up server names, etc... and needs to use system-supplied routines, since they may be using a non-DNS system for these lookups.

Definition at line 4072 of file dighost.c.

References bind9_getaddresses(), INSIST, is_running, isc_app_block(), isc_app_isrunning(), isc_app_unblock(), and ISC_R_SUCCESS.

Referenced by send_tcp_connect(), send_udp(), and show_settings().

int getaddresses ( dig_lookup_t lookup,
const char *  host,
isc_result_t resultp 
)

Definition at line 4092 of file dighost.c.

References bind9_getaddresses(), DIG_MAX_ADDRESSES, fatal(), ISC_LIST_APPEND, isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, isc_result_totext(), and make_server().

Referenced by followup_lookup(), and parse_args().

isc_result_t get_reverse ( char *  reverse,
size_t  len,
char *  value,
isc_boolean_t  ip6_int,
isc_boolean_t  strict 
)

Definition at line 489 of file dighost.c.

References AF_INET6, append(), dns_byaddr_createptrname2(), DNS_BYADDROPT_IPV6INT, dns_fixedname_init, dns_fixedname_name, dns_name_format(), DNS_R_BADDOTTEDQUAD, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, ISC_R_SUCCESS, name, r, reverse_octets(), and isc_netaddr::type.

Referenced by addlookup(), dash_option(), and parse_args().

ISC_PLATFORM_NORETURN_PRE void fatal ( const char *  format,
  ... 
)

void debug ( const char *  format,
  ... 
)

void void check_result ( isc_result_t  result,
const char *  msg 
)

Definition at line 574 of file dighost.c.

isc_boolean_t setup_lookup ( dig_lookup_t lookup  ) 

Setup the supplied lookup structure, making it ready to start sending queries to servers. Create and initialize the message to be sent as well as the query structures and buffer space for the replies. If the server list is empty, clone it from the system default list.

Definition at line 2191 of file dighost.c.

References add_opt(), add_question(), dig_query::byte_count, check_result(), clone_server_list(), dns_ednsopt::code, COMMSIZE, cookie, count_dots(), debug, dns_compress_init(), dns_compress_invalidate(), DNS_EDNSOPTIONS, dns_fixedname_init, dns_fixedname_name, dns_message_addname(), dns_message_create(), dns_message_gettempname(), DNS_MESSAGE_INTENTRENDER, dns_message_puttempname(), dns_message_renderbegin(), dns_message_renderend(), dns_message_rendersection(), dns_message_settsigkey(), DNS_MESSAGEEXTFLAG_DO, DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_RD, dns_name_clone(), dns_name_concatenate(), dns_name_copy(), dns_name_format(), dns_name_fromtext(), dns_name_init(), dns_name_isabsolute(), dns_name_settotextfilter(), dns_opcode_query, DNS_OPT_CLIENT_SUBNET, DNS_OPT_EXPIRE, DNS_OPT_NSID, DNS_OPT_SIT, DNS_R_NAMETOOLONG, dns_rootname, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, EDNSOPTS, extrabytes, fatal(), dig_query::first_pass, dig_query::first_repeat_rcvd, dig_query::first_rr_serial, dig_query::first_soa_rcvd, fixed, free_now, insert_soa(), INSIST, isc_buffer_add, isc_buffer_base, isc_buffer_init, isc_buffer_putmem, isc_buffer_putuint16, isc_buffer_putuint8, isc_buffer_usedlength, ISC_FALSE, isc_hex_decodestring(), ISC_LINK_INIT, ISC_LIST_EMPTY, ISC_LIST_ENQUEUE, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_NEXT, isc_mem_allocate, isc_mempool_get, ISC_R_SUCCESS, isc_random_get(), isc_result_totext(), ISC_TRUE, dig_query::ixfr_axfr, dns_ednsopt::length, dig_query::lengthbuf, dig_query::lengthlist, dig_query::lengthspace, dig_query::lookup, lookup_counter, dig_query::msg_count, MXNAME, name, ndots, dig_query::pending_free, printmessage(), qr, dig_query::recv_made, dig_query::recvbuf, dig_query::recvlist, dig_query::recvspace, REQUIRE, dig_query::rr_count, search_list, dig_query::second_rr_rcvd, dig_query::second_rr_serial, dig_query::sendbuf, server_list, dig_server::servername, dig_query::servname, sockaddr_in6::sin6_addr, dig_query::slbuf, dig_query::slspace, dig_query::sock, trying(), dig_server::userarg, dig_query::userarg, usesearch, dns_ednsopt::value, dig_query::waiting_connect, dig_query::waiting_senddone, and dig_query::warn_id.

Referenced by start_lookup().

void destroy_lookup ( dig_lookup_t lookup  ) 

Definition at line 1717 of file dighost.c.

References debug, dns_message_destroy(), dst_context_destroy(), isc_buffer_free(), ISC_LIST_DEQUEUE, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_mem_free, isc_mempool_put, isc_timer_detach(), and s.

Referenced by main(), parse_args(), and try_clear_lookup().

void do_lookup ( dig_lookup_t lookup  ) 

Initiate either a TCP or UDP lookup.

Definition at line 4125 of file dighost.c.

References debug, ISC_LIST_HEAD, ISC_TRUE, REQUIRE, send_tcp_connect(), and send_udp().

Referenced by start_lookup().

void start_lookup ( void   ) 

If we can, start the next lookup in the queue running. This assumes that the lookup on the head of the queue hasn't been started yet. It also removes the lookup from the head of the queue, setting the current_lookup pointer pointing to it.

Definition at line 1758 of file dighost.c.

References isc_region::base, BUFSIZE, cancel_now, check_if_done(), check_next_lookup(), check_result(), current_lookup, debug, dns_name_init(), dns_name_issubdomain(), dns_name_print(), dns_name_totext(), do_lookup(), dst_key_name(), INSIST, isc_buffer_allocate(), isc_buffer_free(), isc_buffer_usedregion, ISC_FALSE, ISC_LIST_DEQUEUE, ISC_LIST_HEAD, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, lookup_list, MXNAME, next_origin(), r, and setup_lookup().

Referenced by check_next_lookup(), dighost_shutdown(), getinput(), lookup_done(), ns_lwdclient_processgrbn(), onrun_callback(), and start_lookup().

void onrun_callback ( isc_task_t task,
isc_event_t event 
)

Start everything in action upon task startup.

Definition at line 4145 of file dighost.c.

References isc_event_free(), LOCK_LOOKUP, start_lookup(), UNLOCK_LOOKUP, and UNUSED.

Referenced by main().

int dhmain ( int  argc,
char **  argv 
)

void setup_libs ( void   ) 

Setup the ISC and DNS libraries for use by the system.

Definition at line 1461 of file dighost.c.

References check_result(), COMMSIZE, debug, dns_log_init(), dns_log_setcontext(), dns_result_register(), dst_lib_init(), fatal(), have_ipv4, have_ipv6, is_dst_up, isc_entropy_create(), isc_log_create(), isc_log_setcontext(), isc_log_setdebuglevel(), isc_log_usechannel(), isc_mem_create(), isc_mem_setname(), isc_mempool_create(), isc_mempool_setfillcount(), isc_mempool_setfreemax(), isc_mempool_setname(), isc_mutex_init, isc_net_probeipv4(), isc_net_probeipv6(), ISC_R_SUCCESS, isc_socketmgr_create(), isc_task_create(), isc_task_setname(), isc_taskmgr_create(), isc_timermgr_create(), ISC_TRUE, lookup_lock, and pk11_result_register().

Referenced by main().

void setup_system ( void   ) 

Setup the system as a whole, reading key information and resolv.conf settings.

Definition at line 1342 of file dighost.c.

References add_nameserver(), AF_INET6, cookie_secret, copy_server_list(), create_search_list(), debug, dns_name_init(), fatal(), have_ipv4, have_ipv6, isc_entropy_getdata(), ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LIST_INIT, ISC_R_SUCCESS, ISC_TRUE, keyfile, keysecret, lwconf, lwctx, make_searchlist_entry(), mem_alloc(), mem_free(), ndots, RESOLV_CONF, search_list, server_list, setup_file_key(), setup_text_key(), timeout, tries, and verbose.

Referenced by main().

isc_result_t parse_uint ( isc_uint32_t uip,
const char *  value,
isc_uint32_t  max,
const char *  desc 
)

Definition at line 1045 of file dighost.c.

References parse_uint_helper().

Referenced by dash_option(), parse_args(), parse_bits(), plus_option(), save_opt(), set_ndots(), set_port(), set_timeout(), and set_tries().

isc_result_t parse_xint ( isc_uint32_t uip,
const char *  value,
isc_uint32_t  max,
const char *  desc 
)

Definition at line 1051 of file dighost.c.

References parse_uint_helper().

Referenced by plus_option().

isc_result_t parse_netprefix ( isc_sockaddr_t **  sap,
const char *  value 
)

Definition at line 1069 of file dighost.c.

References AF_INET6, fatal(), ISC_FALSE, isc_mem_allocate, isc_parse_uint32(), ISC_R_SUCCESS, isc_result_totext(), isc_sockaddr_fromin(), isc_sockaddr_fromin6(), ISC_TRUE, and isc_sockaddr::length.

Referenced by plus_option().

void parse_hmac ( const char *  hmacstr  ) 

Definition at line 1134 of file dighost.c.

References digestbits, DNS_TSIG_HMACMD5_NAME, DNS_TSIG_HMACSHA1_NAME, DNS_TSIG_HMACSHA224_NAME, DNS_TSIG_HMACSHA256_NAME, DNS_TSIG_HMACSHA384_NAME, DNS_TSIG_HMACSHA512_NAME, fatal(), parse_bits(), and REQUIRE.

Referenced by dash_option(), evaluate_key(), read_confkey(), and setup_keystr().

dig_lookup_t* requeue_lookup ( dig_lookup_t lookold,
isc_boolean_t  servers 
)

Requeue a lookup for further processing, perhaps copying the server list. The new lookup structure is returned to the caller, and is queued for processing. If servers are not cloned in the requeue, they must be added before allowing the current event to complete, since the completion of the event may result in the next entry on the lookup queue getting run.

Definition at line 957 of file dighost.c.

References clone_lookup(), debug, fatal(), INSIST, ISC_LIST_PREPEND, lookup_counter, LOOKUP_LIMIT, and lookup_list.

Referenced by connect_timeout(), followup_lookup(), next_origin(), and recv_done().

dig_lookup_t* make_empty_lookup ( void   ) 

Create an empty lookup structure, which holds all the information needed to get an answer to a user's question. This structure contains two linked lists: the server list (servers to query) and the query list (outstanding queries which have been made to the listed servers).

Definition at line 752 of file dighost.c.

References debug, dns_fixedname_init, fatal(), free_now, INSIST, ISC_FALSE, ISC_LINK_INIT, ISC_LIST_INIT, isc_mem_allocate, ISC_TRUE, and tries.

Referenced by addlookup(), clone_lookup(), and parse_args().

dig_lookup_t* clone_lookup ( dig_lookup_t lookold,
isc_boolean_t  servers 
)

Clone a lookup, perhaps copying the server list. This does not clone the query list, since it will be regenerated by the setup_lookup() function, nor does it queue up the new lookup for processing. Caution: If you don't clone the servers, you MUST clone the server list separately from somewhere else, or construct it by hand.

Definition at line 856 of file dighost.c.

References clone_server_list(), debug, dns_fixedname_name, dns_name_copy(), fatal(), free_now, INSIST, isc_mem_allocate, make_empty_lookup(), and MXNAME.

Referenced by dash_option(), parse_args(), printmessage(), and requeue_lookup().

dig_server_t* make_server ( const char *  servname,
const char *  userarg 
)

Create a server structure, which is part of the lookup structure. This is little more than a linked list of servers to query in hopes of finding the answer the user is looking for.

Definition at line 586 of file dighost.c.

References debug, fatal(), ISC_LINK_INIT, isc_mem_allocate, MXNAME, REQUIRE, dig_server::servername, and dig_server::userarg.

Referenced by clone_server_list(), copy_server_list(), getaddresses(), and set_nameserver().

void flush_server_list ( void   ) 

Definition at line 656 of file dighost.c.

References debug, ISC_LIST_DEQUEUE, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_mem_free, s, and server_list.

Referenced by destroy_libs(), and set_nameserver().

void set_nameserver ( char *  opt  ) 

Definition at line 670 of file dighost.c.

References bind9_getaddresses(), DIG_MAX_ADDRESSES, fatal(), flush_server_list(), ISC_LIST_APPEND, isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, isc_netaddr_fromsockaddr(), ISC_R_SUCCESS, isc_result_totext(), make_server(), and server_list.

Referenced by do_next_command(), and parse_args().

void clone_server_list ( dig_serverlist_t  src,
dig_serverlist_t *  dest 
)

Produce a cloned server list. The dest list must have already had ISC_LIST_INIT applied.

Definition at line 732 of file dighost.c.

References debug, ISC_LINK_INIT, ISC_LIST_ENQUEUE, ISC_LIST_HEAD, ISC_LIST_NEXT, make_server(), dig_server::servername, and dig_server::userarg.

Referenced by clone_lookup(), and setup_lookup().

void cancel_all ( void   ) 

Make everything on the lookup queue go away. Mainly used by the SIGINT handler.

Definition at line 4159 of file dighost.c.

References cancel_now, clear_query(), current_lookup, debug, free_now, ISC_LIST_DEQUEUE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_SOCKCANCEL_ALL, isc_socket_cancel(), isc_timer_detach(), ISC_TRUE, LOCK_LOOKUP, lookup_list, dig_query::sock, try_clear_lookup(), and UNLOCK_LOOKUP.

Referenced by main().

void destroy_libs ( void   ) 

Destroy all of the libs we are using, and get everything ready for a clean shutdown.

Definition at line 4216 of file dighost.c.

References check_result(), clear_searchlist(), current_lookup, debug, DESTROYLOCK, dns_message_destroy(), dns_name_destroy(), dns_name_dynamic(), dns_name_settotextfilter(), dns_tsigkey_detach(), dst_lib_destroy(), flush_server_list(), free_now, INSIST, is_dst_up, isc_buffer_free(), isc_entropy_detach(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_log_destroy(), isc_mem_destroy(), isc_mem_free, isc_mem_stats(), isc_mempool_destroy(), isc_socket_detach(), isc_socketmgr_destroy(), isc_task_detach(), isc_taskmgr_destroy(), isc_timermgr_destroy(), ISC_TRUE, LOCK_LOOKUP, lookup_list, lookup_lock, lwctx, memdebugging, recvcount, REQUIRE, sendcount, sockcount, and UNLOCK_LOOKUP.

Referenced by main().

void set_search_domain ( char *  domain  ) 

Override the search list derived from resolv.conf by 'domain'.

Definition at line 1449 of file dighost.c.

References clear_searchlist(), ISC_LIST_APPEND, make_searchlist_entry(), search(), and search_list.

Referenced by main(), and setoption().

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 481 of file dig.c.

References chase_cnamechain(), check_result(), cleanup(), clone_lookup(), dns_message::counts, debug, default_lookups, detailsection(), dns_fixedname_init, dns_fixedname_name, dns_master_stylecreate2(), dns_master_styledestroy(), dns_message_getopt(), dns_message_gettsig(), dns_message_pseudosectiontotext(), dns_message_sectiontotext(), DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_QR, DNS_MESSAGEFLAG_RA, DNS_MESSAGEFLAG_RD, DNS_MESSAGEFLAG_TC, DNS_MESSAGETEXTFLAG_NOCOMMENTS, DNS_MESSAGETEXTFLAG_NOHEADERS, DNS_MESSAGETEXTFLAG_OMITSOA, DNS_MESSAGETEXTFLAG_ONESOA, dns_name_copy(), dns_name_format(), DNS_NAME_FORMATSIZE, DNS_PSEUDOSECTION_OPT, DNS_PSEUDOSECTION_SIG0, DNS_PSEUDOSECTION_TSIG, dns_rcode_formerr, dns_rcode_notimp, dns_rcode_nxdomain, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, DNS_STYLEFLAG_COMMENT, DNS_STYLEFLAG_MULTILINE, DNS_STYLEFLAG_NO_CLASS, DNS_STYLEFLAG_NO_TTL, DNS_STYLEFLAG_NOCRYPTO, DNS_STYLEFLAG_OMIT_CLASS, DNS_STYLEFLAG_OMIT_OWNER, DNS_STYLEFLAG_OMIT_TTL, DNS_STYLEFLAG_REL_DATA, DNS_STYLEFLAG_REL_OWNER, DNS_STYLEFLAG_RRCOMMENT, DNS_STYLEFLAG_TTL, DNS_STYLEFLAG_TTL_UNITS, extrabytes, fixed, dns_message::flags, dns_message::id, isc_buffer_allocate(), isc_buffer_base, isc_buffer_free(), isc_buffer_usedlength, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, ISC_TF, ISC_TRUE, listed_server, dig_query::lookup, lookup_list, mctx, dig_query::msg_count, multiline, name, noclass, nocrypto, nottl, onesoa, dns_message::opcode, opcodetext, dns_message::opt, OUTPUTBUF, POST, print_error, printed_server, printrdata(), printsection(), query_error, dns_message::rcode, rcode_totext(), dns_rdataset::rdclass, rrcomments, dns_message::sections, seen_error, dig_query::servname, short_answer(), short_form, dig_query::sockaddr, splitwidth, tries, dns_rdataset::ttl, ttlunits, UNUSED, and dig_query::userarg.

Referenced by recv_done(), and setup_lookup().

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 262 of file dig.c.

References dig_query::byte_count, ISC_PRINT_QUADFORMAT, isc_sockaddr_format(), ISC_SOCKADDR_FORMATSIZE, isc_time_microdiff(), key, keysecret, dig_query::lookup, dig_query::msg_count, now, dig_query::rr_count, dig_query::servname, short_form, TIME_NOW, dig_query::time_recv, dig_query::time_sent, UNUSED, use_usec, dig_query::userarg, and validated.

Referenced by check_for_more_data(), and recv_done().

void trying ( char *  frm,
dig_lookup_t lookup 
)

Definition at line 325 of file dig.c.

References short_form, and UNUSED.

Referenced by setup_lookup().

void dighost_shutdown ( void   ) 

Definition at line 2014 of file dig.c.

References argv0, batchfp, batchname, debug, flush_lookup_list(), global_task, in_use, input, isc_app_shutdown(), ISC_FALSE, isc_task_send(), ISC_TRUE, MXNAME, next_token(), parse_args(), and start_lookup().

Referenced by check_if_done().

char* next_token ( char **  stringp,
const char *  delim 
)

Definition at line 396 of file dighost.c.

Referenced by dash_option(), dighost_shutdown(), do_next_command(), ns_server_delzone(), ns_server_dumpdb(), ns_server_dumpsecroots(), ns_server_flushcache(), ns_server_flushnode(), ns_server_mkeys(), ns_server_nta(), ns_server_setdebuglevel(), ns_server_signing(), ns_server_sync(), ns_server_testgen(), ns_server_togglequerylog(), ns_server_tsigdelete(), ns_server_validation(), parse_args(), plus_option(), and zone_from_args().

void save_opt ( dig_lookup_t lookup,
char *  code,
char *  value 
)

Definition at line 1537 of file dighost.c.

References check_result(), dns_ednsopt::code, EDNSOPTS, fatal(), isc_buffer_base, isc_buffer_init, isc_buffer_usedlength, isc_hex_decodestring(), isc_mem_allocate, ISC_R_SUCCESS, dns_ednsopt::length, parse_uint(), and dns_ednsopt::value.

Referenced by plus_option().

void setup_file_key ( void   ) 

Definition at line 1240 of file dighost.c.

References debug, DNS_TSIG_HMACMD5_NAME, DNS_TSIG_HMACSHA1_NAME, DNS_TSIG_HMACSHA224_NAME, DNS_TSIG_HMACSHA256_NAME, DNS_TSIG_HMACSHA384_NAME, DNS_TSIG_HMACSHA512_NAME, dns_tsigkey_createfromkey(), DST_ALG_HMACMD5, DST_ALG_HMACSHA1, DST_ALG_HMACSHA224, DST_ALG_HMACSHA256, DST_ALG_HMACSHA384, DST_ALG_HMACSHA512, dst_key_alg(), dst_key_free(), dst_key_fromnamedfile(), dst_key_name(), DST_TYPE_KEY, DST_TYPE_PRIVATE, ISC_FALSE, ISC_R_SUCCESS, isc_result_totext(), keyfile, keynametext, and read_confkey().

Referenced by main(), and setup_system().

void setup_text_key ( void   ) 

Definition at line 979 of file dighost.c.

References check_result(), debug, digestbits, dns_name_fromtext(), dns_name_init(), dns_name_invalidate(), dns_rootname, dns_tsigkey_create(), dst_key_setbits(), DST_R_UNSUPPORTEDALG, fatal(), isc_base64_decodestring(), isc_buffer_allocate(), isc_buffer_free(), isc_buffer_init, isc_buffer_putstr, isc_buffer_usedlength, ISC_FALSE, isc_mem_allocate, isc_mem_free, ISC_R_SUCCESS, isc_result_totext(), dns_tsigkey::key, keynametext, keysecret, and MXNAME.

Referenced by main(), read_confkey(), and setup_system().


Variable Documentation

dig_lookuplist_t lookup_list

Definition at line 117 of file dighost.c.

Referenced by addlookup(), cancel_all(), check_if_done(), dash_option(), destroy_libs(), flush_lookup_list(), getinput(), main(), parse_args(), printmessage(), recv_done(), requeue_lookup(), and start_lookup().

dig_serverlist_t server_list

Definition at line 118 of file dighost.c.

Referenced by flush_server_list(), main(), set_nameserver(), setup_lookup(), setup_system(), and show_settings().

dig_searchlistlist_t search_list

Definition at line 119 of file dighost.c.

Referenced by clear_searchlist(), create_search_list(), main(), next_origin(), set_search_domain(), setup_lookup(), setup_system(), and show_settings().

unsigned int extrabytes

Definition at line 136 of file dighost.c.

Referenced by printmessage(), recv_done(), and setup_lookup().

isc_boolean_t check_ra

Definition at line 122 of file dighost.c.

Referenced by do_next_command(), main(), parse_args(), and recv_done().

isc_boolean_t have_ipv4

Definition at line 123 of file dighost.c.

Referenced by bind9_getaddresses(), copy_server_list(), dash_option(), doshutdown(), evaluate_local(), parse_args(), send_tcp_connect(), setup_libs(), and setup_system().

isc_boolean_t have_ipv6

Definition at line 124 of file dighost.c.

Referenced by bind9_getaddresses(), copy_server_list(), dash_option(), doshutdown(), evaluate_local(), parse_args(), setup_libs(), and setup_system().

isc_boolean_t specified_source

Definition at line 125 of file dighost.c.

Referenced by dash_option(), send_tcp_connect(), and send_udp().

isc_boolean_t usesearch

Definition at line 128 of file dighost.c.

Referenced by main(), next_origin(), parse_args(), plus_option(), recv_done(), setoption(), setup_lookup(), and show_settings().

isc_boolean_t showsearch

Definition at line 129 of file dighost.c.

Referenced by plus_option(), recv_done(), and setoption().

isc_boolean_t qr

Definition at line 130 of file dighost.c.

Referenced by plus_option(), and setup_lookup().

in_port_t port

Definition at line 134 of file dighost.c.

Referenced by cfg_print_sockaddr(), configure_alternates(), configure_forward(), configure_view(), dash_option(), dns_adb_findaddrinfo(), evaluate_local(), evaluate_server(), fromtext_in_wks(), isc_sockaddr_getport(), listener_bind(), ns_add_reserved_dispatch(), ns_config_getipandkeylist(), ns_config_getiplist(), ns_listenelt_fromconfig(), ns_lwresd_configure(), parse_command_line(), parse_querysource(), parse_sockaddrsub(), portset_fromconf(), send_tcp_connect(), send_udp(), set_port(), and show_settings().

unsigned int timeout

Definition at line 135 of file dighost.c.

Referenced by bringup_timer(), isc__socketmgr_waitevents(), notify_send_toaddr(), ns_query(), parse_args(), plus_option(), recv_done(), send_update(), set_timeout(), setup_system(), show_settings(), soa_query(), and update_done().

isc_mem_t* mctx

Definition at line 39 of file isctest.c.

Referenced by add_sigs(), addclosest(), addnoqname(), addrdataset(), allrdatasets(), ATF_TC_BODY(), bevent_destroy(), build_name_from_str(), cache_find(), cache_findzonecut(), cache_zonecut_callback(), clean_cache_node(), clean_zone_node(), client_create(), compare_labelsequences(), configure_staticstub(), configure_staticstub_serveraddrs(), configure_staticstub_servernames(), configure_zone_ssutable(), delete_data(), destroy(), destroy_ecdb(), destroynode(), dns_difftuple_free(), dns_dlzdestroy(), dns_dlzunregister(), dns_dnssec_signmessage(), dns_dnssec_verifymessage(), dns_fwdtable_destroy(), dns_rbtdb_create(), dns_sdb_putrdata(), dns_sdb_putrr(), dns_sdb_unregister(), dns_sdlz_putnamedrr(), dns_sdlz_putrr(), dns_sdlzunregister(), dns_tkeyctx_destroy(), dns_tsig_sign(), dns_tsig_verify(), dns_view_createresolver(), findnode(), flush_lookup_list(), free_keynode(), free_nta(), get_next_command(), getnode(), hmacmd5_parse(), hmacsha1_parse(), hmacsha224_parse(), hmacsha256_parse(), hmacsha384_parse(), hmacsha512_parse(), include_callback(), insert_nodes(), isc__timermgr_destroy(), isc_buffer_free(), ISC_LIST(), isselfsigned(), levent_destroy(), LIST(), load_raw(), load_text(), loadctx_destroy(), main(), make_dispatchset(), manager_free(), modrdataset(), ns_lwdmanager_detach(), ns_lwreslistener_detach(), ns_lwsearchlist_detach(), ns_xfr_start(), ns_zone_configure(), plus_option(), printmessage(), printrdata(), random_test(), rdatasetiter_destroy(), remove_nodes(), rollback_private(), say_message(), setup_db(), test_context_setup(), test_context_teardown(), test_master(), tostruct_afsdb(), tostruct_any_tsig(), tostruct_caa(), tostruct_cdnskey(), tostruct_cds(), tostruct_cert(), tostruct_ch_a(), tostruct_cname(), tostruct_dlv(), tostruct_dname(), tostruct_dnskey(), tostruct_ds(), tostruct_eui48(), tostruct_eui64(), tostruct_gpos(), tostruct_hinfo(), tostruct_hip(), tostruct_hs_a(), tostruct_in_a(), tostruct_in_a6(), tostruct_in_aaaa(), tostruct_in_apl(), tostruct_in_dhcid(), tostruct_in_kx(), tostruct_in_nsap(), tostruct_in_nsap_ptr(), tostruct_in_px(), tostruct_in_srv(), tostruct_in_wks(), tostruct_ipseckey(), tostruct_isdn(), tostruct_key(), tostruct_keydata(), tostruct_l32(), tostruct_l64(), tostruct_loc(), tostruct_lp(), tostruct_mb(), tostruct_md(), tostruct_mf(), tostruct_mg(), tostruct_minfo(), tostruct_mr(), tostruct_mx(), tostruct_naptr(), tostruct_nid(), tostruct_ns(), tostruct_nsec(), tostruct_nsec3(), tostruct_nsec3param(), tostruct_null(), tostruct_nxt(), tostruct_openpgpkey(), tostruct_opt(), tostruct_ptr(), tostruct_rp(), tostruct_rrsig(), tostruct_rt(), tostruct_sig(), tostruct_soa(), tostruct_spf(), tostruct_sshfp(), tostruct_tkey(), tostruct_tlsa(), tostruct_txt(), tostruct_unspec(), tostruct_uri(), tostruct_x25(), tsig_verify_tcp(), undefine(), and update_action().

int sendcount

Definition at line 145 of file dighost.c.

Referenced by check_if_done(), destroy_libs(), launch_next_query(), send_done(), and send_udp().

int ndots

Definition at line 148 of file dighost.c.

Referenced by next_origin(), parse_args(), plus_option(), set_ndots(), setup_lookup(), setup_system(), and show_settings().

int lookup_counter

Definition at line 150 of file dighost.c.

Referenced by flush_lookup_list(), followup_lookup(), requeue_lookup(), and setup_lookup().

int exitcode

Exit Codes:.

Definition at line 182 of file dighost.c.

Referenced by connect_done(), connect_timeout(), fatal(), main(), and parse_args().

isc_sockaddr_t bind_address

Definition at line 143 of file dighost.c.

Referenced by dash_option().

char keynametext[MXNAME]

Definition at line 184 of file dighost.c.

Referenced by dash_option(), read_confkey(), setup_file_key(), and setup_text_key().

char keyfile[MXNAME]

Definition at line 185 of file dighost.c.

Referenced by configure_session_key(), dash_option(), destroy(), dns_view_restorekeyring(), main(), parse_args(), read_confkey(), read_sessionkey(), setup_file_key(), setup_keyfile(), and setup_system().

char keysecret[MXNAME]

Definition at line 186 of file dighost.c.

Referenced by dash_option(), main(), read_confkey(), received(), setup_system(), and setup_text_key().

dns_name_t* hmacname

Definition at line 189 of file dighost.c.

Referenced by dash_option(), evaluate_key(), setup_keyfile(), and setup_keystr().

unsigned int digestbits

Definition at line 190 of file dighost.c.

Referenced by bind9_check_key(), dash_option(), dns_tsig_sign(), dns_tsig_verify(), evaluate_key(), parse_hmac(), setup_keystr(), and setup_text_key().

dns_tsigkey_t* key

Definition at line 44 of file hash_test.c.

Referenced by add(), add_initial_keys(), addkey(), ATF_TC_BODY(), bind9_check_controlskeys(), bind9_check_namedconf(), check_keylist(), control_recvmessage(), controlkeylist_fromcfg(), dns_dnssec_findmatchingkeys(), dns_dnssec_signs(), dns_message_checksig(), dns_nsec3_maxiterations(), dns_tsig_sign(), dns_tsig_verify(), dns_tsigkey_detach(), dns_tsigkey_find(), dns_view_untrust(), dns_zonekey_iszonekey(), emit(), free_controlkeylist(), free_tsignode(), freestruct_key(), fromstruct_key(), generate_session_key(), get_entry(), get_rndckey(), goodsig(), isccc_cc_checkdup(), isselfsigned(), key_collision(), keyfromds(), keythatsigned(), keythatsigned_unlocked(), load_view_keys(), loadds(), loadexplicitkeys(), loadkey(), logkey(), main(), mark_active_keys(), nameexist(), ns_client_isself(), ns_config_getipandkeylist(), parse_config(), read_sessionkey(), received(), signset(), table_fromwire(), tostruct_key(), tsig_verify_tcp(), validate(), validate_masters(), and writeset().

isc_boolean_t validated

Definition at line 193 of file dighost.c.

Referenced by received(), recv_done(), and valcreate().

isc_taskmgr_t* taskmgr

Definition at line 42 of file isctest.c.

isc_task_t* global_task

Definition at line 140 of file dighost.c.

Referenced by dighost_shutdown(), and main().

isc_boolean_t free_now

Definition at line 126 of file dighost.c.

Referenced by cancel_all(), check_next_lookup(), clone_lookup(), connect_done(), connect_timeout(), destroy_libs(), dns_zone_detach(), dns_zonemgr_detach(), dns_zonemgr_releasezone(), followup_lookup(), isc_ratelimiter_detach(), launch_next_query(), make_empty_lookup(), next_origin(), recv_done(), setup_lookup(), and tcp_length_done().

isc_boolean_t debugging

Definition at line 196 of file dighost.c.

Referenced by dash_option(), debug(), do_next_command(), parse_args(), pre_parse_args(), recvsoa(), send_update(), setoption(), show_settings(), try_clear_lookup(), and update_completed().

isc_boolean_t debugtiming

Definition at line 197 of file dighost.c.

Referenced by debug(), and pre_parse_args().

isc_boolean_t memdebugging

Definition at line 198 of file dighost.c.

Referenced by cleanup(), destroy_libs(), pre_parse_args(), and preparse_args().

isc_boolean_t keep_open

Definition at line 132 of file dighost.c.

Referenced by connect_done(), and plus_option().

char* progname

Definition at line 199 of file dighost.c.

int tries

Definition at line 149 of file dighost.c.

Referenced by addlookup(), getname(), getrdata(), hash_divisor(), main(), make_empty_lookup(), parse_args(), printmessage(), set_tries(), setup_system(), and show_settings().

int fatalexit

Definition at line 183 of file dighost.c.

Referenced by fatal(), main(), and parse_args().

isc_boolean_t verbose

Definition at line 133 of file dighost.c.

ISC_PLATFORM_NORETURN_PRE void ISC_PLATFORM_NORETURN_POST

Definition at line 319 of file dig.h.


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