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