/contrib/ntp/util/ntp-keygen-opts.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 318 lines · 246 code · 12 blank · 60 comment · 7 complexity · 77b8ac0764807c00d8e58c346c982eea MD5 · raw file

  1. /*
  2. * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
  3. *
  4. * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:55 AM EST
  5. * From the definitions ntp-keygen-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. * ntp-keygen 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. * ntp-keygen copyright 1970-2009 David L. Mills and/or others - all rights reserved
  22. *
  23. * see html/copyright.html
  24. */
  25. /*
  26. * This file contains the programmatic interface to the Automated
  27. * Options generated for the ntp-keygen 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_NTP_KEYGEN_OPTS_H_GUARD
  32. #define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD
  33. #include "config.h"
  34. #include <autoopts/options.h>
  35. /*
  36. * Ensure that the library used for compiling this generated header is at
  37. * least as new as the version current when the header template was released
  38. * (not counting patch version increments). Also ensure that the oldest
  39. * tolerable version is at least as old as what was current when the header
  40. * template was released.
  41. */
  42. #define AO_TEMPLATE_VERSION 118784
  43. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  44. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  45. # error option template version mismatches autoopts/options.h header
  46. Choke Me.
  47. #endif
  48. /*
  49. * Enumeration of each option:
  50. */
  51. typedef enum {
  52. INDEX_OPT_CERTIFICATE = 0,
  53. INDEX_OPT_DEBUG_LEVEL = 1,
  54. INDEX_OPT_SET_DEBUG_LEVEL = 2,
  55. INDEX_OPT_ID_KEY = 3,
  56. INDEX_OPT_GQ_PARAMS = 4,
  57. INDEX_OPT_GQ_KEYS = 5,
  58. INDEX_OPT_HOST_KEY = 6,
  59. INDEX_OPT_IFFKEY = 7,
  60. INDEX_OPT_ISSUER_NAME = 8,
  61. INDEX_OPT_MD5KEY = 9,
  62. INDEX_OPT_MODULUS = 10,
  63. INDEX_OPT_PVT_CERT = 11,
  64. INDEX_OPT_PVT_PASSWD = 12,
  65. INDEX_OPT_GET_PVT_PASSWD = 13,
  66. INDEX_OPT_SIGN_KEY = 14,
  67. INDEX_OPT_SUBJECT_NAME = 15,
  68. INDEX_OPT_TRUSTED_CERT = 16,
  69. INDEX_OPT_MV_PARAMS = 17,
  70. INDEX_OPT_MV_KEYS = 18,
  71. INDEX_OPT_VERSION = 19,
  72. INDEX_OPT_HELP = 20,
  73. INDEX_OPT_MORE_HELP = 21,
  74. INDEX_OPT_SAVE_OPTS = 22,
  75. INDEX_OPT_LOAD_OPTS = 23
  76. } teOptIndex;
  77. #define OPTION_CT 24
  78. #define NTP_KEYGEN_VERSION "4.2.4p8"
  79. #define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.4p8"
  80. /*
  81. * Interface defines for all options. Replace "n" with the UPPER_CASED
  82. * option name (as in the teOptIndex enumeration above).
  83. * e.g. HAVE_OPT( CERTIFICATE )
  84. */
  85. #define DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n])
  86. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  87. #define OPT_ARG(n) (DESC(n).optArg.argString)
  88. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  89. #define COUNT_OPT(n) (DESC(n).optOccCt)
  90. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  91. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  92. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  93. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  94. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  95. #define CLEAR_OPT(n) STMTS( \
  96. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  97. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  98. DESC(n).fOptState |= OPTST_DISABLED; \
  99. DESC(n).optCookie = NULL )
  100. /*
  101. * Make sure there are no #define name conflicts with the option names
  102. */
  103. #ifndef NO_OPTION_NAME_WARNINGS
  104. # ifdef CERTIFICATE
  105. # warning undefining CERTIFICATE due to option name conflict
  106. # undef CERTIFICATE
  107. # endif
  108. # ifdef DEBUG_LEVEL
  109. # warning undefining DEBUG_LEVEL due to option name conflict
  110. # undef DEBUG_LEVEL
  111. # endif
  112. # ifdef SET_DEBUG_LEVEL
  113. # warning undefining SET_DEBUG_LEVEL due to option name conflict
  114. # undef SET_DEBUG_LEVEL
  115. # endif
  116. # ifdef ID_KEY
  117. # warning undefining ID_KEY due to option name conflict
  118. # undef ID_KEY
  119. # endif
  120. # ifdef GQ_PARAMS
  121. # warning undefining GQ_PARAMS due to option name conflict
  122. # undef GQ_PARAMS
  123. # endif
  124. # ifdef GQ_KEYS
  125. # warning undefining GQ_KEYS due to option name conflict
  126. # undef GQ_KEYS
  127. # endif
  128. # ifdef HOST_KEY
  129. # warning undefining HOST_KEY due to option name conflict
  130. # undef HOST_KEY
  131. # endif
  132. # ifdef IFFKEY
  133. # warning undefining IFFKEY due to option name conflict
  134. # undef IFFKEY
  135. # endif
  136. # ifdef ISSUER_NAME
  137. # warning undefining ISSUER_NAME due to option name conflict
  138. # undef ISSUER_NAME
  139. # endif
  140. # ifdef MD5KEY
  141. # warning undefining MD5KEY due to option name conflict
  142. # undef MD5KEY
  143. # endif
  144. # ifdef MODULUS
  145. # warning undefining MODULUS due to option name conflict
  146. # undef MODULUS
  147. # endif
  148. # ifdef PVT_CERT
  149. # warning undefining PVT_CERT due to option name conflict
  150. # undef PVT_CERT
  151. # endif
  152. # ifdef PVT_PASSWD
  153. # warning undefining PVT_PASSWD due to option name conflict
  154. # undef PVT_PASSWD
  155. # endif
  156. # ifdef GET_PVT_PASSWD
  157. # warning undefining GET_PVT_PASSWD due to option name conflict
  158. # undef GET_PVT_PASSWD
  159. # endif
  160. # ifdef SIGN_KEY
  161. # warning undefining SIGN_KEY due to option name conflict
  162. # undef SIGN_KEY
  163. # endif
  164. # ifdef SUBJECT_NAME
  165. # warning undefining SUBJECT_NAME due to option name conflict
  166. # undef SUBJECT_NAME
  167. # endif
  168. # ifdef TRUSTED_CERT
  169. # warning undefining TRUSTED_CERT due to option name conflict
  170. # undef TRUSTED_CERT
  171. # endif
  172. # ifdef MV_PARAMS
  173. # warning undefining MV_PARAMS due to option name conflict
  174. # undef MV_PARAMS
  175. # endif
  176. # ifdef MV_KEYS
  177. # warning undefining MV_KEYS due to option name conflict
  178. # undef MV_KEYS
  179. # endif
  180. #else /* NO_OPTION_NAME_WARNINGS */
  181. # undef CERTIFICATE
  182. # undef DEBUG_LEVEL
  183. # undef SET_DEBUG_LEVEL
  184. # undef ID_KEY
  185. # undef GQ_PARAMS
  186. # undef GQ_KEYS
  187. # undef HOST_KEY
  188. # undef IFFKEY
  189. # undef ISSUER_NAME
  190. # undef MD5KEY
  191. # undef MODULUS
  192. # undef PVT_CERT
  193. # undef PVT_PASSWD
  194. # undef GET_PVT_PASSWD
  195. # undef SIGN_KEY
  196. # undef SUBJECT_NAME
  197. # undef TRUSTED_CERT
  198. # undef MV_PARAMS
  199. # undef MV_KEYS
  200. #endif /* NO_OPTION_NAME_WARNINGS */
  201. /*
  202. * Interface defines for specific options.
  203. */
  204. #ifdef OPENSSL
  205. #define VALUE_OPT_CERTIFICATE 'c'
  206. #endif /* OPENSSL */
  207. #ifdef DEBUG
  208. #define VALUE_OPT_DEBUG_LEVEL 'd'
  209. #endif /* DEBUG */
  210. #ifdef DEBUG
  211. #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
  212. #endif /* DEBUG */
  213. #ifdef OPENSSL
  214. #define VALUE_OPT_ID_KEY 'e'
  215. #endif /* OPENSSL */
  216. #ifdef OPENSSL
  217. #define VALUE_OPT_GQ_PARAMS 'G'
  218. #endif /* OPENSSL */
  219. #ifdef OPENSSL
  220. #define VALUE_OPT_GQ_KEYS 'g'
  221. #endif /* OPENSSL */
  222. #ifdef OPENSSL
  223. #define VALUE_OPT_HOST_KEY 'H'
  224. #endif /* OPENSSL */
  225. #ifdef OPENSSL
  226. #define VALUE_OPT_IFFKEY 'I'
  227. #endif /* OPENSSL */
  228. #ifdef OPENSSL
  229. #define VALUE_OPT_ISSUER_NAME 'i'
  230. #endif /* OPENSSL */
  231. #define VALUE_OPT_MD5KEY 'M'
  232. #ifdef OPENSSL
  233. #define VALUE_OPT_MODULUS 'm'
  234. #define OPT_VALUE_MODULUS (DESC(MODULUS).optArg.argInt)
  235. #endif /* OPENSSL */
  236. #ifdef OPENSSL
  237. #define VALUE_OPT_PVT_CERT 'P'
  238. #endif /* OPENSSL */
  239. #ifdef OPENSSL
  240. #define VALUE_OPT_PVT_PASSWD 'p'
  241. #endif /* OPENSSL */
  242. #ifdef OPENSSL
  243. #define VALUE_OPT_GET_PVT_PASSWD 'q'
  244. #endif /* OPENSSL */
  245. #ifdef OPENSSL
  246. #define VALUE_OPT_SIGN_KEY 'S'
  247. #endif /* OPENSSL */
  248. #ifdef OPENSSL
  249. #define VALUE_OPT_SUBJECT_NAME 's'
  250. #endif /* OPENSSL */
  251. #ifdef OPENSSL
  252. #define VALUE_OPT_TRUSTED_CERT 'T'
  253. #endif /* OPENSSL */
  254. #ifdef OPENSSL
  255. #define VALUE_OPT_MV_PARAMS 'V'
  256. #define OPT_VALUE_MV_PARAMS (DESC(MV_PARAMS).optArg.argInt)
  257. #endif /* OPENSSL */
  258. #ifdef OPENSSL
  259. #define VALUE_OPT_MV_KEYS 'v'
  260. #define OPT_VALUE_MV_KEYS (DESC(MV_KEYS).optArg.argInt)
  261. #endif /* OPENSSL */
  262. #define VALUE_OPT_VERSION 'v'
  263. #define VALUE_OPT_HELP '?'
  264. #define VALUE_OPT_MORE_HELP '!'
  265. #define VALUE_OPT_SAVE_OPTS '>'
  266. #define VALUE_OPT_LOAD_OPTS '<'
  267. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  268. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  269. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  270. DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  271. /*
  272. * Interface defines not associated with particular options
  273. */
  274. #define ERRSKIP_OPTERR STMTS( ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  275. #define ERRSTOP_OPTERR STMTS( ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP )
  276. #define RESTART_OPT(n) STMTS( \
  277. ntp_keygenOptions.curOptIdx = (n); \
  278. ntp_keygenOptions.pzCurOpt = NULL )
  279. #define START_OPT RESTART_OPT(1)
  280. #define USAGE(c) (*ntp_keygenOptions.pUsageProc)( &ntp_keygenOptions, c )
  281. /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
  282. /* * * * * *
  283. *
  284. * Declare the ntp-keygen option descriptor.
  285. */
  286. #ifdef __cplusplus
  287. extern "C" {
  288. #endif
  289. extern tOptions ntp_keygenOptions;
  290. #ifndef _
  291. # if ENABLE_NLS
  292. # include <stdio.h>
  293. static inline char* aoGetsText( char const* pz ) {
  294. if (pz == NULL) return NULL;
  295. return (char*)gettext( pz );
  296. }
  297. # define _(s) aoGetsText(s)
  298. # else /* ENABLE_NLS */
  299. # define _(s) s
  300. # endif /* ENABLE_NLS */
  301. #endif
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305. #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */
  306. /* ntp-keygen-opts.h ends here */