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