xref: /freebsd/contrib/ldns/drill/drill_util.h (revision 3078531de10dcae44b253a35125c949ff4235284)
1 /*
2  * util.h
3  * util.c header file
4  * in ldns
5  * (c) 2005 NLnet Labs
6  *
7  * See the file LICENSE for the license
8  *
9  */
10 
11 #ifndef _DRILL_UTIL_H_
12 #define _DRILL_UTIL_H_
13 #include <ldns/ldns.h>
14 
15 
16 /**
17  * Read  keys from filename and append to key_list.
18  */
19 ldns_status read_key_file(const char *filename, ldns_rr_list *key_list,
20 		bool silently);
21 
22 /**
23  * return a address rdf, either A or AAAA
24  * NULL if anything goes wrong
25  */
26 ldns_rdf * ldns_rdf_new_addr_frm_str(char *);
27 
28 /**
29  * print all the ds of the keys in the packet
30  */
31 void print_ds_of_keys(ldns_pkt *p);
32 
33 /**
34  * print some rdfs of a signature
35  */
36 void print_rrsig_abbr(FILE *fp, ldns_rr *sig);
37 /**
38  * print some rdfs of a dnskey
39  */
40 void print_dnskey_abbr(FILE *fp, ldns_rr *key);
41 /**
42  * print some rdfs of a ds
43  */
44 void print_ds_abbr(FILE *fp, ldns_rr *ds);
45 
46 /**
47  * print some rdfs of a rr in a rr_list
48  */
49 void print_rr_list_abbr(FILE *fp, ldns_rr_list *sig, const char *usr);
50 
51 /**
52  * Alloc some memory, with error checking
53  */
54 void *xmalloc(size_t s);
55 
56 /**
57  * Realloc some memory, with error checking
58  */
59 void *xrealloc(void *p, size_t s);
60 
61 /**
62  * Free the data
63  */
64 void xfree(void *q);
65 #endif /* _DRILL_UTIL_H_ */
66