1
0

tcpprep_opts.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpprep_opts.h)
  4. *
  5. * It has been AutoGen-ed April 4, 2010 at 05:59:19 PM by AutoGen 5.9.9
  6. * From the definitions tcpprep_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 32:2:7 templates.
  10. */
  11. /*
  12. * This file was produced by an AutoOpts template. AutoOpts is a
  13. * copyrighted work. This header file is not encumbered by AutoOpts
  14. * licensing, but is provided under the licensing terms chosen by the
  15. * tcpprep author or copyright holder. AutoOpts is licensed under
  16. * the terms of the LGPL. The redistributable library (``libopts'') is
  17. * licensed under the terms of either the LGPL or, at the users discretion,
  18. * the BSD license. See the AutoOpts and/or libopts sources for details.
  19. *
  20. * This source file is copyrighted and licensed under the following terms:
  21. *
  22. * tcpprep copyright (c) 2000-2010 Aaron Turner - all rights reserved
  23. *
  24. * tcpprep is free software copyrighted by Aaron Turner.
  25. *
  26. * Redistribution and use in source and binary forms, with or without
  27. * modification, are permitted provided that the following conditions
  28. * are met:
  29. * 1. Redistributions of source code must retain the above copyright
  30. * notice, this list of conditions and the following disclaimer.
  31. * 2. Redistributions in binary form must reproduce the above copyright
  32. * notice, this list of conditions and the following disclaimer in the
  33. * documentation and/or other materials provided with the distribution.
  34. * 3. Neither the name ``Aaron Turner'' nor the name of any other
  35. * contributor may be used to endorse or promote products derived
  36. * from this software without specific prior written permission.
  37. *
  38. * tcpprep IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS
  39. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  40. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  41. * ARE DISCLAIMED. IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS
  42. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  43. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  44. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  45. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  46. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  47. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  48. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49. */
  50. /*
  51. * This file contains the programmatic interface to the Automated
  52. * Options generated for the tcpprep program.
  53. * These macros are documented in the AutoGen info file in the
  54. * "AutoOpts" chapter. Please refer to that doc for usage help.
  55. */
  56. #ifndef AUTOOPTS_TCPPREP_OPTS_H_GUARD
  57. #define AUTOOPTS_TCPPREP_OPTS_H_GUARD 1
  58. #include "config.h"
  59. #include <autoopts/options.h>
  60. /*
  61. * Ensure that the library used for compiling this generated header is at
  62. * least as new as the version current when the header template was released
  63. * (not counting patch version increments). Also ensure that the oldest
  64. * tolerable version is at least as old as what was current when the header
  65. * template was released.
  66. */
  67. #define AO_TEMPLATE_VERSION 131074
  68. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  69. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  70. # error option template version mismatches autoopts/options.h header
  71. Choke Me.
  72. #endif
  73. /*
  74. * Enumeration of each option:
  75. */
  76. typedef enum {
  77. INDEX_OPT_DBUG = 0,
  78. INDEX_OPT_AUTO = 1,
  79. INDEX_OPT_CIDR = 2,
  80. INDEX_OPT_REGEX = 3,
  81. INDEX_OPT_PORT = 4,
  82. INDEX_OPT_MAC = 5,
  83. INDEX_OPT_REVERSE = 6,
  84. INDEX_OPT_COMMENT = 7,
  85. INDEX_OPT_NO_ARG_COMMENT = 8,
  86. INDEX_OPT_INCLUDE = 9,
  87. INDEX_OPT_EXCLUDE = 10,
  88. INDEX_OPT_CACHEFILE = 11,
  89. INDEX_OPT_PCAP = 12,
  90. INDEX_OPT_PRINT_COMMENT = 13,
  91. INDEX_OPT_PRINT_INFO = 14,
  92. INDEX_OPT_PRINT_STATS = 15,
  93. INDEX_OPT_SERVICES = 16,
  94. INDEX_OPT_NONIP = 17,
  95. INDEX_OPT_RATIO = 18,
  96. INDEX_OPT_MINMASK = 19,
  97. INDEX_OPT_MAXMASK = 20,
  98. INDEX_OPT_VERBOSE = 21,
  99. INDEX_OPT_DECODE = 22,
  100. INDEX_OPT_VERSION = 23,
  101. INDEX_OPT_LESS_HELP = 24,
  102. INDEX_OPT_HELP = 25,
  103. INDEX_OPT_MORE_HELP = 26,
  104. INDEX_OPT_SAVE_OPTS = 27,
  105. INDEX_OPT_LOAD_OPTS = 28
  106. } teOptIndex;
  107. #define OPTION_CT 29
  108. /*
  109. * Interface defines for all options. Replace "n" with the UPPER_CASED
  110. * option name (as in the teOptIndex enumeration above).
  111. * e.g. HAVE_OPT( DBUG )
  112. */
  113. #define DESC(n) (tcpprepOptions.pOptDesc[INDEX_OPT_## n])
  114. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  115. #define OPT_ARG(n) (DESC(n).optArg.argString)
  116. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  117. #define COUNT_OPT(n) (DESC(n).optOccCt)
  118. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  119. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  120. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  121. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  122. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  123. #define CLEAR_OPT(n) STMTS( \
  124. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  125. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  126. DESC(n).fOptState |= OPTST_DISABLED; \
  127. DESC(n).optCookie = NULL )
  128. /* * * * * *
  129. *
  130. * Interface defines for specific options.
  131. */
  132. #ifdef DEBUG
  133. #define VALUE_OPT_DBUG 'd'
  134. #define OPT_VALUE_DBUG (DESC(DBUG).optArg.argInt)
  135. #endif /* DEBUG */
  136. #define VALUE_OPT_AUTO 'a'
  137. #define VALUE_OPT_CIDR 'c'
  138. #define VALUE_OPT_REGEX 'r'
  139. #define VALUE_OPT_PORT 'p'
  140. #define VALUE_OPT_MAC 'e'
  141. #define VALUE_OPT_REVERSE 6
  142. #define VALUE_OPT_COMMENT 'C'
  143. #define VALUE_OPT_NO_ARG_COMMENT 8
  144. #define VALUE_OPT_INCLUDE 'x'
  145. #define VALUE_OPT_EXCLUDE 'X'
  146. #define VALUE_OPT_CACHEFILE 'o'
  147. #define VALUE_OPT_PCAP 'i'
  148. #define VALUE_OPT_PRINT_COMMENT 'P'
  149. #define VALUE_OPT_PRINT_INFO 'I'
  150. #define VALUE_OPT_PRINT_STATS 'S'
  151. #define VALUE_OPT_SERVICES 's'
  152. #define VALUE_OPT_NONIP 'N'
  153. #define VALUE_OPT_RATIO 'R'
  154. #define VALUE_OPT_MINMASK 'm'
  155. #define OPT_VALUE_MINMASK (DESC(MINMASK).optArg.argInt)
  156. #define VALUE_OPT_MAXMASK 'M'
  157. #define OPT_VALUE_MAXMASK (DESC(MAXMASK).optArg.argInt)
  158. #ifdef ENABLE_VERBOSE
  159. #define VALUE_OPT_VERBOSE 'v'
  160. #define SET_OPT_VERBOSE STMTS( \
  161. DESC(VERBOSE).optActualIndex = 21; \
  162. DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
  163. DESC(VERBOSE).fOptState &= OPTST_PERSISTENT_MASK; \
  164. DESC(VERBOSE).fOptState |= OPTST_SET )
  165. #endif /* ENABLE_VERBOSE */
  166. #ifdef ENABLE_VERBOSE
  167. #define VALUE_OPT_DECODE 'A'
  168. #endif /* ENABLE_VERBOSE */
  169. #define VALUE_OPT_VERSION 'V'
  170. #define VALUE_OPT_LESS_HELP 'h'
  171. #define VALUE_OPT_HELP 'H'
  172. #define VALUE_OPT_MORE_HELP '!'
  173. #define VALUE_OPT_SAVE_OPTS INDEX_OPT_SAVE_OPTS
  174. #define VALUE_OPT_LOAD_OPTS INDEX_OPT_LOAD_OPTS
  175. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  176. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  177. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  178. DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  179. /*
  180. * Interface defines not associated with particular options
  181. */
  182. #define ERRSKIP_OPTERR STMTS( tcpprepOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  183. #define ERRSTOP_OPTERR STMTS( tcpprepOptions.fOptSet |= OPTPROC_ERRSTOP )
  184. #define RESTART_OPT(n) STMTS( \
  185. tcpprepOptions.curOptIdx = (n); \
  186. tcpprepOptions.pzCurOpt = NULL )
  187. #define START_OPT RESTART_OPT(1)
  188. #define USAGE(c) (*tcpprepOptions.pUsageProc)( &tcpprepOptions, c )
  189. /* extracted from /usr/local/share/autogen/opthead.tpl near line 409 */
  190. /* * * * * *
  191. *
  192. * Declare the tcpprep option descriptor.
  193. */
  194. #ifdef __cplusplus
  195. extern "C" {
  196. #endif
  197. extern tOptions tcpprepOptions;
  198. #if defined(ENABLE_NLS)
  199. # ifndef _
  200. # include <stdio.h>
  201. static inline char* aoGetsText( char const* pz ) {
  202. if (pz == NULL) return NULL;
  203. return (char*)gettext( pz );
  204. }
  205. # define _(s) aoGetsText(s)
  206. # endif /* _() */
  207. # define OPT_NO_XLAT_CFG_NAMES STMTS(tcpprepOptions.fOptSet |= \
  208. OPTPROC_NXLAT_OPT_CFG;)
  209. # define OPT_NO_XLAT_OPT_NAMES STMTS(tcpprepOptions.fOptSet |= \
  210. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  211. # define OPT_XLAT_CFG_NAMES STMTS(tcpprepOptions.fOptSet &= \
  212. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  213. # define OPT_XLAT_OPT_NAMES STMTS(tcpprepOptions.fOptSet &= \
  214. ~OPTPROC_NXLAT_OPT;)
  215. #else /* ENABLE_NLS */
  216. # define OPT_NO_XLAT_CFG_NAMES
  217. # define OPT_NO_XLAT_OPT_NAMES
  218. # define OPT_XLAT_CFG_NAMES
  219. # define OPT_XLAT_OPT_NAMES
  220. # ifndef _
  221. # define _(_s) _s
  222. # endif
  223. #endif /* ENABLE_NLS */
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227. #endif /* AUTOOPTS_TCPPREP_OPTS_H_GUARD */
  228. /* tcpprep_opts.h ends here */