1tooloptions(3) User Contributed Perl Documentation tooloptions(3)
2
3
4
6 Net::DNS::SEC::Tools::tooloptions - DNSSEC-Tools option routines.
7
9 use Net::DNS::SEC::Tools::tooloptions;
10
11 @specopts = ("propagate+", "waittime=i");
12
13 $optsref = opts_cmdopts(@specopts);
14 %options = %$optsref;
15
16 $zoneref = opts_zonekr($keyrec_file,$keyrec_name,@specopts);
17 %zone_kr = %$zoneref;
18
19 opts_setcsopts(@specopts);
20
21 opts_createkrf();
22
23 opts_suspend();
24
25 opts_restore();
26
27 opts_drop();
28
29 opts_reset();
30
31 opts_gui();
32
33 opts_nogui();
34
35 $oldaction = opts_onerr(1);
36 opts_onerr(0);
37
39 DNSSEC-Tools supports a set of options common to all the tools in the
40 suite. These options may be set from DNSSEC-Tools defaults, values set
41 in the dnssec-tools.conf configuration file, in a keyrec file, from
42 command-specific options, from command-line options, or from any combi‐
43 nation of the five. In order to enforce a common sequence of option
44 interpretation, all DNSSEC-Tools should use the tooloptions.pm routines
45 to initialize their options.
46
47 tooloptions.pm routines combine data from the aforementioned option
48 sources into a hash table. The hash table is returned to the caller,
49 which will then use the options as needed.
50
51 The command-line options are saved between calls, so a command may call
52 tooloptions.pm routines multiple times and still have the command-line
53 options included in the final hash table. This is useful for examining
54 multiple keyrecs in a single command. Inclusion of command-line
55 options may be suspended and restored using the opts_suspend() and
56 opts_restore() calls. Options may be discarded entirely by calling
57 opts_drop(); once dropped, command-line options may never be restored.
58 Suspension, restoration, and dropping of command-line options are only
59 effective after the initial tooloptions.pm call.
60
61 The options sources are combined in this order:
62
63 1. DNSSEC-Tools Defaults
64 The DNSSEC-Tools defaults, as defined in conf.pm are put into a
65 hash table, with the option names as the hash key.
66
67 2. DNSSEC-Tools Configuration File
68 The system-wide DNSSEC-Tools configuration file is read and these
69 option values are added to the option collection. Again, the
70 option names are used as the hash key.
71
72 3. keyrec File
73 If a keyrec file was specified, then the keyrec named by
74 keyrec_name will be retrieved. The keyrec's fields are added to
75 the hash table. Any field whose keyword matches an existing hash
76 key will override any existing values.
77
78 4. Command-Specific Options
79 Options specific to the invoking commands may be specified in
80 @specopts. This array is parsed by Getoptions() from the
81 Getopt::Long Perl module. These options are folded into the hash
82 table; possibly overriding existing hash values. The options given
83 in @specopts must be in the format required by Getoptions().
84
85 5. Command-Line Options
86 The command-line options are parsed using Getoptions() from the
87 Getopt::Long Perl module. These options are folded into the hash
88 table; again, possibly overriding existing hash values. The
89 options given in @specopts must be in the format required by Getop‐
90 tions().
91
92 A reference to the hash table created in these steps is returned to the
93 caller.
94
96 dnssec-tools.conf has these entries:
97
98 ksklength 2048
99 zsklength 512
100
101 example.keyrec has this entry:
102
103 key "Kexample.com.+005+12345"
104 zsklength "1024"
105
106 zonesigner is executed with this command line:
107
108 zonesigner -zsklength 4096 -wait 3600 ... example.com
109
110 opts_zonekr("example.keyrec","Kexample.com.+005+12345",("wait=i")) will
111 read each option source in turn, ending up with:
112 ksklength 512
113 zsklength 4096
114 wait 600
115
117 opts_cmdopts(@csopts)
118 This opts_cmdopts() call builds an option hash from the system con‐
119 figuration file, a keyrec, and a set of command-specific options.
120 A reference to this option hash is returned to the caller.
121
122 If $keyrec_file is given as an empty string, then no keyrec file
123 will be consulted. In this case, it is assumed that $keyrec_name
124 will be left out altogether.
125
126 If a non-existent $keyrec_file is given and opts_createkrf() has
127 been called, then the named keyrec file will be created. opts_cre‐
128 atekrf() must be called for each keyrec file that must be created,
129 as the tooloptions keyrec-creation state is reset after toolop‐
130 tions() has completed.
131
132 opts_zonekr($keyrec_file,$keyrec_name,@csopts)
133 This routine returns a reference to options gathered from the basic
134 option sources and from the zone keyrec named by $keyrec_name,
135 which is found in $keyrec_file. The keyrec fields from the zone's
136 KSK and ZSK are folded in as well, but the key's keyrec_ fields are
137 excluded. This call ensures that the named keyrec is a zone
138 keyrec; if it isn't, undef is returned.
139
140 The $keyrec_file argument specifies a keyrec file that will be con‐
141 sulted. The keyrec named by the $keyrec_name argument will be
142 loaded. If a keyrec file is found and opts_createkrf() has been
143 previously called, then the keyrec file will be created if it
144 doesn't exist.
145
146 If $keyrec_file is given as "", then the command-line options are
147 searched for a -krfile option. If $keyrec_name is given as "",
148 then the name is taken from $ARGV[0].
149
150 The @specopts array contains command-specific arguments; the argu‐
151 ments must be in the format prescribed by the Getopt::Long Perl
152 module.
153
154 opts_setcsopts(@csopts)
155 This routine saves a copy of the command-specific options given in
156 @csopts. This collection of options is added to the @csopts array
157 that may be passed to tooloptions.pm routines.
158
159 opts_createkrf()
160 Force creation of an empty keyrec file if the specified file does
161 not exist. This may happen on calls to opts_zonekr().
162
163 opts_suspend()
164 Suspend inclusion of the command-line options in building the final
165 hash table of responses.
166
167 opts_restore()
168 Restore inclusion of the command-line options in building the final
169 hash table of responses.
170
171 opts_drop()
172 Discard the command-line options. They will no longer be available
173 for inclusion in building the final hash table of responses for
174 this execution of the command.
175
176 opts_reset()
177 Reset an internal flag so that the command-line arguments may be
178 re-examined. This is usually only useful if the arguments have
179 been modified by the calling program itself.
180
181 opts_gui()
182 Set an internal flag so that command arguments may be specified
183 with a GUI. GUI usage requires that Getopt::Long::GUI is avail‐
184 able. If it isn't, then Getopt::Long will be used.
185
186 opts_nogui()
187 Set an internal flag so that the GUI will not be used for specify‐
188 ing command arguments.
189
190 opts_onerr(exitflag)
191 Set an internal flag indicating what should happen if an invalid
192 option is specified on the command line. If exitflag is non-zero,
193 then the process will exit on an invalid option; if it is zero,
194 then the process will not exit. The default action is to report an
195 error without exiting.
196
197 The old exit action is returned.
198
200 Copyright 2005-2007 SPARTA, Inc. All rights reserved. See the COPYING
201 file included with the DNSSEC-Tools package for details.
202
204 Wayne Morrison, tewok@users.sourceforge.net
205
207 zonesigner(8)
208
209 Getopt::Long(3)
210
211 Net::DNS::SEC::Tools::conf(3), Net::DNS::SEC::Tools::defaults(3),
212 Net::DNS::SEC::Tools::keyrec(3)
213
214 Net::DNS::SEC::Tools::keyrec(5)
215
216
217
218perl v5.8.8 2008-02-15 tooloptions(3)