1 /* $NetBSD: sntp-opts.h,v 1.1.1.2 2012/01/31 21:27:31 kardel Exp $ */ 2 3 /* 4 * EDIT THIS FILE WITH CAUTION (sntp-opts.h) 5 * 6 * It has been AutoGen-ed December 24, 2011 at 06:33:53 PM by AutoGen 5.12 7 * From the definitions sntp-opts.def 8 * and the template file options 9 * 10 * Generated from AutoOpts 35:0:10 templates. 11 * 12 * AutoOpts is a copyrighted work. This header file is not encumbered 13 * by AutoOpts licensing, but is provided under the licensing terms chosen 14 * by the sntp author or copyright holder. AutoOpts is 15 * licensed under the terms of the LGPL. The redistributable library 16 * (``libopts'') is licensed under the terms of either the LGPL or, at the 17 * users discretion, the BSD license. See the AutoOpts and/or libopts sources 18 * for details. 19 * 20 * This source file is copyrighted and licensed under the following terms: 21 * 22 * see html/copyright.html 23 * 24 */ 25 /* 26 * This file contains the programmatic interface to the Automated 27 * Options generated for the sntp program. 28 * These macros are documented in the AutoGen info file in the 29 * "AutoOpts" chapter. Please refer to that doc for usage help. 30 */ 31 #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD 32 #define AUTOOPTS_SNTP_OPTS_H_GUARD 1 33 #include "config.h" 34 #include <autoopts/options.h> 35 36 /* 37 * Ensure that the library used for compiling this generated header is at 38 * least as new as the version current when the header template was released 39 * (not counting patch version increments). Also ensure that the oldest 40 * tolerable version is at least as old as what was current when the header 41 * template was released. 42 */ 43 #define AO_TEMPLATE_VERSION 143360 44 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 45 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 46 # error option template version mismatches autoopts/options.h header 47 Choke Me. 48 #endif 49 50 /* 51 * Enumeration of each option: 52 */ 53 typedef enum { 54 INDEX_OPT_IPV4 = 0, 55 INDEX_OPT_IPV6 = 1, 56 INDEX_OPT_NORMALVERBOSE = 2, 57 INDEX_OPT_KOD = 3, 58 INDEX_OPT_SYSLOG = 4, 59 INDEX_OPT_LOGFILE = 5, 60 INDEX_OPT_SETTOD = 6, 61 INDEX_OPT_ADJTIME = 7, 62 INDEX_OPT_BROADCAST = 8, 63 INDEX_OPT_TIMEOUT = 9, 64 INDEX_OPT_AUTHENTICATION = 10, 65 INDEX_OPT_KEYFILE = 11, 66 INDEX_OPT_VERSION = 12, 67 INDEX_OPT_HELP = 13, 68 INDEX_OPT_MORE_HELP = 14, 69 INDEX_OPT_SAVE_OPTS = 15, 70 INDEX_OPT_LOAD_OPTS = 16 71 } teOptIndex; 72 73 #define OPTION_CT 17 74 #define SNTP_VERSION "4.2.6p5" 75 #define SNTP_FULL_VERSION "sntp 4.2.6p5" 76 77 /* 78 * Interface defines for all options. Replace "n" with the UPPER_CASED 79 * option name (as in the teOptIndex enumeration above). 80 * e.g. HAVE_OPT(IPV4) 81 */ 82 #define DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n]) 83 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 84 #define OPT_ARG(n) (DESC(n).optArg.argString) 85 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 86 #define COUNT_OPT(n) (DESC(n).optOccCt) 87 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 88 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 89 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 90 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 91 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 92 #define CLEAR_OPT(n) STMTS( \ 93 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 94 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 95 DESC(n).fOptState |= OPTST_DISABLED; \ 96 DESC(n).optCookie = NULL ) 97 98 /* * * * * * 99 * 100 * Enumeration of sntp exit codes 101 */ 102 typedef enum { 103 SNTP_EXIT_SUCCESS = 0, 104 SNTP_EXIT_FAILURE = 1 105 } sntp_exit_code_t; 106 /* 107 * Make sure there are no #define name conflicts with the option names 108 */ 109 #ifndef NO_OPTION_NAME_WARNINGS 110 # ifdef IPV4 111 # warning undefining IPV4 due to option name conflict 112 # undef IPV4 113 # endif 114 # ifdef IPV6 115 # warning undefining IPV6 due to option name conflict 116 # undef IPV6 117 # endif 118 # ifdef NORMALVERBOSE 119 # warning undefining NORMALVERBOSE due to option name conflict 120 # undef NORMALVERBOSE 121 # endif 122 # ifdef KOD 123 # warning undefining KOD due to option name conflict 124 # undef KOD 125 # endif 126 # ifdef SYSLOG 127 # warning undefining SYSLOG due to option name conflict 128 # undef SYSLOG 129 # endif 130 # ifdef LOGFILE 131 # warning undefining LOGFILE due to option name conflict 132 # undef LOGFILE 133 # endif 134 # ifdef SETTOD 135 # warning undefining SETTOD due to option name conflict 136 # undef SETTOD 137 # endif 138 # ifdef ADJTIME 139 # warning undefining ADJTIME due to option name conflict 140 # undef ADJTIME 141 # endif 142 # ifdef BROADCAST 143 # warning undefining BROADCAST due to option name conflict 144 # undef BROADCAST 145 # endif 146 # ifdef TIMEOUT 147 # warning undefining TIMEOUT due to option name conflict 148 # undef TIMEOUT 149 # endif 150 # ifdef AUTHENTICATION 151 # warning undefining AUTHENTICATION due to option name conflict 152 # undef AUTHENTICATION 153 # endif 154 # ifdef KEYFILE 155 # warning undefining KEYFILE due to option name conflict 156 # undef KEYFILE 157 # endif 158 #else /* NO_OPTION_NAME_WARNINGS */ 159 # undef IPV4 160 # undef IPV6 161 # undef NORMALVERBOSE 162 # undef KOD 163 # undef SYSLOG 164 # undef LOGFILE 165 # undef SETTOD 166 # undef ADJTIME 167 # undef BROADCAST 168 # undef TIMEOUT 169 # undef AUTHENTICATION 170 # undef KEYFILE 171 #endif /* NO_OPTION_NAME_WARNINGS */ 172 173 /* * * * * * 174 * 175 * Interface defines for specific options. 176 */ 177 #define VALUE_OPT_IPV4 '4' 178 #define VALUE_OPT_IPV6 '6' 179 #define VALUE_OPT_NORMALVERBOSE 'd' 180 #define VALUE_OPT_KOD 'K' 181 #define VALUE_OPT_SYSLOG 'p' 182 #define VALUE_OPT_LOGFILE 'l' 183 #define VALUE_OPT_SETTOD 's' 184 #define VALUE_OPT_ADJTIME 'j' 185 #define VALUE_OPT_BROADCAST 'b' 186 #define VALUE_OPT_TIMEOUT 't' 187 188 #define OPT_VALUE_TIMEOUT (DESC(TIMEOUT).optArg.argInt) 189 #define VALUE_OPT_AUTHENTICATION 'a' 190 191 #define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt) 192 #define VALUE_OPT_KEYFILE 'k' 193 #define VALUE_OPT_HELP '?' 194 #define VALUE_OPT_MORE_HELP '!' 195 #define VALUE_OPT_VERSION INDEX_OPT_VERSION 196 #define VALUE_OPT_SAVE_OPTS '>' 197 #define VALUE_OPT_LOAD_OPTS '<' 198 #define SET_OPT_SAVE_OPTS(a) STMTS( \ 199 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 200 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 201 DESC(SAVE_OPTS).optArg.argString = (char const*)(a) ) 202 /* 203 * Interface defines not associated with particular options 204 */ 205 #define ERRSKIP_OPTERR STMTS(sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP) 206 #define ERRSTOP_OPTERR STMTS(sntpOptions.fOptSet |= OPTPROC_ERRSTOP) 207 #define RESTART_OPT(n) STMTS( \ 208 sntpOptions.curOptIdx = (n); \ 209 sntpOptions.pzCurOpt = NULL) 210 #define START_OPT RESTART_OPT(1) 211 #define USAGE(c) (*sntpOptions.pUsageProc)(&sntpOptions, c) 212 /* extracted from opthead.tlib near line 451 */ 213 214 #ifdef __cplusplus 215 extern "C" { 216 #endif 217 218 /* * * * * * 219 * 220 * Declare the sntp option descriptor. 221 */ 222 extern tOptions sntpOptions; 223 224 #if defined(ENABLE_NLS) 225 # ifndef _ 226 # include <stdio.h> 227 static inline char* aoGetsText(char const* pz) { 228 if (pz == NULL) return NULL; 229 return (char*)gettext(pz); 230 } 231 # define _(s) aoGetsText(s) 232 # endif /* _() */ 233 234 # define OPT_NO_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet |= \ 235 OPTPROC_NXLAT_OPT_CFG;) 236 # define OPT_NO_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet |= \ 237 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 238 239 # define OPT_XLAT_CFG_NAMES STMTS(sntpOptions.fOptSet &= \ 240 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 241 # define OPT_XLAT_OPT_NAMES STMTS(sntpOptions.fOptSet &= \ 242 ~OPTPROC_NXLAT_OPT;) 243 244 #else /* ENABLE_NLS */ 245 # define OPT_NO_XLAT_CFG_NAMES 246 # define OPT_NO_XLAT_OPT_NAMES 247 248 # define OPT_XLAT_CFG_NAMES 249 # define OPT_XLAT_OPT_NAMES 250 251 # ifndef _ 252 # define _(_s) _s 253 # endif 254 #endif /* ENABLE_NLS */ 255 256 #ifdef __cplusplus 257 } 258 #endif 259 #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */ 260 /* sntp-opts.h ends here */ 261