1 /* 2 * EDIT THIS FILE WITH CAUTION (ntpd-opts.h) 3 * 4 * It has been AutoGen-ed October 21, 2015 at 12:35:59 PM by AutoGen 5.18.5 5 * From the definitions ntpd-opts.def 6 * and the template file options 7 * 8 * Generated from AutoOpts 41:0:16 templates. 9 * 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 ntpd 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 16 * for details. 17 * 18 * The ntpd program is copyrighted and licensed 19 * under the following terms: 20 * 21 * Copyright (C) 1992-2015 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 24 * can be seen at: 25 * <http://ntp.org/license> 26 * <http://opensource.org/licenses/ntp-license.php> 27 * 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. 37 */ 38 /** 39 * This file contains the programmatic interface to the Automated 40 * Options generated for the ntpd program. 41 * These macros are documented in the AutoGen info file in the 42 * "AutoOpts" chapter. Please refer to that doc for usage help. 43 */ 44 #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD 45 #define AUTOOPTS_NTPD_OPTS_H_GUARD 1 46 #include "config.h" 47 #include <autoopts/options.h> 48 49 /** 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. 55 */ 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 60 Choke Me. 61 #endif 62 63 /** 64 * Enumeration of each option type for ntpd 65 */ 66 typedef enum { 67 INDEX_OPT_IPV4 = 0, 68 INDEX_OPT_IPV6 = 1, 69 INDEX_OPT_AUTHREQ = 2, 70 INDEX_OPT_AUTHNOREQ = 3, 71 INDEX_OPT_BCASTSYNC = 4, 72 INDEX_OPT_CONFIGFILE = 5, 73 INDEX_OPT_DEBUG_LEVEL = 6, 74 INDEX_OPT_SET_DEBUG_LEVEL = 7, 75 INDEX_OPT_DRIFTFILE = 8, 76 INDEX_OPT_PANICGATE = 9, 77 INDEX_OPT_FORCE_STEP_ONCE = 10, 78 INDEX_OPT_JAILDIR = 11, 79 INDEX_OPT_INTERFACE = 12, 80 INDEX_OPT_KEYFILE = 13, 81 INDEX_OPT_LOGFILE = 14, 82 INDEX_OPT_NOVIRTUALIPS = 15, 83 INDEX_OPT_MODIFYMMTIMER = 16, 84 INDEX_OPT_NOFORK = 17, 85 INDEX_OPT_NICE = 18, 86 INDEX_OPT_PIDFILE = 19, 87 INDEX_OPT_PRIORITY = 20, 88 INDEX_OPT_QUIT = 21, 89 INDEX_OPT_PROPAGATIONDELAY = 22, 90 INDEX_OPT_SAVECONFIGQUIT = 23, 91 INDEX_OPT_STATSDIR = 24, 92 INDEX_OPT_TRUSTEDKEY = 25, 93 INDEX_OPT_USER = 26, 94 INDEX_OPT_UPDATEINTERVAL = 27, 95 INDEX_OPT_VAR = 28, 96 INDEX_OPT_DVAR = 29, 97 INDEX_OPT_WAIT_SYNC = 30, 98 INDEX_OPT_SLEW = 31, 99 INDEX_OPT_USEPCC = 32, 100 INDEX_OPT_PCCFREQ = 33, 101 INDEX_OPT_MDNS = 34, 102 INDEX_OPT_VERSION = 35, 103 INDEX_OPT_HELP = 36, 104 INDEX_OPT_MORE_HELP = 37 105 } teOptIndex; 106 /** count of all options for ntpd */ 107 #define OPTION_CT 38 108 /** ntpd version */ 109 #define NTPD_VERSION "4.2.8p4" 110 /** Full ntpd version text */ 111 #define NTPD_FULL_VERSION "ntpd 4.2.8p4" 112 113 /** 114 * Interface defines for all options. Replace "n" with the UPPER_CASED 115 * option name (as in the teOptIndex enumeration above). 116 * e.g. HAVE_OPT(IPV4) 117 */ 118 #define DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n]) 119 /** 'true' if an option has been specified in any way */ 120 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 121 /** The string argument to an option. The argument type must be \"string\". */ 122 #define OPT_ARG(n) (DESC(n).optArg.argString) 123 /** Mask the option state revealing how an option was specified. 124 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 125 * \a OPTST_DEFINED, \a OPTST_RESET or zero. 126 */ 127 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 128 /** Count of option's occurrances *on the command line*. */ 129 #define COUNT_OPT(n) (DESC(n).optOccCt) 130 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 131 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 132 /** 'true' if \a HAVE_OPT would yield 'false'. */ 133 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 134 /** 'true' if OPTST_DISABLED bit not set. */ 135 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 136 /** number of stacked option arguments. 137 * Valid only for stacked option arguments. */ 138 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 139 /** stacked argument vector. 140 * Valid only for stacked option arguments. */ 141 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 142 /** Reset an option. */ 143 #define CLEAR_OPT(n) STMTS( \ 144 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 145 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 146 DESC(n).fOptState |= OPTST_DISABLED; \ 147 DESC(n).optCookie = NULL ) 148 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 149 /** 150 * Enumeration of ntpd exit codes 151 */ 152 typedef enum { 153 NTPD_EXIT_SUCCESS = 0, 154 NTPD_EXIT_FAILURE = 1, 155 NTPD_EXIT_USAGE_ERROR = 64, 156 NTPD_EXIT_LIBOPTS_FAILURE = 70 157 } ntpd_exit_code_t; 158 /** @} */ 159 /** 160 * Make sure there are no #define name conflicts with the option names 161 */ 162 #ifndef NO_OPTION_NAME_WARNINGS 163 # ifdef IPV4 164 # warning undefining IPV4 due to option name conflict 165 # undef IPV4 166 # endif 167 # ifdef IPV6 168 # warning undefining IPV6 due to option name conflict 169 # undef IPV6 170 # endif 171 # ifdef AUTHREQ 172 # warning undefining AUTHREQ due to option name conflict 173 # undef AUTHREQ 174 # endif 175 # ifdef AUTHNOREQ 176 # warning undefining AUTHNOREQ due to option name conflict 177 # undef AUTHNOREQ 178 # endif 179 # ifdef BCASTSYNC 180 # warning undefining BCASTSYNC due to option name conflict 181 # undef BCASTSYNC 182 # endif 183 # ifdef CONFIGFILE 184 # warning undefining CONFIGFILE due to option name conflict 185 # undef CONFIGFILE 186 # endif 187 # ifdef DEBUG_LEVEL 188 # warning undefining DEBUG_LEVEL due to option name conflict 189 # undef DEBUG_LEVEL 190 # endif 191 # ifdef SET_DEBUG_LEVEL 192 # warning undefining SET_DEBUG_LEVEL due to option name conflict 193 # undef SET_DEBUG_LEVEL 194 # endif 195 # ifdef DRIFTFILE 196 # warning undefining DRIFTFILE due to option name conflict 197 # undef DRIFTFILE 198 # endif 199 # ifdef PANICGATE 200 # warning undefining PANICGATE due to option name conflict 201 # undef PANICGATE 202 # endif 203 # ifdef FORCE_STEP_ONCE 204 # warning undefining FORCE_STEP_ONCE due to option name conflict 205 # undef FORCE_STEP_ONCE 206 # endif 207 # ifdef JAILDIR 208 # warning undefining JAILDIR due to option name conflict 209 # undef JAILDIR 210 # endif 211 # ifdef INTERFACE 212 # warning undefining INTERFACE due to option name conflict 213 # undef INTERFACE 214 # endif 215 # ifdef KEYFILE 216 # warning undefining KEYFILE due to option name conflict 217 # undef KEYFILE 218 # endif 219 # ifdef LOGFILE 220 # warning undefining LOGFILE due to option name conflict 221 # undef LOGFILE 222 # endif 223 # ifdef NOVIRTUALIPS 224 # warning undefining NOVIRTUALIPS due to option name conflict 225 # undef NOVIRTUALIPS 226 # endif 227 # ifdef MODIFYMMTIMER 228 # warning undefining MODIFYMMTIMER due to option name conflict 229 # undef MODIFYMMTIMER 230 # endif 231 # ifdef NOFORK 232 # warning undefining NOFORK due to option name conflict 233 # undef NOFORK 234 # endif 235 # ifdef NICE 236 # warning undefining NICE due to option name conflict 237 # undef NICE 238 # endif 239 # ifdef PIDFILE 240 # warning undefining PIDFILE due to option name conflict 241 # undef PIDFILE 242 # endif 243 # ifdef PRIORITY 244 # warning undefining PRIORITY due to option name conflict 245 # undef PRIORITY 246 # endif 247 # ifdef QUIT 248 # warning undefining QUIT due to option name conflict 249 # undef QUIT 250 # endif 251 # ifdef PROPAGATIONDELAY 252 # warning undefining PROPAGATIONDELAY due to option name conflict 253 # undef PROPAGATIONDELAY 254 # endif 255 # ifdef SAVECONFIGQUIT 256 # warning undefining SAVECONFIGQUIT due to option name conflict 257 # undef SAVECONFIGQUIT 258 # endif 259 # ifdef STATSDIR 260 # warning undefining STATSDIR due to option name conflict 261 # undef STATSDIR 262 # endif 263 # ifdef TRUSTEDKEY 264 # warning undefining TRUSTEDKEY due to option name conflict 265 # undef TRUSTEDKEY 266 # endif 267 # ifdef USER 268 # warning undefining USER due to option name conflict 269 # undef USER 270 # endif 271 # ifdef UPDATEINTERVAL 272 # warning undefining UPDATEINTERVAL due to option name conflict 273 # undef UPDATEINTERVAL 274 # endif 275 # ifdef VAR 276 # warning undefining VAR due to option name conflict 277 # undef VAR 278 # endif 279 # ifdef DVAR 280 # warning undefining DVAR due to option name conflict 281 # undef DVAR 282 # endif 283 # ifdef WAIT_SYNC 284 # warning undefining WAIT_SYNC due to option name conflict 285 # undef WAIT_SYNC 286 # endif 287 # ifdef SLEW 288 # warning undefining SLEW due to option name conflict 289 # undef SLEW 290 # endif 291 # ifdef USEPCC 292 # warning undefining USEPCC due to option name conflict 293 # undef USEPCC 294 # endif 295 # ifdef PCCFREQ 296 # warning undefining PCCFREQ due to option name conflict 297 # undef PCCFREQ 298 # endif 299 # ifdef MDNS 300 # warning undefining MDNS due to option name conflict 301 # undef MDNS 302 # endif 303 #else /* NO_OPTION_NAME_WARNINGS */ 304 # undef IPV4 305 # undef IPV6 306 # undef AUTHREQ 307 # undef AUTHNOREQ 308 # undef BCASTSYNC 309 # undef CONFIGFILE 310 # undef DEBUG_LEVEL 311 # undef SET_DEBUG_LEVEL 312 # undef DRIFTFILE 313 # undef PANICGATE 314 # undef FORCE_STEP_ONCE 315 # undef JAILDIR 316 # undef INTERFACE 317 # undef KEYFILE 318 # undef LOGFILE 319 # undef NOVIRTUALIPS 320 # undef MODIFYMMTIMER 321 # undef NOFORK 322 # undef NICE 323 # undef PIDFILE 324 # undef PRIORITY 325 # undef QUIT 326 # undef PROPAGATIONDELAY 327 # undef SAVECONFIGQUIT 328 # undef STATSDIR 329 # undef TRUSTEDKEY 330 # undef USER 331 # undef UPDATEINTERVAL 332 # undef VAR 333 # undef DVAR 334 # undef WAIT_SYNC 335 # undef SLEW 336 # undef USEPCC 337 # undef PCCFREQ 338 # undef MDNS 339 #endif /* NO_OPTION_NAME_WARNINGS */ 340 341 /** 342 * Interface defines for specific options. 343 * @{ 344 */ 345 #define VALUE_OPT_IPV4 '4' 346 #define VALUE_OPT_IPV6 '6' 347 #define VALUE_OPT_AUTHREQ 'a' 348 #define VALUE_OPT_AUTHNOREQ 'A' 349 #define VALUE_OPT_BCASTSYNC 'b' 350 #define VALUE_OPT_CONFIGFILE 'c' 351 #define VALUE_OPT_DEBUG_LEVEL 'd' 352 #define VALUE_OPT_SET_DEBUG_LEVEL 'D' 353 354 #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 355 #define VALUE_OPT_DRIFTFILE 'f' 356 #define VALUE_OPT_PANICGATE 'g' 357 #define VALUE_OPT_FORCE_STEP_ONCE 'G' 358 #define VALUE_OPT_JAILDIR 'i' 359 #define VALUE_OPT_INTERFACE 'I' 360 #define VALUE_OPT_KEYFILE 'k' 361 #define VALUE_OPT_LOGFILE 'l' 362 #define VALUE_OPT_NOVIRTUALIPS 'L' 363 #define VALUE_OPT_MODIFYMMTIMER 'M' 364 #define VALUE_OPT_NOFORK 'n' 365 #define VALUE_OPT_NICE 'N' 366 #define VALUE_OPT_PIDFILE 'p' 367 #define VALUE_OPT_PRIORITY 'P' 368 369 #define OPT_VALUE_PRIORITY (DESC(PRIORITY).optArg.argInt) 370 #define VALUE_OPT_QUIT 'q' 371 #define VALUE_OPT_PROPAGATIONDELAY 'r' 372 #define VALUE_OPT_SAVECONFIGQUIT 0x1001 373 #define VALUE_OPT_STATSDIR 's' 374 #define VALUE_OPT_TRUSTEDKEY 't' 375 #define VALUE_OPT_USER 'u' 376 #define VALUE_OPT_UPDATEINTERVAL 'U' 377 378 #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt) 379 #define VALUE_OPT_VAR 0x1002 380 #define VALUE_OPT_DVAR 0x1003 381 #define VALUE_OPT_WAIT_SYNC 'w' 382 #ifdef HAVE_WORKING_FORK 383 #define OPT_VALUE_WAIT_SYNC (DESC(WAIT_SYNC).optArg.argInt) 384 #endif /* HAVE_WORKING_FORK */ 385 #define VALUE_OPT_SLEW 'x' 386 #define VALUE_OPT_USEPCC 0x1004 387 #define VALUE_OPT_PCCFREQ 0x1005 388 #define VALUE_OPT_MDNS 'm' 389 /** option flag (value) for help-value option */ 390 #define VALUE_OPT_HELP '?' 391 /** option flag (value) for more-help-value option */ 392 #define VALUE_OPT_MORE_HELP '!' 393 /** option flag (value) for version-value option */ 394 #define VALUE_OPT_VERSION 0x1006 395 /* 396 * Interface defines not associated with particular options 397 */ 398 #define ERRSKIP_OPTERR STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP) 399 #define ERRSTOP_OPTERR STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP) 400 #define RESTART_OPT(n) STMTS( \ 401 ntpdOptions.curOptIdx = (n); \ 402 ntpdOptions.pzCurOpt = NULL ) 403 #define START_OPT RESTART_OPT(1) 404 #define USAGE(c) (*ntpdOptions.pUsageProc)(&ntpdOptions, c) 405 406 #ifdef __cplusplus 407 extern "C" { 408 #endif 409 410 411 /* * * * * * 412 * 413 * Declare the ntpd option descriptor. 414 */ 415 extern tOptions ntpdOptions; 416 417 #if defined(ENABLE_NLS) 418 # ifndef _ 419 # include <stdio.h> 420 # ifndef HAVE_GETTEXT 421 extern char * gettext(char const *); 422 # else 423 # include <libintl.h> 424 # endif 425 426 # ifndef ATTRIBUTE_FORMAT_ARG 427 # define ATTRIBUTE_FORMAT_ARG(_a) 428 # endif 429 430 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 431 static inline char* aoGetsText(char const* pz) { 432 if (pz == NULL) return NULL; 433 return (char*)gettext(pz); 434 } 435 # define _(s) aoGetsText(s) 436 # endif /* _() */ 437 438 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet |= \ 439 OPTPROC_NXLAT_OPT_CFG;) 440 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet |= \ 441 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 442 443 # define OPT_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet &= \ 444 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 445 # define OPT_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet &= \ 446 ~OPTPROC_NXLAT_OPT;) 447 448 #else /* ENABLE_NLS */ 449 # define OPT_NO_XLAT_CFG_NAMES 450 # define OPT_NO_XLAT_OPT_NAMES 451 452 # define OPT_XLAT_CFG_NAMES 453 # define OPT_XLAT_OPT_NAMES 454 455 # ifndef _ 456 # define _(_s) _s 457 # endif 458 #endif /* ENABLE_NLS */ 459 460 #ifdef __cplusplus 461 } 462 #endif 463 #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */ 464 465 /* ntpd-opts.h ends here */ 466