1
0

tcpedit_stub.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpedit_stub.h)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions ../../../src/tcpedit/tcpedit_stub.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 42:1:17 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 tcpedit_stub 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. /**
  20. * This file contains the programmatic interface to the Automated
  21. * Options generated for the tcpedit_stub program.
  22. * These macros are documented in the AutoGen info file in the
  23. * "AutoOpts" chapter. Please refer to that doc for usage help.
  24. */
  25. #ifndef AUTOOPTS_TCPEDIT_STUB_H_GUARD
  26. #define AUTOOPTS_TCPEDIT_STUB_H_GUARD 1
  27. #include <autoopts/options.h>
  28. #include <stdarg.h>
  29. #include <stdnoreturn.h>
  30. #if GCC_VERSION > 40400
  31. #define NOT_REACHED __builtin_unreachable();
  32. #else
  33. #define NOT_REACHED
  34. #endif
  35. /**
  36. * Enumeration of each option type for tcpedit_stub
  37. */
  38. typedef enum {
  39. INDEX_OPT_PORTMAP = 1,
  40. INDEX_OPT_SEED = 2,
  41. INDEX_OPT_PNAT = 3,
  42. INDEX_OPT_SRCIPMAP = 4,
  43. INDEX_OPT_DSTIPMAP = 5,
  44. INDEX_OPT_ENDPOINTS = 6,
  45. INDEX_OPT_TCP_SEQUENCE = 7,
  46. INDEX_OPT_SKIPBROADCAST = 8,
  47. INDEX_OPT_FIXCSUM = 9,
  48. INDEX_OPT_FIXHDRLEN = 10,
  49. INDEX_OPT_MTU = 11,
  50. INDEX_OPT_MTU_TRUNC = 12,
  51. INDEX_OPT_EFCS = 13,
  52. INDEX_OPT_TTL = 14,
  53. INDEX_OPT_TOS = 15,
  54. INDEX_OPT_TCLASS = 16,
  55. INDEX_OPT_FLOWLABEL = 17,
  56. INDEX_OPT_FIXLEN = 18,
  57. INDEX_OPT_FUZZ_SEED = 19,
  58. INDEX_OPT_FUZZ_FACTOR = 20,
  59. INDEX_OPT_SKIPL2BROADCAST = 21,
  60. INDEX_OPT_DLT = 22,
  61. INDEX_OPT_ENET_DMAC = 23,
  62. INDEX_OPT_ENET_SMAC = 24,
  63. INDEX_OPT_ENET_SUBSMAC = 25,
  64. INDEX_OPT_ENET_MAC_SEED = 26,
  65. INDEX_OPT_ENET_MAC_SEED_KEEP_BYTES = 27,
  66. INDEX_OPT_ENET_VLAN = 28,
  67. INDEX_OPT_ENET_VLAN_TAG = 29,
  68. INDEX_OPT_ENET_VLAN_CFI = 30,
  69. INDEX_OPT_ENET_VLAN_PRI = 31,
  70. INDEX_OPT_ENET_VLAN_PROTO = 32,
  71. INDEX_OPT_HDLC_CONTROL = 33,
  72. INDEX_OPT_HDLC_ADDRESS = 34,
  73. INDEX_OPT_USER_DLT = 35,
  74. INDEX_OPT_USER_DLINK = 36,
  75. LIBRARY_OPTION_COUNT
  76. } teOptIndex;
  77. /** count of all options for tcpedit_stub */
  78. #define OPTION_CT 37
  79. /**
  80. * Interface defines for all options. Replace "n" with the UPPER_CASED
  81. * option name (as in the teOptIndex enumeration above).
  82. * e.g. HAVE_OPT(TCPEDIT)
  83. */
  84. /** pointer to the library handling procedure. */
  85. extern tOptDesc * const tcpedit_tcpedit_optDesc_p;
  86. #define DESC(n) (tcpedit_tcpedit_optDesc_p[INDEX_OPT_## n])
  87. /** 'true' if an option has been specified in any way */
  88. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  89. /** The string argument to an option. The argument type must be \"string\". */
  90. #define OPT_ARG(n) (DESC(n).optArg.argString)
  91. /** Mask the option state revealing how an option was specified.
  92. * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
  93. * \a OPTST_DEFINED, \a OPTST_RESET or zero.
  94. */
  95. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  96. /** Count of option's occurrances *on the command line*. */
  97. #define COUNT_OPT(n) (DESC(n).optOccCt)
  98. /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
  99. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  100. /** 'true' if \a HAVE_OPT would yield 'false'. */
  101. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  102. /** 'true' if OPTST_DISABLED bit not set. */
  103. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  104. /** number of stacked option arguments.
  105. * Valid only for stacked option arguments. */
  106. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  107. /** stacked argument vector.
  108. * Valid only for stacked option arguments. */
  109. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  110. /** Reset an option. */
  111. #define CLEAR_OPT(n) STMTS( \
  112. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  113. if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  114. DESC(n).fOptState |= OPTST_DISABLED; \
  115. DESC(n).optCookie = NULL )
  116. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  117. /**
  118. * Enumeration of tcpedit_stub exit codes
  119. */
  120. typedef enum {
  121. TCPEDIT_STUB_EXIT_SUCCESS = 0,
  122. TCPEDIT_STUB_EXIT_FAILURE = 1,
  123. TCPEDIT_STUB_EXIT_USAGE_ERROR = 64,
  124. TCPEDIT_STUB_EXIT_LIBOPTS_FAILURE = 70
  125. } tcpedit_stub_exit_code_t;
  126. /**
  127. * Interface defines for specific options.
  128. * @{
  129. */
  130. #define VALUE_OPT_PORTMAP 'r'
  131. #define VALUE_OPT_SEED 's'
  132. #define OPT_VALUE_SEED (DESC(SEED).optArg.argInt)
  133. #define VALUE_OPT_PNAT 'N'
  134. #define VALUE_OPT_SRCIPMAP 'S'
  135. #define VALUE_OPT_DSTIPMAP 'D'
  136. #define VALUE_OPT_ENDPOINTS 'e'
  137. #define VALUE_OPT_TCP_SEQUENCE 0x1001
  138. #define OPT_VALUE_TCP_SEQUENCE (DESC(TCP_SEQUENCE).optArg.argInt)
  139. #define VALUE_OPT_SKIPBROADCAST 'b'
  140. #define VALUE_OPT_FIXCSUM 'C'
  141. #define VALUE_OPT_FIXHDRLEN 0x1002
  142. #define VALUE_OPT_MTU 'm'
  143. #define OPT_VALUE_MTU (DESC(MTU).optArg.argInt)
  144. #define VALUE_OPT_MTU_TRUNC 0x1003
  145. #define VALUE_OPT_EFCS 'E'
  146. #define VALUE_OPT_TTL 0x1004
  147. #define VALUE_OPT_TOS 0x1005
  148. #define OPT_VALUE_TOS (DESC(TOS).optArg.argInt)
  149. #define VALUE_OPT_TCLASS 0x1006
  150. #define OPT_VALUE_TCLASS (DESC(TCLASS).optArg.argInt)
  151. #define VALUE_OPT_FLOWLABEL 0x1007
  152. #define OPT_VALUE_FLOWLABEL (DESC(FLOWLABEL).optArg.argInt)
  153. #define VALUE_OPT_FIXLEN 'F'
  154. #define VALUE_OPT_FUZZ_SEED 0x1008
  155. #define OPT_VALUE_FUZZ_SEED (DESC(FUZZ_SEED).optArg.argInt)
  156. #define VALUE_OPT_FUZZ_FACTOR 0x1009
  157. #define OPT_VALUE_FUZZ_FACTOR (DESC(FUZZ_FACTOR).optArg.argInt)
  158. #define VALUE_OPT_SKIPL2BROADCAST 0x100A
  159. #define VALUE_OPT_DLT 0x100B
  160. #define VALUE_OPT_ENET_DMAC 0x100C
  161. #define VALUE_OPT_ENET_SMAC 0x100D
  162. #define VALUE_OPT_ENET_SUBSMAC 0x100E
  163. #define VALUE_OPT_ENET_MAC_SEED 0x100F
  164. #define OPT_VALUE_ENET_MAC_SEED (DESC(ENET_MAC_SEED).optArg.argInt)
  165. #define VALUE_OPT_ENET_MAC_SEED_KEEP_BYTES 0x1010
  166. #define OPT_VALUE_ENET_MAC_SEED_KEEP_BYTES (DESC(ENET_MAC_SEED_KEEP_BYTES).optArg.argInt)
  167. #define VALUE_OPT_ENET_VLAN 0x1011
  168. #define VALUE_OPT_ENET_VLAN_TAG 0x1012
  169. #define OPT_VALUE_ENET_VLAN_TAG (DESC(ENET_VLAN_TAG).optArg.argInt)
  170. #define VALUE_OPT_ENET_VLAN_CFI 0x1013
  171. #define OPT_VALUE_ENET_VLAN_CFI (DESC(ENET_VLAN_CFI).optArg.argInt)
  172. #define VALUE_OPT_ENET_VLAN_PRI 0x1014
  173. #define OPT_VALUE_ENET_VLAN_PRI (DESC(ENET_VLAN_PRI).optArg.argInt)
  174. #define VALUE_OPT_ENET_VLAN_PROTO 0x1015
  175. #define VALUE_OPT_HDLC_CONTROL 0x1016
  176. #define OPT_VALUE_HDLC_CONTROL (DESC(HDLC_CONTROL).optArg.argInt)
  177. #define VALUE_OPT_HDLC_ADDRESS 0x1017
  178. #define OPT_VALUE_HDLC_ADDRESS (DESC(HDLC_ADDRESS).optArg.argInt)
  179. #define VALUE_OPT_USER_DLT 0x1018
  180. #define OPT_VALUE_USER_DLT (DESC(USER_DLT).optArg.argInt)
  181. #define VALUE_OPT_USER_DLINK 0x1019
  182. /** option flag (value) for help-value option */
  183. #define VALUE_OPT_HELP '?'
  184. /** option flag (value) for more-help-value option */
  185. #define VALUE_OPT_MORE_HELP '!'
  186. #endif /* AUTOOPTS_TCPEDIT_STUB_H_GUARD */
  187. /* tcpedit_stub.h ends here */