tcpreplay_opts.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpreplay_opts.h)
  4. *
  5. * It has been AutoGen-ed Monday July 17, 2006 at 06:47:14 PM PDT
  6. * From the definitions tcpreplay_opts.def
  7. * and the template file options
  8. */
  9. /*
  10. * This file contains the programmatic interface to the Automated
  11. * Options generated for the tcpreplay program.
  12. * These macros are documented in the AutoGen info file in the
  13. * "AutoOpts" chapter. Please refer to that doc for usage help.
  14. */
  15. #ifndef AUTOOPTS_TCPREPLAY_OPTS_H_GUARD
  16. #define AUTOOPTS_TCPREPLAY_OPTS_H_GUARD
  17. /*
  18. * tcpreplay copyright 2000-2005 Aaron Turner - all rights reserved
  19. *
  20. * tcpreplay is free software copyrighted by Aaron Turner.
  21. *
  22. * Redistribution and use in source and binary forms, with or without
  23. * modification, are permitted provided that the following conditions
  24. * are met:
  25. * 1. Redistributions of source code must retain the above copyright
  26. * notice, this list of conditions and the following disclaimer.
  27. * 2. Redistributions in binary form must reproduce the above copyright
  28. * notice, this list of conditions and the following disclaimer in the
  29. * documentation and/or other materials provided with the distribution.
  30. * 3. Neither the name ``Aaron Turner'' nor the name of any other
  31. * contributor may be used to endorse or promote products derived
  32. * from this software without specific prior written permission.
  33. *
  34. * tcpreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS
  35. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  36. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  37. * ARE DISCLAIMED. IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS
  38. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  39. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  40. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  41. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  42. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  43. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  44. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. */
  46. #include "config.h"
  47. #include <autoopts/options.h>
  48. /*
  49. * Ensure that the library used for compiling this generated header is at
  50. * least as new as the version current when the header template was released
  51. * (not counting patch version increments). Also ensure that the oldest
  52. * tolerable version is at least as old as what was current when the header
  53. * template was released.
  54. */
  55. #define AO_TEMPLATE_VERSION 110592
  56. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  57. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  58. # error option template version mismatches autoopts/options.h header
  59. #endif
  60. /*
  61. * Enumeration of each option:
  62. */
  63. typedef enum {
  64. INDEX_OPT_DBUG = 0,
  65. INDEX_OPT_VERBOSE = 1,
  66. INDEX_OPT_DECODE = 2,
  67. INDEX_OPT_CACHEFILE = 3,
  68. INDEX_OPT_INTF1 = 4,
  69. INDEX_OPT_INTF2 = 5,
  70. INDEX_OPT_LOOP = 6,
  71. INDEX_OPT_PKTLEN = 7,
  72. INDEX_OPT_MULTIPLIER = 8,
  73. INDEX_OPT_PPS = 9,
  74. INDEX_OPT_MBPS = 10,
  75. INDEX_OPT_TOPSPEED = 11,
  76. INDEX_OPT_ONEATATIME = 12,
  77. INDEX_OPT_PID = 13,
  78. INDEX_OPT_VERSION = 14,
  79. INDEX_OPT_LESS_HELP = 15,
  80. INDEX_OPT_HELP = 16,
  81. INDEX_OPT_MORE_HELP = 17,
  82. INDEX_OPT_SAVE_OPTS = 18,
  83. INDEX_OPT_LOAD_OPTS = 19
  84. } teOptIndex;
  85. #define OPTION_CT 20
  86. /*
  87. * Interface defines for all options. Replace "n" with
  88. * the UPPER_CASED option name (as in the teOptIndex
  89. * enumeration above). e.g. HAVE_OPT( DBUG )
  90. */
  91. #define DESC(n) tcpreplayOptions.pOptDesc[INDEX_OPT_ ## n]
  92. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  93. #define OPT_ARG(n) (DESC(n).pzLastArg)
  94. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  95. #define COUNT_OPT(n) (DESC(n).optOccCt)
  96. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  97. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  98. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  99. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  100. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  101. #define CLEAR_OPT(n) STMTS( \
  102. DESC(n).fOptState &= OPTST_PERSISTENT; \
  103. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  104. DESC(n).fOptState |= OPTST_DISABLED; \
  105. DESC(n).optCookie = NULL )
  106. /*
  107. * Interface defines for specific options.
  108. */
  109. #define VALUE_OPT_DBUG 'd'
  110. #define OPT_VALUE_DBUG (*(unsigned long*)(&DESC(DBUG).pzLastArg))
  111. #ifdef HAVE_TCPDUMP
  112. #define VALUE_OPT_VERBOSE 'v'
  113. #define SET_OPT_VERBOSE STMTS( \
  114. DESC(VERBOSE).optActualIndex = 1; \
  115. DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
  116. DESC(VERBOSE).fOptState &= OPTST_PERSISTENT; \
  117. DESC(VERBOSE).fOptState |= OPTST_SET )
  118. #endif /* HAVE_TCPDUMP */
  119. #ifdef HAVE_TCPDUMP
  120. #define VALUE_OPT_DECODE 'A'
  121. #endif /* HAVE_TCPDUMP */
  122. #define VALUE_OPT_CACHEFILE 'c'
  123. #define VALUE_OPT_INTF1 'i'
  124. #define VALUE_OPT_INTF2 'I'
  125. #define VALUE_OPT_LOOP 'l'
  126. #define OPT_VALUE_LOOP (*(unsigned long*)(&DESC(LOOP).pzLastArg))
  127. #define VALUE_OPT_PKTLEN 'L'
  128. #define VALUE_OPT_MULTIPLIER 'm'
  129. #define VALUE_OPT_PPS 'p'
  130. #define OPT_VALUE_PPS (*(unsigned long*)(&DESC(PPS).pzLastArg))
  131. #define VALUE_OPT_MBPS 'M'
  132. #define VALUE_OPT_TOPSPEED 't'
  133. #define VALUE_OPT_ONEATATIME 'o'
  134. #define VALUE_OPT_PID 'P'
  135. #define VALUE_OPT_VERSION 'V'
  136. #define VALUE_OPT_LESS_HELP 'h'
  137. #define VALUE_OPT_SAVE_OPTS INDEX_OPT_SAVE_OPTS
  138. #define VALUE_OPT_LOAD_OPTS INDEX_OPT_LOAD_OPTS
  139. #define VALUE_OPT_HELP 'H'
  140. #define VALUE_OPT_MORE_HELP '!'
  141. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  142. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \
  143. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  144. DESC(SAVE_OPTS).pzLastArg = (const char*)(a) )
  145. /*
  146. * Interface defines not associated with particular options
  147. */
  148. #define ERRSKIP_OPTERR STMTS( tcpreplayOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  149. #define ERRSTOP_OPTERR STMTS( tcpreplayOptions.fOptSet |= OPTPROC_ERRSTOP )
  150. #define RESTART_OPT(n) STMTS( \
  151. tcpreplayOptions.curOptIdx = (n); \
  152. tcpreplayOptions.pzCurOpt = NULL )
  153. #define START_OPT RESTART_OPT(1)
  154. #define USAGE(c) (*tcpreplayOptions.pUsageProc)( &tcpreplayOptions, c )
  155. /* extracted from opthead near line 289 */
  156. /* * * * * *
  157. *
  158. * Declare the tcpreplay option descriptor.
  159. */
  160. #ifdef __cplusplus
  161. extern "C" {
  162. #endif
  163. extern tOptions tcpreplayOptions;
  164. #ifndef _
  165. # if ENABLE_NLS
  166. # include <stdio.h>
  167. static inline char* aoGetsText( const char* pz ) {
  168. if (pz == NULL) return NULL;
  169. return (char*)gettext( pz );
  170. }
  171. # define _(s) aoGetsText(s)
  172. # else /* ENABLE_NLS */
  173. # define _(s) s
  174. # endif /* ENABLE_NLS */
  175. #endif
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179. #endif /* AUTOOPTS_TCPREPLAY_OPTS_H_GUARD */
  180. /*
  181. * Local Variables:
  182. * Mode: C
  183. * c-file-style: "stroustrup"
  184. * indent-tabs-mode: nil
  185. * End:
  186. * options.h ends here */