tcpedit_stub.h 7.5 KB

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