ntpd-opts.h revision 298699
11541Srgrimes/* 21541Srgrimes * EDIT THIS FILE WITH CAUTION (ntpd-opts.h) 31541Srgrimes * 41541Srgrimes * It has been AutoGen-ed April 26, 2016 at 08:26:13 PM by AutoGen 5.18.5 51541Srgrimes * From the definitions ntpd-opts.def 61541Srgrimes * and the template file options 71541Srgrimes * 81541Srgrimes * Generated from AutoOpts 41:0:16 templates. 91541Srgrimes * 101541Srgrimes * AutoOpts is a copyrighted work. This header file is not encumbered 111541Srgrimes * by AutoOpts licensing, but is provided under the licensing terms chosen 121541Srgrimes * by the ntpd author or copyright holder. AutoOpts is 131541Srgrimes * licensed under the terms of the LGPL. The redistributable library 141541Srgrimes * (``libopts'') is licensed under the terms of either the LGPL or, at the 151541Srgrimes * users discretion, the BSD license. See the AutoOpts and/or libopts sources 161541Srgrimes * for details. 171541Srgrimes * 181541Srgrimes * The ntpd program is copyrighted and licensed 191541Srgrimes * under the following terms: 201541Srgrimes * 211541Srgrimes * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved. 221541Srgrimes * This is free software. It is licensed for use, modification and 231541Srgrimes * redistribution under the terms of the NTP License, copies of which 241541Srgrimes * can be seen at: 251541Srgrimes * <http://ntp.org/license> 261541Srgrimes * <http://opensource.org/licenses/ntp-license.php> 271541Srgrimes * 281541Srgrimes * Permission to use, copy, modify, and distribute this software and its 291541Srgrimes * documentation for any purpose with or without fee is hereby granted, 301541Srgrimes * provided that the above copyright notice appears in all copies and that 311541Srgrimes * both the copyright notice and this permission notice appear in 321541Srgrimes * supporting documentation, and that the name The University of Delaware not be used in 331541Srgrimes * advertising or publicity pertaining to distribution of the software 3441086Struckman * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 351541Srgrimes * representations about the suitability this software for any purpose. It 361541Srgrimes * is provided "as is" without express or implied warranty. 371541Srgrimes */ 381541Srgrimes/** 391541Srgrimes * This file contains the programmatic interface to the Automated 401541Srgrimes * Options generated for the ntpd program. 4132726Seivind * These macros are documented in the AutoGen info file in the 4232726Seivind * "AutoOpts" chapter. Please refer to that doc for usage help. 431541Srgrimes */ 441541Srgrimes#ifndef AUTOOPTS_NTPD_OPTS_H_GUARD 4512577Sbde#define AUTOOPTS_NTPD_OPTS_H_GUARD 1 461541Srgrimes#include "config.h" 471541Srgrimes#include <autoopts/options.h> 4824206Sbde 4924206Sbde/** 501541Srgrimes * Ensure that the library used for compiling this generated header is at 513308Sphk * least as new as the version current when the header template was released 5212517Sjulian * (not counting patch version increments). Also ensure that the oldest 5329357Speter * tolerable version is at least as old as what was current when the header 5441086Struckman * template was released. 5512517Sjulian */ 5612517Sjulian#define AO_TEMPLATE_VERSION 167936 5712517Sjulian#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 5812517Sjulian || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 591541Srgrimes# error option template version mismatches autoopts/options.h header 601541Srgrimes Choke Me. 611541Srgrimes#endif 621541Srgrimes 631541Srgrimes/** 6412675Sjulian * Enumeration of each option type for ntpd 6512675Sjulian */ 6612675Sjuliantypedef enum { 6712675Sjulian INDEX_OPT_IPV4 = 0, 6829357Speter INDEX_OPT_IPV6 = 1, 6912675Sjulian INDEX_OPT_AUTHREQ = 2, 7012675Sjulian INDEX_OPT_AUTHNOREQ = 3, 7112678Sphk INDEX_OPT_BCASTSYNC = 4, 7212675Sjulian INDEX_OPT_CONFIGFILE = 5, 7312675Sjulian INDEX_OPT_DEBUG_LEVEL = 6, 7429357Speter INDEX_OPT_SET_DEBUG_LEVEL = 7, 7512675Sjulian INDEX_OPT_DRIFTFILE = 8, 7612819Sphk INDEX_OPT_PANICGATE = 9, 771541Srgrimes INDEX_OPT_FORCE_STEP_ONCE = 10, 781541Srgrimes INDEX_OPT_JAILDIR = 11, 7941086Struckman INDEX_OPT_INTERFACE = 12, 801541Srgrimes INDEX_OPT_KEYFILE = 13, 811541Srgrimes INDEX_OPT_LOGFILE = 14, 821541Srgrimes INDEX_OPT_NOVIRTUALIPS = 15, 831541Srgrimes INDEX_OPT_MODIFYMMTIMER = 16, 841541Srgrimes INDEX_OPT_NOFORK = 17, 8512675Sjulian INDEX_OPT_NICE = 18, 861541Srgrimes INDEX_OPT_PIDFILE = 19, 871541Srgrimes INDEX_OPT_PRIORITY = 20, 881541Srgrimes INDEX_OPT_QUIT = 21, 891541Srgrimes INDEX_OPT_PROPAGATIONDELAY = 22, 901541Srgrimes INDEX_OPT_SAVECONFIGQUIT = 23, 911541Srgrimes INDEX_OPT_STATSDIR = 24, 921541Srgrimes INDEX_OPT_TRUSTEDKEY = 25, 931541Srgrimes INDEX_OPT_USER = 26, 9441086Struckman INDEX_OPT_UPDATEINTERVAL = 27, 951541Srgrimes INDEX_OPT_VAR = 28, 961541Srgrimes INDEX_OPT_DVAR = 29, 971541Srgrimes INDEX_OPT_WAIT_SYNC = 30, 981541Srgrimes INDEX_OPT_SLEW = 31, 9912675Sjulian INDEX_OPT_USEPCC = 32, 1001541Srgrimes INDEX_OPT_PCCFREQ = 33, 1011541Srgrimes INDEX_OPT_MDNS = 34, 1021541Srgrimes INDEX_OPT_VERSION = 35, 1031541Srgrimes INDEX_OPT_HELP = 36, 1041541Srgrimes INDEX_OPT_MORE_HELP = 37 1051541Srgrimes} teOptIndex; 1061541Srgrimes/** count of all options for ntpd */ 1071541Srgrimes#define OPTION_CT 38 10841086Struckman/** ntpd version */ 1091541Srgrimes#define NTPD_VERSION "4.2.8p7" 1101541Srgrimes/** Full ntpd version text */ 1111541Srgrimes#define NTPD_FULL_VERSION "ntpd 4.2.8p7" 1121541Srgrimes 11312675Sjulian/** 1141541Srgrimes * Interface defines for all options. Replace "n" with the UPPER_CASED 1151541Srgrimes * option name (as in the teOptIndex enumeration above). 1161541Srgrimes * e.g. HAVE_OPT(IPV4) 1171541Srgrimes */ 1181541Srgrimes#define DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n]) 1191541Srgrimes/** 'true' if an option has been specified in any way */ 1201541Srgrimes#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 1211541Srgrimes/** The string argument to an option. The argument type must be \"string\". */ 1221541Srgrimes#define OPT_ARG(n) (DESC(n).optArg.argString) 1231541Srgrimes/** Mask the option state revealing how an option was specified. 1241541Srgrimes * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 1251541Srgrimes * \a OPTST_DEFINED, \a OPTST_RESET or zero. 1261541Srgrimes */ 1271541Srgrimes#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 1281541Srgrimes/** Count of option's occurrances *on the command line*. */ 1291541Srgrimes#define COUNT_OPT(n) (DESC(n).optOccCt) 1301541Srgrimes/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 1313098Sphk#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 1323098Sphk/** 'true' if \a HAVE_OPT would yield 'false'. */ 1331541Srgrimes#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 1341541Srgrimes/** 'true' if OPTST_DISABLED bit not set. */ 1351541Srgrimes#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 1361541Srgrimes/** number of stacked option arguments. 1371541Srgrimes * Valid only for stacked option arguments. */ 1381541Srgrimes#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 1391541Srgrimes/** stacked argument vector. 1401541Srgrimes * Valid only for stacked option arguments. */ 1411541Srgrimes#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 1421541Srgrimes/** Reset an option. */ 14336179Sphk#define CLEAR_OPT(n) STMTS( \ 1441541Srgrimes DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 1451541Srgrimes if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 1461541Srgrimes DESC(n).fOptState |= OPTST_DISABLED; \ 14736179Sphk DESC(n).optCookie = NULL ) 14836179Sphk/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 1491541Srgrimes/** 1501541Srgrimes * Enumeration of ntpd exit codes 1511541Srgrimes */ 15236179Sphktypedef enum { 1531541Srgrimes NTPD_EXIT_SUCCESS = 0, 1541541Srgrimes NTPD_EXIT_FAILURE = 1, 1551541Srgrimes NTPD_EXIT_USAGE_ERROR = 64, 1561541Srgrimes NTPD_EXIT_LIBOPTS_FAILURE = 70 1571541Srgrimes} ntpd_exit_code_t; 1581541Srgrimes/** @} */ 15912675Sjulian/** 16029357Speter * Make sure there are no #define name conflicts with the option names 1611541Srgrimes */ 16229357Speter#ifndef NO_OPTION_NAME_WARNINGS 1631541Srgrimes# ifdef IPV4 1641541Srgrimes# warning undefining IPV4 due to option name conflict 16529357Speter# undef IPV4 16629357Speter# endif 1671541Srgrimes# ifdef IPV6 16829357Speter# warning undefining IPV6 due to option name conflict 1691541Srgrimes# undef IPV6 17029357Speter# endif 17129357Speter# ifdef AUTHREQ 17229357Speter# warning undefining AUTHREQ due to option name conflict 17329357Speter# undef AUTHREQ 17429357Speter# endif 17529357Speter# ifdef AUTHNOREQ 1761541Srgrimes# warning undefining AUTHNOREQ due to option name conflict 17729357Speter# undef AUTHNOREQ 1781541Srgrimes# endif 1791541Srgrimes# ifdef BCASTSYNC 1801549Srgrimes# warning undefining BCASTSYNC due to option name conflict 1811541Srgrimes# undef BCASTSYNC 1821541Srgrimes# endif 1831541Srgrimes# ifdef CONFIGFILE 1841541Srgrimes# warning undefining CONFIGFILE due to option name conflict 1851541Srgrimes# undef CONFIGFILE 1861541Srgrimes# endif 1871541Srgrimes# ifdef DEBUG_LEVEL 18841086Struckman# warning undefining DEBUG_LEVEL due to option name conflict 18941086Struckman# undef DEBUG_LEVEL 1901541Srgrimes# endif 1911541Srgrimes# ifdef SET_DEBUG_LEVEL 1921541Srgrimes# warning undefining SET_DEBUG_LEVEL due to option name conflict 1931541Srgrimes# undef SET_DEBUG_LEVEL 1941541Srgrimes# endif 1951541Srgrimes# ifdef DRIFTFILE 1961541Srgrimes# warning undefining DRIFTFILE due to option name conflict 19712675Sjulian# undef DRIFTFILE 1981541Srgrimes# endif 1991541Srgrimes# ifdef PANICGATE 20036735Sdfr# warning undefining PANICGATE due to option name conflict 2011541Srgrimes# undef PANICGATE 2021541Srgrimes# endif 2031541Srgrimes# ifdef FORCE_STEP_ONCE 2041541Srgrimes# warning undefining FORCE_STEP_ONCE due to option name conflict 2051541Srgrimes# undef FORCE_STEP_ONCE 2061541Srgrimes# endif 2071541Srgrimes# ifdef JAILDIR 2081541Srgrimes# warning undefining JAILDIR due to option name conflict 2091541Srgrimes# undef JAILDIR 2101541Srgrimes# endif 2111541Srgrimes# ifdef INTERFACE 2121541Srgrimes# warning undefining INTERFACE due to option name conflict 2131541Srgrimes# undef INTERFACE 2141541Srgrimes# endif 2151541Srgrimes# ifdef KEYFILE 21636179Sphk# warning undefining KEYFILE due to option name conflict 2171541Srgrimes# undef KEYFILE 2181541Srgrimes# endif 2191541Srgrimes# ifdef LOGFILE 2201541Srgrimes# warning undefining LOGFILE due to option name conflict 2211541Srgrimes# undef LOGFILE 2221541Srgrimes# endif 2231541Srgrimes# ifdef NOVIRTUALIPS 2241541Srgrimes# warning undefining NOVIRTUALIPS due to option name conflict 2251541Srgrimes# undef NOVIRTUALIPS 2261541Srgrimes# endif 2271541Srgrimes# ifdef MODIFYMMTIMER 2281541Srgrimes# warning undefining MODIFYMMTIMER due to option name conflict 2291541Srgrimes# undef MODIFYMMTIMER 23041086Struckman# endif 23141086Struckman# ifdef NOFORK 23241086Struckman# warning undefining NOFORK due to option name conflict 23341086Struckman# undef NOFORK 23441086Struckman# endif 2351541Srgrimes# ifdef NICE 2361541Srgrimes# warning undefining NICE due to option name conflict 23741086Struckman# undef NICE 23841086Struckman# endif 23941086Struckman# ifdef PIDFILE 24041086Struckman# warning undefining PIDFILE due to option name conflict 24141086Struckman# undef PIDFILE 2421541Srgrimes# endif 24341086Struckman# ifdef PRIORITY 2441541Srgrimes# warning undefining PRIORITY due to option name conflict 2451541Srgrimes# undef PRIORITY 2461541Srgrimes# endif 2478161Sjkh# ifdef QUIT 2481541Srgrimes# warning undefining QUIT due to option name conflict 2491541Srgrimes# undef QUIT 2501541Srgrimes# endif 25112517Sjulian# ifdef PROPAGATIONDELAY 25233679Sbde# warning undefining PROPAGATIONDELAY due to option name conflict 25317040Swollman# undef PROPAGATIONDELAY 25412675Sjulian# endif 25517040Swollman# ifdef SAVECONFIGQUIT 25612517Sjulian# warning undefining SAVECONFIGQUIT due to option name conflict 25729506Sbde# undef SAVECONFIGQUIT 25812675Sjulian# endif 25929506Sbde# ifdef STATSDIR 26029506Sbde# warning undefining STATSDIR due to option name conflict 26112517Sjulian# undef STATSDIR 26212517Sjulian# endif 26312517Sjulian# ifdef TRUSTEDKEY 26412517Sjulian# warning undefining TRUSTEDKEY due to option name conflict 26512517Sjulian# undef TRUSTEDKEY 26612517Sjulian# endif 26712517Sjulian# ifdef USER 26812517Sjulian# warning undefining USER due to option name conflict 26914851Sbde# undef USER 27014851Sbde# endif 27114851Sbde# ifdef UPDATEINTERVAL 27212521Sjulian# warning undefining UPDATEINTERVAL due to option name conflict 27312517Sjulian# undef UPDATEINTERVAL 27412517Sjulian# endif 27512517Sjulian# ifdef VAR 27612517Sjulian# 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 407extern "C" { 408#endif 409 410 411/* * * * * * 412 * 413 * Declare the ntpd option descriptor. 414 */ 415extern 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 430static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 431static 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