tcpreplay_edit_opts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpreplay_edit_opts.h)
  4. *
  5. * It has been AutoGen-ed Monday June 9, 2008 at 11:05:43 AM PDT
  6. * From the definitions tcpreplay_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 30:0:5 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. * tcpreplay 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. * tcpreplay copyright 2000-2008 Aaron Turner - all rights reserved
  23. *
  24. * tcpreplay 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. * tcpreplay 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 tcpreplay 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_TCPREPLAY_EDIT_OPTS_H_GUARD
  57. #define AUTOOPTS_TCPREPLAY_EDIT_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 122880
  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_PORTMAP = 1,
  78. INDEX_OPT_SEED = 2,
  79. INDEX_OPT_PNAT = 3,
  80. INDEX_OPT_SRCIPMAP = 4,
  81. INDEX_OPT_DSTIPMAP = 5,
  82. INDEX_OPT_ENDPOINTS = 6,
  83. INDEX_OPT_SKIPBROADCAST = 7,
  84. INDEX_OPT_FIXCSUM = 8,
  85. INDEX_OPT_MTU = 9,
  86. INDEX_OPT_EFCS = 10,
  87. INDEX_OPT_TTL = 11,
  88. INDEX_OPT_FIXLEN = 12,
  89. INDEX_OPT_SKIPL2BROADCAST = 13,
  90. INDEX_OPT_DLT = 14,
  91. INDEX_OPT_ENET_DMAC = 15,
  92. INDEX_OPT_ENET_SMAC = 16,
  93. INDEX_OPT_ENET_VLAN = 17,
  94. INDEX_OPT_ENET_VLAN_TAG = 18,
  95. INDEX_OPT_ENET_VLAN_CFI = 19,
  96. INDEX_OPT_ENET_VLAN_PRI = 20,
  97. INDEX_OPT_HDLC_CONTROL = 21,
  98. INDEX_OPT_HDLC_ADDRESS = 22,
  99. INDEX_OPT_USER_DLT = 23,
  100. INDEX_OPT_USER_DLINK = 24,
  101. INDEX_OPT_DBUG = 25,
  102. INDEX_OPT_QUIET = 26,
  103. INDEX_OPT_TIMER = 27,
  104. INDEX_OPT_SLEEP_ACCEL = 28,
  105. INDEX_OPT_RDTSC_CLICKS = 29,
  106. INDEX_OPT_VERBOSE = 30,
  107. INDEX_OPT_DECODE = 31,
  108. INDEX_OPT_ENABLE_FILE_CACHE = 32,
  109. INDEX_OPT_CACHEFILE = 33,
  110. INDEX_OPT_INTF1 = 34,
  111. INDEX_OPT_INTF2 = 35,
  112. INDEX_OPT_LISTNICS = 36,
  113. INDEX_OPT_LOOP = 37,
  114. INDEX_OPT_PKTLEN = 38,
  115. INDEX_OPT_LIMIT = 39,
  116. INDEX_OPT_MULTIPLIER = 40,
  117. INDEX_OPT_PPS = 41,
  118. INDEX_OPT_MBPS = 42,
  119. INDEX_OPT_TOPSPEED = 43,
  120. INDEX_OPT_ONEATATIME = 44,
  121. INDEX_OPT_PID = 45,
  122. INDEX_OPT_VERSION = 46,
  123. INDEX_OPT_LESS_HELP = 47,
  124. INDEX_OPT_HELP = 48,
  125. INDEX_OPT_MORE_HELP = 49,
  126. INDEX_OPT_SAVE_OPTS = 50,
  127. INDEX_OPT_LOAD_OPTS = 51
  128. } teOptIndex;
  129. #define OPTION_CT 52
  130. /*
  131. * Interface defines for all options. Replace "n" with the UPPER_CASED
  132. * option name (as in the teOptIndex enumeration above).
  133. * e.g. HAVE_OPT( TCPEDIT )
  134. */
  135. #define DESC(n) (tcpreplayOptions.pOptDesc[INDEX_OPT_## n])
  136. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  137. #define OPT_ARG(n) (DESC(n).optArg.argString)
  138. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  139. #define COUNT_OPT(n) (DESC(n).optOccCt)
  140. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  141. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  142. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  143. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  144. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  145. #define CLEAR_OPT(n) STMTS( \
  146. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  147. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  148. DESC(n).fOptState |= OPTST_DISABLED; \
  149. DESC(n).optCookie = NULL )
  150. /*
  151. * Interface defines for specific options.
  152. */
  153. #define VALUE_OPT_PORTMAP 'r'
  154. #define VALUE_OPT_SEED 's'
  155. #define OPT_VALUE_SEED (DESC(SEED).optArg.argInt)
  156. #define VALUE_OPT_PNAT 'N'
  157. #define VALUE_OPT_SRCIPMAP 'S'
  158. #define VALUE_OPT_DSTIPMAP 'D'
  159. #ifdef HAVE_CACHEFILE_SUPPORT
  160. #define VALUE_OPT_ENDPOINTS 'e'
  161. #endif /* HAVE_CACHEFILE_SUPPORT */
  162. #define VALUE_OPT_SKIPBROADCAST 'b'
  163. #define VALUE_OPT_FIXCSUM 'C'
  164. #define VALUE_OPT_MTU 'm'
  165. #define OPT_VALUE_MTU (DESC(MTU).optArg.argInt)
  166. #define VALUE_OPT_EFCS 'E'
  167. #define VALUE_OPT_TTL 11
  168. #define VALUE_OPT_FIXLEN 'F'
  169. #define VALUE_OPT_SKIPL2BROADCAST 13
  170. #define VALUE_OPT_DLT 14
  171. #define VALUE_OPT_ENET_DMAC 15
  172. #define VALUE_OPT_ENET_SMAC 16
  173. #define VALUE_OPT_ENET_VLAN 17
  174. #define VALUE_OPT_ENET_VLAN_TAG 18
  175. #define OPT_VALUE_ENET_VLAN_TAG (DESC(ENET_VLAN_TAG).optArg.argInt)
  176. #define VALUE_OPT_ENET_VLAN_CFI 19
  177. #define OPT_VALUE_ENET_VLAN_CFI (DESC(ENET_VLAN_CFI).optArg.argInt)
  178. #define VALUE_OPT_ENET_VLAN_PRI 20
  179. #define OPT_VALUE_ENET_VLAN_PRI (DESC(ENET_VLAN_PRI).optArg.argInt)
  180. #define VALUE_OPT_HDLC_CONTROL 21
  181. #define OPT_VALUE_HDLC_CONTROL (DESC(HDLC_CONTROL).optArg.argInt)
  182. #define VALUE_OPT_HDLC_ADDRESS 22
  183. #define OPT_VALUE_HDLC_ADDRESS (DESC(HDLC_ADDRESS).optArg.argInt)
  184. #define VALUE_OPT_USER_DLT 23
  185. #define OPT_VALUE_USER_DLT (DESC(USER_DLT).optArg.argInt)
  186. #define VALUE_OPT_USER_DLINK 24
  187. #ifdef DEBUG
  188. #define VALUE_OPT_DBUG 'd'
  189. #define OPT_VALUE_DBUG (DESC(DBUG).optArg.argInt)
  190. #endif /* DEBUG */
  191. #define VALUE_OPT_QUIET 'q'
  192. #define VALUE_OPT_TIMER 'T'
  193. #define VALUE_OPT_SLEEP_ACCEL 28
  194. #define OPT_VALUE_SLEEP_ACCEL (DESC(SLEEP_ACCEL).optArg.argInt)
  195. #define VALUE_OPT_RDTSC_CLICKS 29
  196. #define OPT_VALUE_RDTSC_CLICKS (DESC(RDTSC_CLICKS).optArg.argInt)
  197. #ifdef ENABLE_VERBOSE
  198. #define VALUE_OPT_VERBOSE 'v'
  199. #define SET_OPT_VERBOSE STMTS( \
  200. DESC(VERBOSE).optActualIndex = 30; \
  201. DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
  202. DESC(VERBOSE).fOptState &= OPTST_PERSISTENT_MASK; \
  203. DESC(VERBOSE).fOptState |= OPTST_SET )
  204. #endif /* ENABLE_VERBOSE */
  205. #ifdef ENABLE_VERBOSE
  206. #define VALUE_OPT_DECODE 'A'
  207. #endif /* ENABLE_VERBOSE */
  208. #define VALUE_OPT_ENABLE_FILE_CACHE 'K'
  209. #define VALUE_OPT_CACHEFILE 'c'
  210. #define VALUE_OPT_INTF1 'i'
  211. #define VALUE_OPT_INTF2 'I'
  212. #ifdef ENABLE_PCAP_FINDALLDEVS
  213. #define VALUE_OPT_LISTNICS 132
  214. #endif /* ENABLE_PCAP_FINDALLDEVS */
  215. #define VALUE_OPT_LOOP 'l'
  216. #define OPT_VALUE_LOOP (DESC(LOOP).optArg.argInt)
  217. #define VALUE_OPT_PKTLEN 134
  218. #define VALUE_OPT_LIMIT 'L'
  219. #define OPT_VALUE_LIMIT (DESC(LIMIT).optArg.argInt)
  220. #define VALUE_OPT_MULTIPLIER 'x'
  221. #define VALUE_OPT_PPS 'p'
  222. #define OPT_VALUE_PPS (DESC(PPS).optArg.argInt)
  223. #define VALUE_OPT_MBPS 'M'
  224. #define VALUE_OPT_TOPSPEED 't'
  225. #define VALUE_OPT_ONEATATIME 'o'
  226. #define VALUE_OPT_PID 'P'
  227. #define VALUE_OPT_VERSION 'V'
  228. #define VALUE_OPT_LESS_HELP 'h'
  229. #define VALUE_OPT_HELP 'H'
  230. #define VALUE_OPT_MORE_HELP '!'
  231. #define VALUE_OPT_SAVE_OPTS INDEX_OPT_SAVE_OPTS
  232. #define VALUE_OPT_LOAD_OPTS INDEX_OPT_LOAD_OPTS
  233. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  234. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  235. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  236. DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  237. /*
  238. * Interface defines not associated with particular options
  239. */
  240. #define ERRSKIP_OPTERR STMTS( tcpreplayOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  241. #define ERRSTOP_OPTERR STMTS( tcpreplayOptions.fOptSet |= OPTPROC_ERRSTOP )
  242. #define RESTART_OPT(n) STMTS( \
  243. tcpreplayOptions.curOptIdx = (n); \
  244. tcpreplayOptions.pzCurOpt = NULL )
  245. #define START_OPT RESTART_OPT(1)
  246. #define USAGE(c) (*tcpreplayOptions.pUsageProc)( &tcpreplayOptions, c )
  247. /* extracted from /opt/local/share/autogen/opthead.tpl near line 380 */
  248. /* * * * * *
  249. *
  250. * Declare the tcpreplay option descriptor.
  251. */
  252. #ifdef __cplusplus
  253. extern "C" {
  254. #endif
  255. extern tOptions tcpreplayOptions;
  256. #ifndef _
  257. # if ENABLE_NLS
  258. # include <stdio.h>
  259. static inline char* aoGetsText( char const* pz ) {
  260. if (pz == NULL) return NULL;
  261. return (char*)gettext( pz );
  262. }
  263. # define _(s) aoGetsText(s)
  264. # else /* ENABLE_NLS */
  265. # define _(s) s
  266. # endif /* ENABLE_NLS */
  267. #endif
  268. #ifdef __cplusplus
  269. }
  270. #endif
  271. #endif /* AUTOOPTS_TCPREPLAY_EDIT_OPTS_H_GUARD */
  272. /* tcpreplay_edit_opts.h ends here */