PageRenderTime 54ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/ntp-4.2.6p5/ntpd/ntpd-opts.h

#
C Header | 397 lines | 317 code | 17 blank | 63 comment | 5 complexity | da85c6b077876bc0be59a07f51f22061 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, LGPL-3.0
  1. /*
  2. * EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
  3. *
  4. * It has been AutoGen-ed December 24, 2011 at 06:34:00 PM by AutoGen 5.12
  5. * From the definitions ntpd-opts.def
  6. * and the template file options
  7. *
  8. * Generated from AutoOpts 35:0:10 templates.
  9. *
  10. * AutoOpts is a copyrighted work. This header file is not encumbered
  11. * by AutoOpts licensing, but is provided under the licensing terms chosen
  12. * by the ntpd author or copyright holder. AutoOpts is
  13. * licensed under the terms of the LGPL. The redistributable library
  14. * (``libopts'') is licensed under the terms of either the LGPL or, at the
  15. * users discretion, the BSD license. See the AutoOpts and/or libopts sources
  16. * for details.
  17. *
  18. * This source file is copyrighted and licensed under the following terms:
  19. *
  20. * see html/copyright.html
  21. *
  22. */
  23. /*
  24. * This file contains the programmatic interface to the Automated
  25. * Options generated for the ntpd program.
  26. * These macros are documented in the AutoGen info file in the
  27. * "AutoOpts" chapter. Please refer to that doc for usage help.
  28. */
  29. #ifndef AUTOOPTS_NTPD_OPTS_H_GUARD
  30. #define AUTOOPTS_NTPD_OPTS_H_GUARD 1
  31. #include "config.h"
  32. #include <autoopts/options.h>
  33. /*
  34. * Ensure that the library used for compiling this generated header is at
  35. * least as new as the version current when the header template was released
  36. * (not counting patch version increments). Also ensure that the oldest
  37. * tolerable version is at least as old as what was current when the header
  38. * template was released.
  39. */
  40. #define AO_TEMPLATE_VERSION 143360
  41. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  42. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  43. # error option template version mismatches autoopts/options.h header
  44. Choke Me.
  45. #endif
  46. /*
  47. * Enumeration of each option:
  48. */
  49. typedef enum {
  50. INDEX_OPT_IPV4 = 0,
  51. INDEX_OPT_IPV6 = 1,
  52. INDEX_OPT_AUTHREQ = 2,
  53. INDEX_OPT_AUTHNOREQ = 3,
  54. INDEX_OPT_BCASTSYNC = 4,
  55. INDEX_OPT_CONFIGFILE = 5,
  56. INDEX_OPT_DEBUG_LEVEL = 6,
  57. INDEX_OPT_SET_DEBUG_LEVEL = 7,
  58. INDEX_OPT_DRIFTFILE = 8,
  59. INDEX_OPT_PANICGATE = 9,
  60. INDEX_OPT_JAILDIR = 10,
  61. INDEX_OPT_INTERFACE = 11,
  62. INDEX_OPT_KEYFILE = 12,
  63. INDEX_OPT_LOGFILE = 13,
  64. INDEX_OPT_NOVIRTUALIPS = 14,
  65. INDEX_OPT_MODIFYMMTIMER = 15,
  66. INDEX_OPT_NOFORK = 16,
  67. INDEX_OPT_NICE = 17,
  68. INDEX_OPT_PIDFILE = 18,
  69. INDEX_OPT_PRIORITY = 19,
  70. INDEX_OPT_QUIT = 20,
  71. INDEX_OPT_PROPAGATIONDELAY = 21,
  72. INDEX_OPT_SAVECONFIGQUIT = 22,
  73. INDEX_OPT_STATSDIR = 23,
  74. INDEX_OPT_TRUSTEDKEY = 24,
  75. INDEX_OPT_USER = 25,
  76. INDEX_OPT_UPDATEINTERVAL = 26,
  77. INDEX_OPT_VAR = 27,
  78. INDEX_OPT_DVAR = 28,
  79. INDEX_OPT_SLEW = 29,
  80. INDEX_OPT_USEPCC = 30,
  81. INDEX_OPT_PCCFREQ = 31,
  82. INDEX_OPT_MLOCK = 32,
  83. INDEX_OPT_VERSION = 33,
  84. INDEX_OPT_HELP = 34,
  85. INDEX_OPT_MORE_HELP = 35
  86. } teOptIndex;
  87. #define OPTION_CT 36
  88. #define NTPD_VERSION "4.2.6p5"
  89. #define NTPD_FULL_VERSION "ntpd 4.2.6p5"
  90. /*
  91. * Interface defines for all options. Replace "n" with the UPPER_CASED
  92. * option name (as in the teOptIndex enumeration above).
  93. * e.g. HAVE_OPT(IPV4)
  94. */
  95. #define DESC(n) (ntpdOptions.pOptDesc[INDEX_OPT_## n])
  96. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  97. #define OPT_ARG(n) (DESC(n).optArg.argString)
  98. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  99. #define COUNT_OPT(n) (DESC(n).optOccCt)
  100. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  101. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  102. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  103. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  104. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  105. #define CLEAR_OPT(n) STMTS( \
  106. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  107. if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  108. DESC(n).fOptState |= OPTST_DISABLED; \
  109. DESC(n).optCookie = NULL )
  110. /* * * * * *
  111. *
  112. * Enumeration of ntpd exit codes
  113. */
  114. typedef enum {
  115. NTPD_EXIT_SUCCESS = 0,
  116. NTPD_EXIT_FAILURE = 1
  117. } ntpd_exit_code_t;
  118. /*
  119. * Make sure there are no #define name conflicts with the option names
  120. */
  121. #ifndef NO_OPTION_NAME_WARNINGS
  122. # ifdef IPV4
  123. # warning undefining IPV4 due to option name conflict
  124. # undef IPV4
  125. # endif
  126. # ifdef IPV6
  127. # warning undefining IPV6 due to option name conflict
  128. # undef IPV6
  129. # endif
  130. # ifdef AUTHREQ
  131. # warning undefining AUTHREQ due to option name conflict
  132. # undef AUTHREQ
  133. # endif
  134. # ifdef AUTHNOREQ
  135. # warning undefining AUTHNOREQ due to option name conflict
  136. # undef AUTHNOREQ
  137. # endif
  138. # ifdef BCASTSYNC
  139. # warning undefining BCASTSYNC due to option name conflict
  140. # undef BCASTSYNC
  141. # endif
  142. # ifdef CONFIGFILE
  143. # warning undefining CONFIGFILE due to option name conflict
  144. # undef CONFIGFILE
  145. # endif
  146. # ifdef DEBUG_LEVEL
  147. # warning undefining DEBUG_LEVEL due to option name conflict
  148. # undef DEBUG_LEVEL
  149. # endif
  150. # ifdef SET_DEBUG_LEVEL
  151. # warning undefining SET_DEBUG_LEVEL due to option name conflict
  152. # undef SET_DEBUG_LEVEL
  153. # endif
  154. # ifdef DRIFTFILE
  155. # warning undefining DRIFTFILE due to option name conflict
  156. # undef DRIFTFILE
  157. # endif
  158. # ifdef PANICGATE
  159. # warning undefining PANICGATE due to option name conflict
  160. # undef PANICGATE
  161. # endif
  162. # ifdef JAILDIR
  163. # warning undefining JAILDIR due to option name conflict
  164. # undef JAILDIR
  165. # endif
  166. # ifdef INTERFACE
  167. # warning undefining INTERFACE due to option name conflict
  168. # undef INTERFACE
  169. # endif
  170. # ifdef KEYFILE
  171. # warning undefining KEYFILE due to option name conflict
  172. # undef KEYFILE
  173. # endif
  174. # ifdef LOGFILE
  175. # warning undefining LOGFILE due to option name conflict
  176. # undef LOGFILE
  177. # endif
  178. # ifdef NOVIRTUALIPS
  179. # warning undefining NOVIRTUALIPS due to option name conflict
  180. # undef NOVIRTUALIPS
  181. # endif
  182. # ifdef MODIFYMMTIMER
  183. # warning undefining MODIFYMMTIMER due to option name conflict
  184. # undef MODIFYMMTIMER
  185. # endif
  186. # ifdef MLOCK
  187. # warning undefining MLOCK due to option name conflict
  188. # undef MLOCK
  189. # endif
  190. # ifdef NOFORK
  191. # warning undefining NOFORK due to option name conflict
  192. # undef NOFORK
  193. # endif
  194. # ifdef NICE
  195. # warning undefining NICE due to option name conflict
  196. # undef NICE
  197. # endif
  198. # ifdef PIDFILE
  199. # warning undefining PIDFILE due to option name conflict
  200. # undef PIDFILE
  201. # endif
  202. # ifdef PRIORITY
  203. # warning undefining PRIORITY due to option name conflict
  204. # undef PRIORITY
  205. # endif
  206. # ifdef QUIT
  207. # warning undefining QUIT due to option name conflict
  208. # undef QUIT
  209. # endif
  210. # ifdef PROPAGATIONDELAY
  211. # warning undefining PROPAGATIONDELAY due to option name conflict
  212. # undef PROPAGATIONDELAY
  213. # endif
  214. # ifdef SAVECONFIGQUIT
  215. # warning undefining SAVECONFIGQUIT due to option name conflict
  216. # undef SAVECONFIGQUIT
  217. # endif
  218. # ifdef STATSDIR
  219. # warning undefining STATSDIR due to option name conflict
  220. # undef STATSDIR
  221. # endif
  222. # ifdef TRUSTEDKEY
  223. # warning undefining TRUSTEDKEY due to option name conflict
  224. # undef TRUSTEDKEY
  225. # endif
  226. # ifdef USER
  227. # warning undefining USER due to option name conflict
  228. # undef USER
  229. # endif
  230. # ifdef UPDATEINTERVAL
  231. # warning undefining UPDATEINTERVAL due to option name conflict
  232. # undef UPDATEINTERVAL
  233. # endif
  234. # ifdef VAR
  235. # warning undefining VAR due to option name conflict
  236. # undef VAR
  237. # endif
  238. # ifdef DVAR
  239. # warning undefining DVAR due to option name conflict
  240. # undef DVAR
  241. # endif
  242. # ifdef SLEW
  243. # warning undefining SLEW due to option name conflict
  244. # undef SLEW
  245. # endif
  246. # ifdef USEPCC
  247. # warning undefining USEPCC due to option name conflict
  248. # undef USEPCC
  249. # endif
  250. # ifdef PCCFREQ
  251. # warning undefining PCCFREQ due to option name conflict
  252. # undef PCCFREQ
  253. # endif
  254. #else /* NO_OPTION_NAME_WARNINGS */
  255. # undef IPV4
  256. # undef IPV6
  257. # undef AUTHREQ
  258. # undef AUTHNOREQ
  259. # undef BCASTSYNC
  260. # undef CONFIGFILE
  261. # undef DEBUG_LEVEL
  262. # undef SET_DEBUG_LEVEL
  263. # undef DRIFTFILE
  264. # undef PANICGATE
  265. # undef JAILDIR
  266. # undef INTERFACE
  267. # undef KEYFILE
  268. # undef LOGFILE
  269. # undef NOVIRTUALIPS
  270. # undef MODIFYMMTIMER
  271. # undef MLOCK
  272. # undef NOFORK
  273. # undef NICE
  274. # undef PIDFILE
  275. # undef PRIORITY
  276. # undef QUIT
  277. # undef PROPAGATIONDELAY
  278. # undef SAVECONFIGQUIT
  279. # undef STATSDIR
  280. # undef TRUSTEDKEY
  281. # undef USER
  282. # undef UPDATEINTERVAL
  283. # undef VAR
  284. # undef DVAR
  285. # undef SLEW
  286. # undef USEPCC
  287. # undef PCCFREQ
  288. #endif /* NO_OPTION_NAME_WARNINGS */
  289. /* * * * * *
  290. *
  291. * Interface defines for specific options.
  292. */
  293. #define VALUE_OPT_IPV4 '4'
  294. #define VALUE_OPT_IPV6 '6'
  295. #define VALUE_OPT_AUTHREQ 'a'
  296. #define VALUE_OPT_AUTHNOREQ 'A'
  297. #define VALUE_OPT_BCASTSYNC 'b'
  298. #define VALUE_OPT_CONFIGFILE 'c'
  299. #define VALUE_OPT_DEBUG_LEVEL 'd'
  300. #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
  301. #define VALUE_OPT_DRIFTFILE 'f'
  302. #define VALUE_OPT_PANICGATE 'g'
  303. #define VALUE_OPT_JAILDIR 'i'
  304. #define VALUE_OPT_INTERFACE 'I'
  305. #define VALUE_OPT_KEYFILE 'k'
  306. #define VALUE_OPT_LOGFILE 'l'
  307. #define VALUE_OPT_NOVIRTUALIPS 'L'
  308. #define VALUE_OPT_MODIFYMMTIMER 'M'
  309. #define VALUE_OPT_MLOCK 'm'
  310. #define VALUE_OPT_NOFORK 'n'
  311. #define VALUE_OPT_NICE 'N'
  312. #define VALUE_OPT_PIDFILE 'p'
  313. #define VALUE_OPT_PRIORITY 'P'
  314. #define OPT_VALUE_PRIORITY (DESC(PRIORITY).optArg.argInt)
  315. #define VALUE_OPT_QUIT 'q'
  316. #define VALUE_OPT_PROPAGATIONDELAY 'r'
  317. #define VALUE_OPT_SAVECONFIGQUIT 22
  318. #define VALUE_OPT_STATSDIR 's'
  319. #define VALUE_OPT_TRUSTEDKEY 't'
  320. #define VALUE_OPT_USER 'u'
  321. #define VALUE_OPT_UPDATEINTERVAL 'U'
  322. #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt)
  323. #define VALUE_OPT_VAR 27
  324. #define VALUE_OPT_DVAR 28
  325. #define VALUE_OPT_SLEW 'x'
  326. #define VALUE_OPT_USEPCC 30
  327. #define VALUE_OPT_PCCFREQ 31
  328. #define VALUE_OPT_HELP '?'
  329. #define VALUE_OPT_MORE_HELP '!'
  330. #define VALUE_OPT_VERSION INDEX_OPT_VERSION
  331. /*
  332. * Interface defines not associated with particular options
  333. */
  334. #define ERRSKIP_OPTERR STMTS(ntpdOptions.fOptSet &= ~OPTPROC_ERRSTOP)
  335. #define ERRSTOP_OPTERR STMTS(ntpdOptions.fOptSet |= OPTPROC_ERRSTOP)
  336. #define RESTART_OPT(n) STMTS( \
  337. ntpdOptions.curOptIdx = (n); \
  338. ntpdOptions.pzCurOpt = NULL)
  339. #define START_OPT RESTART_OPT(1)
  340. #define USAGE(c) (*ntpdOptions.pUsageProc)(&ntpdOptions, c)
  341. /* extracted from opthead.tlib near line 451 */
  342. #ifdef __cplusplus
  343. extern "C" {
  344. #endif
  345. /* * * * * *
  346. *
  347. * Declare the ntpd option descriptor.
  348. */
  349. extern tOptions ntpdOptions;
  350. #if defined(ENABLE_NLS)
  351. # ifndef _
  352. # include <stdio.h>
  353. static inline char* aoGetsText(char const* pz) {
  354. if (pz == NULL) return NULL;
  355. return (char*)gettext(pz);
  356. }
  357. # define _(s) aoGetsText(s)
  358. # endif /* _() */
  359. # define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet |= \
  360. OPTPROC_NXLAT_OPT_CFG;)
  361. # define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet |= \
  362. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  363. # define OPT_XLAT_CFG_NAMES STMTS(ntpdOptions.fOptSet &= \
  364. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  365. # define OPT_XLAT_OPT_NAMES STMTS(ntpdOptions.fOptSet &= \
  366. ~OPTPROC_NXLAT_OPT;)
  367. #else /* ENABLE_NLS */
  368. # define OPT_NO_XLAT_CFG_NAMES
  369. # define OPT_NO_XLAT_OPT_NAMES
  370. # define OPT_XLAT_CFG_NAMES
  371. # define OPT_XLAT_OPT_NAMES
  372. # ifndef _
  373. # define _(_s) _s
  374. # endif
  375. #endif /* ENABLE_NLS */
  376. #ifdef __cplusplus
  377. }
  378. #endif
  379. #endif /* AUTOOPTS_NTPD_OPTS_H_GUARD */
  380. /* ntpd-opts.h ends here */