/contrib/ntp/sntp/sntp-opts.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 283 lines · 132 code · 12 blank · 139 comment · 7 complexity · 4ed5186b5d76884c6157afd214860447 MD5 · raw file

  1. /*
  2. * EDIT THIS FILE WITH CAUTION (sntp-opts.h)
  3. *
  4. * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:49 AM EST
  5. * From the definitions sntp-opts.def
  6. * and the template file options
  7. *
  8. * Generated from AutoOpts 29:0:4 templates.
  9. */
  10. /*
  11. * This file was produced by an AutoOpts template. AutoOpts is a
  12. * copyrighted work. This header file is not encumbered by AutoOpts
  13. * licensing, but is provided under the licensing terms chosen by the
  14. * sntp author or copyright holder. AutoOpts is licensed under
  15. * the terms of the LGPL. The redistributable library (``libopts'') is
  16. * licensed under the terms of either the LGPL or, at the users discretion,
  17. * the BSD license. See the AutoOpts and/or libopts sources for details.
  18. *
  19. * This source file is copyrighted and licensed under the following terms:
  20. *
  21. * sntp copyright 1970-2006 ntp.org - all rights reserved
  22. *
  23. * General Public Licence for the software known as MSNTP
  24. * ------------------------------------------------------
  25. *
  26. * (c) Copyright, N.M. Maclaren, 1996, 1997, 2000
  27. * (c) Copyright, University of Cambridge, 1996, 1997, 2000
  28. *
  29. *
  30. *
  31. * Free use of MSNTP in source and binary forms is permitted, provided that this
  32. * entire licence is duplicated in all copies, and that any documentation,
  33. * announcements, and other materials related to use acknowledge that the software
  34. * was developed by N.M. Maclaren (hereafter refered to as the Author) at the
  35. * University of Cambridge. Neither the name of the Author nor the University of
  36. * Cambridge may be used to endorse or promote products derived from this material
  37. * without specific prior written permission.
  38. *
  39. * The Author and the University of Cambridge retain the copyright and all other
  40. * legal rights to the software and make it available non-exclusively. All users
  41. * must ensure that the software in all its derivations carries a copyright notice
  42. * in the form:
  43. * (c) Copyright N.M. Maclaren,
  44. * (c) Copyright University of Cambridge.
  45. *
  46. *
  47. *
  48. * NO WARRANTY
  49. *
  50. * Because the MSNTP software is licensed free of charge, the Author and the
  51. * University of Cambridge provide absolutely no warranty, either expressed or
  52. * implied, including, but not limited to, the implied warranties of
  53. * merchantability and fitness for a particular purpose. The entire risk as to
  54. * the quality and performance of the MSNTP software is with you. Should MSNTP
  55. * prove defective, you assume the cost of all necessary servicing or repair.
  56. *
  57. * In no event, unless required by law, will the Author or the University of
  58. * Cambridge, or any other party who may modify and redistribute this software as
  59. * permitted in accordance with the provisions below, be liable for damages for
  60. * any losses whatsoever, including but not limited to lost profits, lost monies,
  61. * lost or corrupted data, or other special, incidental or consequential losses
  62. * that may arise out of the use or inability to use the MSNTP software.
  63. *
  64. *
  65. *
  66. * COPYING POLICY
  67. *
  68. * Permission is hereby granted for copying and distribution of copies of the
  69. * MSNTP source and binary files, and of any part thereof, subject to the
  70. * following licence conditions:
  71. *
  72. * 1. You may distribute MSNTP or components of MSNTP, with or without additions
  73. * developed by you or by others. No charge, other than an "at-cost" distribution
  74. * fee, may be charged for copies, derivations, or distributions of this material
  75. * without the express written consent of the copyright holders.
  76. *
  77. * 2. You may also distribute MSNTP along with any other product for sale,
  78. * provided that the cost of the bundled package is the same regardless of whether
  79. * MSNTP is included or not, and provided that those interested only in MSNTP must
  80. * be notified that it is a product freely available from the University of
  81. * Cambridge.
  82. *
  83. * 3. If you distribute MSNTP software or parts of MSNTP, with or without
  84. * additions developed by you or others, then you must either make available the
  85. * source to all portions of the MSNTP system (exclusive of any additions made by
  86. * you or by others) upon request, or instead you may notify anyone requesting
  87. * source that it is freely available from the University of Cambridge.
  88. *
  89. * 4. You may not omit any of the copyright notices on either the source files,
  90. * the executable files, or the documentation.
  91. *
  92. * 5. You may not omit transmission of this License agreement with whatever
  93. * portions of MSNTP that are distributed.
  94. *
  95. * 6. Any users of this software must be notified that it is without warranty or
  96. * guarantee of any nature, express or implied, nor is there any fitness for use
  97. * represented.
  98. *
  99. *
  100. * October 1996
  101. * April 1997
  102. * October 2000
  103. */
  104. /*
  105. * This file contains the programmatic interface to the Automated
  106. * Options generated for the sntp program.
  107. * These macros are documented in the AutoGen info file in the
  108. * "AutoOpts" chapter. Please refer to that doc for usage help.
  109. */
  110. #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD
  111. #define AUTOOPTS_SNTP_OPTS_H_GUARD
  112. #include "config.h"
  113. #include <autoopts/options.h>
  114. /*
  115. * Ensure that the library used for compiling this generated header is at
  116. * least as new as the version current when the header template was released
  117. * (not counting patch version increments). Also ensure that the oldest
  118. * tolerable version is at least as old as what was current when the header
  119. * template was released.
  120. */
  121. #define AO_TEMPLATE_VERSION 118784
  122. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  123. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  124. # error option template version mismatches autoopts/options.h header
  125. Choke Me.
  126. #endif
  127. /*
  128. * Enumeration of each option:
  129. */
  130. typedef enum {
  131. INDEX_OPT_IPV4 = 0,
  132. INDEX_OPT_IPV6 = 1,
  133. INDEX_OPT_UNPRIVPORT = 2,
  134. INDEX_OPT_NORMALVERBOSE = 3,
  135. INDEX_OPT_EXTRAVERBOSE = 4,
  136. INDEX_OPT_MEGAVERBOSE = 5,
  137. INDEX_OPT_SETTIMEOFDAY = 6,
  138. INDEX_OPT_ADJTIME = 7,
  139. INDEX_OPT_VERSION = 8,
  140. INDEX_OPT_HELP = 9,
  141. INDEX_OPT_MORE_HELP = 10,
  142. INDEX_OPT_SAVE_OPTS = 11,
  143. INDEX_OPT_LOAD_OPTS = 12
  144. } teOptIndex;
  145. #define OPTION_CT 13
  146. #define SNTP_VERSION "4.2.4p8"
  147. #define SNTP_FULL_VERSION "sntp - standard SNTP program - Ver. 4.2.4p8"
  148. /*
  149. * Interface defines for all options. Replace "n" with the UPPER_CASED
  150. * option name (as in the teOptIndex enumeration above).
  151. * e.g. HAVE_OPT( IPV4 )
  152. */
  153. #define DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n])
  154. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  155. #define OPT_ARG(n) (DESC(n).optArg.argString)
  156. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  157. #define COUNT_OPT(n) (DESC(n).optOccCt)
  158. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  159. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  160. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  161. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  162. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  163. #define CLEAR_OPT(n) STMTS( \
  164. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  165. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  166. DESC(n).fOptState |= OPTST_DISABLED; \
  167. DESC(n).optCookie = NULL )
  168. /*
  169. * Make sure there are no #define name conflicts with the option names
  170. */
  171. #ifndef NO_OPTION_NAME_WARNINGS
  172. # ifdef IPV4
  173. # warning undefining IPV4 due to option name conflict
  174. # undef IPV4
  175. # endif
  176. # ifdef IPV6
  177. # warning undefining IPV6 due to option name conflict
  178. # undef IPV6
  179. # endif
  180. # ifdef UNPRIVPORT
  181. # warning undefining UNPRIVPORT due to option name conflict
  182. # undef UNPRIVPORT
  183. # endif
  184. # ifdef NORMALVERBOSE
  185. # warning undefining NORMALVERBOSE due to option name conflict
  186. # undef NORMALVERBOSE
  187. # endif
  188. # ifdef EXTRAVERBOSE
  189. # warning undefining EXTRAVERBOSE due to option name conflict
  190. # undef EXTRAVERBOSE
  191. # endif
  192. # ifdef MEGAVERBOSE
  193. # warning undefining MEGAVERBOSE due to option name conflict
  194. # undef MEGAVERBOSE
  195. # endif
  196. # ifdef SETTIMEOFDAY
  197. # warning undefining SETTIMEOFDAY due to option name conflict
  198. # undef SETTIMEOFDAY
  199. # endif
  200. # ifdef ADJTIME
  201. # warning undefining ADJTIME due to option name conflict
  202. # undef ADJTIME
  203. # endif
  204. #else /* NO_OPTION_NAME_WARNINGS */
  205. # undef IPV4
  206. # undef IPV6
  207. # undef UNPRIVPORT
  208. # undef NORMALVERBOSE
  209. # undef EXTRAVERBOSE
  210. # undef MEGAVERBOSE
  211. # undef SETTIMEOFDAY
  212. # undef ADJTIME
  213. #endif /* NO_OPTION_NAME_WARNINGS */
  214. /*
  215. * Interface defines for specific options.
  216. */
  217. #define VALUE_OPT_IPV4 '4'
  218. #define WHICH_OPT_IPV4 (DESC(IPV4).optActualValue)
  219. #define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex)
  220. #define VALUE_OPT_IPV6 '6'
  221. #define VALUE_OPT_UNPRIVPORT 'u'
  222. #define VALUE_OPT_NORMALVERBOSE 'v'
  223. #define VALUE_OPT_EXTRAVERBOSE 'V'
  224. #define VALUE_OPT_MEGAVERBOSE 'W'
  225. #define VALUE_OPT_SETTIMEOFDAY 'r'
  226. #define VALUE_OPT_ADJTIME 'a'
  227. #define VALUE_OPT_VERSION 'v'
  228. #define VALUE_OPT_HELP '?'
  229. #define VALUE_OPT_MORE_HELP '!'
  230. #define VALUE_OPT_SAVE_OPTS '>'
  231. #define VALUE_OPT_LOAD_OPTS '<'
  232. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  233. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  234. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  235. DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  236. /*
  237. * Interface defines not associated with particular options
  238. */
  239. #define ERRSKIP_OPTERR STMTS( sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  240. #define ERRSTOP_OPTERR STMTS( sntpOptions.fOptSet |= OPTPROC_ERRSTOP )
  241. #define RESTART_OPT(n) STMTS( \
  242. sntpOptions.curOptIdx = (n); \
  243. sntpOptions.pzCurOpt = NULL )
  244. #define START_OPT RESTART_OPT(1)
  245. #define USAGE(c) (*sntpOptions.pUsageProc)( &sntpOptions, c )
  246. /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
  247. /* * * * * *
  248. *
  249. * Declare the sntp option descriptor.
  250. */
  251. #ifdef __cplusplus
  252. extern "C" {
  253. #endif
  254. extern tOptions sntpOptions;
  255. #ifndef _
  256. # if ENABLE_NLS
  257. # include <stdio.h>
  258. static inline char* aoGetsText( char const* pz ) {
  259. if (pz == NULL) return NULL;
  260. return (char*)gettext( pz );
  261. }
  262. # define _(s) aoGetsText(s)
  263. # else /* ENABLE_NLS */
  264. # define _(s) s
  265. # endif /* ENABLE_NLS */
  266. #endif
  267. #ifdef __cplusplus
  268. }
  269. #endif
  270. #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */
  271. /* sntp-opts.h ends here */