tcpcapinfo_opts.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpcapinfo_opts.h)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions tcpcapinfo_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 41:1:16 templates.
  10. *
  11. * AutoOpts is a copyrighted work. This header file is not encumbered
  12. * by AutoOpts licensing, but is provided under the licensing terms chosen
  13. * by the tcpcapinfo author or copyright holder. AutoOpts is
  14. * licensed under the terms of the LGPL. The redistributable library
  15. * (``libopts'') is licensed under the terms of either the LGPL or, at the
  16. * users discretion, the BSD license. See the AutoOpts and/or libopts sources
  17. * for details.
  18. *
  19. * The tcpcapinfo program is copyrighted and licensed
  20. * under the following terms:
  21. *
  22. * Copyright (C) 2000-2012 Aaron Turner and Fred Klassen, all rights reserved.
  23. * This is free software. It is licensed for use, modification and
  24. * redistribution under the terms of the GNU General Public License,
  25. * version 3 or later <http://gnu.org/licenses/gpl.html>
  26. *
  27. * tcpcapinfo is free software: you can redistribute it and/or modify it
  28. * under the terms of the GNU General Public License as published by the
  29. * Free Software Foundation, either version 3 of the License, or
  30. * (at your option) any later version.
  31. *
  32. * tcpcapinfo is distributed in the hope that it will be useful, but
  33. * WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  35. * See the GNU General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU General Public License along
  38. * with this program. If not, see <http://www.gnu.org/licenses/>.
  39. */
  40. /**
  41. * This file contains the programmatic interface to the Automated
  42. * Options generated for the tcpcapinfo program.
  43. * These macros are documented in the AutoGen info file in the
  44. * "AutoOpts" chapter. Please refer to that doc for usage help.
  45. */
  46. #ifndef AUTOOPTS_TCPCAPINFO_OPTS_H_GUARD
  47. #define AUTOOPTS_TCPCAPINFO_OPTS_H_GUARD 1
  48. #include "config.h"
  49. #include <autoopts/options.h>
  50. /**
  51. * Ensure that the library used for compiling this generated header is at
  52. * least as new as the version current when the header template was released
  53. * (not counting patch version increments). Also ensure that the oldest
  54. * tolerable version is at least as old as what was current when the header
  55. * template was released.
  56. */
  57. #define AO_TEMPLATE_VERSION 167937
  58. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  59. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  60. # error option template version mismatches autoopts/options.h header
  61. Choke Me.
  62. #endif
  63. /**
  64. * Enumeration of each option type for tcpcapinfo
  65. */
  66. typedef enum {
  67. INDEX_OPT_DBUG = 0,
  68. INDEX_OPT_VERSION = 1,
  69. INDEX_OPT_HELP = 2,
  70. INDEX_OPT_MORE_HELP = 3
  71. } teOptIndex;
  72. /** count of all options for tcpcapinfo */
  73. #define OPTION_CT 4
  74. /**
  75. * Interface defines for all options. Replace "n" with the UPPER_CASED
  76. * option name (as in the teOptIndex enumeration above).
  77. * e.g. HAVE_OPT(DBUG)
  78. */
  79. #define DESC(n) (tcpcapinfoOptions.pOptDesc[INDEX_OPT_## n])
  80. /** 'true' if an option has been specified in any way */
  81. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  82. /** The string argument to an option. The argument type must be \"string\". */
  83. #define OPT_ARG(n) (DESC(n).optArg.argString)
  84. /** Mask the option state revealing how an option was specified.
  85. * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
  86. * \a OPTST_DEFINED, \a OPTST_RESET or zero.
  87. */
  88. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  89. /** Count of option's occurrances *on the command line*. */
  90. #define COUNT_OPT(n) (DESC(n).optOccCt)
  91. /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
  92. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  93. /** 'true' if \a HAVE_OPT would yield 'false'. */
  94. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  95. /** 'true' if OPTST_DISABLED bit not set. */
  96. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  97. /** number of stacked option arguments.
  98. * Valid only for stacked option arguments. */
  99. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  100. /** stacked argument vector.
  101. * Valid only for stacked option arguments. */
  102. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  103. /** Reset an option. */
  104. #define CLEAR_OPT(n) STMTS( \
  105. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  106. if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  107. DESC(n).fOptState |= OPTST_DISABLED; \
  108. DESC(n).optCookie = NULL )
  109. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  110. /**
  111. * Enumeration of tcpcapinfo exit codes
  112. */
  113. typedef enum {
  114. TCPCAPINFO_EXIT_SUCCESS = 0,
  115. TCPCAPINFO_EXIT_FAILURE = 1,
  116. TCPCAPINFO_EXIT_USAGE_ERROR = 64,
  117. TCPCAPINFO_EXIT_LIBOPTS_FAILURE = 70
  118. } tcpcapinfo_exit_code_t;
  119. /**
  120. * Interface defines for specific options.
  121. * @{
  122. */
  123. #define VALUE_OPT_DBUG 'd'
  124. #ifdef DEBUG
  125. #define OPT_VALUE_DBUG (DESC(DBUG).optArg.argInt)
  126. #endif /* DEBUG */
  127. #define VALUE_OPT_VERSION 'V'
  128. /** option flag (value) for help-value option */
  129. #define VALUE_OPT_HELP 'H'
  130. /** option flag (value) for more-help-value option */
  131. #define VALUE_OPT_MORE_HELP '!'
  132. /*
  133. * Interface defines not associated with particular options
  134. */
  135. #define ERRSKIP_OPTERR STMTS(tcpcapinfoOptions.fOptSet &= ~OPTPROC_ERRSTOP)
  136. #define ERRSTOP_OPTERR STMTS(tcpcapinfoOptions.fOptSet |= OPTPROC_ERRSTOP)
  137. #define RESTART_OPT(n) STMTS( \
  138. tcpcapinfoOptions.curOptIdx = (n); \
  139. tcpcapinfoOptions.pzCurOpt = NULL )
  140. #define START_OPT RESTART_OPT(1)
  141. #define USAGE(c) (*tcpcapinfoOptions.pUsageProc)(&tcpcapinfoOptions, c)
  142. #ifdef __cplusplus
  143. extern "C" {
  144. #endif
  145. /* * * * * *
  146. *
  147. * Declare the tcpcapinfo option descriptor.
  148. */
  149. extern tOptions tcpcapinfoOptions;
  150. #if defined(ENABLE_NLS)
  151. # ifndef _
  152. # include <stdio.h>
  153. # ifndef HAVE_GETTEXT
  154. extern char * gettext(char const *);
  155. # else
  156. # include <libintl.h>
  157. # endif
  158. # ifndef ATTRIBUTE_FORMAT_ARG
  159. # define ATTRIBUTE_FORMAT_ARG(_a)
  160. # endif
  161. static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
  162. static inline char* aoGetsText(char const* pz) {
  163. if (pz == NULL) return NULL;
  164. return (char*)gettext(pz);
  165. }
  166. # define _(s) aoGetsText(s)
  167. # endif /* _() */
  168. # define OPT_NO_XLAT_CFG_NAMES STMTS(tcpcapinfoOptions.fOptSet |= \
  169. OPTPROC_NXLAT_OPT_CFG;)
  170. # define OPT_NO_XLAT_OPT_NAMES STMTS(tcpcapinfoOptions.fOptSet |= \
  171. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  172. # define OPT_XLAT_CFG_NAMES STMTS(tcpcapinfoOptions.fOptSet &= \
  173. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  174. # define OPT_XLAT_OPT_NAMES STMTS(tcpcapinfoOptions.fOptSet &= \
  175. ~OPTPROC_NXLAT_OPT;)
  176. #else /* ENABLE_NLS */
  177. # define OPT_NO_XLAT_CFG_NAMES
  178. # define OPT_NO_XLAT_OPT_NAMES
  179. # define OPT_XLAT_CFG_NAMES
  180. # define OPT_XLAT_OPT_NAMES
  181. # ifndef _
  182. # define _(_s) _s
  183. # endif
  184. #endif /* ENABLE_NLS */
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188. #endif /* AUTOOPTS_TCPCAPINFO_OPTS_H_GUARD */
  189. /* tcpcapinfo_opts.h ends here */