xref: /freebsd/contrib/ldns/drill/drill.h (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1 /*
2  * drill.h
3  * the main header file of drill
4  * (c) 2005, 2006 NLnet Labs
5  *
6  * See the file LICENSE for the license
7  *
8  */
9 #ifndef _DRILL_H_
10 #define _DRILL_H_
11 #include "config.h"
12 
13 #include "drill_util.h"
14 
15 #define DRILL_VERSION PACKAGE_VERSION
16 
17 /* what kind of stuff do we allow */
18 #define DRILL_QUERY	0
19 #define DRILL_TRACE	1
20 #define DRILL_CHASE	2
21 #define DRILL_AFROMFILE 3
22 #define DRILL_QTOFILE 	4
23 #define DRILL_NSEC	5
24 #define DRILL_REVERSE	6
25 #define DRILL_SECTRACE 	7
26 
27 #define DRILL_ON(VAR, BIT) \
28 (VAR) = (VAR) | (BIT)
29 #define DRILL_OFF(VAR, BIT) \
30 (VAR) = (VAR) & ~(BIT)
31 
32 extern ldns_rr_list *global_dns_root;
33 extern int verbosity;
34 
35 void do_trace(ldns_resolver *res,
36 			    ldns_rdf *name,
37 			    ldns_rr_type type,
38 			    ldns_rr_class c);
39 ldns_status do_chase(ldns_resolver *res,
40 				 ldns_rdf *name,
41 				 ldns_rr_type type,
42 				 ldns_rr_class c,
43 				 ldns_rr_list *trusted_keys,
44 				 ldns_pkt *pkt_o,
45 				 uint16_t qflags,
46 				 ldns_rr_list *prev_key_list);
47 int do_secure_trace(ldns_resolver *res,
48 				ldns_rdf *name,
49 				ldns_rr_type type,
50 				ldns_rr_class c,
51 				ldns_rr_list *trusted_keys,
52 				ldns_rdf *start_name);
53 
54 ldns_rr_list *	get_rr(ldns_resolver *res,
55 				  ldns_rdf *zname,
56 				  ldns_rr_type t,
57 				  ldns_rr_class c);
58 
59 void drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p);
60 void drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p);
61 
62 ldns_pkt_type get_dnssec_rr(ldns_pkt *p,
63 					   ldns_rdf *name,
64 					   ldns_rr_type t,
65 					   ldns_rr_list **rrlist,
66 					   ldns_rr_list **sig);
67 
68 ldns_rr *ldns_nsec3_exact_match(ldns_rdf *qname,
69 						  ldns_rr_type qtype,
70 						  ldns_rr_list *nsec3s);
71 
72 ldns_rdf *ldns_nsec3_closest_encloser(ldns_rdf *qname,
73 							   ldns_rr_type qtype,
74 							   ldns_rr_list *nsec3s);
75 
76 /* verifies denial of existence of *name in *pkt (must contain NSEC or NSEC3 records
77  * if *nsec_rrs and *nsec_rr_sigs are given, pointers to the relevant nsecs and their signatures are
78  * placed there
79  */
80 ldns_status ldns_verify_denial(ldns_pkt *pkt,
81 						 ldns_rdf *name,
82 						 ldns_rr_type type,
83 						 ldns_rr_list **nsec_rrs,
84 						 ldns_rr_list **nsec_rr_sigs);
85 
86 ldns_pkt *read_hex_pkt(char *filename);
87 ldns_buffer *read_hex_buffer(char *filename);
88 void	init_root(void);
89 ldns_rr_list *read_root_hints(const char *filename);
90 void clear_root(void);
91 void	dump_hex(const ldns_pkt *pkt, const char *file);
92 void warning(const char *fmt, ...);
93 void	error(const char *fmt, ...);
94 void	mesg(const char *fmt, ...);
95 
96 /* screen.c */
97 void resolver_print_nameservers(ldns_resolver *r);
98 void print_dnskey(ldns_rr_list *key_list);
99 void print_ds(ldns_rr_list *ds_list);
100 
101 #endif /* _DRILL_H_ */
102