xref: /freebsd/contrib/ntp/sntp/sntp-opts.h (revision 3bdf775801b218aa5a89564839405b122f4b233e)
1 /*
2  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.h)
3  *
4  *  It has been AutoGen-ed  Tuesday December  8, 2009 at 08:14:49 AM EST
5  *  From the definitions    sntp-opts.def
6  *  and the template file   options
7  *
8  * Generated from AutoOpts 29:0:4 templates.
9  */
10 
11 /*
12  *  This file was produced by an AutoOpts template.  AutoOpts is a
13  *  copyrighted work.  This header file is not encumbered by AutoOpts
14  *  licensing, but is provided under the licensing terms chosen by the
15  *  sntp author or copyright holder.  AutoOpts is licensed under
16  *  the terms of the LGPL.  The redistributable library (``libopts'') is
17  *  licensed under the terms of either the LGPL or, at the users discretion,
18  *  the BSD license.  See the AutoOpts and/or libopts sources for details.
19  *
20  * This source file is copyrighted and licensed under the following terms:
21  *
22  * sntp copyright 1970-2006 ntp.org - all rights reserved
23  *
24  *         General Public Licence for the software known as MSNTP
25  *         ------------------------------------------------------
26  *
27  * 	  (c) Copyright, N.M. Maclaren, 1996, 1997, 2000
28  * 	  (c) Copyright, University of Cambridge, 1996, 1997, 2000
29  *
30  *
31  *
32  * Free use of MSNTP in source and binary forms is permitted, provided that this
33  * entire licence is duplicated in all copies, and that any documentation,
34  * announcements, and other materials related to use acknowledge that the software
35  * was developed by N.M. Maclaren (hereafter refered to as the Author) at the
36  * University of Cambridge.  Neither the name of the Author nor the University of
37  * Cambridge may be used to endorse or promote products derived from this material
38  * without specific prior written permission.
39  *
40  * The Author and the University of Cambridge retain the copyright and all other
41  * legal rights to the software and make it available non-exclusively.  All users
42  * must ensure that the software in all its derivations carries a copyright notice
43  * in the form:
44  * 	  (c) Copyright N.M. Maclaren,
45  * 	  (c) Copyright University of Cambridge.
46  *
47  *
48  *
49  *                            NO WARRANTY
50  *
51  * Because the MSNTP software is licensed free of charge, the Author and the
52  * University of Cambridge provide absolutely no warranty, either expressed or
53  * implied, including, but not limited to, the implied warranties of
54  * merchantability and fitness for a particular purpose.  The entire risk as to
55  * the quality and performance of the MSNTP software is with you.  Should MSNTP
56  * prove defective, you assume the cost of all necessary servicing or repair.
57  *
58  * In no event, unless required by law, will the Author or the University of
59  * Cambridge, or any other party who may modify and redistribute this software as
60  * permitted in accordance with the provisions below, be liable for damages for
61  * any losses whatsoever, including but not limited to lost profits, lost monies,
62  * lost or corrupted data, or other special, incidental or consequential losses
63  * that may arise out of the use or inability to use the MSNTP software.
64  *
65  *
66  *
67  *                          COPYING POLICY
68  *
69  * Permission is hereby granted for copying and distribution of copies of the
70  * MSNTP source and binary files, and of any part thereof, subject to the
71  * following licence conditions:
72  *
73  * 1. You may distribute MSNTP or components of MSNTP, with or without additions
74  * developed by you or by others.  No charge, other than an "at-cost" distribution
75  * fee, may be charged for copies, derivations, or distributions of this material
76  * without the express written consent of the copyright holders.
77  *
78  * 2. You may also distribute MSNTP along with any other product for sale,
79  * provided that the cost of the bundled package is the same regardless of whether
80  * MSNTP is included or not, and provided that those interested only in MSNTP must
81  * be notified that it is a product freely available from the University of
82  * Cambridge.
83  *
84  * 3. If you distribute MSNTP software or parts of MSNTP, with or without
85  * additions developed by you or others, then you must either make available the
86  * source to all portions of the MSNTP system (exclusive of any additions made by
87  * you or by others) upon request, or instead you may notify anyone requesting
88  * source that it is freely available from the University of Cambridge.
89  *
90  * 4. You may not omit any of the copyright notices on either the source files,
91  * the executable files, or the documentation.
92  *
93  * 5. You may not omit transmission of this License agreement with whatever
94  * portions of MSNTP that are distributed.
95  *
96  * 6. Any users of this software must be notified that it is without warranty or
97  * guarantee of any nature, express or implied, nor is there any fitness for use
98  * represented.
99  *
100  *
101  * October 1996
102  * April 1997
103  * October 2000
104  */
105 /*
106  *  This file contains the programmatic interface to the Automated
107  *  Options generated for the sntp program.
108  *  These macros are documented in the AutoGen info file in the
109  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
110  */
111 #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD
112 #define AUTOOPTS_SNTP_OPTS_H_GUARD
113 #include "config.h"
114 #include <autoopts/options.h>
115 
116 /*
117  *  Ensure that the library used for compiling this generated header is at
118  *  least as new as the version current when the header template was released
119  *  (not counting patch version increments).  Also ensure that the oldest
120  *  tolerable version is at least as old as what was current when the header
121  *  template was released.
122  */
123 #define AO_TEMPLATE_VERSION 118784
124 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
125  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
126 # error option template version mismatches autoopts/options.h header
127   Choke Me.
128 #endif
129 
130 /*
131  *  Enumeration of each option:
132  */
133 typedef enum {
134         INDEX_OPT_IPV4             =  0,
135         INDEX_OPT_IPV6             =  1,
136         INDEX_OPT_UNPRIVPORT       =  2,
137         INDEX_OPT_NORMALVERBOSE    =  3,
138         INDEX_OPT_EXTRAVERBOSE     =  4,
139         INDEX_OPT_MEGAVERBOSE      =  5,
140         INDEX_OPT_SETTIMEOFDAY     =  6,
141         INDEX_OPT_ADJTIME          =  7,
142         INDEX_OPT_VERSION          = 8,
143         INDEX_OPT_HELP             = 9,
144         INDEX_OPT_MORE_HELP        = 10,
145         INDEX_OPT_SAVE_OPTS        = 11,
146         INDEX_OPT_LOAD_OPTS        = 12
147 } teOptIndex;
148 
149 #define OPTION_CT    13
150 #define SNTP_VERSION       "4.2.4p8"
151 #define SNTP_FULL_VERSION  "sntp - standard SNTP program - Ver. 4.2.4p8"
152 
153 /*
154  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
155  *  option name (as in the teOptIndex enumeration above).
156  *  e.g. HAVE_OPT( IPV4 )
157  */
158 #define         DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n])
159 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
160 #define      OPT_ARG(n) (DESC(n).optArg.argString)
161 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
162 #define    COUNT_OPT(n) (DESC(n).optOccCt)
163 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
164 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
165 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
166 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
167 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
168 #define    CLEAR_OPT(n) STMTS( \
169                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
170                 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
171                     DESC(n).fOptState |= OPTST_DISABLED; \
172                 DESC(n).optCookie = NULL )
173 
174 /*
175  *  Make sure there are no #define name conflicts with the option names
176  */
177 #ifndef     NO_OPTION_NAME_WARNINGS
178 # ifdef    IPV4
179 #  warning undefining IPV4 due to option name conflict
180 #  undef   IPV4
181 # endif
182 # ifdef    IPV6
183 #  warning undefining IPV6 due to option name conflict
184 #  undef   IPV6
185 # endif
186 # ifdef    UNPRIVPORT
187 #  warning undefining UNPRIVPORT due to option name conflict
188 #  undef   UNPRIVPORT
189 # endif
190 # ifdef    NORMALVERBOSE
191 #  warning undefining NORMALVERBOSE due to option name conflict
192 #  undef   NORMALVERBOSE
193 # endif
194 # ifdef    EXTRAVERBOSE
195 #  warning undefining EXTRAVERBOSE due to option name conflict
196 #  undef   EXTRAVERBOSE
197 # endif
198 # ifdef    MEGAVERBOSE
199 #  warning undefining MEGAVERBOSE due to option name conflict
200 #  undef   MEGAVERBOSE
201 # endif
202 # ifdef    SETTIMEOFDAY
203 #  warning undefining SETTIMEOFDAY due to option name conflict
204 #  undef   SETTIMEOFDAY
205 # endif
206 # ifdef    ADJTIME
207 #  warning undefining ADJTIME due to option name conflict
208 #  undef   ADJTIME
209 # endif
210 #else  /* NO_OPTION_NAME_WARNINGS */
211 # undef IPV4
212 # undef IPV6
213 # undef UNPRIVPORT
214 # undef NORMALVERBOSE
215 # undef EXTRAVERBOSE
216 # undef MEGAVERBOSE
217 # undef SETTIMEOFDAY
218 # undef ADJTIME
219 #endif  /*  NO_OPTION_NAME_WARNINGS */
220 
221 /*
222  *  Interface defines for specific options.
223  */
224 #define VALUE_OPT_IPV4           '4'
225 #define WHICH_OPT_IPV4           (DESC(IPV4).optActualValue)
226 #define WHICH_IDX_IPV4           (DESC(IPV4).optActualIndex)
227 #define VALUE_OPT_IPV6           '6'
228 #define VALUE_OPT_UNPRIVPORT     'u'
229 #define VALUE_OPT_NORMALVERBOSE  'v'
230 #define VALUE_OPT_EXTRAVERBOSE   'V'
231 #define VALUE_OPT_MEGAVERBOSE    'W'
232 #define VALUE_OPT_SETTIMEOFDAY   'r'
233 #define VALUE_OPT_ADJTIME        'a'
234 
235 #define VALUE_OPT_VERSION       'v'
236 #define VALUE_OPT_HELP          '?'
237 #define VALUE_OPT_MORE_HELP     '!'
238 #define VALUE_OPT_SAVE_OPTS     '>'
239 #define VALUE_OPT_LOAD_OPTS     '<'
240 #define SET_OPT_SAVE_OPTS(a)   STMTS( \
241         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
242         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
243         DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
244 /*
245  *  Interface defines not associated with particular options
246  */
247 #define ERRSKIP_OPTERR  STMTS( sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP )
248 #define ERRSTOP_OPTERR  STMTS( sntpOptions.fOptSet |= OPTPROC_ERRSTOP )
249 #define RESTART_OPT(n)  STMTS( \
250                 sntpOptions.curOptIdx = (n); \
251                 sntpOptions.pzCurOpt  = NULL )
252 #define START_OPT       RESTART_OPT(1)
253 #define USAGE(c)        (*sntpOptions.pUsageProc)( &sntpOptions, c )
254 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
255 
256 /* * * * * *
257  *
258  *  Declare the sntp option descriptor.
259  */
260 #ifdef  __cplusplus
261 extern "C" {
262 #endif
263 
264 extern tOptions   sntpOptions;
265 
266 #ifndef _
267 #  if ENABLE_NLS
268 #    include <stdio.h>
269      static inline char* aoGetsText( char const* pz ) {
270          if (pz == NULL) return NULL;
271          return (char*)gettext( pz );
272      }
273 #    define _(s)  aoGetsText(s)
274 #  else  /* ENABLE_NLS */
275 #    define _(s)  s
276 #  endif /* ENABLE_NLS */
277 #endif
278 
279 #ifdef  __cplusplus
280 }
281 #endif
282 #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */
283 /* sntp-opts.h ends here */
284