.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "tooloptions 3" .TH tooloptions 3 2023-07-29 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::DNS::SEC::Tools::tooloptions \- DNSSEC\-Tools option routines. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Net::DNS::SEC::Tools::tooloptions; \& \& @specopts = ("propagate+", "waittime=i"); \& \& %opts = opts_cmdline($restoreargv,@calleropts); \& \& $optsref = opts_cmdopts(@specopts); \& %options = %$optsref; \& \& $zoneref = opts_zonekr($keyrec_file,$keyrec_name,@specopts); \& %zone_kr = %$zoneref; \& \& opts_setcsopts(@specopts); \& \& opts_createkrf(); \& \& opts_suspend(); \& \& opts_restore(); \& \& opts_drop(); \& \& opts_reset(); \& \& opts_gui(); \& \& opts_nogui(); \& \& $oldaction = opts_onerr(1); \& opts_onerr(0); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" DNSSEC-Tools supports a set of options common to all the tools in the suite. These options may be set from DNSSEC-Tools defaults, values set in the \&\fBdnssec\-tools.conf\fR configuration file, in a \fIkeyrec\fR file, from command-specific options, from command-line options, or from any combination of the five. In order to enforce a common sequence of option interpretation, all DNSSEC-Tools should use the \fBtooloptions.pm\fR routines to initialize their options. .PP \&\fBtooloptions.pm\fR routines combine data from the aforementioned option sources into a hash table. The hash table is returned to the caller, which will then use the options as needed. .PP The command-line options are saved between calls, so a command may call \&\fBtooloptions.pm\fR routines multiple times and still have the command-line options included in the final hash table. This is useful for examining multiple \fIkeyrec\fRs in a single command. Inclusion of command-line options may be suspended and restored using the \fR\f(BIopts_suspend()\fR\fI\fR and \&\fI\fR\f(BIopts_restore()\fR\fI\fR calls. Options may be discarded entirely by calling \&\fI\fR\f(BIopts_drop()\fR\fI\fR; once dropped, command-line options may never be restored. Suspension, restoration, and dropping of command-line options are only effective after the initial \fBtooloptions.pm\fR call. .PP The options sources are combined in this order: .IP "1. DNSSEC-Tools Defaults" 4 .IX Item "1. DNSSEC-Tools Defaults" The DNSSEC-Tools defaults, as defined in \fBconf.pm\fR are put into a hash table, with the option names as the hash key. .IP "2. DNSSEC-Tools Configuration File" 4 .IX Item "2. DNSSEC-Tools Configuration File" The system-wide DNSSEC-Tools configuration file is read and these option values are added to the option collection. Again, the option names are used as the hash key. .IP "3. \fIkeyrec\fR File" 4 .IX Item "3. keyrec File" If a \fIkeyrec\fR file was specified, then the \fIkeyrec\fR named by \fIkeyrec_name\fR will be retrieved. The \fIkeyrec\fR's fields are added to the hash table. Any field whose keyword matches an existing hash key will override any existing values. .IP "4. Command-Specific Options" 4 .IX Item "4. Command-Specific Options" Options specific to the invoking commands may be specified in \fR\f(CI@specopts\fR\fI\fR. This array is parsed by \fI\fR\f(BIGetoptions()\fR\fI\fR from the \fBGetopt::Long\fR Perl module. These options are folded into the hash table; possibly overriding existing hash values. The options given in \fI\fR\f(CI@specopts\fR\fI\fR must be in the format required by \fI\fR\f(BIGetoptions()\fR\fI\fR. .IP "5. Command-Line Options" 4 .IX Item "5. Command-Line Options" The command-line options are parsed using \fR\f(BIGetoptions()\fR\fI\fR from the \&\fBGetopt::Long\fR Perl module. These options are folded into the hash table; again, possibly overriding existing hash values. The options given in \&\fI\fR\f(CI@specopts\fR\fI\fR must be in the format required by \fI\fR\f(BIGetoptions()\fR\fI\fR. .PP A reference to the hash table created in these steps is returned to the caller. .SH EXAMPLE .IX Header "EXAMPLE" \&\fBdnssec\-tools.conf\fR has these entries: .PP .Vb 2 \& ksklength 2048 \& zsklength 1024 .Ve .PP \&\fBexample.keyrec\fR has this entry: .PP .Vb 2 \& key "Kexample.com.+005+12345" \& zsklength "2048" .Ve .PP \&\fBzonesigner\fR is executed with this command line: .PP .Vb 1 \& zonesigner \-zsklength 4096 \-wait 3600 ... example.com .Ve .PP \&\fIopts_zonekr("example.keyrec","Kexample.com.+005+12345",("wait=i"))\fR will read each option source in turn, ending up with: \fIksklength\fR 1024 \fIzsklength\fR 4096 \fIwait\fR 600 .SH "TOOLOPTIONS INTERFACES" .IX Header "TOOLOPTIONS INTERFACES" .IP \fIopts_cmdline($restoreargv,@calleropts)\fR 4 .IX Item "opts_cmdline($restoreargv,@calleropts)" This routine parses a command line looking for the arguments in the standard set of options and an optional set of options specified by the caller. If the first argument is true, the program-wide \f(CW@ARGV\fR is restored after parsing. If the caller provides other arguments, they're added as additional options. The parsed options are returned to the caller in a hash. .IP \fIopts_cmdopts(@csopts)\fR 4 .IX Item "opts_cmdopts(@csopts)" The \fR\f(BIopts_cmdopts()\fR\fI\fR call builds an option hash from the system configuration file, a \fIkeyrec\fR, and a set of command-specific options. A reference to this option hash is returned to the caller. .Sp If \fR\f(CI$keyrec_file\fR\fI\fR is given as an empty string, then no \fIkeyrec\fR file will be consulted. In this case, it is assumed that \fI\fR\f(CI$keyrec_name\fR\fI\fR will be left out altogether. .Sp If a non-existent \fR\f(CI$keyrec_file\fR\fI\fR is given and \fI\fR\f(BIopts_createkrf()\fR\fI\fR has been called, then the named \fIkeyrec\fR file will be created. \fI\fR\f(BIopts_createkrf()\fR\fI\fR must be called for each \fIkeyrec\fR file that must be created, as the \&\fBtooloptions\fR \fIkeyrec\fR\-creation state is reset after \fBtooloptions()\fR has completed. .IP \fIopts_zonekr($keyrec_file,$keyrec_name,@csopts)\fR 4 .IX Item "opts_zonekr($keyrec_file,$keyrec_name,@csopts)" This routine returns a reference to options gathered from the basic option sources and from the zone \fIkeyrec\fR named by \fR\f(CI$keyrec_name\fR\fI\fR, which is found in \fI\fR\f(CI$keyrec_file\fR\fI\fR. The \fIkeyrec\fR fields from the zone's KSK and ZSK are folded in as well, but the key's \fIkeyrec_\fR fields are excluded. This call ensures that the named \fIkeyrec\fR is a zone \fIkeyrec\fR; if it isn't, \&\fIundef\fR is returned. .Sp The \fIkeyrec\fR file is read with \fR\f(BIkeyrec_read()\fR\fI\fR. To ensure it is properly read, \fI\fR\f(BIkeyrec_close()\fR\fI\fR is called first. .Sp The \fR\f(CI$keyrec_file\fR\fI\fR argument specifies a \fIkeyrec\fR file that will be consulted. The \fIkeyrec\fR named by the \fI\fR\f(CI$keyrec_name\fR\fI\fR argument will be loaded. If a \fIkeyrec\fR file is found and \fI\fR\f(BIopts_createkrf()\fR\fI\fR has been previously called, then the \fIkeyrec\fR file will be created if it doesn't exist. .Sp If \fR\f(CI$keyrec_file\fR\fI\fR is given as "", then the command-line options are searched for a \fI\-krfile\fR option. If \fI\fR\f(CI$keyrec_name\fR\fI\fR is given as "", then the name is taken from \fI\fR\f(CI$ARGV\fR\fI[0]\fR. .Sp The \fR\f(CI@specopts\fR\fI\fR array contains command-specific arguments; the arguments must be in the format prescribed by the \fBGetopt::Long\fR Perl module. .Sp If the command line contains the \fI\-dtconfig\fR option, then \fIopts_zonekr\fR() sets that option to be the configuration file. It then parses that file and uses it as the source for configuration file data. .IP \fIopts_setcsopts(@csopts)\fR 4 .IX Item "opts_setcsopts(@csopts)" This routine saves a copy of the command-specific options given in \fR\f(CI@csopts\fR\fI\fR. This collection of options is added to the \fI\fR\f(CI@csopts\fR\fI\fR array that may be passed to \fBtooloptions.pm\fR routines. .IP \fR\f(BIopts_createkrf()\fR\fI\fR 4 .IX Item "opts_createkrf()" Force creation of an empty \fIkeyrec\fR file if the specified file does not exist. This may happen on calls to \fR\f(BIopts_zonekr()\fR\fI\fR. .IP \fR\f(BIopts_suspend()\fR\fI\fR 4 .IX Item "opts_suspend()" Suspend inclusion of the command-line options in building the final hash table of responses. .IP \fR\f(BIopts_restore()\fR\fI\fR 4 .IX Item "opts_restore()" Restore inclusion of the command-line options in building the final hash table of responses. .IP \fR\f(BIopts_drop()\fR\fI\fR 4 .IX Item "opts_drop()" Discard the command-line options. They will no longer be available for inclusion in building the final hash table of responses for this execution of the command. .IP \fR\f(BIopts_reset()\fR\fI\fR 4 .IX Item "opts_reset()" Reset an internal flag so that the command-line arguments may be re-examined. This is usually only useful if the arguments have been modified by the calling program itself. .IP \fR\f(BIopts_gui()\fR\fI\fR 4 .IX Item "opts_gui()" Set an internal flag so that command arguments may be specified with a GUI. GUI usage requires that \fBGetopt::GUI::Long\fR is available. If it isn't, then \&\fBGetopt::Long\fR will be used. .IP \fR\f(BIopts_nogui()\fR\fI\fR 4 .IX Item "opts_nogui()" Set an internal flag so that the GUI will not be used for specifying command arguments. .IP \fIopts_onerr(exitflag)\fR 4 .IX Item "opts_onerr(exitflag)" Set an internal flag indicating what should happen if an invalid option is specified on the command line. If \fIexitflag\fR is non-zero, then the process will exit on an invalid option; if it is zero, then the process will not exit. The default action is to report an error without exiting. .Sp The old exit action is returned. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2005\-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. .SH AUTHOR .IX Header "AUTHOR" Wayne Morrison, tewok@tislabs.com .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBzonesigner\|(8)\fR .PP \&\fBGetopt::Long\|(3)\fR .PP \&\fBNet::DNS::SEC::Tools::conf\|(3)\fR, \&\fBNet::DNS::SEC::Tools::defaults\|(3)\fR, \&\fBNet::DNS::SEC::Tools::keyrec\|(3)\fR .PP \&\fBNet::DNS::SEC::Tools::keyrec\|(5)\fR