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