1 /*
2  * Part of DNS zone file validator `validns`.
3  *
4  * Copyright 2011-2014 Anton Berezin <tobez@tobez.org>
5  * Modified BSD license.
6  * (See LICENSE file in the distribution.)
7  *
8  */
9 #ifndef _COMMON_H_
10 #define _COMMON_H_ 1
11 
12 struct file_info
13 {
14 	struct file_info *next;
15 	FILE *file;
16 	int  line;
17 	int  paren_mode;
18 	char buf[2048];
19 	char name[0];
20 };
21 
22 extern struct file_info *file_info;
23 
24 #define N_POLICY_CHECKS 9
25 
26 #define POLICY_SINGLE_NS 0
27 #define POLICY_CNAME_OTHER_DATA 1
28 #define POLICY_NSEC3PARAM_NOT_APEX 2
29 #define POLICY_MX_ALIAS 3
30 #define POLICY_NS_ALIAS 4
31 #define POLICY_RP_TXT_EXISTS 5
32 #define POLICY_DNAME 6
33 #define POLICY_DNSKEY 7
34 #define POLICY_TLSA_HOST 8
35 
36 #define MAX_TIMES_TO_CHECK 32
37 
38 struct globals {
39 	struct stats {
40 		int names_count;
41 		int rr_count;
42 		int rrset_count;
43 		int error_count;
44 		int skipped_dup_rr_count;
45 		int soa_rr_count;
46 		int signatures_verified;
47 		int delegations;
48 		int not_authoritative;
49 		int nsec3_count;
50 	} stats;
51 	struct command_line_options
52 	{
53 		int die_on_first_error;
54 		int no_output;
55 		int summary;
56 		int verbose;
57 		char *include_path;
58 		char *current_origin;
59 		int n_times_to_check;
60 		uint32_t times_to_check[MAX_TIMES_TO_CHECK];
61 		char policy_checks[N_POLICY_CHECKS];
62 		int n_threads;
63 	} opt;
64 	int exit_code;
65 	long default_ttl;
66 	int nsec3_present;
67 	int nsec3_opt_out_present;
68 	int dnssec_active;
69 };
70 
71 extern struct globals G;
72 
73 #define SHA1_BYTES 20
74 #define SHA256_BYTES 32
75 #define SHA384_BYTES 48
76 #define SHA512_BYTES 64
77 /* GOST R 34.11-94 - 32 bytes */
78 #define GOST_BYTES 32
79 
80 #endif
81