.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' '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 turned on, 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. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "tooloptions 3pm" .TH tooloptions 3pm "2012-06-18" "perl v5.14.2" "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 \fI\fIopts_suspend()\fI\fR and \&\fI\fIopts_restore()\fI\fR calls. Options may be discarded entirely by calling \&\fI\fIopts_drop()\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 \fI\f(CI@specopts\fI\fR. This array is parsed by \fI\fIGetoptions()\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\f(CI@specopts\fI\fR must be in the format required by \fI\fIGetoptions()\fI\fR. .IP "5. Command-Line Options" 4 .IX Item "5. Command-Line Options" The command-line options are parsed using \fI\fIGetoptions()\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\f(CI@specopts\fI\fR must be in the format required by \fI\fIGetoptions()\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(\*(L"example.keyrec\*(R",\*(L"Kexample.com.+005+12345\*(R",(\*(L"wait=i\*(R"))\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 \fI\fIopts_cmdopts()\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 \fI\f(CI$keyrec_file\fI\fR is given as an empty string, then no \fIkeyrec\fR file will be consulted. In this case, it is assumed that \fI\f(CI$keyrec_name\fI\fR will be left out altogether. .Sp If a non-existent \fI\f(CI$keyrec_file\fI\fR is given and \fI\fIopts_createkrf()\fI\fR has been called, then the named \fIkeyrec\fR file will be created. \fI\fIopts_createkrf()\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 \fB\f(BItooloptions()\fB\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 \fI\f(CI$keyrec_name\fI\fR, which is found in \fI\f(CI$keyrec_file\fI\fR. The \fIkeyrec\fR fields from the zone's \s-1KSK\s0 and \s-1ZSK\s0 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 \fI\fIkeyrec_read()\fI\fR. To ensure it is properly read, \fI\fIkeyrec_close()\fI\fR is called first. .Sp The \fI\f(CI$keyrec_file\fI\fR argument specifies a \fIkeyrec\fR file that will be consulted. The \fIkeyrec\fR named by the \fI\f(CI$keyrec_name\fI\fR argument will be loaded. If a \fIkeyrec\fR file is found and \fI\fIopts_createkrf()\fI\fR has been previously called, then the \fIkeyrec\fR file will be created if it doesn't exist. .Sp If \fI\f(CI$keyrec_file\fI\fR is given as "", then the command-line options are searched for a \fI\-krfile\fR option. If \fI\f(CI$keyrec_name\fI\fR is given as "", then the name is taken from \fI\f(CI$ARGV\fI[0]\fR. .Sp The \fI\f(CI@specopts\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 \fI\f(CI@csopts\fI\fR. This collection of options is added to the \fI\f(CI@csopts\fI\fR array that may be passed to \fBtooloptions.pm\fR routines. .IP "\fI\fIopts_createkrf()\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 \fI\fIopts_zonekr()\fI\fR. .IP "\fI\fIopts_suspend()\fI\fR" 4 .IX Item "opts_suspend()" Suspend inclusion of the command-line options in building the final hash table of responses. .IP "\fI\fIopts_restore()\fI\fR" 4 .IX Item "opts_restore()" Restore inclusion of the command-line options in building the final hash table of responses. .IP "\fI\fIopts_drop()\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 "\fI\fIopts_reset()\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 "\fI\fIopts_gui()\fI\fR" 4 .IX Item "opts_gui()" Set an internal flag so that command arguments may be specified with a \s-1GUI\s0. \&\s-1GUI\s0 usage requires that \fBGetopt::GUI::Long\fR is available. If it isn't, then \&\fBGetopt::Long\fR will be used. .IP "\fI\fIopts_nogui()\fI\fR" 4 .IX Item "opts_nogui()" Set an internal flag so that the \s-1GUI\s0 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\-2012 \s-1SPARTA\s0, Inc. All rights reserved. See the \s-1COPYING\s0 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" \&\fB\f(BIzonesigner\fB\|(8)\fR .PP \&\fB\f(BIGetopt::Long\fB\|(3)\fR .PP \&\fB\f(BINet::DNS::SEC::Tools::conf\fB\|(3)\fR, \&\fB\f(BINet::DNS::SEC::Tools::defaults\fB\|(3)\fR, \&\fB\f(BINet::DNS::SEC::Tools::keyrec\fB\|(3)\fR .PP \&\fB\f(BINet::DNS::SEC::Tools::keyrec\fB\|(5)\fR