ntpsnmpd-opts.h revision 298770
129088Smarkm/*
229088Smarkm *  EDIT THIS FILE WITH CAUTION  (ntpsnmpd-opts.h)
329088Smarkm *
429088Smarkm *  It has been AutoGen-ed  April 26, 2016 at 08:29:43 PM by AutoGen 5.18.5
529088Smarkm *  From the definitions    ntpsnmpd-opts.def
629088Smarkm *  and the template file   options
729088Smarkm *
829088Smarkm * Generated from AutoOpts 41:0:16 templates.
929088Smarkm *
1029088Smarkm *  AutoOpts is a copyrighted work.  This header file is not encumbered
1129088Smarkm *  by AutoOpts licensing, but is provided under the licensing terms chosen
12351432Semaste *  by the ntpsnmpd author or copyright holder.  AutoOpts is
1329088Smarkm *  licensed under the terms of the LGPL.  The redistributable library
1429088Smarkm *  (``libopts'') is licensed under the terms of either the LGPL or, at the
1529088Smarkm *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
1629088Smarkm *  for details.
1729088Smarkm *
1829088Smarkm * The ntpsnmpd program is copyrighted and licensed
1929088Smarkm * under the following terms:
2029088Smarkm *
2129088Smarkm *  Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
2229088Smarkm *  This is free software. It is licensed for use, modification and
2329088Smarkm *  redistribution under the terms of the NTP License, copies of which
2429088Smarkm *  can be seen at:
2529088Smarkm *    <http://ntp.org/license>
2629088Smarkm *    <http://opensource.org/licenses/ntp-license.php>
2729088Smarkm *
2829088Smarkm *  Permission to use, copy, modify, and distribute this software and its
2957414Smarkm *  documentation for any purpose with or without fee is hereby granted,
3029088Smarkm *  provided that the above copyright notice appears in all copies and that
31182419Strhodes *  both the copyright notice and this permission notice appear in
3229088Smarkm *  supporting documentation, and that the name The University of Delaware not be used in
3379528Sru *  advertising or publicity pertaining to distribution of the software
3429088Smarkm *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
3529088Smarkm *  representations about the suitability this software for any purpose. It
3629088Smarkm *  is provided "as is" without express or implied warranty.
3729088Smarkm */
3829088Smarkm/**
3929088Smarkm *  This file contains the programmatic interface to the Automated
4029088Smarkm *  Options generated for the ntpsnmpd program.
41139713Smaxim *  These macros are documented in the AutoGen info file in the
4229088Smarkm *  "AutoOpts" chapter.  Please refer to that doc for usage help.
4329088Smarkm */
4429088Smarkm#ifndef AUTOOPTS_NTPSNMPD_OPTS_H_GUARD
4529088Smarkm#define AUTOOPTS_NTPSNMPD_OPTS_H_GUARD 1
4629088Smarkm#include "config.h"
4731622Scharnier#include <autoopts/options.h>
4829088Smarkm
4929088Smarkm/**
5029088Smarkm *  Ensure that the library used for compiling this generated header is at
5129088Smarkm *  least as new as the version current when the header template was released
5231622Scharnier *  (not counting patch version increments).  Also ensure that the oldest
5329088Smarkm *  tolerable version is at least as old as what was current when the header
5429088Smarkm *  template was released.
5529088Smarkm */
5629088Smarkm#define AO_TEMPLATE_VERSION 167936
5729088Smarkm#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
5829088Smarkm || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
5929088Smarkm# error option template version mismatches autoopts/options.h header
6029088Smarkm  Choke Me.
6129088Smarkm#endif
6229088Smarkm
6329088Smarkm/**
6429088Smarkm *  Enumeration of each option type for ntpsnmpd
6529088Smarkm */
6670890Srutypedef enum {
6729088Smarkm    INDEX_OPT_NOFORK        =  0,
6829088Smarkm    INDEX_OPT_SYSLOG        =  1,
6929088Smarkm    INDEX_OPT_AGENTXSOCKET  =  2,
7031622Scharnier    INDEX_OPT_VERSION       =  3,
7129088Smarkm    INDEX_OPT_HELP          =  4,
7229088Smarkm    INDEX_OPT_MORE_HELP     =  5,
7381965Smarkm    INDEX_OPT_SAVE_OPTS     =  6,
7429088Smarkm    INDEX_OPT_LOAD_OPTS     =  7
7529088Smarkm} teOptIndex;
7631622Scharnier/** count of all options for ntpsnmpd */
7729088Smarkm#define OPTION_CT    8
7829088Smarkm/** ntpsnmpd version */
7929088Smarkm#define NTPSNMPD_VERSION       "4.2.8p7"
8029088Smarkm/** Full ntpsnmpd version text */
8129088Smarkm#define NTPSNMPD_FULL_VERSION  "ntpsnmpd 4.2.8p7"
8231622Scharnier
8329088Smarkm/**
8431622Scharnier *  Interface defines for all options.  Replace "n" with the UPPER_CASED
85139713Smaxim *  option name (as in the teOptIndex enumeration above).
86139713Smaxim *  e.g. HAVE_OPT(NOFORK)
87139713Smaxim */
88139713Smaxim#define         DESC(n) (ntpsnmpdOptions.pOptDesc[INDEX_OPT_## n])
89139713Smaxim/** 'true' if an option has been specified in any way */
90139713Smaxim#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
91139713Smaxim/** The string argument to an option. The argument type must be \"string\". */
92139713Smaxim#define      OPT_ARG(n) (DESC(n).optArg.argString)
9329088Smarkm/** Mask the option state revealing how an option was specified.
9429088Smarkm *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
9529088Smarkm * \a OPTST_DEFINED, \a OPTST_RESET or zero.
9629088Smarkm */
9731622Scharnier#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
9829088Smarkm/** Count of option's occurrances *on the command line*. */
9929088Smarkm#define    COUNT_OPT(n) (DESC(n).optOccCt)
10029088Smarkm/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
10129088Smarkm#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
10231622Scharnier/** 'true' if \a HAVE_OPT would yield 'false'. */
10329088Smarkm#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
10431622Scharnier/** 'true' if OPTST_DISABLED bit not set. */
10531622Scharnier#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
10631622Scharnier/** number of stacked option arguments.
10729088Smarkm *  Valid only for stacked option arguments. */
10829088Smarkm#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
10929088Smarkm/** stacked argument vector.
11029088Smarkm *  Valid only for stacked option arguments. */
11129088Smarkm#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
11231622Scharnier/** Reset an option. */
11329088Smarkm#define    CLEAR_OPT(n) STMTS( \
11429088Smarkm                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
11529088Smarkm                if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
11629088Smarkm                    DESC(n).fOptState |= OPTST_DISABLED; \
11729088Smarkm                DESC(n).optCookie = NULL )
11829088Smarkm/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
11929088Smarkm/**
12029088Smarkm *  Enumeration of ntpsnmpd exit codes
12131622Scharnier */
12229088Smarkmtypedef enum {
12329088Smarkm    NTPSNMPD_EXIT_SUCCESS         = 0,
12429088Smarkm    NTPSNMPD_EXIT_FAILURE         = 1,
12529088Smarkm    NTPSNMPD_EXIT_USAGE_ERROR     = 64,
12629088Smarkm    NTPSNMPD_EXIT_NO_CONFIG_INPUT = 66,
12729088Smarkm    NTPSNMPD_EXIT_LIBOPTS_FAILURE = 70
12831622Scharnier}   ntpsnmpd_exit_code_t;
12929088Smarkm/** @} */
13029088Smarkm/**
13129088Smarkm *  Make sure there are no #define name conflicts with the option names
13229088Smarkm */
13329088Smarkm#ifndef     NO_OPTION_NAME_WARNINGS
13429088Smarkm# ifdef    NOFORK
13529088Smarkm#  warning undefining NOFORK due to option name conflict
13631622Scharnier#  undef   NOFORK
13731622Scharnier# endif
13829088Smarkm# ifdef    SYSLOG
13929088Smarkm#  warning undefining SYSLOG due to option name conflict
14029088Smarkm#  undef   SYSLOG
14129088Smarkm# endif
14229088Smarkm# ifdef    AGENTXSOCKET
143140601Sru#  warning undefining AGENTXSOCKET due to option name conflict
144140601Sru#  undef   AGENTXSOCKET
14531622Scharnier# endif
14629088Smarkm#else  /* NO_OPTION_NAME_WARNINGS */
14729088Smarkm# undef NOFORK
14829088Smarkm# undef SYSLOG
149140601Sru# undef AGENTXSOCKET
150140601Sru#endif  /*  NO_OPTION_NAME_WARNINGS */
15129088Smarkm
15229088Smarkm/**
15329088Smarkm *  Interface defines for specific options.
15429088Smarkm * @{
15529088Smarkm */
15629088Smarkm#define VALUE_OPT_NOFORK         'n'
15729088Smarkm#define VALUE_OPT_SYSLOG         'p'
15831622Scharnier#define VALUE_OPT_AGENTXSOCKET   0x1001
15929088Smarkm/** option flag (value) for help-value option */
16029088Smarkm#define VALUE_OPT_HELP          '?'
16131622Scharnier/** option flag (value) for more-help-value option */
16229088Smarkm#define VALUE_OPT_MORE_HELP     '!'
16381965Smarkm/** option flag (value) for version-value option */
16431622Scharnier#define VALUE_OPT_VERSION       0x1002
16529088Smarkm/** option flag (value) for save-opts-value option */
16629088Smarkm#define VALUE_OPT_SAVE_OPTS     '>'
16731622Scharnier/** option flag (value) for load-opts-value option */
16829088Smarkm#define VALUE_OPT_LOAD_OPTS     '<'
16929088Smarkm#define SET_OPT_SAVE_OPTS(a)   STMTS( \
17029088Smarkm        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
17181965Smarkm        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
17229088Smarkm        DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
17329088Smarkm/*
17429088Smarkm *  Interface defines not associated with particular options
17529088Smarkm */
17631622Scharnier#define ERRSKIP_OPTERR  STMTS(ntpsnmpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
17768965Sru#define ERRSTOP_OPTERR  STMTS(ntpsnmpdOptions.fOptSet |= OPTPROC_ERRSTOP)
17829088Smarkm#define RESTART_OPT(n)  STMTS( \
17931622Scharnier                ntpsnmpdOptions.curOptIdx = (n); \
18029088Smarkm                ntpsnmpdOptions.pzCurOpt  = NULL )
18129088Smarkm#define START_OPT       RESTART_OPT(1)
18229088Smarkm#define USAGE(c)        (*ntpsnmpdOptions.pUsageProc)(&ntpsnmpdOptions, c)
18329088Smarkm
18431622Scharnier#ifdef  __cplusplus
18531622Scharnierextern "C" {
18629088Smarkm#endif
18729088Smarkm
18829088Smarkm
18929088Smarkm/* * * * * *
19029088Smarkm *
19129088Smarkm *  Declare the ntpsnmpd option descriptor.
19231622Scharnier */
19329088Smarkmextern tOptions ntpsnmpdOptions;
19429088Smarkm
19529088Smarkm#if defined(ENABLE_NLS)
19629088Smarkm# ifndef _
19731622Scharnier#   include <stdio.h>
19829088Smarkm#   ifndef HAVE_GETTEXT
19929088Smarkm      extern char * gettext(char const *);
20029088Smarkm#   else
20131622Scharnier#     include <libintl.h>
20229088Smarkm#   endif
203140601Sru
204140601Sru# ifndef ATTRIBUTE_FORMAT_ARG
20529088Smarkm#   define ATTRIBUTE_FORMAT_ARG(_a)
20629088Smarkm# endif
20729088Smarkm
20829088Smarkmstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
20929088Smarkmstatic inline char* aoGetsText(char const* pz) {
21031622Scharnier    if (pz == NULL) return NULL;
21129088Smarkm    return (char*)gettext(pz);
21229088Smarkm}
21329088Smarkm#   define _(s)  aoGetsText(s)
21429088Smarkm# endif /* _() */
21531622Scharnier
21629088Smarkm# define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpsnmpdOptions.fOptSet |= \
21729088Smarkm                                    OPTPROC_NXLAT_OPT_CFG;)
21829088Smarkm# define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpsnmpdOptions.fOptSet |= \
21929088Smarkm                                    OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
22029088Smarkm
22129088Smarkm# define OPT_XLAT_CFG_NAMES     STMTS(ntpsnmpdOptions.fOptSet &= \
22229088Smarkm                                  ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
22329088Smarkm# define OPT_XLAT_OPT_NAMES     STMTS(ntpsnmpdOptions.fOptSet &= \
22429088Smarkm                                  ~OPTPROC_NXLAT_OPT;)
22529088Smarkm
22671899Sru#else   /* ENABLE_NLS */
22729088Smarkm# define OPT_NO_XLAT_CFG_NAMES
22829088Smarkm# define OPT_NO_XLAT_OPT_NAMES
229140601Sru
230140601Sru# define OPT_XLAT_CFG_NAMES
23129088Smarkm# define OPT_XLAT_OPT_NAMES
23229088Smarkm
23329088Smarkm# ifndef _
23429088Smarkm#   define _(_s)  _s
23529088Smarkm# endif
23629088Smarkm#endif  /* ENABLE_NLS */
23729088Smarkm
238140601Sru#ifdef  __cplusplus
239140601Sru}
24031622Scharnier#endif
24129088Smarkm#endif /* AUTOOPTS_NTPSNMPD_OPTS_H_GUARD */
24229088Smarkm
24329088Smarkm/* ntpsnmpd-opts.h ends here */
24429088Smarkm