sntp-opts.h revision 301301
162587Sitojun/* 262587Sitojun * EDIT THIS FILE WITH CAUTION (sntp-opts.h) 362587Sitojun * 462587Sitojun * It has been AutoGen-ed June 2, 2016 at 07:18:40 AM by AutoGen 5.18.5 562587Sitojun * From the definitions sntp-opts.def 662587Sitojun * and the template file options 762587Sitojun * 862587Sitojun * Generated from AutoOpts 41:0:16 templates. 962587Sitojun * 1062587Sitojun * AutoOpts is a copyrighted work. This header file is not encumbered 1162587Sitojun * by AutoOpts licensing, but is provided under the licensing terms chosen 1262587Sitojun * by the sntp author or copyright holder. AutoOpts is 1362587Sitojun * licensed under the terms of the LGPL. The redistributable library 1462587Sitojun * (``libopts'') is licensed under the terms of either the LGPL or, at the 1562587Sitojun * users discretion, the BSD license. See the AutoOpts and/or libopts sources 1662587Sitojun * for details. 1762587Sitojun * 1862587Sitojun * The sntp program is copyrighted and licensed 1962587Sitojun * under the following terms: 2062587Sitojun * 2162587Sitojun * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved. 2262587Sitojun * This is free software. It is licensed for use, modification and 2362587Sitojun * redistribution under the terms of the NTP License, copies of which 2462587Sitojun * can be seen at: 2562587Sitojun * <http://ntp.org/license> 2662587Sitojun * <http://opensource.org/licenses/ntp-license.php> 2762587Sitojun * 2862587Sitojun * Permission to use, copy, modify, and distribute this software and its 2962587Sitojun * documentation for any purpose with or without fee is hereby granted, 3062587Sitojun * provided that the above copyright notice appears in all copies and that 3162587Sitojun * both the copyright notice and this permission notice appear in 3262587Sitojun * supporting documentation, and that the name The University of Delaware not be used in 3362587Sitojun * advertising or publicity pertaining to distribution of the software 3462587Sitojun * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 3562587Sitojun * representations about the suitability this software for any purpose. It 3662587Sitojun * is provided "as is" without express or implied warranty. 3762587Sitojun */ 3862587Sitojun/** 3962587Sitojun * This file contains the programmatic interface to the Automated 4062587Sitojun * Options generated for the sntp program. 4162587Sitojun * These macros are documented in the AutoGen info file in the 4262587Sitojun * "AutoOpts" chapter. Please refer to that doc for usage help. 4362587Sitojun */ 4462587Sitojun#ifndef AUTOOPTS_SNTP_OPTS_H_GUARD 4562587Sitojun#define AUTOOPTS_SNTP_OPTS_H_GUARD 1 4662587Sitojun#include "config.h" 4762587Sitojun#include <autoopts/options.h> 4862587Sitojun 4962587Sitojun/** 5062587Sitojun * Ensure that the library used for compiling this generated header is at 5162587Sitojun * least as new as the version current when the header template was released 5262587Sitojun * (not counting patch version increments). Also ensure that the oldest 5362587Sitojun * tolerable version is at least as old as what was current when the header 5462587Sitojun * template was released. 5562587Sitojun */ 5662587Sitojun#define AO_TEMPLATE_VERSION 167936 5762587Sitojun#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 5862587Sitojun || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 5962587Sitojun# error option template version mismatches autoopts/options.h header 6062587Sitojun Choke Me. 6162587Sitojun#endif 6262587Sitojun 6362587Sitojun/** 6462587Sitojun * Enumeration of each option type for sntp 6562587Sitojun */ 6662587Sitojuntypedef enum { 6762587Sitojun INDEX_OPT_IPV4 = 0, 6862587Sitojun INDEX_OPT_IPV6 = 1, 6962587Sitojun INDEX_OPT_AUTHENTICATION = 2, 7062587Sitojun INDEX_OPT_BROADCAST = 3, 7162587Sitojun INDEX_OPT_CONCURRENT = 4, 7262587Sitojun INDEX_OPT_DEBUG_LEVEL = 5, 7362587Sitojun INDEX_OPT_SET_DEBUG_LEVEL = 6, 7462587Sitojun INDEX_OPT_GAP = 7, 7562587Sitojun INDEX_OPT_KOD = 8, 7662587Sitojun INDEX_OPT_KEYFILE = 9, 7762587Sitojun INDEX_OPT_LOGFILE = 10, 7862587Sitojun INDEX_OPT_STEPLIMIT = 11, 7962587Sitojun INDEX_OPT_NTPVERSION = 12, 8062587Sitojun INDEX_OPT_USERESERVEDPORT = 13, 8162587Sitojun INDEX_OPT_STEP = 14, 8262587Sitojun INDEX_OPT_SLEW = 15, 8362587Sitojun INDEX_OPT_TIMEOUT = 16, 8468618Sbmilekic INDEX_OPT_WAIT = 17, 8562587Sitojun INDEX_OPT_VERSION = 18, 8662587Sitojun INDEX_OPT_HELP = 19, 8762587Sitojun INDEX_OPT_MORE_HELP = 20, 8862587Sitojun INDEX_OPT_SAVE_OPTS = 21, 8962587Sitojun INDEX_OPT_LOAD_OPTS = 22 9062587Sitojun} teOptIndex; 9162587Sitojun/** count of all options for sntp */ 9262587Sitojun#define OPTION_CT 23 9362587Sitojun/** sntp version */ 9468618Sbmilekic#define SNTP_VERSION "4.2.8p8" 9562587Sitojun/** Full sntp version text */ 9662587Sitojun#define SNTP_FULL_VERSION "sntp 4.2.8p8" 9762587Sitojun 9862587Sitojun/** 9962587Sitojun * Interface defines for all options. Replace "n" with the UPPER_CASED 10062587Sitojun * option name (as in the teOptIndex enumeration above). 10162587Sitojun * e.g. HAVE_OPT(IPV4) 10262587Sitojun */ 10362587Sitojun#define DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n]) 10462587Sitojun/** 'true' if an option has been specified in any way */ 10562587Sitojun#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 10662587Sitojun/** The string argument to an option. The argument type must be \"string\". */ 10762587Sitojun#define OPT_ARG(n) (DESC(n).optArg.argString) 10862587Sitojun/** Mask the option state revealing how an option was specified. 10962587Sitojun * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 11062587Sitojun * \a OPTST_DEFINED, \a OPTST_RESET or zero. 11162587Sitojun */ 11262587Sitojun#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 11362587Sitojun/** Count of option's occurrances *on the command line*. */ 11462587Sitojun#define COUNT_OPT(n) (DESC(n).optOccCt) 11562587Sitojun/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 11662587Sitojun#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 11762587Sitojun/** 'true' if \a HAVE_OPT would yield 'false'. */ 11862587Sitojun#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 11962587Sitojun/** 'true' if OPTST_DISABLED bit not set. */ 12062587Sitojun#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 12162587Sitojun/** number of stacked option arguments. 12262587Sitojun * Valid only for stacked option arguments. */ 12362587Sitojun#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 12462587Sitojun/** stacked argument vector. 12562587Sitojun * Valid only for stacked option arguments. */ 12662587Sitojun#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 12762587Sitojun/** Reset an option. */ 12862587Sitojun#define CLEAR_OPT(n) STMTS( \ 12962587Sitojun DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 13062587Sitojun if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 13162587Sitojun DESC(n).fOptState |= OPTST_DISABLED; \ 13262587Sitojun DESC(n).optCookie = NULL ) 13362587Sitojun/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13462587Sitojun/** 13562587Sitojun * Enumeration of sntp exit codes 13662587Sitojun */ 13762587Sitojuntypedef enum { 13862587Sitojun SNTP_EXIT_SUCCESS = 0, 13962587Sitojun SNTP_EXIT_FAILURE = 1, 14062587Sitojun SNTP_EXIT_USAGE_ERROR = 64, 14162587Sitojun SNTP_EXIT_NO_CONFIG_INPUT = 66, 14262587Sitojun SNTP_EXIT_LIBOPTS_FAILURE = 70 14362587Sitojun} sntp_exit_code_t; 14462587Sitojun/** @} */ 14562587Sitojun/** 14662587Sitojun * Make sure there are no #define name conflicts with the option names 14762587Sitojun */ 14862587Sitojun#ifndef NO_OPTION_NAME_WARNINGS 14962587Sitojun# ifdef IPV4 15062587Sitojun# warning undefining IPV4 due to option name conflict 15162587Sitojun# undef IPV4 15262587Sitojun# endif 15362587Sitojun# ifdef IPV6 15462587Sitojun# warning undefining IPV6 due to option name conflict 15562587Sitojun# undef IPV6 15662587Sitojun# endif 15762587Sitojun# ifdef AUTHENTICATION 15862587Sitojun# warning undefining AUTHENTICATION due to option name conflict 15962587Sitojun# undef AUTHENTICATION 16062587Sitojun# endif 16162587Sitojun# ifdef BROADCAST 16262587Sitojun# warning undefining BROADCAST due to option name conflict 16362587Sitojun# undef BROADCAST 16462587Sitojun# endif 16562587Sitojun# ifdef CONCURRENT 16662587Sitojun# warning undefining CONCURRENT due to option name conflict 16762587Sitojun# undef CONCURRENT 16862587Sitojun# endif 16962587Sitojun# ifdef DEBUG_LEVEL 17062587Sitojun# warning undefining DEBUG_LEVEL due to option name conflict 17162587Sitojun# undef DEBUG_LEVEL 17262587Sitojun# endif 17362587Sitojun# ifdef SET_DEBUG_LEVEL 17462587Sitojun# warning undefining SET_DEBUG_LEVEL due to option name conflict 17562587Sitojun# undef SET_DEBUG_LEVEL 17662587Sitojun# endif 17762587Sitojun# ifdef GAP 17862587Sitojun# warning undefining GAP due to option name conflict 17968618Sbmilekic# undef GAP 18068618Sbmilekic# endif 18168618Sbmilekic# ifdef KOD 18268618Sbmilekic# warning undefining KOD due to option name conflict 18368618Sbmilekic# undef KOD 18468618Sbmilekic# endif 18568618Sbmilekic# ifdef KEYFILE 18668618Sbmilekic# warning undefining KEYFILE due to option name conflict 18768618Sbmilekic# undef KEYFILE 18868618Sbmilekic# endif 18968618Sbmilekic# ifdef LOGFILE 19068618Sbmilekic# warning undefining LOGFILE due to option name conflict 19168618Sbmilekic# undef LOGFILE 19268618Sbmilekic# endif 19368618Sbmilekic# ifdef STEPLIMIT 19468618Sbmilekic# warning undefining STEPLIMIT due to option name conflict 19568618Sbmilekic# undef STEPLIMIT 19668618Sbmilekic# endif 19768618Sbmilekic# ifdef NTPVERSION 19868618Sbmilekic# warning undefining NTPVERSION due to option name conflict 19968618Sbmilekic# undef NTPVERSION 20068618Sbmilekic# endif 20168618Sbmilekic# ifdef USERESERVEDPORT 20268618Sbmilekic# warning undefining USERESERVEDPORT due to option name conflict 20368618Sbmilekic# undef USERESERVEDPORT 20468618Sbmilekic# endif 20568618Sbmilekic# ifdef STEP 20662587Sitojun# warning undefining STEP due to option name conflict 20768618Sbmilekic# undef STEP 20862587Sitojun# endif 20962587Sitojun# ifdef SLEW 21062587Sitojun# warning undefining SLEW due to option name conflict 21162587Sitojun# undef SLEW 21262587Sitojun# endif 21362587Sitojun# ifdef TIMEOUT 21468618Sbmilekic# warning undefining TIMEOUT due to option name conflict 21562587Sitojun# undef TIMEOUT 21662587Sitojun# endif 21762587Sitojun# ifdef WAIT 21862587Sitojun# warning undefining WAIT due to option name conflict 21962587Sitojun# undef WAIT 22062587Sitojun# endif 22162587Sitojun#else /* NO_OPTION_NAME_WARNINGS */ 22262587Sitojun# undef IPV4 22362587Sitojun# undef IPV6 22462587Sitojun# undef AUTHENTICATION 22562587Sitojun# undef BROADCAST 22662587Sitojun# undef CONCURRENT 22762587Sitojun# undef DEBUG_LEVEL 22862587Sitojun# undef SET_DEBUG_LEVEL 22962587Sitojun# undef GAP 23062587Sitojun# undef KOD 23162587Sitojun# undef KEYFILE 23262587Sitojun# undef LOGFILE 23362587Sitojun# undef STEPLIMIT 23462587Sitojun# undef NTPVERSION 23562587Sitojun# undef USERESERVEDPORT 23662587Sitojun# undef STEP 23762587Sitojun# undef SLEW 23862587Sitojun# undef TIMEOUT 23962587Sitojun# undef WAIT 24062587Sitojun#endif /* NO_OPTION_NAME_WARNINGS */ 24162587Sitojun 24262587Sitojun/** 24362587Sitojun * Interface defines for specific options. 24462587Sitojun * @{ 24562587Sitojun */ 24662587Sitojun#define VALUE_OPT_IPV4 '4' 24762587Sitojun#define VALUE_OPT_IPV6 '6' 24862587Sitojun#define VALUE_OPT_AUTHENTICATION 'a' 24962587Sitojun 25062587Sitojun#define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt) 25162587Sitojun#define VALUE_OPT_BROADCAST 'b' 25262587Sitojun#define VALUE_OPT_CONCURRENT 'c' 25362587Sitojun#define VALUE_OPT_DEBUG_LEVEL 'd' 25462587Sitojun#define VALUE_OPT_SET_DEBUG_LEVEL 'D' 25562587Sitojun 25662587Sitojun#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 25762587Sitojun#define VALUE_OPT_GAP 'g' 25862587Sitojun 25962587Sitojun#define OPT_VALUE_GAP (DESC(GAP).optArg.argInt) 26062587Sitojun#define VALUE_OPT_KOD 'K' 26162587Sitojun#define VALUE_OPT_KEYFILE 'k' 26262587Sitojun#define VALUE_OPT_LOGFILE 'l' 26362587Sitojun#define VALUE_OPT_STEPLIMIT 'M' 26462587Sitojun 26562587Sitojun#define OPT_VALUE_STEPLIMIT (DESC(STEPLIMIT).optArg.argInt) 26662587Sitojun#define VALUE_OPT_NTPVERSION 'o' 26762587Sitojun 26862587Sitojun#define OPT_VALUE_NTPVERSION (DESC(NTPVERSION).optArg.argInt) 26962587Sitojun#define VALUE_OPT_USERESERVEDPORT 'r' 27062587Sitojun#define VALUE_OPT_STEP 'S' 27162587Sitojun#define VALUE_OPT_SLEW 's' 27262587Sitojun#define VALUE_OPT_TIMEOUT 't' 27362587Sitojun 27462587Sitojun#define OPT_VALUE_TIMEOUT (DESC(TIMEOUT).optArg.argInt) 27562587Sitojun#define VALUE_OPT_WAIT 0x1001 27662587Sitojun 27762587Sitojun#define SET_OPT_WAIT STMTS( \ 27862587Sitojun DESC(WAIT).optActualIndex = 17; \ 27962587Sitojun DESC(WAIT).optActualValue = VALUE_OPT_WAIT; \ 28062587Sitojun DESC(WAIT).fOptState &= OPTST_PERSISTENT_MASK; \ 28162587Sitojun DESC(WAIT).fOptState |= OPTST_SET ) 28262587Sitojun#define DISABLE_OPT_WAIT STMTS( \ 28362587Sitojun DESC(WAIT).fOptState &= OPTST_PERSISTENT_MASK; \ 28462587Sitojun DESC(WAIT).fOptState |= OPTST_SET | OPTST_DISABLED; \ 28562587Sitojun DESC(WAIT).optArg.argString = NULL ) 28662587Sitojun/** option flag (value) for help-value option */ 28762587Sitojun#define VALUE_OPT_HELP '?' 28862587Sitojun/** option flag (value) for more-help-value option */ 28962587Sitojun#define VALUE_OPT_MORE_HELP '!' 29062587Sitojun/** option flag (value) for version-value option */ 29162587Sitojun#define VALUE_OPT_VERSION 0x1002 29262587Sitojun/** option flag (value) for save-opts-value option */ 29362587Sitojun#define VALUE_OPT_SAVE_OPTS '>' 29462587Sitojun/** option flag (value) for load-opts-value option */ 29562587Sitojun#define VALUE_OPT_LOAD_OPTS '<' 29662587Sitojun#define SET_OPT_SAVE_OPTS(a) STMTS( \ 29762587Sitojun DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 29862587Sitojun DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 29962587Sitojun DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 30062587Sitojun/* 30162587Sitojun * Interface defines not associated with particular options 30262587Sitojun */ 30362587Sitojun#define ERRSKIP_OPTERR STMTS(sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP) 30462587Sitojun#define ERRSTOP_OPTERR STMTS(sntpOptions.fOptSet |= OPTPROC_ERRSTOP) 30562587Sitojun#define RESTART_OPT(n) STMTS( \ 30662587Sitojun sntpOptions.curOptIdx = (n); \ 30762587Sitojun sntpOptions.pzCurOpt = NULL ) 30862587Sitojun#define START_OPT RESTART_OPT(1) 30962587Sitojun#define USAGE(c) (*sntpOptions.pUsageProc)(&sntpOptions, c) 31062587Sitojun 31162587Sitojun#ifdef __cplusplus 31262587Sitojunextern "C" { 31362587Sitojun#endif 31462587Sitojun 31562587Sitojun 31662587Sitojun/* * * * * * 31762587Sitojun * 31862587Sitojun * Declare the sntp option descriptor. 31962587Sitojun */ 32062587Sitojunextern tOptions sntpOptions; 32162587Sitojun 32262587Sitojun#if defined(ENABLE_NLS) 32362587Sitojun# ifndef _ 32462587Sitojun# include <stdio.h> 32562587Sitojun# ifndef HAVE_GETTEXT 32662587Sitojun extern char * gettext(char const *); 32762587Sitojun# else 32862587Sitojun# include <libintl.h> 32962587Sitojun# endif 33062587Sitojun 33162587Sitojun# ifndef ATTRIBUTE_FORMAT_ARG 33262587Sitojun# define ATTRIBUTE_FORMAT_ARG(_a) 33362587Sitojun# endif 33462587Sitojun 33562587Sitojunstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 33662587Sitojunstatic inline char* aoGetsText(char const* pz) { 33762587Sitojun if (pz == NULL) return NULL; 33862587Sitojun return (char*)gettext(pz); 33962587Sitojun} 34062587Sitojun# define _(s) aoGetsText(s) 34162587Sitojun# endif /* _() */ 34262587Sitojun 34362587Sitojun# define OPT_NO_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet |= \ 34462587Sitojun OPTPROC_NXLAT_OPT_CFG;) 34562587Sitojun# define OPT_NO_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet |= \ 34662587Sitojun OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 34762587Sitojun 34862587Sitojun# define OPT_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet &= \ 349 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 350# define OPT_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet &= \ 351 ~OPTPROC_NXLAT_OPT;) 352 353#else /* ENABLE_NLS */ 354# define OPT_NO_XLAT_CFG_NAMES 355# define OPT_NO_XLAT_OPT_NAMES 356 357# define OPT_XLAT_CFG_NAMES 358# define OPT_XLAT_OPT_NAMES 359 360# ifndef _ 361# define _(_s) _s 362# endif 363#endif /* ENABLE_NLS */ 364 365#ifdef __cplusplus 366} 367#endif 368#endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */ 369 370/* sntp-opts.h ends here */ 371