tcpedit_stub.h 7.8 KB

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