2 * EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.h)
4 * It has been AutoGen-ed January 20, 2016 at 04:19:14 AM by AutoGen 5.18.5
5 * From the definitions ntpsnmpd-opts.def
6 * and the template file options
8 * Generated from AutoOpts 41:0:16 templates.
10 * AutoOpts is a copyrighted work. This header file is not encumbered
11 * by AutoOpts licensing, but is provided under the licensing terms chosen
12 * by the ntpsnmpd author or copyright holder. AutoOpts is
13 * licensed under the terms of the LGPL. The redistributable library
14 * (``libopts'') is licensed under the terms of either the LGPL or, at the
15 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
18 * The ntpsnmpd program is copyrighted and licensed
19 * under the following terms:
21 * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
22 * This is free software. It is licensed for use, modification and
23 * redistribution under the terms of the NTP License, copies of which
25 * <http://ntp.org/license>
26 * <http://opensource.org/licenses/ntp-license.php>
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose with or without fee is hereby granted,
30 * provided that the above copyright notice appears in all copies and that
31 * both the copyright notice and this permission notice appear in
32 * supporting documentation, and that the name The University of Delaware not be used in
33 * advertising or publicity pertaining to distribution of the software
34 * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35 * representations about the suitability this software for any purpose. It
36 * is provided "as is" without express or implied warranty.
39 * This file contains the programmatic interface to the Automated
40 * Options generated for the ntpsnmpd program.
41 * These macros are documented in the AutoGen info file in the
42 * "AutoOpts" chapter. Please refer to that doc for usage help.
44 #ifndef AUTOOPTS_NTPSNMPD_OPTS_H_GUARD
45 #define AUTOOPTS_NTPSNMPD_OPTS_H_GUARD 1
47 #include <autoopts/options.h>
50 * Ensure that the library used for compiling this generated header is at
51 * least as new as the version current when the header template was released
52 * (not counting patch version increments). Also ensure that the oldest
53 * tolerable version is at least as old as what was current when the header
54 * template was released.
56 #define AO_TEMPLATE_VERSION 167936
57 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59 # error option template version mismatches autoopts/options.h header
64 * Enumeration of each option type for ntpsnmpd
69 INDEX_OPT_AGENTXSOCKET = 2,
70 INDEX_OPT_VERSION = 3,
72 INDEX_OPT_MORE_HELP = 5,
73 INDEX_OPT_SAVE_OPTS = 6,
74 INDEX_OPT_LOAD_OPTS = 7
76 /** count of all options for ntpsnmpd */
78 /** ntpsnmpd version */
79 #define NTPSNMPD_VERSION "4.2.8p6"
80 /** Full ntpsnmpd version text */
81 #define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p6"
84 * Interface defines for all options. Replace "n" with the UPPER_CASED
85 * option name (as in the teOptIndex enumeration above).
86 * e.g. HAVE_OPT(NOFORK)
88 #define DESC(n) (ntpsnmpdOptions.pOptDesc[INDEX_OPT_## n])
89 /** 'true' if an option has been specified in any way */
90 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
91 /** The string argument to an option. The argument type must be \"string\". */
92 #define OPT_ARG(n) (DESC(n).optArg.argString)
93 /** Mask the option state revealing how an option was specified.
94 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
95 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
97 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
98 /** Count of option's occurrances *on the command line*. */
99 #define COUNT_OPT(n) (DESC(n).optOccCt)
100 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
101 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
102 /** 'true' if \a HAVE_OPT would yield 'false'. */
103 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
104 /** 'true' if OPTST_DISABLED bit not set. */
105 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
106 /** number of stacked option arguments.
107 * Valid only for stacked option arguments. */
108 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
109 /** stacked argument vector.
110 * Valid only for stacked option arguments. */
111 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
112 /** Reset an option. */
113 #define CLEAR_OPT(n) STMTS( \
114 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
115 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
116 DESC(n).fOptState |= OPTST_DISABLED; \
117 DESC(n).optCookie = NULL )
118 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120 * Enumeration of ntpsnmpd exit codes
123 NTPSNMPD_EXIT_SUCCESS = 0,
124 NTPSNMPD_EXIT_FAILURE = 1,
125 NTPSNMPD_EXIT_USAGE_ERROR = 64,
126 NTPSNMPD_EXIT_NO_CONFIG_INPUT = 66,
127 NTPSNMPD_EXIT_LIBOPTS_FAILURE = 70
128 } ntpsnmpd_exit_code_t;
131 * Make sure there are no #define name conflicts with the option names
133 #ifndef NO_OPTION_NAME_WARNINGS
135 # warning undefining NOFORK due to option name conflict
139 # warning undefining SYSLOG due to option name conflict
143 # warning undefining AGENTXSOCKET due to option name conflict
146 #else /* NO_OPTION_NAME_WARNINGS */
150 #endif /* NO_OPTION_NAME_WARNINGS */
153 * Interface defines for specific options.
156 #define VALUE_OPT_NOFORK 'n'
157 #define VALUE_OPT_SYSLOG 'p'
158 #define VALUE_OPT_AGENTXSOCKET 0x1001
159 /** option flag (value) for help-value option */
160 #define VALUE_OPT_HELP '?'
161 /** option flag (value) for more-help-value option */
162 #define VALUE_OPT_MORE_HELP '!'
163 /** option flag (value) for version-value option */
164 #define VALUE_OPT_VERSION 0x1002
165 /** option flag (value) for save-opts-value option */
166 #define VALUE_OPT_SAVE_OPTS '>'
167 /** option flag (value) for load-opts-value option */
168 #define VALUE_OPT_LOAD_OPTS '<'
169 #define SET_OPT_SAVE_OPTS(a) STMTS( \
170 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
171 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
172 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
174 * Interface defines not associated with particular options
176 #define ERRSKIP_OPTERR STMTS(ntpsnmpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
177 #define ERRSTOP_OPTERR STMTS(ntpsnmpdOptions.fOptSet |= OPTPROC_ERRSTOP)
178 #define RESTART_OPT(n) STMTS( \
179 ntpsnmpdOptions.curOptIdx = (n); \
180 ntpsnmpdOptions.pzCurOpt = NULL )
181 #define START_OPT RESTART_OPT(1)
182 #define USAGE(c) (*ntpsnmpdOptions.pUsageProc)(&ntpsnmpdOptions, c)
191 * Declare the ntpsnmpd option descriptor.
193 extern tOptions ntpsnmpdOptions;
195 #if defined(ENABLE_NLS)
198 # ifndef HAVE_GETTEXT
199 extern char * gettext(char const *);
201 # include <libintl.h>
204 # ifndef ATTRIBUTE_FORMAT_ARG
205 # define ATTRIBUTE_FORMAT_ARG(_a)
208 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
209 static inline char* aoGetsText(char const* pz) {
210 if (pz == NULL) return NULL;
211 return (char*)gettext(pz);
213 # define _(s) aoGetsText(s)
216 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntpsnmpdOptions.fOptSet |= \
217 OPTPROC_NXLAT_OPT_CFG;)
218 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntpsnmpdOptions.fOptSet |= \
219 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
221 # define OPT_XLAT_CFG_NAMES STMTS(ntpsnmpdOptions.fOptSet &= \
222 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
223 # define OPT_XLAT_OPT_NAMES STMTS(ntpsnmpdOptions.fOptSet &= \
226 #else /* ENABLE_NLS */
227 # define OPT_NO_XLAT_CFG_NAMES
228 # define OPT_NO_XLAT_OPT_NAMES
230 # define OPT_XLAT_CFG_NAMES
231 # define OPT_XLAT_OPT_NAMES
236 #endif /* ENABLE_NLS */
241 #endif /* AUTOOPTS_NTPSNMPD_OPTS_H_GUARD */
243 /* ntpsnmpd-opts.h ends here */