tcpedit_stub.h 7.4 KB

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