ntpdc-opts.h revision 285612
144290Swollman/* 244290Swollman * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h) 344290Swollman * 493151Sphk * It has been AutoGen-ed June 29, 2015 at 04:30:50 PM by AutoGen 5.18.5 544290Swollman * From the definitions ntpdc-opts.def 644290Swollman * and the template file options 744290Swollman * 844290Swollman * Generated from AutoOpts 41:0:16 templates. 944290Swollman * 1050476Speter * AutoOpts is a copyrighted work. This header file is not encumbered 1144290Swollman * by AutoOpts licensing, but is provided under the licensing terms chosen 12263955Sgjb * by the ntpdc author or copyright holder. AutoOpts is 1344301Swollman * licensed under the terms of the LGPL. The redistributable library 1479531Sru * (``libopts'') is licensed under the terms of either the LGPL or, at the 1544290Swollman * users discretion, the BSD license. See the AutoOpts and/or libopts sources 1644290Swollman * for details. 1744290Swollman * 1844290Swollman * The ntpdc program is copyrighted and licensed 1944290Swollman * under the following terms: 2044290Swollman * 2174385Sphk * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved. 2244290Swollman * This is free software. It is licensed for use, modification and 2344290Swollman * redistribution under the terms of the NTP License, copies of which 2444290Swollman * can be seen at: 2544290Swollman * <http://ntp.org/license> 2644290Swollman * <http://opensource.org/licenses/ntp-license.php> 2744290Swollman * 2874385Sphk * Permission to use, copy, modify, and distribute this software and its 2944290Swollman * documentation for any purpose with or without fee is hereby granted, 3044290Swollman * provided that the above copyright notice appears in all copies and that 3159512Sphantom * both the copyright notice and this permission notice appear in 3259512Sphantom * supporting documentation, and that the name The University of Delaware not be used in 3344290Swollman * advertising or publicity pertaining to distribution of the software 3484306Sru * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no 3584306Sru * representations about the suitability this software for any purpose. It 3644290Swollman * is provided "as is" without express or implied warranty. 3744290Swollman */ 3844290Swollman/** 39143326Scperciva * This file contains the programmatic interface to the Automated 4044290Swollman * Options generated for the ntpdc program. 4144290Swollman * These macros are documented in the AutoGen info file in the 4244290Swollman * "AutoOpts" chapter. Please refer to that doc for usage help. 4344290Swollman */ 4444290Swollman#ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD 4544290Swollman#define AUTOOPTS_NTPDC_OPTS_H_GUARD 1 4644290Swollman#include "config.h" 4774385Sphk#include <autoopts/options.h> 4874385Sphk 4944290Swollman/** 5044290Swollman * Ensure that the library used for compiling this generated header is at 5144290Swollman * least as new as the version current when the header template was released 5244290Swollman * (not counting patch version increments). Also ensure that the oldest 53143326Scperciva * tolerable version is at least as old as what was current when the header 5444290Swollman * template was released. 5544290Swollman */ 5644290Swollman#define AO_TEMPLATE_VERSION 167936 5744290Swollman#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 5844290Swollman || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 5944290Swollman# error option template version mismatches autoopts/options.h header 6044290Swollman Choke Me. 6174385Sphk#endif 6274385Sphk 6344290Swollman/** 6444290Swollman * Enumeration of each option type for ntpdc 6544290Swollman */ 6644290Swollmantypedef enum { 6744290Swollman INDEX_OPT_IPV4 = 0, 6844290Swollman INDEX_OPT_IPV6 = 1, 6944290Swollman INDEX_OPT_COMMAND = 2, 70120957Shmp INDEX_OPT_DEBUG_LEVEL = 3, 71120957Shmp INDEX_OPT_SET_DEBUG_LEVEL = 4, 7244290Swollman INDEX_OPT_INTERACTIVE = 5, 73120957Shmp INDEX_OPT_LISTPEERS = 6, 74120957Shmp INDEX_OPT_NUMERIC = 7, 75120957Shmp INDEX_OPT_PEERS = 8, 76120957Shmp INDEX_OPT_SHOWPEERS = 9, 77141846Sru INDEX_OPT_VERSION = 10, 7844290Swollman INDEX_OPT_HELP = 11, 7944290Swollman INDEX_OPT_MORE_HELP = 12, 8081251Sru INDEX_OPT_SAVE_OPTS = 13, 8181251Sru INDEX_OPT_LOAD_OPTS = 14 8244290Swollman} teOptIndex; 8344290Swollman/** count of all options for ntpdc */ 84120957Shmp#define OPTION_CT 15 85120957Shmp/** ntpdc version */ 8644290Swollman#define NTPDC_VERSION "4.2.8p3" 8744290Swollman/** Full ntpdc version text */ 8844290Swollman#define NTPDC_FULL_VERSION "ntpdc 4.2.8p3" 8944290Swollman 9044290Swollman/** 91131539Sru * Interface defines for all options. Replace "n" with the UPPER_CASED 9244290Swollman * option name (as in the teOptIndex enumeration above). 9344290Swollman * e.g. HAVE_OPT(IPV4) 9444290Swollman */ 95120957Shmp#define DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n]) 96120957Shmp/** 'true' if an option has been specified in any way */ 97120957Shmp#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 98120957Shmp/** The string argument to an option. The argument type must be \"string\". */ 9944290Swollman#define OPT_ARG(n) (DESC(n).optArg.argString) 10044290Swollman/** Mask the option state revealing how an option was specified. 10144290Swollman * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 10244290Swollman * \a OPTST_DEFINED, \a OPTST_RESET or zero. 10344290Swollman */ 10444290Swollman#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 10544290Swollman/** Count of option's occurrances *on the command line*. */ 10644290Swollman#define COUNT_OPT(n) (DESC(n).optOccCt) 10744290Swollman/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 10844290Swollman#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 10944290Swollman/** 'true' if \a HAVE_OPT would yield 'false'. */ 11044290Swollman#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 11144290Swollman/** 'true' if OPTST_DISABLED bit not set. */ 11244290Swollman#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 11344290Swollman/** number of stacked option arguments. 11479754Sdd * Valid only for stacked option arguments. */ 11544290Swollman#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 11644290Swollman/** stacked argument vector. 11744290Swollman * Valid only for stacked option arguments. */ 11874385Sphk#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 11974385Sphk/** Reset an option. */ 12074385Sphk#define CLEAR_OPT(n) STMTS( \ 12174385Sphk DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 12274385Sphk if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 12375161Sru DESC(n).fOptState |= OPTST_DISABLED; \ 12474385Sphk DESC(n).optCookie = NULL ) 12575161Sru/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 12674385Sphk/** 12774385Sphk * Enumeration of ntpdc exit codes 12875161Sru */ 12974385Sphktypedef enum { 13074385Sphk NTPDC_EXIT_SUCCESS = 0, 13174385Sphk NTPDC_EXIT_FAILURE = 1, 13274385Sphk NTPDC_EXIT_USAGE_ERROR = 64, 13375161Sru NTPDC_EXIT_NO_CONFIG_INPUT = 66, 13474385Sphk NTPDC_EXIT_LIBOPTS_FAILURE = 70 13544290Swollman} ntpdc_exit_code_t; 13644290Swollman/** @} */ 13744290Swollman/** 13844290Swollman * Make sure there are no #define name conflicts with the option names 13944290Swollman */ 14044290Swollman#ifndef NO_OPTION_NAME_WARNINGS 14144290Swollman# ifdef IPV4 14244290Swollman# warning undefining IPV4 due to option name conflict 14344290Swollman# undef IPV4 14444290Swollman# endif 14579754Sdd# ifdef IPV6 14675161Sru# warning undefining IPV6 due to option name conflict 14744290Swollman# undef IPV6 14844290Swollman# endif 14944290Swollman# ifdef COMMAND 15044290Swollman# warning undefining COMMAND due to option name conflict 15144290Swollman# undef COMMAND 15244290Swollman# endif 15379754Sdd# ifdef DEBUG_LEVEL 15475161Sru# warning undefining DEBUG_LEVEL due to option name conflict 15544290Swollman# undef DEBUG_LEVEL 15644290Swollman# endif 15744290Swollman# ifdef SET_DEBUG_LEVEL 15844301Swollman# warning undefining SET_DEBUG_LEVEL due to option name conflict 159147434Sru# undef SET_DEBUG_LEVEL 160147434Sru# endif 161140505Sru# ifdef INTERACTIVE 162140505Sru# warning undefining INTERACTIVE due to option name conflict 163140505Sru# undef INTERACTIVE 16444290Swollman# endif 16544290Swollman# ifdef LISTPEERS 16644290Swollman# warning undefining LISTPEERS due to option name conflict 16744290Swollman# undef LISTPEERS 16844290Swollman# endif 16944290Swollman# ifdef NUMERIC 17044290Swollman# warning undefining NUMERIC due to option name conflict 17144290Swollman# undef NUMERIC 172141846Sru# endif 17344356Swollman# ifdef PEERS 17444356Swollman# warning undefining PEERS due to option name conflict 17544356Swollman# undef PEERS 17644356Swollman# endif 17744356Swollman# ifdef SHOWPEERS 17844356Swollman# warning undefining SHOWPEERS due to option name conflict 17944356Swollman# undef SHOWPEERS 180120957Shmp# endif 181120957Shmp#else /* NO_OPTION_NAME_WARNINGS */ 18244356Swollman# undef IPV4 18344356Swollman# undef IPV6 18444356Swollman# undef COMMAND 185# undef DEBUG_LEVEL 186# undef SET_DEBUG_LEVEL 187# undef INTERACTIVE 188# undef LISTPEERS 189# undef NUMERIC 190# undef PEERS 191# undef SHOWPEERS 192#endif /* NO_OPTION_NAME_WARNINGS */ 193 194/** 195 * Interface defines for specific options. 196 * @{ 197 */ 198#define VALUE_OPT_IPV4 '4' 199#define VALUE_OPT_IPV6 '6' 200#define VALUE_OPT_COMMAND 'c' 201#define VALUE_OPT_DEBUG_LEVEL 'd' 202#define VALUE_OPT_SET_DEBUG_LEVEL 'D' 203 204#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt) 205#define VALUE_OPT_INTERACTIVE 'i' 206#define VALUE_OPT_LISTPEERS 'l' 207#define VALUE_OPT_NUMERIC 'n' 208#define VALUE_OPT_PEERS 'p' 209#define VALUE_OPT_SHOWPEERS 's' 210/** option flag (value) for help-value option */ 211#define VALUE_OPT_HELP '?' 212/** option flag (value) for more-help-value option */ 213#define VALUE_OPT_MORE_HELP '!' 214/** option flag (value) for version-value option */ 215#define VALUE_OPT_VERSION 0x1001 216/** option flag (value) for save-opts-value option */ 217#define VALUE_OPT_SAVE_OPTS '>' 218/** option flag (value) for load-opts-value option */ 219#define VALUE_OPT_LOAD_OPTS '<' 220#define SET_OPT_SAVE_OPTS(a) STMTS( \ 221 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 222 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 223 DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 224/* 225 * Interface defines not associated with particular options 226 */ 227#define ERRSKIP_OPTERR STMTS(ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP) 228#define ERRSTOP_OPTERR STMTS(ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP) 229#define RESTART_OPT(n) STMTS( \ 230 ntpdcOptions.curOptIdx = (n); \ 231 ntpdcOptions.pzCurOpt = NULL ) 232#define START_OPT RESTART_OPT(1) 233#define USAGE(c) (*ntpdcOptions.pUsageProc)(&ntpdcOptions, c) 234 235#ifdef __cplusplus 236extern "C" { 237#endif 238 239 240/* * * * * * 241 * 242 * Declare the ntpdc option descriptor. 243 */ 244extern tOptions ntpdcOptions; 245 246#if defined(ENABLE_NLS) 247# ifndef _ 248# include <stdio.h> 249# ifndef HAVE_GETTEXT 250 extern char * gettext(char const *); 251# else 252# include <libintl.h> 253# endif 254 255# ifndef ATTRIBUTE_FORMAT_ARG 256# define ATTRIBUTE_FORMAT_ARG(_a) 257# endif 258 259static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 260static inline char* aoGetsText(char const* pz) { 261 if (pz == NULL) return NULL; 262 return (char*)gettext(pz); 263} 264# define _(s) aoGetsText(s) 265# endif /* _() */ 266 267# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet |= \ 268 OPTPROC_NXLAT_OPT_CFG;) 269# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet |= \ 270 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 271 272# define OPT_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet &= \ 273 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 274# define OPT_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet &= \ 275 ~OPTPROC_NXLAT_OPT;) 276 277#else /* ENABLE_NLS */ 278# define OPT_NO_XLAT_CFG_NAMES 279# define OPT_NO_XLAT_OPT_NAMES 280 281# define OPT_XLAT_CFG_NAMES 282# define OPT_XLAT_OPT_NAMES 283 284# ifndef _ 285# define _(_s) _s 286# endif 287#endif /* ENABLE_NLS */ 288 289#ifdef __cplusplus 290} 291#endif 292#endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */ 293 294/* ntpdc-opts.h ends here */ 295