xref: /netbsd-src/external/bsd/ntp/dist/sntp/sntp-opts.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: sntp-opts.h,v 1.1.1.1 2009/12/13 16:57:12 kardel Exp $	*/
2 
3 /*
4  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.h)
5  *
6  *  It has been AutoGen-ed  December 10, 2009 at 05:07:29 AM by AutoGen 5.10
7  *  From the definitions    sntp-opts.def
8  *  and the template file   options
9  *
10  * Generated from AutoOpts 33:0:8 templates.
11  */
12 
13 /*
14  *  This file was produced by an AutoOpts template.  AutoOpts is a
15  *  copyrighted work.  This header file is not encumbered by AutoOpts
16  *  licensing, but is provided under the licensing terms chosen by the
17  *  sntp author or copyright holder.  AutoOpts is licensed under
18  *  the terms of the LGPL.  The redistributable library (``libopts'') is
19  *  licensed under the terms of either the LGPL or, at the users discretion,
20  *  the BSD license.  See the AutoOpts and/or libopts sources for details.
21  *
22  * This source file is copyrighted and licensed under the following terms:
23  *
24  * sntp copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved
25  *
26  * see html/copyright.html
27  */
28 /*
29  *  This file contains the programmatic interface to the Automated
30  *  Options generated for the sntp program.
31  *  These macros are documented in the AutoGen info file in the
32  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
33  */
34 #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD
35 #define AUTOOPTS_SNTP_OPTS_H_GUARD 1
36 #include "config.h"
37 #include <autoopts/options.h>
38 
39 /*
40  *  Ensure that the library used for compiling this generated header is at
41  *  least as new as the version current when the header template was released
42  *  (not counting patch version increments).  Also ensure that the oldest
43  *  tolerable version is at least as old as what was current when the header
44  *  template was released.
45  */
46 #define AO_TEMPLATE_VERSION 135168
47 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
48  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
49 # error option template version mismatches autoopts/options.h header
50   Choke Me.
51 #endif
52 
53 /*
54  *  Enumeration of each option:
55  */
56 typedef enum {
57     INDEX_OPT_IPV4            =  0,
58     INDEX_OPT_IPV6            =  1,
59     INDEX_OPT_NORMALVERBOSE   =  2,
60     INDEX_OPT_KOD             =  3,
61     INDEX_OPT_SYSLOG          =  4,
62     INDEX_OPT_FILELOG         =  5,
63     INDEX_OPT_SETTOD          =  6,
64     INDEX_OPT_ADJTIME         =  7,
65     INDEX_OPT_BROADCAST       =  8,
66     INDEX_OPT_TIMEOUT         =  9,
67     INDEX_OPT_AUTHENTICATION  = 10,
68     INDEX_OPT_KEYFILE         = 11,
69     INDEX_OPT_VERSION         = 12,
70     INDEX_OPT_HELP            = 13,
71     INDEX_OPT_MORE_HELP       = 14,
72     INDEX_OPT_SAVE_OPTS       = 15,
73     INDEX_OPT_LOAD_OPTS       = 16
74 } teOptIndex;
75 
76 #define OPTION_CT    17
77 #define SNTP_VERSION       "4.2.6"
78 #define SNTP_FULL_VERSION  "sntp - standard SNTP program - Ver. 4.2.6"
79 
80 /*
81  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
82  *  option name (as in the teOptIndex enumeration above).
83  *  e.g. HAVE_OPT( IPV4 )
84  */
85 #define         DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n])
86 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
87 #define      OPT_ARG(n) (DESC(n).optArg.argString)
88 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
89 #define    COUNT_OPT(n) (DESC(n).optOccCt)
90 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
91 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
92 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
93 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
94 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
95 #define    CLEAR_OPT(n) STMTS( \
96                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
97                 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
98                     DESC(n).fOptState |= OPTST_DISABLED; \
99                 DESC(n).optCookie = NULL )
100 
101 /*
102  *  Make sure there are no #define name conflicts with the option names
103  */
104 #ifndef     NO_OPTION_NAME_WARNINGS
105 # ifdef    IPV4
106 #  warning undefining IPV4 due to option name conflict
107 #  undef   IPV4
108 # endif
109 # ifdef    IPV6
110 #  warning undefining IPV6 due to option name conflict
111 #  undef   IPV6
112 # endif
113 # ifdef    NORMALVERBOSE
114 #  warning undefining NORMALVERBOSE due to option name conflict
115 #  undef   NORMALVERBOSE
116 # endif
117 # ifdef    KOD
118 #  warning undefining KOD due to option name conflict
119 #  undef   KOD
120 # endif
121 # ifdef    SYSLOG
122 #  warning undefining SYSLOG due to option name conflict
123 #  undef   SYSLOG
124 # endif
125 # ifdef    FILELOG
126 #  warning undefining FILELOG due to option name conflict
127 #  undef   FILELOG
128 # endif
129 # ifdef    SETTOD
130 #  warning undefining SETTOD due to option name conflict
131 #  undef   SETTOD
132 # endif
133 # ifdef    ADJTIME
134 #  warning undefining ADJTIME due to option name conflict
135 #  undef   ADJTIME
136 # endif
137 # ifdef    BROADCAST
138 #  warning undefining BROADCAST due to option name conflict
139 #  undef   BROADCAST
140 # endif
141 # ifdef    TIMEOUT
142 #  warning undefining TIMEOUT due to option name conflict
143 #  undef   TIMEOUT
144 # endif
145 # ifdef    AUTHENTICATION
146 #  warning undefining AUTHENTICATION due to option name conflict
147 #  undef   AUTHENTICATION
148 # endif
149 # ifdef    KEYFILE
150 #  warning undefining KEYFILE due to option name conflict
151 #  undef   KEYFILE
152 # endif
153 #else  /* NO_OPTION_NAME_WARNINGS */
154 # undef IPV4
155 # undef IPV6
156 # undef NORMALVERBOSE
157 # undef KOD
158 # undef SYSLOG
159 # undef FILELOG
160 # undef SETTOD
161 # undef ADJTIME
162 # undef BROADCAST
163 # undef TIMEOUT
164 # undef AUTHENTICATION
165 # undef KEYFILE
166 #endif  /*  NO_OPTION_NAME_WARNINGS */
167 
168 /* * * * * *
169  *
170  *  Interface defines for specific options.
171  */
172 #define VALUE_OPT_IPV4           '4'
173 #define VALUE_OPT_IPV6           '6'
174 #define VALUE_OPT_NORMALVERBOSE  'd'
175 #define VALUE_OPT_KOD            'K'
176 #define VALUE_OPT_SYSLOG         'p'
177 #define VALUE_OPT_FILELOG        'l'
178 #define VALUE_OPT_SETTOD         's'
179 #define VALUE_OPT_ADJTIME        'j'
180 #define VALUE_OPT_BROADCAST      'b'
181 #define VALUE_OPT_TIMEOUT        't'
182 
183 #define OPT_VALUE_TIMEOUT        (DESC(TIMEOUT).optArg.argInt)
184 #define VALUE_OPT_AUTHENTICATION 'a'
185 
186 #define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt)
187 #define VALUE_OPT_KEYFILE        'k'
188 #define VALUE_OPT_HELP          '?'
189 #define VALUE_OPT_MORE_HELP     '!'
190 #define VALUE_OPT_VERSION       INDEX_OPT_VERSION
191 #define VALUE_OPT_SAVE_OPTS     '>'
192 #define VALUE_OPT_LOAD_OPTS     '<'
193 #define SET_OPT_SAVE_OPTS(a)   STMTS( \
194         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
195         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
196         DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
197 /*
198  *  Interface defines not associated with particular options
199  */
200 #define ERRSKIP_OPTERR  STMTS( sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP )
201 #define ERRSTOP_OPTERR  STMTS( sntpOptions.fOptSet |= OPTPROC_ERRSTOP )
202 #define RESTART_OPT(n)  STMTS( \
203                 sntpOptions.curOptIdx = (n); \
204                 sntpOptions.pzCurOpt  = NULL )
205 #define START_OPT       RESTART_OPT(1)
206 #define USAGE(c)        (*sntpOptions.pUsageProc)( &sntpOptions, c )
207 /* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */
208 
209 /* * * * * *
210  *
211  *  Declare the sntp option descriptor.
212  */
213 #ifdef  __cplusplus
214 extern "C" {
215 #endif
216 
217 extern tOptions   sntpOptions;
218 
219 #if defined(ENABLE_NLS)
220 # ifndef _
221 #   include <stdio.h>
222     static inline char* aoGetsText( char const* pz ) {
223         if (pz == NULL) return NULL;
224         return (char*)gettext( pz );
225     }
226 #   define _(s)  aoGetsText(s)
227 # endif /* _() */
228 
229 # define OPT_NO_XLAT_CFG_NAMES  STMTS(sntpOptions.fOptSet |= \
230                                     OPTPROC_NXLAT_OPT_CFG;)
231 # define OPT_NO_XLAT_OPT_NAMES  STMTS(sntpOptions.fOptSet |= \
232                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
233 
234 # define OPT_XLAT_CFG_NAMES     STMTS(sntpOptions.fOptSet &= \
235                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
236 # define OPT_XLAT_OPT_NAMES     STMTS(sntpOptions.fOptSet &= \
237                                   ~OPTPROC_NXLAT_OPT;)
238 
239 #else   /* ENABLE_NLS */
240 # define OPT_NO_XLAT_CFG_NAMES
241 # define OPT_NO_XLAT_OPT_NAMES
242 
243 # define OPT_XLAT_CFG_NAMES
244 # define OPT_XLAT_OPT_NAMES
245 
246 # ifndef _
247 #   define _(_s)  _s
248 # endif
249 #endif  /* ENABLE_NLS */
250 
251 #ifdef  __cplusplus
252 }
253 #endif
254 #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */
255 /* sntp-opts.h ends here */
256