tcprewrite_opts.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcprewrite_opts.h)
  4. *
  5. * It has been AutoGen-ed Monday August 7, 2006 at 09:28:37 PM PDT
  6. * From the definitions tcprewrite_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 tcprewrite 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_TCPREWRITE_OPTS_H_GUARD
  16. #define AUTOOPTS_TCPREWRITE_OPTS_H_GUARD
  17. /*
  18. * tcprewrite copyright 2004-2006 Aaron Turner - all rights reserved
  19. *
  20. * tcprewrite 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. * tcprewrite 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_DMAC = 1,
  65. INDEX_OPT_SMAC = 2,
  66. INDEX_OPT_PROTO = 3,
  67. INDEX_OPT_DLINK = 4,
  68. INDEX_OPT_PORTMAP = 5,
  69. INDEX_OPT_SEED = 6,
  70. INDEX_OPT_PNAT = 7,
  71. INDEX_OPT_ENDPOINTS = 8,
  72. INDEX_OPT_SKIPBROADCAST = 9,
  73. INDEX_OPT_FIXCSUM = 10,
  74. INDEX_OPT_MTU = 11,
  75. INDEX_OPT_FIXLEN = 12,
  76. INDEX_OPT_VLAN = 13,
  77. INDEX_OPT_VLAN_TAG = 14,
  78. INDEX_OPT_VLAN_CFI = 15,
  79. INDEX_OPT_VLAN_PRI = 16,
  80. INDEX_OPT_DLT = 17,
  81. INDEX_OPT_DBUG = 18,
  82. INDEX_OPT_INFILE = 19,
  83. INDEX_OPT_OUTFILE = 20,
  84. INDEX_OPT_CACHEFILE = 21,
  85. INDEX_OPT_VERBOSE = 22,
  86. INDEX_OPT_DECODE = 23,
  87. INDEX_OPT_VERSION = 24,
  88. INDEX_OPT_LESS_HELP = 25,
  89. INDEX_OPT_HELP = 26,
  90. INDEX_OPT_MORE_HELP = 27,
  91. INDEX_OPT_SAVE_OPTS = 28,
  92. INDEX_OPT_LOAD_OPTS = 29
  93. } teOptIndex;
  94. #define OPTION_CT 30
  95. /*
  96. * Interface defines for all options. Replace "n" with
  97. * the UPPER_CASED option name (as in the teOptIndex
  98. * enumeration above). e.g. HAVE_OPT( TCPEDIT )
  99. */
  100. #define DESC(n) tcprewriteOptions.pOptDesc[INDEX_OPT_ ## n]
  101. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  102. #define OPT_ARG(n) (DESC(n).pzLastArg)
  103. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  104. #define COUNT_OPT(n) (DESC(n).optOccCt)
  105. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  106. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  107. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  108. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  109. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  110. #define CLEAR_OPT(n) STMTS( \
  111. DESC(n).fOptState &= OPTST_PERSISTENT; \
  112. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  113. DESC(n).fOptState |= OPTST_DISABLED; \
  114. DESC(n).optCookie = NULL )
  115. /*
  116. * Interface defines for specific options.
  117. */
  118. #define VALUE_OPT_DMAC 'D'
  119. #define VALUE_OPT_SMAC 'S'
  120. #define VALUE_OPT_PROTO 'P'
  121. #define OPT_VALUE_PROTO (*(unsigned long*)(&DESC(PROTO).pzLastArg))
  122. #define VALUE_OPT_DLINK 'l'
  123. #define VALUE_OPT_PORTMAP 'r'
  124. #define VALUE_OPT_SEED 's'
  125. #define OPT_VALUE_SEED (*(unsigned long*)(&DESC(SEED).pzLastArg))
  126. #define VALUE_OPT_PNAT 'N'
  127. #define VALUE_OPT_ENDPOINTS 'e'
  128. #define VALUE_OPT_SKIPBROADCAST 'b'
  129. #define VALUE_OPT_FIXCSUM 'C'
  130. #define VALUE_OPT_MTU 'm'
  131. #define OPT_VALUE_MTU (*(unsigned long*)(&DESC(MTU).pzLastArg))
  132. #define VALUE_OPT_FIXLEN 'F'
  133. #define VALUE_OPT_VLAN 'T'
  134. #define VALUE_OPT_VLAN_TAG 't'
  135. #define OPT_VALUE_VLAN_TAG (*(unsigned long*)(&DESC(VLAN_TAG).pzLastArg))
  136. #define VALUE_OPT_VLAN_CFI 'f'
  137. #define OPT_VALUE_VLAN_CFI (*(unsigned long*)(&DESC(VLAN_CFI).pzLastArg))
  138. #define VALUE_OPT_VLAN_PRI 'p'
  139. #define OPT_VALUE_VLAN_PRI (*(unsigned long*)(&DESC(VLAN_PRI).pzLastArg))
  140. #define VALUE_OPT_DLT 'L'
  141. #define OPT_VALUE_DLT (*(unsigned long*)(&DESC(DLT).pzLastArg))
  142. #define VALUE_OPT_DBUG 'd'
  143. #define OPT_VALUE_DBUG (*(unsigned long*)(&DESC(DBUG).pzLastArg))
  144. #define VALUE_OPT_INFILE 'i'
  145. #define VALUE_OPT_OUTFILE 'o'
  146. #define VALUE_OPT_CACHEFILE 'c'
  147. #define SET_OPT_CACHEFILE(a) STMTS( \
  148. DESC(CACHEFILE).optActualIndex = 21; \
  149. DESC(CACHEFILE).optActualValue = VALUE_OPT_CACHEFILE; \
  150. DESC(CACHEFILE).fOptState &= OPTST_PERSISTENT; \
  151. DESC(CACHEFILE).fOptState |= OPTST_SET; \
  152. DESC(CACHEFILE).pzLastArg = (const char*)(a); \
  153. (*(DESC(CACHEFILE).pOptProc))( &tcprewriteOptions, \
  154. tcprewriteOptions.pOptDesc + 21 ); )
  155. #ifdef HAVE_TCPDUMP
  156. #define VALUE_OPT_VERBOSE 'v'
  157. #define SET_OPT_VERBOSE STMTS( \
  158. DESC(VERBOSE).optActualIndex = 22; \
  159. DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
  160. DESC(VERBOSE).fOptState &= OPTST_PERSISTENT; \
  161. DESC(VERBOSE).fOptState |= OPTST_SET )
  162. #endif /* HAVE_TCPDUMP */
  163. #ifdef HAVE_TCPDUMP
  164. #define VALUE_OPT_DECODE 'A'
  165. #endif /* HAVE_TCPDUMP */
  166. #define VALUE_OPT_VERSION 'V'
  167. #define VALUE_OPT_LESS_HELP 'h'
  168. #define VALUE_OPT_SAVE_OPTS INDEX_OPT_SAVE_OPTS
  169. #define VALUE_OPT_LOAD_OPTS INDEX_OPT_LOAD_OPTS
  170. #define VALUE_OPT_HELP 'H'
  171. #define VALUE_OPT_MORE_HELP '!'
  172. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  173. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT; \
  174. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  175. DESC(SAVE_OPTS).pzLastArg = (const char*)(a) )
  176. /*
  177. * Interface defines not associated with particular options
  178. */
  179. #define ERRSKIP_OPTERR STMTS( tcprewriteOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  180. #define ERRSTOP_OPTERR STMTS( tcprewriteOptions.fOptSet |= OPTPROC_ERRSTOP )
  181. #define RESTART_OPT(n) STMTS( \
  182. tcprewriteOptions.curOptIdx = (n); \
  183. tcprewriteOptions.pzCurOpt = NULL )
  184. #define START_OPT RESTART_OPT(1)
  185. #define USAGE(c) (*tcprewriteOptions.pUsageProc)( &tcprewriteOptions, c )
  186. /* extracted from opthead near line 289 */
  187. /* * * * * *
  188. *
  189. * Declare the tcprewrite option descriptor.
  190. */
  191. #ifdef __cplusplus
  192. extern "C" {
  193. #endif
  194. extern tOptions tcprewriteOptions;
  195. #ifndef _
  196. # if ENABLE_NLS
  197. # include <stdio.h>
  198. static inline char* aoGetsText( const char* pz ) {
  199. if (pz == NULL) return NULL;
  200. return (char*)gettext( pz );
  201. }
  202. # define _(s) aoGetsText(s)
  203. # else /* ENABLE_NLS */
  204. # define _(s) s
  205. # endif /* ENABLE_NLS */
  206. #endif
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210. #endif /* AUTOOPTS_TCPREWRITE_OPTS_H_GUARD */
  211. /*
  212. * Local Variables:
  213. * Mode: C
  214. * c-file-style: "stroustrup"
  215. * indent-tabs-mode: nil
  216. * End:
  217. * options.h ends here */