1280849Scy/*
2258945Sroberto *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.h)
3280849Scy *
4330567Sgordon *  It has been AutoGen-ed  February 27, 2018 at 05:15:31 PM by AutoGen 5.18.5
5258945Sroberto *  From the definitions    ntpsnmpd-opts.def
6258945Sroberto *  and the template file   options
7258945Sroberto *
8280849Scy * Generated from AutoOpts 41:0:16 templates.
9258945Sroberto *
10258945Sroberto *  AutoOpts is a copyrighted work.  This header file is not encumbered
11258945Sroberto *  by AutoOpts licensing, but is provided under the licensing terms chosen
12258945Sroberto *  by the ntpsnmpd author or copyright holder.  AutoOpts is
13258945Sroberto *  licensed under the terms of the LGPL.  The redistributable library
14258945Sroberto *  (``libopts'') is licensed under the terms of either the LGPL or, at the
15258945Sroberto *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
16258945Sroberto *  for details.
17258945Sroberto *
18280849Scy * The ntpsnmpd program is copyrighted and licensed
19280849Scy * under the following terms:
20258945Sroberto *
21316722Sdelphij *  Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.
22280849Scy *  This is free software. It is licensed for use, modification and
23280849Scy *  redistribution under the terms of the NTP License, copies of which
24280849Scy *  can be seen at:
25280849Scy *    <http://ntp.org/license>
26280849Scy *    <http://opensource.org/licenses/ntp-license.php>
27280849Scy *
28280849Scy *  Permission to use, copy, modify, and distribute this software and its
29280849Scy *  documentation for any purpose with or without fee is hereby granted,
30280849Scy *  provided that the above copyright notice appears in all copies and that
31280849Scy *  both the copyright notice and this permission notice appear in
32280849Scy *  supporting documentation, and that the name The University of Delaware not be used in
33280849Scy *  advertising or publicity pertaining to distribution of the software
34280849Scy *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35280849Scy *  representations about the suitability this software for any purpose. It
36280849Scy *  is provided "as is" without express or implied warranty.
37258945Sroberto */
38280849Scy/**
39258945Sroberto *  This file contains the programmatic interface to the Automated
40258945Sroberto *  Options generated for the ntpsnmpd program.
41258945Sroberto *  These macros are documented in the AutoGen info file in the
42258945Sroberto *  "AutoOpts" chapter.  Please refer to that doc for usage help.
43258945Sroberto */
44258945Sroberto#ifndef AUTOOPTS_NTPSNMPD_OPTS_H_GUARD
45258945Sroberto#define AUTOOPTS_NTPSNMPD_OPTS_H_GUARD 1
46258945Sroberto#include "config.h"
47258945Sroberto#include <autoopts/options.h>
48258945Sroberto
49280849Scy/**
50258945Sroberto *  Ensure that the library used for compiling this generated header is at
51258945Sroberto *  least as new as the version current when the header template was released
52258945Sroberto *  (not counting patch version increments).  Also ensure that the oldest
53258945Sroberto *  tolerable version is at least as old as what was current when the header
54258945Sroberto *  template was released.
55258945Sroberto */
56280849Scy#define AO_TEMPLATE_VERSION 167936
57258945Sroberto#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58258945Sroberto || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59258945Sroberto# error option template version mismatches autoopts/options.h header
60258945Sroberto  Choke Me.
61258945Sroberto#endif
62258945Sroberto
63280849Scy/**
64280849Scy *  Enumeration of each option type for ntpsnmpd
65258945Sroberto */
66258945Srobertotypedef enum {
67258945Sroberto    INDEX_OPT_NOFORK        =  0,
68258945Sroberto    INDEX_OPT_SYSLOG        =  1,
69258945Sroberto    INDEX_OPT_AGENTXSOCKET  =  2,
70258945Sroberto    INDEX_OPT_VERSION       =  3,
71258945Sroberto    INDEX_OPT_HELP          =  4,
72258945Sroberto    INDEX_OPT_MORE_HELP     =  5,
73258945Sroberto    INDEX_OPT_SAVE_OPTS     =  6,
74258945Sroberto    INDEX_OPT_LOAD_OPTS     =  7
75258945Sroberto} teOptIndex;
76280849Scy/** count of all options for ntpsnmpd */
77258945Sroberto#define OPTION_CT    8
78280849Scy/** ntpsnmpd version */
79330567Sgordon#define NTPSNMPD_VERSION       "4.2.8p11"
80280849Scy/** Full ntpsnmpd version text */
81330567Sgordon#define NTPSNMPD_FULL_VERSION  "ntpsnmpd 4.2.8p11"
82258945Sroberto
83280849Scy/**
84258945Sroberto *  Interface defines for all options.  Replace "n" with the UPPER_CASED
85258945Sroberto *  option name (as in the teOptIndex enumeration above).
86258945Sroberto *  e.g. HAVE_OPT(NOFORK)
87258945Sroberto */
88258945Sroberto#define         DESC(n) (ntpsnmpdOptions.pOptDesc[INDEX_OPT_## n])
89280849Scy/** 'true' if an option has been specified in any way */
90258945Sroberto#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
91280849Scy/** The string argument to an option. The argument type must be \"string\". */
92258945Sroberto#define      OPT_ARG(n) (DESC(n).optArg.argString)
93280849Scy/** Mask the option state revealing how an option was specified.
94280849Scy *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
95280849Scy * \a OPTST_DEFINED, \a OPTST_RESET or zero.
96280849Scy */
97258945Sroberto#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
98280849Scy/** Count of option's occurrances *on the command line*. */
99258945Sroberto#define    COUNT_OPT(n) (DESC(n).optOccCt)
100280849Scy/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
101258945Sroberto#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
102280849Scy/** 'true' if \a HAVE_OPT would yield 'false'. */
103258945Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
104280849Scy/** 'true' if OPTST_DISABLED bit not set. */
105258945Sroberto#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
106280849Scy/** number of stacked option arguments.
107280849Scy *  Valid only for stacked option arguments. */
108258945Sroberto#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
109280849Scy/** stacked argument vector.
110280849Scy *  Valid only for stacked option arguments. */
111258945Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
112280849Scy/** Reset an option. */
113258945Sroberto#define    CLEAR_OPT(n) STMTS( \
114258945Sroberto                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
115258945Sroberto                if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
116258945Sroberto                    DESC(n).fOptState |= OPTST_DISABLED; \
117258945Sroberto                DESC(n).optCookie = NULL )
118280849Scy/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
119280849Scy/**
120258945Sroberto *  Enumeration of ntpsnmpd exit codes
121258945Sroberto */
122258945Srobertotypedef enum {
123280849Scy    NTPSNMPD_EXIT_SUCCESS         = 0,
124280849Scy    NTPSNMPD_EXIT_FAILURE         = 1,
125280849Scy    NTPSNMPD_EXIT_USAGE_ERROR     = 64,
126280849Scy    NTPSNMPD_EXIT_NO_CONFIG_INPUT = 66,
127280849Scy    NTPSNMPD_EXIT_LIBOPTS_FAILURE = 70
128280849Scy}   ntpsnmpd_exit_code_t;
129280849Scy/** @} */
130280849Scy/**
131258945Sroberto *  Make sure there are no #define name conflicts with the option names
132258945Sroberto */
133258945Sroberto#ifndef     NO_OPTION_NAME_WARNINGS
134258945Sroberto# ifdef    NOFORK
135258945Sroberto#  warning undefining NOFORK due to option name conflict
136258945Sroberto#  undef   NOFORK
137258945Sroberto# endif
138258945Sroberto# ifdef    SYSLOG
139258945Sroberto#  warning undefining SYSLOG due to option name conflict
140258945Sroberto#  undef   SYSLOG
141258945Sroberto# endif
142258945Sroberto# ifdef    AGENTXSOCKET
143258945Sroberto#  warning undefining AGENTXSOCKET due to option name conflict
144258945Sroberto#  undef   AGENTXSOCKET
145258945Sroberto# endif
146258945Sroberto#else  /* NO_OPTION_NAME_WARNINGS */
147258945Sroberto# undef NOFORK
148258945Sroberto# undef SYSLOG
149258945Sroberto# undef AGENTXSOCKET
150258945Sroberto#endif  /*  NO_OPTION_NAME_WARNINGS */
151258945Sroberto
152280849Scy/**
153258945Sroberto *  Interface defines for specific options.
154280849Scy * @{
155258945Sroberto */
156258945Sroberto#define VALUE_OPT_NOFORK         'n'
157258945Sroberto#define VALUE_OPT_SYSLOG         'p'
158280849Scy#define VALUE_OPT_AGENTXSOCKET   0x1001
159280849Scy/** option flag (value) for help-value option */
160258945Sroberto#define VALUE_OPT_HELP          '?'
161280849Scy/** option flag (value) for more-help-value option */
162258945Sroberto#define VALUE_OPT_MORE_HELP     '!'
163280849Scy/** option flag (value) for version-value option */
164280849Scy#define VALUE_OPT_VERSION       0x1002
165280849Scy/** option flag (value) for save-opts-value option */
166258945Sroberto#define VALUE_OPT_SAVE_OPTS     '>'
167280849Scy/** option flag (value) for load-opts-value option */
168258945Sroberto#define VALUE_OPT_LOAD_OPTS     '<'
169258945Sroberto#define SET_OPT_SAVE_OPTS(a)   STMTS( \
170258945Sroberto        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
171258945Sroberto        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
172280849Scy        DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
173258945Sroberto/*
174258945Sroberto *  Interface defines not associated with particular options
175258945Sroberto */
176258945Sroberto#define ERRSKIP_OPTERR  STMTS(ntpsnmpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
177258945Sroberto#define ERRSTOP_OPTERR  STMTS(ntpsnmpdOptions.fOptSet |= OPTPROC_ERRSTOP)
178258945Sroberto#define RESTART_OPT(n)  STMTS( \
179258945Sroberto                ntpsnmpdOptions.curOptIdx = (n); \
180280849Scy                ntpsnmpdOptions.pzCurOpt  = NULL )
181258945Sroberto#define START_OPT       RESTART_OPT(1)
182258945Sroberto#define USAGE(c)        (*ntpsnmpdOptions.pUsageProc)(&ntpsnmpdOptions, c)
183258945Sroberto
184258945Sroberto#ifdef  __cplusplus
185258945Srobertoextern "C" {
186258945Sroberto#endif
187258945Sroberto
188280849Scy
189258945Sroberto/* * * * * *
190258945Sroberto *
191258945Sroberto *  Declare the ntpsnmpd option descriptor.
192258945Sroberto */
193258945Srobertoextern tOptions ntpsnmpdOptions;
194258945Sroberto
195258945Sroberto#if defined(ENABLE_NLS)
196258945Sroberto# ifndef _
197258945Sroberto#   include <stdio.h>
198280849Scy#   ifndef HAVE_GETTEXT
199280849Scy      extern char * gettext(char const *);
200280849Scy#   else
201280849Scy#     include <libintl.h>
202280849Scy#   endif
203280849Scy
204280849Scy# ifndef ATTRIBUTE_FORMAT_ARG
205280849Scy#   define ATTRIBUTE_FORMAT_ARG(_a)
206280849Scy# endif
207280849Scy
208280849Scystatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
209258945Srobertostatic inline char* aoGetsText(char const* pz) {
210258945Sroberto    if (pz == NULL) return NULL;
211258945Sroberto    return (char*)gettext(pz);
212258945Sroberto}
213258945Sroberto#   define _(s)  aoGetsText(s)
214258945Sroberto# endif /* _() */
215258945Sroberto
216258945Sroberto# define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpsnmpdOptions.fOptSet |= \
217258945Sroberto                                    OPTPROC_NXLAT_OPT_CFG;)
218258945Sroberto# define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpsnmpdOptions.fOptSet |= \
219258945Sroberto                                    OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
220258945Sroberto
221258945Sroberto# define OPT_XLAT_CFG_NAMES     STMTS(ntpsnmpdOptions.fOptSet &= \
222258945Sroberto                                  ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
223258945Sroberto# define OPT_XLAT_OPT_NAMES     STMTS(ntpsnmpdOptions.fOptSet &= \
224258945Sroberto                                  ~OPTPROC_NXLAT_OPT;)
225258945Sroberto
226258945Sroberto#else   /* ENABLE_NLS */
227258945Sroberto# define OPT_NO_XLAT_CFG_NAMES
228258945Sroberto# define OPT_NO_XLAT_OPT_NAMES
229258945Sroberto
230258945Sroberto# define OPT_XLAT_CFG_NAMES
231258945Sroberto# define OPT_XLAT_OPT_NAMES
232258945Sroberto
233258945Sroberto# ifndef _
234258945Sroberto#   define _(_s)  _s
235258945Sroberto# endif
236258945Sroberto#endif  /* ENABLE_NLS */
237258945Sroberto
238258945Sroberto#ifdef  __cplusplus
239258945Sroberto}
240258945Sroberto#endif
241258945Sroberto#endif /* AUTOOPTS_NTPSNMPD_OPTS_H_GUARD */
242280849Scy
243258945Sroberto/* ntpsnmpd-opts.h ends here */
244