1290001Sglebius/* 2181834Sroberto * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h) 3290001Sglebius * 4310419Sdelphij * It has been AutoGen-ed November 21, 2016 at 08:02:17 AM by AutoGen 5.18.5 5181834Sroberto * From the definitions ntpdc-opts.def 6181834Sroberto * and the template file options 7181834Sroberto * 8290001Sglebius * Generated from AutoOpts 41:0:16 templates. 9181834Sroberto * 10290001Sglebius * AutoOpts is a copyrighted work. This header file is not encumbered 11290001Sglebius * by AutoOpts licensing, but is provided under the licensing terms chosen 12290001Sglebius * by the ntpdc author or copyright holder. AutoOpts is 13290001Sglebius * licensed under the terms of the LGPL. The redistributable library 14290001Sglebius * (``libopts'') is licensed under the terms of either the LGPL or, at the 15290001Sglebius * users discretion, the BSD license. See the AutoOpts and/or libopts sources 16290001Sglebius * for details. 17181834Sroberto * 18290001Sglebius * The ntpdc program is copyrighted and licensed 19290001Sglebius * under the following terms: 20181834Sroberto * 21294905Sdelphij * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved. 22290001Sglebius * This is free software. It is licensed for use, modification and 23290001Sglebius * redistribution under the terms of the NTP License, copies of which 24290001Sglebius * can be seen at: 25290001Sglebius * <http://ntp.org/license> 26290001Sglebius * <http://opensource.org/licenses/ntp-license.php> 27290001Sglebius * 28290001Sglebius * Permission to use, copy, modify, and distribute this software and its 29290001Sglebius * documentation for any purpose with or without fee is hereby granted, 30290001Sglebius * provided that the above copyright notice appears in all copies and that 31290001Sglebius * both the copyright notice and this permission notice appear in 32290001Sglebius * supporting documentation, and that the name The University of Delaware not be used in 33290001Sglebius * advertising or publicity pertaining to distribution of the software 34290001Sglebius * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 35290001Sglebius * representations about the suitability this software for any purpose. It 36290001Sglebius * is provided "as is" without express or implied warranty. 37181834Sroberto */ 38290001Sglebius/** 39181834Sroberto * This file contains the programmatic interface to the Automated 40181834Sroberto * Options generated for the ntpdc program. 41181834Sroberto * These macros are documented in the AutoGen info file in the 42181834Sroberto * "AutoOpts" chapter. Please refer to that doc for usage help. 43181834Sroberto */ 44181834Sroberto#ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD 45290001Sglebius#define AUTOOPTS_NTPDC_OPTS_H_GUARD 1 46181834Sroberto#include "config.h" 47181834Sroberto#include <autoopts/options.h> 48181834Sroberto 49290001Sglebius/** 50181834Sroberto * Ensure that the library used for compiling this generated header is at 51181834Sroberto * least as new as the version current when the header template was released 52181834Sroberto * (not counting patch version increments). Also ensure that the oldest 53181834Sroberto * tolerable version is at least as old as what was current when the header 54181834Sroberto * template was released. 55181834Sroberto */ 56290001Sglebius#define AO_TEMPLATE_VERSION 167936 57181834Sroberto#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 58181834Sroberto || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 59181834Sroberto# error option template version mismatches autoopts/options.h header 60181834Sroberto Choke Me. 61181834Sroberto#endif 62181834Sroberto 63290001Sglebius/** 64290001Sglebius * Enumeration of each option type for ntpdc 65181834Sroberto */ 66181834Srobertotypedef enum { 67290001Sglebius INDEX_OPT_IPV4 = 0, 68290001Sglebius INDEX_OPT_IPV6 = 1, 69290001Sglebius INDEX_OPT_COMMAND = 2, 70290001Sglebius INDEX_OPT_DEBUG_LEVEL = 3, 71290001Sglebius INDEX_OPT_SET_DEBUG_LEVEL = 4, 72290001Sglebius INDEX_OPT_INTERACTIVE = 5, 73290001Sglebius INDEX_OPT_LISTPEERS = 6, 74290001Sglebius INDEX_OPT_NUMERIC = 7, 75290001Sglebius INDEX_OPT_PEERS = 8, 76290001Sglebius INDEX_OPT_SHOWPEERS = 9, 77290001Sglebius INDEX_OPT_VERSION = 10, 78290001Sglebius INDEX_OPT_HELP = 11, 79290001Sglebius INDEX_OPT_MORE_HELP = 12, 80290001Sglebius INDEX_OPT_SAVE_OPTS = 13, 81290001Sglebius INDEX_OPT_LOAD_OPTS = 14 82181834Sroberto} teOptIndex; 83290001Sglebius/** count of all options for ntpdc */ 84181834Sroberto#define OPTION_CT 15 85290001Sglebius/** ntpdc version */ 86310419Sdelphij#define NTPDC_VERSION "4.2.8p9" 87290001Sglebius/** Full ntpdc version text */ 88310419Sdelphij#define NTPDC_FULL_VERSION "ntpdc 4.2.8p9" 89181834Sroberto 90290001Sglebius/** 91181834Sroberto * Interface defines for all options. Replace "n" with the UPPER_CASED 92181834Sroberto * option name (as in the teOptIndex enumeration above). 93290001Sglebius * e.g. HAVE_OPT(IPV4) 94181834Sroberto */ 95181834Sroberto#define DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n]) 96290001Sglebius/** 'true' if an option has been specified in any way */ 97181834Sroberto#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 98290001Sglebius/** The string argument to an option. The argument type must be \"string\". */ 99181834Sroberto#define OPT_ARG(n) (DESC(n).optArg.argString) 100290001Sglebius/** Mask the option state revealing how an option was specified. 101290001Sglebius * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 102290001Sglebius * \a OPTST_DEFINED, \a OPTST_RESET or zero. 103290001Sglebius */ 104181834Sroberto#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 105290001Sglebius/** Count of option's occurrances *on the command line*. */ 106181834Sroberto#define COUNT_OPT(n) (DESC(n).optOccCt) 107290001Sglebius/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 108181834Sroberto#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 109290001Sglebius/** 'true' if \a HAVE_OPT would yield 'false'. */ 110181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 111290001Sglebius/** 'true' if OPTST_DISABLED bit not set. */ 112181834Sroberto#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 113290001Sglebius/** number of stacked option arguments. 114290001Sglebius * Valid only for stacked option arguments. */ 115181834Sroberto#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 116290001Sglebius/** stacked argument vector. 117290001Sglebius * Valid only for stacked option arguments. */ 118181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 119290001Sglebius/** Reset an option. */ 120181834Sroberto#define CLEAR_OPT(n) STMTS( \ 121181834Sroberto DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 122290001Sglebius if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 123181834Sroberto DESC(n).fOptState |= OPTST_DISABLED; \ 124181834Sroberto DESC(n).optCookie = NULL ) 125290001Sglebius/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 126290001Sglebius/** 127290001Sglebius * Enumeration of ntpdc exit codes 128290001Sglebius */ 129290001Sglebiustypedef enum { 130290001Sglebius NTPDC_EXIT_SUCCESS = 0, 131290001Sglebius NTPDC_EXIT_FAILURE = 1, 132290001Sglebius NTPDC_EXIT_USAGE_ERROR = 64, 133290001Sglebius NTPDC_EXIT_NO_CONFIG_INPUT = 66, 134290001Sglebius NTPDC_EXIT_LIBOPTS_FAILURE = 70 135290001Sglebius} ntpdc_exit_code_t; 136290001Sglebius/** @} */ 137290001Sglebius/** 138181834Sroberto * Make sure there are no #define name conflicts with the option names 139181834Sroberto */ 140181834Sroberto#ifndef NO_OPTION_NAME_WARNINGS 141181834Sroberto# ifdef IPV4 142181834Sroberto# warning undefining IPV4 due to option name conflict 143181834Sroberto# undef IPV4 144181834Sroberto# endif 145181834Sroberto# ifdef IPV6 146181834Sroberto# warning undefining IPV6 due to option name conflict 147181834Sroberto# undef IPV6 148181834Sroberto# endif 149181834Sroberto# ifdef COMMAND 150181834Sroberto# warning undefining COMMAND due to option name conflict 151181834Sroberto# undef COMMAND 152181834Sroberto# endif 153290001Sglebius# ifdef DEBUG_LEVEL 154290001Sglebius# warning undefining DEBUG_LEVEL due to option name conflict 155290001Sglebius# undef DEBUG_LEVEL 156290001Sglebius# endif 157290001Sglebius# ifdef SET_DEBUG_LEVEL 158290001Sglebius# warning undefining SET_DEBUG_LEVEL due to option name conflict 159290001Sglebius# undef SET_DEBUG_LEVEL 160290001Sglebius# endif 161290001Sglebius# ifdef INTERACTIVE 162290001Sglebius# warning undefining INTERACTIVE due to option name conflict 163290001Sglebius# undef INTERACTIVE 164290001Sglebius# endif 165181834Sroberto# ifdef LISTPEERS 166181834Sroberto# warning undefining LISTPEERS due to option name conflict 167181834Sroberto# undef LISTPEERS 168181834Sroberto# endif 169290001Sglebius# ifdef NUMERIC 170290001Sglebius# warning undefining NUMERIC due to option name conflict 171290001Sglebius# undef NUMERIC 172290001Sglebius# endif 173181834Sroberto# ifdef PEERS 174181834Sroberto# warning undefining PEERS due to option name conflict 175181834Sroberto# undef PEERS 176181834Sroberto# endif 177181834Sroberto# ifdef SHOWPEERS 178181834Sroberto# warning undefining SHOWPEERS due to option name conflict 179181834Sroberto# undef SHOWPEERS 180181834Sroberto# endif 181181834Sroberto#else /* NO_OPTION_NAME_WARNINGS */ 182181834Sroberto# undef IPV4 183181834Sroberto# undef IPV6 184181834Sroberto# undef COMMAND 185290001Sglebius# undef DEBUG_LEVEL 186290001Sglebius# undef SET_DEBUG_LEVEL 187290001Sglebius# undef INTERACTIVE 188181834Sroberto# undef LISTPEERS 189290001Sglebius# undef NUMERIC 190181834Sroberto# undef PEERS 191181834Sroberto# undef SHOWPEERS 192181834Sroberto#endif /* NO_OPTION_NAME_WARNINGS */ 193181834Sroberto 194290001Sglebius/** 195181834Sroberto * Interface defines for specific options. 196290001Sglebius * @{ 197181834Sroberto */ 198181834Sroberto#define VALUE_OPT_IPV4 '4' 199181834Sroberto#define VALUE_OPT_IPV6 '6' 200181834Sroberto#define VALUE_OPT_COMMAND 'c' 201290001Sglebius#define VALUE_OPT_DEBUG_LEVEL 'd' 202290001Sglebius#define VALUE_OPT_SET_DEBUG_LEVEL 'D' 203290001Sglebius 204290001Sglebius#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 205290001Sglebius#define VALUE_OPT_INTERACTIVE 'i' 206181834Sroberto#define VALUE_OPT_LISTPEERS 'l' 207290001Sglebius#define VALUE_OPT_NUMERIC 'n' 208181834Sroberto#define VALUE_OPT_PEERS 'p' 209181834Sroberto#define VALUE_OPT_SHOWPEERS 's' 210290001Sglebius/** option flag (value) for help-value option */ 211181834Sroberto#define VALUE_OPT_HELP '?' 212290001Sglebius/** option flag (value) for more-help-value option */ 213181834Sroberto#define VALUE_OPT_MORE_HELP '!' 214290001Sglebius/** option flag (value) for version-value option */ 215290001Sglebius#define VALUE_OPT_VERSION 0x1001 216290001Sglebius/** option flag (value) for save-opts-value option */ 217181834Sroberto#define VALUE_OPT_SAVE_OPTS '>' 218290001Sglebius/** option flag (value) for load-opts-value option */ 219181834Sroberto#define VALUE_OPT_LOAD_OPTS '<' 220181834Sroberto#define SET_OPT_SAVE_OPTS(a) STMTS( \ 221181834Sroberto DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 222181834Sroberto DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 223290001Sglebius DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 224181834Sroberto/* 225181834Sroberto * Interface defines not associated with particular options 226181834Sroberto */ 227290001Sglebius#define ERRSKIP_OPTERR STMTS(ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP) 228290001Sglebius#define ERRSTOP_OPTERR STMTS(ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP) 229181834Sroberto#define RESTART_OPT(n) STMTS( \ 230181834Sroberto ntpdcOptions.curOptIdx = (n); \ 231181834Sroberto ntpdcOptions.pzCurOpt = NULL ) 232181834Sroberto#define START_OPT RESTART_OPT(1) 233290001Sglebius#define USAGE(c) (*ntpdcOptions.pUsageProc)(&ntpdcOptions, c) 234181834Sroberto 235290001Sglebius#ifdef __cplusplus 236290001Sglebiusextern "C" { 237290001Sglebius#endif 238290001Sglebius 239290001Sglebius 240181834Sroberto/* * * * * * 241181834Sroberto * 242181834Sroberto * Declare the ntpdc option descriptor. 243181834Sroberto */ 244290001Sglebiusextern tOptions ntpdcOptions; 245181834Sroberto 246290001Sglebius#if defined(ENABLE_NLS) 247290001Sglebius# ifndef _ 248290001Sglebius# include <stdio.h> 249290001Sglebius# ifndef HAVE_GETTEXT 250290001Sglebius extern char * gettext(char const *); 251290001Sglebius# else 252290001Sglebius# include <libintl.h> 253290001Sglebius# endif 254181834Sroberto 255290001Sglebius# ifndef ATTRIBUTE_FORMAT_ARG 256290001Sglebius# define ATTRIBUTE_FORMAT_ARG(_a) 257290001Sglebius# endif 258181834Sroberto 259290001Sglebiusstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 260290001Sglebiusstatic inline char* aoGetsText(char const* pz) { 261290001Sglebius if (pz == NULL) return NULL; 262290001Sglebius return (char*)gettext(pz); 263290001Sglebius} 264290001Sglebius# define _(s) aoGetsText(s) 265290001Sglebius# endif /* _() */ 266290001Sglebius 267290001Sglebius# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet |= \ 268290001Sglebius OPTPROC_NXLAT_OPT_CFG;) 269290001Sglebius# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet |= \ 270290001Sglebius OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 271290001Sglebius 272290001Sglebius# define OPT_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet &= \ 273290001Sglebius ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 274290001Sglebius# define OPT_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet &= \ 275290001Sglebius ~OPTPROC_NXLAT_OPT;) 276290001Sglebius 277290001Sglebius#else /* ENABLE_NLS */ 278290001Sglebius# define OPT_NO_XLAT_CFG_NAMES 279290001Sglebius# define OPT_NO_XLAT_OPT_NAMES 280290001Sglebius 281290001Sglebius# define OPT_XLAT_CFG_NAMES 282290001Sglebius# define OPT_XLAT_OPT_NAMES 283290001Sglebius 284290001Sglebius# ifndef _ 285290001Sglebius# define _(_s) _s 286290001Sglebius# endif 287290001Sglebius#endif /* ENABLE_NLS */ 288290001Sglebius 289181834Sroberto#ifdef __cplusplus 290181834Sroberto} 291181834Sroberto#endif 292181834Sroberto#endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */ 293290001Sglebius 294181834Sroberto/* ntpdc-opts.h ends here */ 295