summaryrefslogtreecommitdiffstats
path: root/src/danetool-options.h
blob: 9965aeb5817f76f93fffc443783b0283c26af086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#include <stdbool.h>
#include <stdio.h>

#ifndef DANETOOL_OPTIONS_H_
#define DANETOOL_OPTIONS_H_ 1

struct danetool_list
{
  const char **args;
  unsigned int count;
};

struct danetool_options
{
  /* Options present in the command line */
  struct
  {
    bool debug;
    bool verbose;
    bool outfile;
    bool load_pubkey;
    bool load_certificate;
    bool dlv;
    bool hash;
    bool check;
    bool check_ee;
    bool check_ca;
    bool tlsa_rr;
    bool host;
    bool proto;
    bool port;
    bool starttls_proto;
    bool ca;
    bool x509;
    bool domain;
    bool local_dns;
    bool insecure;
    bool inder;
    bool print_raw;
    bool quiet;
    bool version;
    bool help;
    bool more_help;
  } present;

  /* Option arguments in raw string form */
  struct
  {
    const char *debug;
    const char *outfile;
    const char *load_pubkey;
    const char *load_certificate;
    const char *dlv;
    const char *hash;
    const char *check;
    const char *host;
    const char *proto;
    const char *port;
    const char *starttls_proto;
    const char *version;
  } arg;

  /* Option arguments parsed as integer */
  struct
  {
    int debug;
  } value;

  /* Option enablement status */
  struct
  {
    bool debug;
    bool verbose;
    bool outfile;
    bool load_pubkey;
    bool load_certificate;
    bool dlv;
    bool hash;
    bool check;
    bool check_ee;
    bool check_ca;
    bool tlsa_rr;
    bool host;
    bool proto;
    bool port;
    bool starttls_proto;
    bool ca;
    bool x509;
    bool domain;
    bool local_dns;
    bool insecure;
    bool inder;
    bool print_raw;
    bool quiet;
    bool version;
    bool help;
    bool more_help;
  } enabled;
};

#define HAVE_OPT(name) HAVE_OPT_ ## name
#define OPT_ARG(name) OPT_ARG_ ## name
#define ENABLED_OPT(name) ENABLED_OPT_ ## name
#define OPTS_COUNT(name) OPTS_COUNT_ ## name
#define OPTS_ARRAY(name) OPTS_ARRAY_ ## name
#define USAGE(status) usage (stdout, (status))

#define HAVE_OPT_DEBUG danetool_options.present.debug
#define HAVE_OPT_VERBOSE danetool_options.present.verbose
#define HAVE_OPT_OUTFILE danetool_options.present.outfile
#define HAVE_OPT_LOAD_PUBKEY danetool_options.present.load_pubkey
#define HAVE_OPT_LOAD_CERTIFICATE danetool_options.present.load_certificate
#define HAVE_OPT_DLV danetool_options.present.dlv
#define HAVE_OPT_HASH danetool_options.present.hash
#define HAVE_OPT_CHECK danetool_options.present.check
#define HAVE_OPT_CHECK_EE danetool_options.present.check_ee
#define HAVE_OPT_CHECK_CA danetool_options.present.check_ca
#define HAVE_OPT_TLSA_RR danetool_options.present.tlsa_rr
#define HAVE_OPT_HOST danetool_options.present.host
#define HAVE_OPT_PROTO danetool_options.present.proto
#define HAVE_OPT_PORT danetool_options.present.port
#define HAVE_OPT_STARTTLS_PROTO danetool_options.present.starttls_proto
#define HAVE_OPT_CA danetool_options.present.ca
#define HAVE_OPT_X509 danetool_options.present.x509
#define HAVE_OPT_DOMAIN danetool_options.present.domain
#define HAVE_OPT_LOCAL_DNS danetool_options.present.local_dns
#define HAVE_OPT_INSECURE danetool_options.present.insecure
#define HAVE_OPT_INDER danetool_options.present.inder
#define HAVE_OPT_PRINT_RAW danetool_options.present.print_raw
#define HAVE_OPT_QUIET danetool_options.present.quiet
#define HAVE_OPT_VERSION danetool_options.present.version
#define HAVE_OPT_HELP danetool_options.present.help
#define HAVE_OPT_MORE_HELP danetool_options.present.more_help

#define OPT_ARG_DEBUG danetool_options.arg.debug
#define OPT_ARG_VERBOSE danetool_options.arg.verbose
#define OPT_ARG_OUTFILE danetool_options.arg.outfile
#define OPT_ARG_LOAD_PUBKEY danetool_options.arg.load_pubkey
#define OPT_ARG_LOAD_CERTIFICATE danetool_options.arg.load_certificate
#define OPT_ARG_DLV danetool_options.arg.dlv
#define OPT_ARG_HASH danetool_options.arg.hash
#define OPT_ARG_CHECK danetool_options.arg.check
#define OPT_ARG_CHECK_EE danetool_options.arg.check_ee
#define OPT_ARG_CHECK_CA danetool_options.arg.check_ca
#define OPT_ARG_TLSA_RR danetool_options.arg.tlsa_rr
#define OPT_ARG_HOST danetool_options.arg.host
#define OPT_ARG_PROTO danetool_options.arg.proto
#define OPT_ARG_PORT danetool_options.arg.port
#define OPT_ARG_STARTTLS_PROTO danetool_options.arg.starttls_proto
#define OPT_ARG_CA danetool_options.arg.ca
#define OPT_ARG_X509 danetool_options.arg.x509
#define OPT_ARG_DOMAIN danetool_options.arg.domain
#define OPT_ARG_LOCAL_DNS danetool_options.arg.local_dns
#define OPT_ARG_INSECURE danetool_options.arg.insecure
#define OPT_ARG_INDER danetool_options.arg.inder
#define OPT_ARG_PRINT_RAW danetool_options.arg.print_raw
#define OPT_ARG_QUIET danetool_options.arg.quiet
#define OPT_ARG_VERSION danetool_options.arg.version
#define OPT_ARG_HELP danetool_options.arg.help
#define OPT_ARG_MORE_HELP danetool_options.arg.more_help

#define OPT_VALUE_DEBUG danetool_options.value.debug

#define ENABLED_OPT_DEBUG danetool_options.enabled.debug
#define ENABLED_OPT_VERBOSE danetool_options.enabled.verbose
#define ENABLED_OPT_OUTFILE danetool_options.enabled.outfile
#define ENABLED_OPT_LOAD_PUBKEY danetool_options.enabled.load_pubkey
#define ENABLED_OPT_LOAD_CERTIFICATE danetool_options.enabled.load_certificate
#define ENABLED_OPT_DLV danetool_options.enabled.dlv
#define ENABLED_OPT_HASH danetool_options.enabled.hash
#define ENABLED_OPT_CHECK danetool_options.enabled.check
#define ENABLED_OPT_CHECK_EE danetool_options.enabled.check_ee
#define ENABLED_OPT_CHECK_CA danetool_options.enabled.check_ca
#define ENABLED_OPT_TLSA_RR danetool_options.enabled.tlsa_rr
#define ENABLED_OPT_HOST danetool_options.enabled.host
#define ENABLED_OPT_PROTO danetool_options.enabled.proto
#define ENABLED_OPT_PORT danetool_options.enabled.port
#define ENABLED_OPT_STARTTLS_PROTO danetool_options.enabled.starttls_proto
#define ENABLED_OPT_CA danetool_options.enabled.ca
#define ENABLED_OPT_X509 danetool_options.enabled.x509
#define ENABLED_OPT_DOMAIN danetool_options.enabled.domain
#define ENABLED_OPT_LOCAL_DNS danetool_options.enabled.local_dns
#define ENABLED_OPT_INSECURE danetool_options.enabled.insecure
#define ENABLED_OPT_INDER danetool_options.enabled.inder
#define ENABLED_OPT_PRINT_RAW danetool_options.enabled.print_raw
#define ENABLED_OPT_QUIET danetool_options.enabled.quiet
#define ENABLED_OPT_VERSION danetool_options.enabled.version
#define ENABLED_OPT_HELP danetool_options.enabled.help
#define ENABLED_OPT_MORE_HELP danetool_options.enabled.more_help




extern struct danetool_options danetool_options;
int process_options (int argc, char **argv);
void usage (FILE *out, int status);

#endif /* DANETOOL_OPTIONS_H_ */
#define optionProcess(a,b,c) process_options(b,c)
#define STACKCT_OPT OPTS_COUNT
#define STACKLST_OPT OPTS_ARRAY