tcpreplay_edit_opts.c 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpreplay_edit_opts.c)
  4. *
  5. * It has been AutoGen-ed Tuesday February 17, 2009 at 06:33:34 PM PST
  6. * From the definitions tcpreplay_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 32:0:7 templates.
  10. */
  11. /*
  12. * This file was produced by an AutoOpts template. AutoOpts is a
  13. * copyrighted work. This source file is not encumbered by AutoOpts
  14. * licensing, but is provided under the licensing terms chosen by the
  15. * tcpreplay author or copyright holder. AutoOpts is licensed under
  16. * the terms of the LGPL. The redistributable library (``libopts'') is
  17. * licensed under the terms of either the LGPL or, at the users discretion,
  18. * the BSD license. See the AutoOpts and/or libopts sources for details.
  19. *
  20. * This source file is copyrighted and licensed under the following terms:
  21. *
  22. * tcpreplay copyright 2000-2008 Aaron Turner - all rights reserved
  23. *
  24. * tcpreplay is free software copyrighted by Aaron Turner.
  25. *
  26. * Redistribution and use in source and binary forms, with or without
  27. * modification, are permitted provided that the following conditions
  28. * are met:
  29. * 1. Redistributions of source code must retain the above copyright
  30. * notice, this list of conditions and the following disclaimer.
  31. * 2. Redistributions in binary form must reproduce the above copyright
  32. * notice, this list of conditions and the following disclaimer in the
  33. * documentation and/or other materials provided with the distribution.
  34. * 3. Neither the name ``Aaron Turner'' nor the name of any other
  35. * contributor may be used to endorse or promote products derived
  36. * from this software without specific prior written permission.
  37. *
  38. * tcpreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS
  39. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  40. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  41. * ARE DISCLAIMED. IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS
  42. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  43. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  44. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  45. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  46. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  47. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  48. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49. */
  50. #include <sys/types.h>
  51. #include <limits.h>
  52. #include <stdio.h>
  53. #include <stdlib.h>
  54. #include <errno.h>
  55. extern FILE * option_usage_fp;
  56. #define OPTION_CODE_COMPILE 1
  57. #include "tcpreplay_edit_opts.h"
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. /* TRANSLATORS: choose the translation for option names wisely because you
  62. cannot ever change your mind. */
  63. tSCC zCopyright[] =
  64. "tcpreplay copyright (c) 2000-2008 Aaron Turner, all rights reserved";
  65. tSCC zCopyrightNotice[1458] =
  66. "tcpreplay is free software copyrighted by Aaron Turner.\n\n\
  67. Redistribution and use in source and binary forms, with or without\n\
  68. modification, are permitted provided that the following conditions are met: 1.\n\
  69. Redistributions of source code must retain the above copyright notice, this\n\
  70. list of conditions and the following disclaimer. 2. Redistributions in binary\n\
  71. form must reproduce the above copyright notice, this list of conditions and the\n\
  72. following disclaimer in the documentation and/or other materials provided with\n\
  73. the distribution. 3. Neither the name ``Aaron Turner'' nor the name of any\n\
  74. other contributor may be used to endorse or promote products derived from this\n\
  75. software without specific prior written permission.\n\n\
  76. tcpreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS OR IMPLIED\n\
  77. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\
  78. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\n\
  79. EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n\
  80. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n\
  81. BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\
  82. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n\
  83. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n\
  84. OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n\
  85. ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
  86. extern tUsageProc optionUsage;
  87. /*
  88. * global included definitions
  89. */
  90. #include "defines.h"
  91. #include "tcpreplay.h"
  92. #include "common.h"
  93. #include "config.h"
  94. #include <stdlib.h>
  95. #include <sys/types.h>
  96. #include <unistd.h>
  97. extern tcpreplay_opt_t options;
  98. #ifndef NULL
  99. # define NULL 0
  100. #endif
  101. #ifndef EXIT_SUCCESS
  102. # define EXIT_SUCCESS 0
  103. #endif
  104. #ifndef EXIT_FAILURE
  105. # define EXIT_FAILURE 1
  106. #endif
  107. /*
  108. * Tcpedit option description:
  109. */
  110. tSCC zTcpeditText[] =
  111. "";
  112. #define TCPEDIT_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
  113. /*
  114. * Portmap option description:
  115. */
  116. tSCC zPortmapText[] =
  117. "Rewrite TCP/UDP ports";
  118. tSCC zPortmap_NAME[] = "PORTMAP";
  119. tSCC zPortmap_Name[] = "portmap";
  120. #define PORTMAP_FLAGS (OPTST_DISABLED \
  121. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  122. /*
  123. * Seed option description:
  124. */
  125. tSCC zSeedText[] =
  126. "Randomize src/dst IP addresses w/ given seed";
  127. tSCC zSeed_NAME[] = "SEED";
  128. tSCC zSeed_Name[] = "seed";
  129. #define SEED_FLAGS (OPTST_DISABLED \
  130. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  131. /*
  132. * Pnat option description with
  133. * "Must also have options" and "Incompatible options":
  134. */
  135. tSCC zPnatText[] =
  136. "Rewrite IP addresses using pseudo-NAT";
  137. tSCC zPnat_NAME[] = "PNAT";
  138. tSCC zPnat_Name[] = "pnat";
  139. static const int
  140. aPnatCantList[] = {
  141. INDEX_OPT_SRCIPMAP, NO_EQUIVALENT };
  142. #define PNAT_FLAGS (OPTST_DISABLED | OPTST_STACKED \
  143. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  144. /*
  145. * Srcipmap option description with
  146. * "Must also have options" and "Incompatible options":
  147. */
  148. tSCC zSrcipmapText[] =
  149. "Rewrite source IP addresses using pseudo-NAT";
  150. tSCC zSrcipmap_NAME[] = "SRCIPMAP";
  151. tSCC zSrcipmap_Name[] = "srcipmap";
  152. static const int
  153. aSrcipmapCantList[] = {
  154. INDEX_OPT_PNAT, NO_EQUIVALENT };
  155. #define SRCIPMAP_FLAGS (OPTST_DISABLED \
  156. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  157. /*
  158. * Dstipmap option description with
  159. * "Must also have options" and "Incompatible options":
  160. */
  161. tSCC zDstipmapText[] =
  162. "Rewrite destination IP addresses using pseudo-NAT";
  163. tSCC zDstipmap_NAME[] = "DSTIPMAP";
  164. tSCC zDstipmap_Name[] = "dstipmap";
  165. static const int
  166. aDstipmapCantList[] = {
  167. INDEX_OPT_PNAT, NO_EQUIVALENT };
  168. #define DSTIPMAP_FLAGS (OPTST_DISABLED \
  169. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  170. /*
  171. * Endpoints option description with
  172. * "Must also have options" and "Incompatible options":
  173. */
  174. #ifdef HAVE_CACHEFILE_SUPPORT
  175. tSCC zEndpointsText[] =
  176. "Rewrite IP addresses to be between two endpoints";
  177. tSCC zEndpoints_NAME[] = "ENDPOINTS";
  178. tSCC zEndpoints_Name[] = "endpoints";
  179. static const int
  180. aEndpointsMustList[] = {
  181. INDEX_OPT_CACHEFILE, NO_EQUIVALENT };
  182. #define ENDPOINTS_FLAGS (OPTST_DISABLED \
  183. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  184. #else /* disable Endpoints */
  185. #define VALUE_OPT_ENDPOINTS NO_EQUIVALENT
  186. #define ENDPOINTS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  187. #define aEndpointsMustList NULL
  188. #define zEndpointsText NULL
  189. #define zEndpoints_NAME NULL
  190. #define zEndpoints_Name NULL
  191. #endif /* HAVE_CACHEFILE_SUPPORT */
  192. /*
  193. * Skipbroadcast option description:
  194. */
  195. tSCC zSkipbroadcastText[] =
  196. "Skip rewriting broadcast/multicast IP's";
  197. tSCC zSkipbroadcast_NAME[] = "SKIPBROADCAST";
  198. tSCC zSkipbroadcast_Name[] = "skipbroadcast";
  199. #define SKIPBROADCAST_FLAGS (OPTST_DISABLED)
  200. /*
  201. * Fixcsum option description:
  202. */
  203. tSCC zFixcsumText[] =
  204. "Force recalculation of IP/TCP/UDP checksums";
  205. tSCC zFixcsum_NAME[] = "FIXCSUM";
  206. tSCC zFixcsum_Name[] = "fixcsum";
  207. #define FIXCSUM_FLAGS (OPTST_DISABLED)
  208. /*
  209. * Mtu option description:
  210. */
  211. tSCC zMtuText[] =
  212. "Override default MTU length (1500 bytes)";
  213. tSCC zMtu_NAME[] = "MTU";
  214. tSCC zMtu_Name[] = "mtu";
  215. #define MTU_FLAGS (OPTST_DISABLED \
  216. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  217. /*
  218. * Mtu_Trunc option description:
  219. */
  220. tSCC zMtu_TruncText[] =
  221. "Truncate packets larger then specified MTU";
  222. tSCC zMtu_Trunc_NAME[] = "MTU_TRUNC";
  223. tSCC zMtu_Trunc_Name[] = "mtu-trunc";
  224. #define MTU_TRUNC_FLAGS (OPTST_DISABLED)
  225. /*
  226. * Efcs option description:
  227. */
  228. tSCC zEfcsText[] =
  229. "Remove Ethernet checksums (FCS) from end of frames";
  230. tSCC zEfcs_NAME[] = "EFCS";
  231. tSCC zEfcs_Name[] = "efcs";
  232. #define EFCS_FLAGS (OPTST_DISABLED)
  233. /*
  234. * Ttl option description:
  235. */
  236. tSCC zTtlText[] =
  237. "Modify the IPv4 TTL";
  238. tSCC zTtl_NAME[] = "TTL";
  239. tSCC zTtl_Name[] = "ttl";
  240. #define TTL_FLAGS (OPTST_DISABLED \
  241. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  242. /*
  243. * Tos option description:
  244. */
  245. tSCC zTosText[] =
  246. "Set the IPv4 TOS/DiffServ/ECN byte";
  247. tSCC zTos_NAME[] = "TOS";
  248. tSCC zTos_Name[] = "tos";
  249. #define TOS_FLAGS (OPTST_DISABLED \
  250. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  251. /*
  252. * Fixlen option description:
  253. */
  254. tSCC zFixlenText[] =
  255. "Pad or truncate packet data to match header length";
  256. tSCC zFixlen_NAME[] = "FIXLEN";
  257. tSCC zFixlen_Name[] = "fixlen";
  258. #define FIXLEN_FLAGS (OPTST_DISABLED \
  259. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  260. /*
  261. * Skipl2broadcast option description:
  262. */
  263. tSCC zSkipl2broadcastText[] =
  264. "Skip rewriting broadcast/multicast Layer 2 addresses";
  265. tSCC zSkipl2broadcast_NAME[] = "SKIPL2BROADCAST";
  266. tSCC zSkipl2broadcast_Name[] = "skipl2broadcast";
  267. #define SKIPL2BROADCAST_FLAGS (OPTST_DISABLED)
  268. /*
  269. * Dlt option description:
  270. */
  271. tSCC zDltText[] =
  272. "Override output DLT encapsulation";
  273. tSCC zDlt_NAME[] = "DLT";
  274. tSCC zDlt_Name[] = "dlt";
  275. #define DLT_FLAGS (OPTST_DISABLED \
  276. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  277. /*
  278. * Enet_Dmac option description:
  279. */
  280. tSCC zEnet_DmacText[] =
  281. "Override destination ethernet MAC addresses";
  282. tSCC zEnet_Dmac_NAME[] = "ENET_DMAC";
  283. tSCC zEnet_Dmac_Name[] = "enet-dmac";
  284. #define ENET_DMAC_FLAGS (OPTST_DISABLED \
  285. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  286. /*
  287. * Enet_Smac option description:
  288. */
  289. tSCC zEnet_SmacText[] =
  290. "Override source ethernet MAC addresses";
  291. tSCC zEnet_Smac_NAME[] = "ENET_SMAC";
  292. tSCC zEnet_Smac_Name[] = "enet-smac";
  293. #define ENET_SMAC_FLAGS (OPTST_DISABLED \
  294. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  295. /*
  296. * Enet_Vlan option description:
  297. */
  298. tSCC zEnet_VlanText[] =
  299. "Specify ethernet 802.1q VLAN tag mode";
  300. tSCC zEnet_Vlan_NAME[] = "ENET_VLAN";
  301. tSCC zEnet_Vlan_Name[] = "enet-vlan";
  302. #define ENET_VLAN_FLAGS (OPTST_DISABLED \
  303. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  304. /*
  305. * Enet_Vlan_Tag option description with
  306. * "Must also have options" and "Incompatible options":
  307. */
  308. tSCC zEnet_Vlan_TagText[] =
  309. "Specify the new ethernet 802.1q VLAN tag value";
  310. tSCC zEnet_Vlan_Tag_NAME[] = "ENET_VLAN_TAG";
  311. tSCC zEnet_Vlan_Tag_Name[] = "enet-vlan-tag";
  312. static const int
  313. aEnet_Vlan_TagMustList[] = {
  314. INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
  315. #define ENET_VLAN_TAG_FLAGS (OPTST_DISABLED \
  316. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  317. /*
  318. * Enet_Vlan_Cfi option description with
  319. * "Must also have options" and "Incompatible options":
  320. */
  321. tSCC zEnet_Vlan_CfiText[] =
  322. "Specify the ethernet 802.1q VLAN CFI value";
  323. tSCC zEnet_Vlan_Cfi_NAME[] = "ENET_VLAN_CFI";
  324. tSCC zEnet_Vlan_Cfi_Name[] = "enet-vlan-cfi";
  325. static const int
  326. aEnet_Vlan_CfiMustList[] = {
  327. INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
  328. #define ENET_VLAN_CFI_FLAGS (OPTST_DISABLED \
  329. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  330. /*
  331. * Enet_Vlan_Pri option description with
  332. * "Must also have options" and "Incompatible options":
  333. */
  334. tSCC zEnet_Vlan_PriText[] =
  335. "Specify the ethernet 802.1q VLAN priority";
  336. tSCC zEnet_Vlan_Pri_NAME[] = "ENET_VLAN_PRI";
  337. tSCC zEnet_Vlan_Pri_Name[] = "enet-vlan-pri";
  338. static const int
  339. aEnet_Vlan_PriMustList[] = {
  340. INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
  341. #define ENET_VLAN_PRI_FLAGS (OPTST_DISABLED \
  342. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  343. /*
  344. * Hdlc_Control option description:
  345. */
  346. tSCC zHdlc_ControlText[] =
  347. "Specify HDLC control value";
  348. tSCC zHdlc_Control_NAME[] = "HDLC_CONTROL";
  349. tSCC zHdlc_Control_Name[] = "hdlc-control";
  350. #define HDLC_CONTROL_FLAGS (OPTST_DISABLED \
  351. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  352. /*
  353. * Hdlc_Address option description:
  354. */
  355. tSCC zHdlc_AddressText[] =
  356. "Specify HDLC address";
  357. tSCC zHdlc_Address_NAME[] = "HDLC_ADDRESS";
  358. tSCC zHdlc_Address_Name[] = "hdlc-address";
  359. #define HDLC_ADDRESS_FLAGS (OPTST_DISABLED \
  360. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  361. /*
  362. * User_Dlt option description:
  363. */
  364. tSCC zUser_DltText[] =
  365. "Set output file DLT type";
  366. tSCC zUser_Dlt_NAME[] = "USER_DLT";
  367. tSCC zUser_Dlt_Name[] = "user-dlt";
  368. #define USER_DLT_FLAGS (OPTST_DISABLED \
  369. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  370. /*
  371. * User_Dlink option description:
  372. */
  373. tSCC zUser_DlinkText[] =
  374. "Rewrite Data-Link layer with user specified data";
  375. tSCC zUser_Dlink_NAME[] = "USER_DLINK";
  376. tSCC zUser_Dlink_Name[] = "user-dlink";
  377. #define USER_DLINK_FLAGS (OPTST_DISABLED | OPTST_STACKED \
  378. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  379. /*
  380. * Dbug option description:
  381. */
  382. #ifdef DEBUG
  383. tSCC zDbugText[] =
  384. "Enable debugging output";
  385. tSCC zDbug_NAME[] = "DBUG";
  386. tSCC zDbug_Name[] = "dbug";
  387. #define zDbugDefaultArg ((char const*)0)
  388. #define DBUG_FLAGS (OPTST_DISABLED | OPTST_IMM \
  389. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  390. #else /* disable Dbug */
  391. #define VALUE_OPT_DBUG NO_EQUIVALENT
  392. #define DBUG_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  393. #define zDbugDefaultArg NULL
  394. #define zDbugText NULL
  395. #define zDbug_NAME NULL
  396. #define zDbug_Name NULL
  397. #endif /* DEBUG */
  398. /*
  399. * Quiet option description:
  400. */
  401. tSCC zQuietText[] =
  402. "Quiet mode";
  403. tSCC zQuiet_NAME[] = "QUIET";
  404. tSCC zQuiet_Name[] = "quiet";
  405. #define QUIET_FLAGS (OPTST_DISABLED)
  406. /*
  407. * Timer option description:
  408. */
  409. tSCC zTimerText[] =
  410. "Select packet timing mode: select, ioport, rdtsc, gtod, nano, abstime";
  411. tSCC zTimer_NAME[] = "TIMER";
  412. tSCC zTimer_Name[] = "timer";
  413. tSCC zTimerDefaultArg[] = "gtod";
  414. #define TIMER_FLAGS (OPTST_DISABLED \
  415. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  416. /*
  417. * Sleep_Accel option description:
  418. */
  419. tSCC zSleep_AccelText[] =
  420. "Reduce the amount of time to sleep by specified usec";
  421. tSCC zSleep_Accel_NAME[] = "SLEEP_ACCEL";
  422. tSCC zSleep_Accel_Name[] = "sleep-accel";
  423. #define zSleep_AccelDefaultArg ((char const*)0)
  424. #define SLEEP_ACCEL_FLAGS (OPTST_DISABLED \
  425. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  426. /*
  427. * Rdtsc_Clicks option description:
  428. */
  429. tSCC zRdtsc_ClicksText[] =
  430. "Specify the RDTSC clicks/usec";
  431. tSCC zRdtsc_Clicks_NAME[] = "RDTSC_CLICKS";
  432. tSCC zRdtsc_Clicks_Name[] = "rdtsc-clicks";
  433. #define zRdtsc_ClicksDefaultArg ((char const*)0)
  434. #define RDTSC_CLICKS_FLAGS (OPTST_DISABLED \
  435. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  436. /*
  437. * Verbose option description:
  438. */
  439. #ifdef ENABLE_VERBOSE
  440. tSCC zVerboseText[] =
  441. "Print decoded packets via tcpdump to STDOUT";
  442. tSCC zVerbose_NAME[] = "VERBOSE";
  443. tSCC zVerbose_Name[] = "verbose";
  444. #define VERBOSE_FLAGS (OPTST_DISABLED | OPTST_IMM)
  445. #else /* disable Verbose */
  446. #define VALUE_OPT_VERBOSE NO_EQUIVALENT
  447. #define VERBOSE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  448. #define zVerboseText NULL
  449. #define zVerbose_NAME NULL
  450. #define zVerbose_Name NULL
  451. #endif /* ENABLE_VERBOSE */
  452. /*
  453. * Decode option description with
  454. * "Must also have options" and "Incompatible options":
  455. */
  456. #ifdef ENABLE_VERBOSE
  457. tSCC zDecodeText[] =
  458. "Arguments passed to tcpdump decoder";
  459. tSCC zDecode_NAME[] = "DECODE";
  460. tSCC zDecode_Name[] = "decode";
  461. static const int
  462. aDecodeMustList[] = {
  463. INDEX_OPT_VERBOSE, NO_EQUIVALENT };
  464. #define DECODE_FLAGS (OPTST_DISABLED \
  465. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  466. #else /* disable Decode */
  467. #define VALUE_OPT_DECODE NO_EQUIVALENT
  468. #define DECODE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  469. #define aDecodeMustList NULL
  470. #define zDecodeText NULL
  471. #define zDecode_NAME NULL
  472. #define zDecode_Name NULL
  473. #endif /* ENABLE_VERBOSE */
  474. /*
  475. * Enable_File_Cache option description with
  476. * "Must also have options" and "Incompatible options":
  477. */
  478. tSCC zEnable_File_CacheText[] =
  479. "Enable caching of packets to internal memory";
  480. tSCC zEnable_File_Cache_NAME[] = "ENABLE_FILE_CACHE";
  481. tSCC zEnable_File_Cache_Name[] = "enable-file-cache";
  482. static const int
  483. aEnable_File_CacheMustList[] = {
  484. INDEX_OPT_LOOP, NO_EQUIVALENT };
  485. #define ENABLE_FILE_CACHE_FLAGS (OPTST_DISABLED)
  486. /*
  487. * Cachefile option description:
  488. */
  489. tSCC zCachefileText[] =
  490. "Split traffic via a tcpprep cache file";
  491. tSCC zCachefile_NAME[] = "CACHEFILE";
  492. tSCC zCachefile_Name[] = "cachefile";
  493. #define CACHEFILE_FLAGS (OPTST_DISABLED \
  494. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  495. /*
  496. * Intf1 option description:
  497. */
  498. tSCC zIntf1Text[] =
  499. "Server/primary traffic output interface";
  500. tSCC zIntf1_NAME[] = "INTF1";
  501. tSCC zIntf1_Name[] = "intf1";
  502. #define INTF1_FLAGS (OPTST_DISABLED | OPTST_MUST_SET \
  503. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  504. /*
  505. * Intf2 option description with
  506. * "Must also have options" and "Incompatible options":
  507. */
  508. tSCC zIntf2Text[] =
  509. "Client/secondary traffic output interface";
  510. tSCC zIntf2_NAME[] = "INTF2";
  511. tSCC zIntf2_Name[] = "intf2";
  512. static const int
  513. aIntf2MustList[] = {
  514. INDEX_OPT_CACHEFILE, NO_EQUIVALENT };
  515. #define INTF2_FLAGS (OPTST_DISABLED \
  516. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  517. /*
  518. * Listnics option description:
  519. */
  520. #ifdef ENABLE_PCAP_FINDALLDEVS
  521. tSCC zListnicsText[] =
  522. "List available network interfaces and exit";
  523. tSCC zListnics_NAME[] = "LISTNICS";
  524. tSCC zListnics_Name[] = "listnics";
  525. #define LISTNICS_FLAGS (OPTST_DISABLED | OPTST_IMM)
  526. #else /* disable Listnics */
  527. #define VALUE_OPT_LISTNICS NO_EQUIVALENT
  528. #define LISTNICS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  529. #define zListnicsText NULL
  530. #define zListnics_NAME NULL
  531. #define zListnics_Name NULL
  532. #endif /* ENABLE_PCAP_FINDALLDEVS */
  533. /*
  534. * Loop option description:
  535. */
  536. tSCC zLoopText[] =
  537. "Loop through the capture file X times";
  538. tSCC zLoop_NAME[] = "LOOP";
  539. tSCC zLoop_Name[] = "loop";
  540. #define zLoopDefaultArg ((char const*)1)
  541. #define LOOP_FLAGS (OPTST_DISABLED \
  542. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  543. /*
  544. * Pktlen option description:
  545. */
  546. tSCC zPktlenText[] =
  547. "Override the snaplen and use the actual packet len";
  548. tSCC zPktlen_NAME[] = "PKTLEN";
  549. tSCC zPktlen_Name[] = "pktlen";
  550. #define PKTLEN_FLAGS (OPTST_DISABLED)
  551. /*
  552. * Limit option description:
  553. */
  554. tSCC zLimitText[] =
  555. "Limit the number of packets to send";
  556. tSCC zLimit_NAME[] = "LIMIT";
  557. tSCC zLimit_Name[] = "limit";
  558. #define zLimitDefaultArg ((char const*)-1)
  559. #define LIMIT_FLAGS (OPTST_DISABLED \
  560. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  561. /*
  562. * Multiplier option description with
  563. * "Must also have options" and "Incompatible options":
  564. */
  565. tSCC zMultiplierText[] =
  566. "Modify replay speed to a given multiple";
  567. tSCC zMultiplier_NAME[] = "MULTIPLIER";
  568. tSCC zMultiplier_Name[] = "multiplier";
  569. static const int
  570. aMultiplierCantList[] = {
  571. INDEX_OPT_PPS,
  572. INDEX_OPT_MBPS,
  573. INDEX_OPT_ONEATATIME,
  574. INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
  575. #define MULTIPLIER_FLAGS (OPTST_DISABLED \
  576. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  577. /*
  578. * Pps option description with
  579. * "Must also have options" and "Incompatible options":
  580. */
  581. tSCC zPpsText[] =
  582. "Replay packets at a given packets/sec";
  583. tSCC zPps_NAME[] = "PPS";
  584. tSCC zPps_Name[] = "pps";
  585. static const int
  586. aPpsCantList[] = {
  587. INDEX_OPT_MULTIPLIER,
  588. INDEX_OPT_MBPS,
  589. INDEX_OPT_ONEATATIME,
  590. INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
  591. #define PPS_FLAGS (OPTST_DISABLED \
  592. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  593. /*
  594. * Mbps option description with
  595. * "Must also have options" and "Incompatible options":
  596. */
  597. tSCC zMbpsText[] =
  598. "Replay packets at a given Mbps";
  599. tSCC zMbps_NAME[] = "MBPS";
  600. tSCC zMbps_Name[] = "mbps";
  601. static const int
  602. aMbpsCantList[] = {
  603. INDEX_OPT_MULTIPLIER,
  604. INDEX_OPT_PPS,
  605. INDEX_OPT_ONEATATIME,
  606. INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
  607. #define MBPS_FLAGS (OPTST_DISABLED \
  608. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  609. /*
  610. * Topspeed option description with
  611. * "Must also have options" and "Incompatible options":
  612. */
  613. tSCC zTopspeedText[] =
  614. "Replay packets as fast as possible";
  615. tSCC zTopspeed_NAME[] = "TOPSPEED";
  616. tSCC zTopspeed_Name[] = "topspeed";
  617. static const int
  618. aTopspeedCantList[] = {
  619. INDEX_OPT_MBPS,
  620. INDEX_OPT_MULTIPLIER,
  621. INDEX_OPT_PPS,
  622. INDEX_OPT_ONEATATIME, NO_EQUIVALENT };
  623. #define TOPSPEED_FLAGS (OPTST_DISABLED)
  624. /*
  625. * Oneatatime option description with
  626. * "Must also have options" and "Incompatible options":
  627. */
  628. tSCC zOneatatimeText[] =
  629. "Replay one packet at a time for each user input";
  630. tSCC zOneatatime_NAME[] = "ONEATATIME";
  631. tSCC zOneatatime_Name[] = "oneatatime";
  632. static const int
  633. aOneatatimeCantList[] = {
  634. INDEX_OPT_MBPS,
  635. INDEX_OPT_PPS,
  636. INDEX_OPT_MULTIPLIER,
  637. INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
  638. #define ONEATATIME_FLAGS (OPTST_DISABLED)
  639. /*
  640. * Pps_Multi option description with
  641. * "Must also have options" and "Incompatible options":
  642. */
  643. tSCC zPps_MultiText[] =
  644. "Number of packets to send for each time interval";
  645. tSCC zPps_Multi_NAME[] = "PPS_MULTI";
  646. tSCC zPps_Multi_Name[] = "pps-multi";
  647. #define zPps_MultiDefaultArg ((char const*)1)
  648. static const int
  649. aPps_MultiMustList[] = {
  650. INDEX_OPT_PPS, NO_EQUIVALENT };
  651. #define PPS_MULTI_FLAGS (OPTST_DISABLED \
  652. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  653. /*
  654. * Pid option description:
  655. */
  656. tSCC zPidText[] =
  657. "Print the PID of tcpreplay at startup";
  658. tSCC zPid_NAME[] = "PID";
  659. tSCC zPid_Name[] = "pid";
  660. #define PID_FLAGS (OPTST_DISABLED)
  661. /*
  662. * Version option description:
  663. */
  664. tSCC zVersionText[] =
  665. "Print version information";
  666. tSCC zVersion_NAME[] = "VERSION";
  667. tSCC zVersion_Name[] = "version";
  668. #define VERSION_FLAGS (OPTST_DISABLED)
  669. /*
  670. * Less_Help option description:
  671. */
  672. tSCC zLess_HelpText[] =
  673. "Display less usage information and exit";
  674. tSCC zLess_Help_NAME[] = "LESS_HELP";
  675. tSCC zLess_Help_Name[] = "less-help";
  676. #define LESS_HELP_FLAGS (OPTST_DISABLED | OPTST_IMM)
  677. /*
  678. * Help/More_Help option descriptions:
  679. */
  680. tSCC zHelpText[] = "Display usage information and exit";
  681. tSCC zHelp_Name[] = "help";
  682. tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
  683. tSCC zMore_Help_Name[] = "more-help";
  684. tSCC zSave_OptsText[] = "Save the option state to a config file";
  685. tSCC zSave_Opts_Name[] = "save-opts";
  686. tSCC zLoad_OptsText[] = "Load options from a config file";
  687. tSCC zLoad_Opts_NAME[] = "LOAD_OPTS";
  688. tSCC zNotLoad_Opts_Name[] = "no-load-opts";
  689. tSCC zNotLoad_Opts_Pfx[] = "no";
  690. #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
  691. /*
  692. * Declare option callback procedures
  693. */
  694. #ifdef DEBUG
  695. static tOptProc doOptDbug;
  696. #else /* not DEBUG */
  697. # define doOptDbug NULL
  698. #endif /* def/not DEBUG */
  699. #ifdef ENABLE_PCAP_FINDALLDEVS
  700. static tOptProc doOptListnics;
  701. #else /* not ENABLE_PCAP_FINDALLDEVS */
  702. # define doOptListnics NULL
  703. #endif /* def/not ENABLE_PCAP_FINDALLDEVS */
  704. extern tOptProc
  705. optionNumericVal, optionPagedUsage, optionStackArg;
  706. static tOptProc
  707. doOptEnet_Vlan_Cfi, doOptEnet_Vlan_Pri, doOptEnet_Vlan_Tag,
  708. doOptLess_Help, doOptLimit, doOptLoop,
  709. doOptMtu, doOptPid, doOptPps_Multi,
  710. doOptTos, doOptVersion, doUsageOpt;
  711. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  712. *
  713. * Define the Tcpreplay Option Descriptions.
  714. */
  715. static tOptDesc optDesc[ OPTION_CT ] = {
  716. { /* entry idx, value */ 0, 0,
  717. /* equiv idx, value */ 0, 0,
  718. /* equivalenced to */ NO_EQUIVALENT,
  719. /* min, max, act ct */ 0, 0, 0,
  720. /* opt state flags */ TCPEDIT_FLAGS, 0,
  721. /* last opt argumnt */ { NULL },
  722. /* arg list/cookie */ NULL,
  723. /* must/cannot opts */ NULL, NULL,
  724. /* option proc */ NULL,
  725. /* desc, NAME, name */ zTcpeditText, NULL, NULL,
  726. /* disablement strs */ NULL, NULL },
  727. { /* entry idx, value */ 1, VALUE_OPT_PORTMAP,
  728. /* equiv idx, value */ 1, VALUE_OPT_PORTMAP,
  729. /* equivalenced to */ NO_EQUIVALENT,
  730. /* min, max, act ct */ 0, 1, 0,
  731. /* opt state flags */ PORTMAP_FLAGS, 0,
  732. /* last opt argumnt */ { NULL },
  733. /* arg list/cookie */ NULL,
  734. /* must/cannot opts */ NULL, NULL,
  735. /* option proc */ NULL,
  736. /* desc, NAME, name */ zPortmapText, zPortmap_NAME, zPortmap_Name,
  737. /* disablement strs */ NULL, NULL },
  738. { /* entry idx, value */ 2, VALUE_OPT_SEED,
  739. /* equiv idx, value */ 2, VALUE_OPT_SEED,
  740. /* equivalenced to */ NO_EQUIVALENT,
  741. /* min, max, act ct */ 0, 1, 0,
  742. /* opt state flags */ SEED_FLAGS, 0,
  743. /* last opt argumnt */ { NULL },
  744. /* arg list/cookie */ NULL,
  745. /* must/cannot opts */ NULL, NULL,
  746. /* option proc */ optionNumericVal,
  747. /* desc, NAME, name */ zSeedText, zSeed_NAME, zSeed_Name,
  748. /* disablement strs */ NULL, NULL },
  749. { /* entry idx, value */ 3, VALUE_OPT_PNAT,
  750. /* equiv idx, value */ 3, VALUE_OPT_PNAT,
  751. /* equivalenced to */ NO_EQUIVALENT,
  752. /* min, max, act ct */ 0, 2, 0,
  753. /* opt state flags */ PNAT_FLAGS, 0,
  754. /* last opt argumnt */ { NULL },
  755. /* arg list/cookie */ NULL,
  756. /* must/cannot opts */ NULL, aPnatCantList,
  757. /* option proc */ optionStackArg,
  758. /* desc, NAME, name */ zPnatText, zPnat_NAME, zPnat_Name,
  759. /* disablement strs */ NULL, NULL },
  760. { /* entry idx, value */ 4, VALUE_OPT_SRCIPMAP,
  761. /* equiv idx, value */ 4, VALUE_OPT_SRCIPMAP,
  762. /* equivalenced to */ NO_EQUIVALENT,
  763. /* min, max, act ct */ 0, 1, 0,
  764. /* opt state flags */ SRCIPMAP_FLAGS, 0,
  765. /* last opt argumnt */ { NULL },
  766. /* arg list/cookie */ NULL,
  767. /* must/cannot opts */ NULL, aSrcipmapCantList,
  768. /* option proc */ NULL,
  769. /* desc, NAME, name */ zSrcipmapText, zSrcipmap_NAME, zSrcipmap_Name,
  770. /* disablement strs */ NULL, NULL },
  771. { /* entry idx, value */ 5, VALUE_OPT_DSTIPMAP,
  772. /* equiv idx, value */ 5, VALUE_OPT_DSTIPMAP,
  773. /* equivalenced to */ NO_EQUIVALENT,
  774. /* min, max, act ct */ 0, 1, 0,
  775. /* opt state flags */ DSTIPMAP_FLAGS, 0,
  776. /* last opt argumnt */ { NULL },
  777. /* arg list/cookie */ NULL,
  778. /* must/cannot opts */ NULL, aDstipmapCantList,
  779. /* option proc */ NULL,
  780. /* desc, NAME, name */ zDstipmapText, zDstipmap_NAME, zDstipmap_Name,
  781. /* disablement strs */ NULL, NULL },
  782. { /* entry idx, value */ 6, VALUE_OPT_ENDPOINTS,
  783. /* equiv idx, value */ 6, VALUE_OPT_ENDPOINTS,
  784. /* equivalenced to */ NO_EQUIVALENT,
  785. /* min, max, act ct */ 0, 1, 0,
  786. /* opt state flags */ ENDPOINTS_FLAGS, 0,
  787. /* last opt argumnt */ { NULL },
  788. /* arg list/cookie */ NULL,
  789. /* must/cannot opts */ aEndpointsMustList, NULL,
  790. /* option proc */ NULL,
  791. /* desc, NAME, name */ zEndpointsText, zEndpoints_NAME, zEndpoints_Name,
  792. /* disablement strs */ NULL, NULL },
  793. { /* entry idx, value */ 7, VALUE_OPT_SKIPBROADCAST,
  794. /* equiv idx, value */ 7, VALUE_OPT_SKIPBROADCAST,
  795. /* equivalenced to */ NO_EQUIVALENT,
  796. /* min, max, act ct */ 0, 1, 0,
  797. /* opt state flags */ SKIPBROADCAST_FLAGS, 0,
  798. /* last opt argumnt */ { NULL },
  799. /* arg list/cookie */ NULL,
  800. /* must/cannot opts */ NULL, NULL,
  801. /* option proc */ NULL,
  802. /* desc, NAME, name */ zSkipbroadcastText, zSkipbroadcast_NAME, zSkipbroadcast_Name,
  803. /* disablement strs */ NULL, NULL },
  804. { /* entry idx, value */ 8, VALUE_OPT_FIXCSUM,
  805. /* equiv idx, value */ 8, VALUE_OPT_FIXCSUM,
  806. /* equivalenced to */ NO_EQUIVALENT,
  807. /* min, max, act ct */ 0, 1, 0,
  808. /* opt state flags */ FIXCSUM_FLAGS, 0,
  809. /* last opt argumnt */ { NULL },
  810. /* arg list/cookie */ NULL,
  811. /* must/cannot opts */ NULL, NULL,
  812. /* option proc */ NULL,
  813. /* desc, NAME, name */ zFixcsumText, zFixcsum_NAME, zFixcsum_Name,
  814. /* disablement strs */ NULL, NULL },
  815. { /* entry idx, value */ 9, VALUE_OPT_MTU,
  816. /* equiv idx, value */ 9, VALUE_OPT_MTU,
  817. /* equivalenced to */ NO_EQUIVALENT,
  818. /* min, max, act ct */ 0, 1, 0,
  819. /* opt state flags */ MTU_FLAGS, 0,
  820. /* last opt argumnt */ { NULL },
  821. /* arg list/cookie */ NULL,
  822. /* must/cannot opts */ NULL, NULL,
  823. /* option proc */ doOptMtu,
  824. /* desc, NAME, name */ zMtuText, zMtu_NAME, zMtu_Name,
  825. /* disablement strs */ NULL, NULL },
  826. { /* entry idx, value */ 10, VALUE_OPT_MTU_TRUNC,
  827. /* equiv idx, value */ 10, VALUE_OPT_MTU_TRUNC,
  828. /* equivalenced to */ NO_EQUIVALENT,
  829. /* min, max, act ct */ 0, 1, 0,
  830. /* opt state flags */ MTU_TRUNC_FLAGS, 0,
  831. /* last opt argumnt */ { NULL },
  832. /* arg list/cookie */ NULL,
  833. /* must/cannot opts */ NULL, NULL,
  834. /* option proc */ NULL,
  835. /* desc, NAME, name */ zMtu_TruncText, zMtu_Trunc_NAME, zMtu_Trunc_Name,
  836. /* disablement strs */ NULL, NULL },
  837. { /* entry idx, value */ 11, VALUE_OPT_EFCS,
  838. /* equiv idx, value */ 11, VALUE_OPT_EFCS,
  839. /* equivalenced to */ NO_EQUIVALENT,
  840. /* min, max, act ct */ 0, 1, 0,
  841. /* opt state flags */ EFCS_FLAGS, 0,
  842. /* last opt argumnt */ { NULL },
  843. /* arg list/cookie */ NULL,
  844. /* must/cannot opts */ NULL, NULL,
  845. /* option proc */ NULL,
  846. /* desc, NAME, name */ zEfcsText, zEfcs_NAME, zEfcs_Name,
  847. /* disablement strs */ NULL, NULL },
  848. { /* entry idx, value */ 12, VALUE_OPT_TTL,
  849. /* equiv idx, value */ 12, VALUE_OPT_TTL,
  850. /* equivalenced to */ NO_EQUIVALENT,
  851. /* min, max, act ct */ 0, 1, 0,
  852. /* opt state flags */ TTL_FLAGS, 0,
  853. /* last opt argumnt */ { NULL },
  854. /* arg list/cookie */ NULL,
  855. /* must/cannot opts */ NULL, NULL,
  856. /* option proc */ NULL,
  857. /* desc, NAME, name */ zTtlText, zTtl_NAME, zTtl_Name,
  858. /* disablement strs */ NULL, NULL },
  859. { /* entry idx, value */ 13, VALUE_OPT_TOS,
  860. /* equiv idx, value */ 13, VALUE_OPT_TOS,
  861. /* equivalenced to */ NO_EQUIVALENT,
  862. /* min, max, act ct */ 0, 1, 0,
  863. /* opt state flags */ TOS_FLAGS, 0,
  864. /* last opt argumnt */ { NULL },
  865. /* arg list/cookie */ NULL,
  866. /* must/cannot opts */ NULL, NULL,
  867. /* option proc */ doOptTos,
  868. /* desc, NAME, name */ zTosText, zTos_NAME, zTos_Name,
  869. /* disablement strs */ NULL, NULL },
  870. { /* entry idx, value */ 14, VALUE_OPT_FIXLEN,
  871. /* equiv idx, value */ 14, VALUE_OPT_FIXLEN,
  872. /* equivalenced to */ NO_EQUIVALENT,
  873. /* min, max, act ct */ 0, 1, 0,
  874. /* opt state flags */ FIXLEN_FLAGS, 0,
  875. /* last opt argumnt */ { NULL },
  876. /* arg list/cookie */ NULL,
  877. /* must/cannot opts */ NULL, NULL,
  878. /* option proc */ NULL,
  879. /* desc, NAME, name */ zFixlenText, zFixlen_NAME, zFixlen_Name,
  880. /* disablement strs */ NULL, NULL },
  881. { /* entry idx, value */ 15, VALUE_OPT_SKIPL2BROADCAST,
  882. /* equiv idx, value */ 15, VALUE_OPT_SKIPL2BROADCAST,
  883. /* equivalenced to */ NO_EQUIVALENT,
  884. /* min, max, act ct */ 0, 1, 0,
  885. /* opt state flags */ SKIPL2BROADCAST_FLAGS, 0,
  886. /* last opt argumnt */ { NULL },
  887. /* arg list/cookie */ NULL,
  888. /* must/cannot opts */ NULL, NULL,
  889. /* option proc */ NULL,
  890. /* desc, NAME, name */ zSkipl2broadcastText, zSkipl2broadcast_NAME, zSkipl2broadcast_Name,
  891. /* disablement strs */ NULL, NULL },
  892. { /* entry idx, value */ 16, VALUE_OPT_DLT,
  893. /* equiv idx, value */ 16, VALUE_OPT_DLT,
  894. /* equivalenced to */ NO_EQUIVALENT,
  895. /* min, max, act ct */ 0, 1, 0,
  896. /* opt state flags */ DLT_FLAGS, 0,
  897. /* last opt argumnt */ { NULL },
  898. /* arg list/cookie */ NULL,
  899. /* must/cannot opts */ NULL, NULL,
  900. /* option proc */ NULL,
  901. /* desc, NAME, name */ zDltText, zDlt_NAME, zDlt_Name,
  902. /* disablement strs */ NULL, NULL },
  903. { /* entry idx, value */ 17, VALUE_OPT_ENET_DMAC,
  904. /* equiv idx, value */ 17, VALUE_OPT_ENET_DMAC,
  905. /* equivalenced to */ NO_EQUIVALENT,
  906. /* min, max, act ct */ 0, 1, 0,
  907. /* opt state flags */ ENET_DMAC_FLAGS, 0,
  908. /* last opt argumnt */ { NULL },
  909. /* arg list/cookie */ NULL,
  910. /* must/cannot opts */ NULL, NULL,
  911. /* option proc */ NULL,
  912. /* desc, NAME, name */ zEnet_DmacText, zEnet_Dmac_NAME, zEnet_Dmac_Name,
  913. /* disablement strs */ NULL, NULL },
  914. { /* entry idx, value */ 18, VALUE_OPT_ENET_SMAC,
  915. /* equiv idx, value */ 18, VALUE_OPT_ENET_SMAC,
  916. /* equivalenced to */ NO_EQUIVALENT,
  917. /* min, max, act ct */ 0, 1, 0,
  918. /* opt state flags */ ENET_SMAC_FLAGS, 0,
  919. /* last opt argumnt */ { NULL },
  920. /* arg list/cookie */ NULL,
  921. /* must/cannot opts */ NULL, NULL,
  922. /* option proc */ NULL,
  923. /* desc, NAME, name */ zEnet_SmacText, zEnet_Smac_NAME, zEnet_Smac_Name,
  924. /* disablement strs */ NULL, NULL },
  925. { /* entry idx, value */ 19, VALUE_OPT_ENET_VLAN,
  926. /* equiv idx, value */ 19, VALUE_OPT_ENET_VLAN,
  927. /* equivalenced to */ NO_EQUIVALENT,
  928. /* min, max, act ct */ 0, 1, 0,
  929. /* opt state flags */ ENET_VLAN_FLAGS, 0,
  930. /* last opt argumnt */ { NULL },
  931. /* arg list/cookie */ NULL,
  932. /* must/cannot opts */ NULL, NULL,
  933. /* option proc */ NULL,
  934. /* desc, NAME, name */ zEnet_VlanText, zEnet_Vlan_NAME, zEnet_Vlan_Name,
  935. /* disablement strs */ NULL, NULL },
  936. { /* entry idx, value */ 20, VALUE_OPT_ENET_VLAN_TAG,
  937. /* equiv idx, value */ 20, VALUE_OPT_ENET_VLAN_TAG,
  938. /* equivalenced to */ NO_EQUIVALENT,
  939. /* min, max, act ct */ 0, 1, 0,
  940. /* opt state flags */ ENET_VLAN_TAG_FLAGS, 0,
  941. /* last opt argumnt */ { NULL },
  942. /* arg list/cookie */ NULL,
  943. /* must/cannot opts */ aEnet_Vlan_TagMustList, NULL,
  944. /* option proc */ doOptEnet_Vlan_Tag,
  945. /* desc, NAME, name */ zEnet_Vlan_TagText, zEnet_Vlan_Tag_NAME, zEnet_Vlan_Tag_Name,
  946. /* disablement strs */ NULL, NULL },
  947. { /* entry idx, value */ 21, VALUE_OPT_ENET_VLAN_CFI,
  948. /* equiv idx, value */ 21, VALUE_OPT_ENET_VLAN_CFI,
  949. /* equivalenced to */ NO_EQUIVALENT,
  950. /* min, max, act ct */ 0, 1, 0,
  951. /* opt state flags */ ENET_VLAN_CFI_FLAGS, 0,
  952. /* last opt argumnt */ { NULL },
  953. /* arg list/cookie */ NULL,
  954. /* must/cannot opts */ aEnet_Vlan_CfiMustList, NULL,
  955. /* option proc */ doOptEnet_Vlan_Cfi,
  956. /* desc, NAME, name */ zEnet_Vlan_CfiText, zEnet_Vlan_Cfi_NAME, zEnet_Vlan_Cfi_Name,
  957. /* disablement strs */ NULL, NULL },
  958. { /* entry idx, value */ 22, VALUE_OPT_ENET_VLAN_PRI,
  959. /* equiv idx, value */ 22, VALUE_OPT_ENET_VLAN_PRI,
  960. /* equivalenced to */ NO_EQUIVALENT,
  961. /* min, max, act ct */ 0, 1, 0,
  962. /* opt state flags */ ENET_VLAN_PRI_FLAGS, 0,
  963. /* last opt argumnt */ { NULL },
  964. /* arg list/cookie */ NULL,
  965. /* must/cannot opts */ aEnet_Vlan_PriMustList, NULL,
  966. /* option proc */ doOptEnet_Vlan_Pri,
  967. /* desc, NAME, name */ zEnet_Vlan_PriText, zEnet_Vlan_Pri_NAME, zEnet_Vlan_Pri_Name,
  968. /* disablement strs */ NULL, NULL },
  969. { /* entry idx, value */ 23, VALUE_OPT_HDLC_CONTROL,
  970. /* equiv idx, value */ 23, VALUE_OPT_HDLC_CONTROL,
  971. /* equivalenced to */ NO_EQUIVALENT,
  972. /* min, max, act ct */ 0, 1, 0,
  973. /* opt state flags */ HDLC_CONTROL_FLAGS, 0,
  974. /* last opt argumnt */ { NULL },
  975. /* arg list/cookie */ NULL,
  976. /* must/cannot opts */ NULL, NULL,
  977. /* option proc */ optionNumericVal,
  978. /* desc, NAME, name */ zHdlc_ControlText, zHdlc_Control_NAME, zHdlc_Control_Name,
  979. /* disablement strs */ NULL, NULL },
  980. { /* entry idx, value */ 24, VALUE_OPT_HDLC_ADDRESS,
  981. /* equiv idx, value */ 24, VALUE_OPT_HDLC_ADDRESS,
  982. /* equivalenced to */ NO_EQUIVALENT,
  983. /* min, max, act ct */ 0, 1, 0,
  984. /* opt state flags */ HDLC_ADDRESS_FLAGS, 0,
  985. /* last opt argumnt */ { NULL },
  986. /* arg list/cookie */ NULL,
  987. /* must/cannot opts */ NULL, NULL,
  988. /* option proc */ optionNumericVal,
  989. /* desc, NAME, name */ zHdlc_AddressText, zHdlc_Address_NAME, zHdlc_Address_Name,
  990. /* disablement strs */ NULL, NULL },
  991. { /* entry idx, value */ 25, VALUE_OPT_USER_DLT,
  992. /* equiv idx, value */ 25, VALUE_OPT_USER_DLT,
  993. /* equivalenced to */ NO_EQUIVALENT,
  994. /* min, max, act ct */ 0, 1, 0,
  995. /* opt state flags */ USER_DLT_FLAGS, 0,
  996. /* last opt argumnt */ { NULL },
  997. /* arg list/cookie */ NULL,
  998. /* must/cannot opts */ NULL, NULL,
  999. /* option proc */ optionNumericVal,
  1000. /* desc, NAME, name */ zUser_DltText, zUser_Dlt_NAME, zUser_Dlt_Name,
  1001. /* disablement strs */ NULL, NULL },
  1002. { /* entry idx, value */ 26, VALUE_OPT_USER_DLINK,
  1003. /* equiv idx, value */ 26, VALUE_OPT_USER_DLINK,
  1004. /* equivalenced to */ NO_EQUIVALENT,
  1005. /* min, max, act ct */ 0, 2, 0,
  1006. /* opt state flags */ USER_DLINK_FLAGS, 0,
  1007. /* last opt argumnt */ { NULL },
  1008. /* arg list/cookie */ NULL,
  1009. /* must/cannot opts */ NULL, NULL,
  1010. /* option proc */ optionStackArg,
  1011. /* desc, NAME, name */ zUser_DlinkText, zUser_Dlink_NAME, zUser_Dlink_Name,
  1012. /* disablement strs */ NULL, NULL },
  1013. { /* entry idx, value */ 27, VALUE_OPT_DBUG,
  1014. /* equiv idx, value */ 27, VALUE_OPT_DBUG,
  1015. /* equivalenced to */ NO_EQUIVALENT,
  1016. /* min, max, act ct */ 0, 1, 0,
  1017. /* opt state flags */ DBUG_FLAGS, 0,
  1018. /* last opt argumnt */ { zDbugDefaultArg },
  1019. /* arg list/cookie */ NULL,
  1020. /* must/cannot opts */ NULL, NULL,
  1021. /* option proc */ doOptDbug,
  1022. /* desc, NAME, name */ zDbugText, zDbug_NAME, zDbug_Name,
  1023. /* disablement strs */ NULL, NULL },
  1024. { /* entry idx, value */ 28, VALUE_OPT_QUIET,
  1025. /* equiv idx, value */ 28, VALUE_OPT_QUIET,
  1026. /* equivalenced to */ NO_EQUIVALENT,
  1027. /* min, max, act ct */ 0, 1, 0,
  1028. /* opt state flags */ QUIET_FLAGS, 0,
  1029. /* last opt argumnt */ { NULL },
  1030. /* arg list/cookie */ NULL,
  1031. /* must/cannot opts */ NULL, NULL,
  1032. /* option proc */ NULL,
  1033. /* desc, NAME, name */ zQuietText, zQuiet_NAME, zQuiet_Name,
  1034. /* disablement strs */ NULL, NULL },
  1035. { /* entry idx, value */ 29, VALUE_OPT_TIMER,
  1036. /* equiv idx, value */ 29, VALUE_OPT_TIMER,
  1037. /* equivalenced to */ NO_EQUIVALENT,
  1038. /* min, max, act ct */ 0, 1, 0,
  1039. /* opt state flags */ TIMER_FLAGS, 0,
  1040. /* last opt argumnt */ { zTimerDefaultArg },
  1041. /* arg list/cookie */ NULL,
  1042. /* must/cannot opts */ NULL, NULL,
  1043. /* option proc */ NULL,
  1044. /* desc, NAME, name */ zTimerText, zTimer_NAME, zTimer_Name,
  1045. /* disablement strs */ NULL, NULL },
  1046. { /* entry idx, value */ 30, VALUE_OPT_SLEEP_ACCEL,
  1047. /* equiv idx, value */ 30, VALUE_OPT_SLEEP_ACCEL,
  1048. /* equivalenced to */ NO_EQUIVALENT,
  1049. /* min, max, act ct */ 0, 1, 0,
  1050. /* opt state flags */ SLEEP_ACCEL_FLAGS, 0,
  1051. /* last opt argumnt */ { zSleep_AccelDefaultArg },
  1052. /* arg list/cookie */ NULL,
  1053. /* must/cannot opts */ NULL, NULL,
  1054. /* option proc */ optionNumericVal,
  1055. /* desc, NAME, name */ zSleep_AccelText, zSleep_Accel_NAME, zSleep_Accel_Name,
  1056. /* disablement strs */ NULL, NULL },
  1057. { /* entry idx, value */ 31, VALUE_OPT_RDTSC_CLICKS,
  1058. /* equiv idx, value */ 31, VALUE_OPT_RDTSC_CLICKS,
  1059. /* equivalenced to */ NO_EQUIVALENT,
  1060. /* min, max, act ct */ 0, 1, 0,
  1061. /* opt state flags */ RDTSC_CLICKS_FLAGS, 0,
  1062. /* last opt argumnt */ { zRdtsc_ClicksDefaultArg },
  1063. /* arg list/cookie */ NULL,
  1064. /* must/cannot opts */ NULL, NULL,
  1065. /* option proc */ optionNumericVal,
  1066. /* desc, NAME, name */ zRdtsc_ClicksText, zRdtsc_Clicks_NAME, zRdtsc_Clicks_Name,
  1067. /* disablement strs */ NULL, NULL },
  1068. { /* entry idx, value */ 32, VALUE_OPT_VERBOSE,
  1069. /* equiv idx, value */ 32, VALUE_OPT_VERBOSE,
  1070. /* equivalenced to */ NO_EQUIVALENT,
  1071. /* min, max, act ct */ 0, 1, 0,
  1072. /* opt state flags */ VERBOSE_FLAGS, 0,
  1073. /* last opt argumnt */ { NULL },
  1074. /* arg list/cookie */ NULL,
  1075. /* must/cannot opts */ NULL, NULL,
  1076. /* option proc */ NULL,
  1077. /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name,
  1078. /* disablement strs */ NULL, NULL },
  1079. { /* entry idx, value */ 33, VALUE_OPT_DECODE,
  1080. /* equiv idx, value */ 33, VALUE_OPT_DECODE,
  1081. /* equivalenced to */ NO_EQUIVALENT,
  1082. /* min, max, act ct */ 0, 1, 0,
  1083. /* opt state flags */ DECODE_FLAGS, 0,
  1084. /* last opt argumnt */ { NULL },
  1085. /* arg list/cookie */ NULL,
  1086. /* must/cannot opts */ aDecodeMustList, NULL,
  1087. /* option proc */ NULL,
  1088. /* desc, NAME, name */ zDecodeText, zDecode_NAME, zDecode_Name,
  1089. /* disablement strs */ NULL, NULL },
  1090. { /* entry idx, value */ 34, VALUE_OPT_ENABLE_FILE_CACHE,
  1091. /* equiv idx, value */ 34, VALUE_OPT_ENABLE_FILE_CACHE,
  1092. /* equivalenced to */ NO_EQUIVALENT,
  1093. /* min, max, act ct */ 0, 1, 0,
  1094. /* opt state flags */ ENABLE_FILE_CACHE_FLAGS, 0,
  1095. /* last opt argumnt */ { NULL },
  1096. /* arg list/cookie */ NULL,
  1097. /* must/cannot opts */ aEnable_File_CacheMustList, NULL,
  1098. /* option proc */ NULL,
  1099. /* desc, NAME, name */ zEnable_File_CacheText, zEnable_File_Cache_NAME, zEnable_File_Cache_Name,
  1100. /* disablement strs */ NULL, NULL },
  1101. { /* entry idx, value */ 35, VALUE_OPT_CACHEFILE,
  1102. /* equiv idx, value */ 35, VALUE_OPT_CACHEFILE,
  1103. /* equivalenced to */ NO_EQUIVALENT,
  1104. /* min, max, act ct */ 0, 1, 0,
  1105. /* opt state flags */ CACHEFILE_FLAGS, 0,
  1106. /* last opt argumnt */ { NULL },
  1107. /* arg list/cookie */ NULL,
  1108. /* must/cannot opts */ NULL, NULL,
  1109. /* option proc */ NULL,
  1110. /* desc, NAME, name */ zCachefileText, zCachefile_NAME, zCachefile_Name,
  1111. /* disablement strs */ NULL, NULL },
  1112. { /* entry idx, value */ 36, VALUE_OPT_INTF1,
  1113. /* equiv idx, value */ 36, VALUE_OPT_INTF1,
  1114. /* equivalenced to */ NO_EQUIVALENT,
  1115. /* min, max, act ct */ 1, 1, 0,
  1116. /* opt state flags */ INTF1_FLAGS, 0,
  1117. /* last opt argumnt */ { NULL },
  1118. /* arg list/cookie */ NULL,
  1119. /* must/cannot opts */ NULL, NULL,
  1120. /* option proc */ NULL,
  1121. /* desc, NAME, name */ zIntf1Text, zIntf1_NAME, zIntf1_Name,
  1122. /* disablement strs */ NULL, NULL },
  1123. { /* entry idx, value */ 37, VALUE_OPT_INTF2,
  1124. /* equiv idx, value */ 37, VALUE_OPT_INTF2,
  1125. /* equivalenced to */ NO_EQUIVALENT,
  1126. /* min, max, act ct */ 0, 1, 0,
  1127. /* opt state flags */ INTF2_FLAGS, 0,
  1128. /* last opt argumnt */ { NULL },
  1129. /* arg list/cookie */ NULL,
  1130. /* must/cannot opts */ aIntf2MustList, NULL,
  1131. /* option proc */ NULL,
  1132. /* desc, NAME, name */ zIntf2Text, zIntf2_NAME, zIntf2_Name,
  1133. /* disablement strs */ NULL, NULL },
  1134. { /* entry idx, value */ 38, VALUE_OPT_LISTNICS,
  1135. /* equiv idx, value */ 38, VALUE_OPT_LISTNICS,
  1136. /* equivalenced to */ NO_EQUIVALENT,
  1137. /* min, max, act ct */ 0, 1, 0,
  1138. /* opt state flags */ LISTNICS_FLAGS, 0,
  1139. /* last opt argumnt */ { NULL },
  1140. /* arg list/cookie */ NULL,
  1141. /* must/cannot opts */ NULL, NULL,
  1142. /* option proc */ doOptListnics,
  1143. /* desc, NAME, name */ zListnicsText, zListnics_NAME, zListnics_Name,
  1144. /* disablement strs */ NULL, NULL },
  1145. { /* entry idx, value */ 39, VALUE_OPT_LOOP,
  1146. /* equiv idx, value */ 39, VALUE_OPT_LOOP,
  1147. /* equivalenced to */ NO_EQUIVALENT,
  1148. /* min, max, act ct */ 0, 1, 0,
  1149. /* opt state flags */ LOOP_FLAGS, 0,
  1150. /* last opt argumnt */ { zLoopDefaultArg },
  1151. /* arg list/cookie */ NULL,
  1152. /* must/cannot opts */ NULL, NULL,
  1153. /* option proc */ doOptLoop,
  1154. /* desc, NAME, name */ zLoopText, zLoop_NAME, zLoop_Name,
  1155. /* disablement strs */ NULL, NULL },
  1156. { /* entry idx, value */ 40, VALUE_OPT_PKTLEN,
  1157. /* equiv idx, value */ 40, VALUE_OPT_PKTLEN,
  1158. /* equivalenced to */ NO_EQUIVALENT,
  1159. /* min, max, act ct */ 0, 1, 0,
  1160. /* opt state flags */ PKTLEN_FLAGS, 0,
  1161. /* last opt argumnt */ { NULL },
  1162. /* arg list/cookie */ NULL,
  1163. /* must/cannot opts */ NULL, NULL,
  1164. /* option proc */ NULL,
  1165. /* desc, NAME, name */ zPktlenText, zPktlen_NAME, zPktlen_Name,
  1166. /* disablement strs */ NULL, NULL },
  1167. { /* entry idx, value */ 41, VALUE_OPT_LIMIT,
  1168. /* equiv idx, value */ 41, VALUE_OPT_LIMIT,
  1169. /* equivalenced to */ NO_EQUIVALENT,
  1170. /* min, max, act ct */ 0, 1, 0,
  1171. /* opt state flags */ LIMIT_FLAGS, 0,
  1172. /* last opt argumnt */ { zLimitDefaultArg },
  1173. /* arg list/cookie */ NULL,
  1174. /* must/cannot opts */ NULL, NULL,
  1175. /* option proc */ doOptLimit,
  1176. /* desc, NAME, name */ zLimitText, zLimit_NAME, zLimit_Name,
  1177. /* disablement strs */ NULL, NULL },
  1178. { /* entry idx, value */ 42, VALUE_OPT_MULTIPLIER,
  1179. /* equiv idx, value */ 42, VALUE_OPT_MULTIPLIER,
  1180. /* equivalenced to */ NO_EQUIVALENT,
  1181. /* min, max, act ct */ 0, 1, 0,
  1182. /* opt state flags */ MULTIPLIER_FLAGS, 0,
  1183. /* last opt argumnt */ { NULL },
  1184. /* arg list/cookie */ NULL,
  1185. /* must/cannot opts */ NULL, aMultiplierCantList,
  1186. /* option proc */ NULL,
  1187. /* desc, NAME, name */ zMultiplierText, zMultiplier_NAME, zMultiplier_Name,
  1188. /* disablement strs */ NULL, NULL },
  1189. { /* entry idx, value */ 43, VALUE_OPT_PPS,
  1190. /* equiv idx, value */ 43, VALUE_OPT_PPS,
  1191. /* equivalenced to */ NO_EQUIVALENT,
  1192. /* min, max, act ct */ 0, 1, 0,
  1193. /* opt state flags */ PPS_FLAGS, 0,
  1194. /* last opt argumnt */ { NULL },
  1195. /* arg list/cookie */ NULL,
  1196. /* must/cannot opts */ NULL, aPpsCantList,
  1197. /* option proc */ optionNumericVal,
  1198. /* desc, NAME, name */ zPpsText, zPps_NAME, zPps_Name,
  1199. /* disablement strs */ NULL, NULL },
  1200. { /* entry idx, value */ 44, VALUE_OPT_MBPS,
  1201. /* equiv idx, value */ 44, VALUE_OPT_MBPS,
  1202. /* equivalenced to */ NO_EQUIVALENT,
  1203. /* min, max, act ct */ 0, 1, 0,
  1204. /* opt state flags */ MBPS_FLAGS, 0,
  1205. /* last opt argumnt */ { NULL },
  1206. /* arg list/cookie */ NULL,
  1207. /* must/cannot opts */ NULL, aMbpsCantList,
  1208. /* option proc */ NULL,
  1209. /* desc, NAME, name */ zMbpsText, zMbps_NAME, zMbps_Name,
  1210. /* disablement strs */ NULL, NULL },
  1211. { /* entry idx, value */ 45, VALUE_OPT_TOPSPEED,
  1212. /* equiv idx, value */ 45, VALUE_OPT_TOPSPEED,
  1213. /* equivalenced to */ NO_EQUIVALENT,
  1214. /* min, max, act ct */ 0, 1, 0,
  1215. /* opt state flags */ TOPSPEED_FLAGS, 0,
  1216. /* last opt argumnt */ { NULL },
  1217. /* arg list/cookie */ NULL,
  1218. /* must/cannot opts */ NULL, aTopspeedCantList,
  1219. /* option proc */ NULL,
  1220. /* desc, NAME, name */ zTopspeedText, zTopspeed_NAME, zTopspeed_Name,
  1221. /* disablement strs */ NULL, NULL },
  1222. { /* entry idx, value */ 46, VALUE_OPT_ONEATATIME,
  1223. /* equiv idx, value */ 46, VALUE_OPT_ONEATATIME,
  1224. /* equivalenced to */ NO_EQUIVALENT,
  1225. /* min, max, act ct */ 0, 1, 0,
  1226. /* opt state flags */ ONEATATIME_FLAGS, 0,
  1227. /* last opt argumnt */ { NULL },
  1228. /* arg list/cookie */ NULL,
  1229. /* must/cannot opts */ NULL, aOneatatimeCantList,
  1230. /* option proc */ NULL,
  1231. /* desc, NAME, name */ zOneatatimeText, zOneatatime_NAME, zOneatatime_Name,
  1232. /* disablement strs */ NULL, NULL },
  1233. { /* entry idx, value */ 47, VALUE_OPT_PPS_MULTI,
  1234. /* equiv idx, value */ 47, VALUE_OPT_PPS_MULTI,
  1235. /* equivalenced to */ NO_EQUIVALENT,
  1236. /* min, max, act ct */ 0, 1, 0,
  1237. /* opt state flags */ PPS_MULTI_FLAGS, 0,
  1238. /* last opt argumnt */ { zPps_MultiDefaultArg },
  1239. /* arg list/cookie */ NULL,
  1240. /* must/cannot opts */ aPps_MultiMustList, NULL,
  1241. /* option proc */ doOptPps_Multi,
  1242. /* desc, NAME, name */ zPps_MultiText, zPps_Multi_NAME, zPps_Multi_Name,
  1243. /* disablement strs */ NULL, NULL },
  1244. { /* entry idx, value */ 48, VALUE_OPT_PID,
  1245. /* equiv idx, value */ 48, VALUE_OPT_PID,
  1246. /* equivalenced to */ NO_EQUIVALENT,
  1247. /* min, max, act ct */ 0, 1, 0,
  1248. /* opt state flags */ PID_FLAGS, 0,
  1249. /* last opt argumnt */ { NULL },
  1250. /* arg list/cookie */ NULL,
  1251. /* must/cannot opts */ NULL, NULL,
  1252. /* option proc */ doOptPid,
  1253. /* desc, NAME, name */ zPidText, zPid_NAME, zPid_Name,
  1254. /* disablement strs */ NULL, NULL },
  1255. { /* entry idx, value */ 49, VALUE_OPT_VERSION,
  1256. /* equiv idx, value */ 49, VALUE_OPT_VERSION,
  1257. /* equivalenced to */ NO_EQUIVALENT,
  1258. /* min, max, act ct */ 0, 1, 0,
  1259. /* opt state flags */ VERSION_FLAGS, 0,
  1260. /* last opt argumnt */ { NULL },
  1261. /* arg list/cookie */ NULL,
  1262. /* must/cannot opts */ NULL, NULL,
  1263. /* option proc */ doOptVersion,
  1264. /* desc, NAME, name */ zVersionText, zVersion_NAME, zVersion_Name,
  1265. /* disablement strs */ NULL, NULL },
  1266. { /* entry idx, value */ 50, VALUE_OPT_LESS_HELP,
  1267. /* equiv idx, value */ 50, VALUE_OPT_LESS_HELP,
  1268. /* equivalenced to */ NO_EQUIVALENT,
  1269. /* min, max, act ct */ 0, 1, 0,
  1270. /* opt state flags */ LESS_HELP_FLAGS, 0,
  1271. /* last opt argumnt */ { NULL },
  1272. /* arg list/cookie */ NULL,
  1273. /* must/cannot opts */ NULL, NULL,
  1274. /* option proc */ doOptLess_Help,
  1275. /* desc, NAME, name */ zLess_HelpText, zLess_Help_NAME, zLess_Help_Name,
  1276. /* disablement strs */ NULL, NULL },
  1277. { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
  1278. /* equiv idx value */ NO_EQUIVALENT, 0,
  1279. /* equivalenced to */ NO_EQUIVALENT,
  1280. /* min, max, act ct */ 0, 1, 0,
  1281. /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
  1282. /* last opt argumnt */ { NULL },
  1283. /* arg list/cookie */ NULL,
  1284. /* must/cannot opts */ NULL, NULL,
  1285. /* option proc */ doUsageOpt,
  1286. /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
  1287. /* disablement strs */ NULL, NULL },
  1288. { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
  1289. /* equiv idx value */ NO_EQUIVALENT, 0,
  1290. /* equivalenced to */ NO_EQUIVALENT,
  1291. /* min, max, act ct */ 0, 1, 0,
  1292. /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
  1293. /* last opt argumnt */ { NULL },
  1294. /* arg list/cookie */ NULL,
  1295. /* must/cannot opts */ NULL, NULL,
  1296. /* option proc */ optionPagedUsage,
  1297. /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
  1298. /* disablement strs */ NULL, NULL },
  1299. { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
  1300. /* equiv idx value */ NO_EQUIVALENT, 0,
  1301. /* equivalenced to */ NO_EQUIVALENT,
  1302. /* min, max, act ct */ 0, 1, 0,
  1303. /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
  1304. | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
  1305. /* last opt argumnt */ { NULL },
  1306. /* arg list/cookie */ NULL,
  1307. /* must/cannot opts */ NULL, NULL,
  1308. /* option proc */ NULL,
  1309. /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
  1310. /* disablement strs */ NULL, NULL },
  1311. { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
  1312. /* equiv idx value */ NO_EQUIVALENT, 0,
  1313. /* equivalenced to */ NO_EQUIVALENT,
  1314. /* min, max, act ct */ 0, NOLIMIT, 0,
  1315. /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
  1316. | OPTST_DISABLE_IMM, 0,
  1317. /* last opt argumnt */ { NULL },
  1318. /* arg list/cookie */ NULL,
  1319. /* must/cannot opts */ NULL, NULL,
  1320. /* option proc */ optionLoadOpt,
  1321. /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
  1322. /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
  1323. };
  1324. tOptDesc * const tcpedit_tcpedit_optDesc_p = optDesc + 0;
  1325. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1326. *
  1327. * Define the Tcpreplay Option Environment
  1328. */
  1329. tSCC zPROGNAME[] = "TCPREPLAY";
  1330. tSCC zUsageTitle[] =
  1331. "tcpreplay (tcpreplay) - Replay network traffic stored in pcap files\n\
  1332. USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>\n";
  1333. tSCC zRcName[] = ".tcpreplayrc";
  1334. tSCC* apzHomeList[] = {
  1335. "$$/",
  1336. NULL };
  1337. #define zBugsAddr NULL
  1338. tSCC zExplain[] = "\n\
  1339. tcpreplay is a tool for replaying network traffic from files saved with\n\
  1340. tcpdump or other tools which write pcap(3) files.\n";
  1341. tSCC zDetail[] = "\n\
  1342. The basic operation of tcpreplay is to resend all packets from the\n\
  1343. input file(s) at the speed at which they were recorded, or a specified \n\
  1344. data rate, up to as fast as the hardware is capable.\n\n\
  1345. Optionally, the traffic can be split between two interfaces, written to\n\
  1346. files, filtered and edited in various ways, providing the means to test\n\
  1347. firewalls, NIDS and other network devices.\n\n\
  1348. For more details, please see the Tcpreplay Manual at:\n\
  1349. http://tcpreplay.synfin.net/trac/wiki/manual\n";
  1350. #define zFullVersion NULL
  1351. /* extracted from /usr/local/share/autogen/optcode.tpl near line 496 */
  1352. #if defined(ENABLE_NLS)
  1353. # define OPTPROC_BASE OPTPROC_TRANSLATE
  1354. static tOptionXlateProc translate_option_strings;
  1355. #else
  1356. # define OPTPROC_BASE OPTPROC_NONE
  1357. # define translate_option_strings NULL
  1358. #endif /* ENABLE_NLS */
  1359. #define tcpreplay_full_usage NULL
  1360. #define tcpreplay_short_usage NULL
  1361. tOptions tcpreplayOptions = {
  1362. OPTIONS_STRUCT_VERSION,
  1363. 0, NULL, /* original argc + argv */
  1364. ( OPTPROC_BASE
  1365. + OPTPROC_ERRSTOP
  1366. + OPTPROC_SHORTOPT
  1367. + OPTPROC_LONGOPT
  1368. + OPTPROC_NO_REQ_OPT
  1369. + OPTPROC_ARGS_REQ
  1370. + OPTPROC_GNUUSAGE
  1371. + OPTPROC_HAS_IMMED ),
  1372. 0, NULL, /* current option index, current option */
  1373. NULL, NULL, zPROGNAME,
  1374. zRcName, zCopyright, zCopyrightNotice,
  1375. zFullVersion, apzHomeList, zUsageTitle,
  1376. zExplain, zDetail, optDesc,
  1377. zBugsAddr, /* address to send bugs to */
  1378. NULL, NULL, /* extensions/saved state */
  1379. optionUsage, /* usage procedure */
  1380. translate_option_strings, /* translation procedure */
  1381. /*
  1382. * Indexes to special options
  1383. */
  1384. { INDEX_OPT_MORE_HELP, /* more-help option index */
  1385. INDEX_OPT_SAVE_OPTS, /* save option index */
  1386. NO_EQUIVALENT, /* '-#' option index */
  1387. 9 /* index of default opt */
  1388. },
  1389. 55 /* full option count */, 51 /* user option count */,
  1390. tcpreplay_full_usage, tcpreplay_short_usage,
  1391. NULL, NULL
  1392. };
  1393. /*
  1394. * Create the static procedure(s) declared above.
  1395. */
  1396. static void
  1397. doUsageOpt(
  1398. tOptions* pOptions,
  1399. tOptDesc* pOptDesc )
  1400. {
  1401. USAGE( EXIT_SUCCESS );
  1402. }
  1403. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1404. *
  1405. * For the mtu option.
  1406. */
  1407. static void
  1408. doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
  1409. {
  1410. static const struct {long const rmin, rmax;} rng[1] = {
  1411. { 1, MAXPACKET } };
  1412. long val;
  1413. int ix;
  1414. char * pzEnd;
  1415. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1416. goto emit_ranges;
  1417. errno = 0;
  1418. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1419. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1420. goto bad_value;
  1421. if (*pzEnd != '\0')
  1422. goto bad_value;
  1423. for (ix = 0; ix < 1; ix++) {
  1424. if (val < rng[ix].rmin)
  1425. continue; /* ranges need not be ordered. */
  1426. if (val == rng[ix].rmin)
  1427. goto valid_return;
  1428. if (rng[ix].rmax == LONG_MIN)
  1429. continue;
  1430. if (val <= rng[ix].rmax)
  1431. goto valid_return;
  1432. }
  1433. bad_value:
  1434. option_usage_fp = stderr;
  1435. emit_ranges:
  1436. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1437. return;
  1438. valid_return:
  1439. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1440. free((void *)pOptDesc->optArg.argString);
  1441. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1442. }
  1443. pOptDesc->optArg.argInt = val;
  1444. }
  1445. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1446. *
  1447. * For the tos option.
  1448. */
  1449. static void
  1450. doOptTos(tOptions* pOptions, tOptDesc* pOptDesc)
  1451. {
  1452. static const struct {long const rmin, rmax;} rng[1] = {
  1453. { 0, 255 } };
  1454. long val;
  1455. int ix;
  1456. char * pzEnd;
  1457. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1458. goto emit_ranges;
  1459. errno = 0;
  1460. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1461. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1462. goto bad_value;
  1463. if (*pzEnd != '\0')
  1464. goto bad_value;
  1465. for (ix = 0; ix < 1; ix++) {
  1466. if (val < rng[ix].rmin)
  1467. continue; /* ranges need not be ordered. */
  1468. if (val == rng[ix].rmin)
  1469. goto valid_return;
  1470. if (rng[ix].rmax == LONG_MIN)
  1471. continue;
  1472. if (val <= rng[ix].rmax)
  1473. goto valid_return;
  1474. }
  1475. bad_value:
  1476. option_usage_fp = stderr;
  1477. emit_ranges:
  1478. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1479. return;
  1480. valid_return:
  1481. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1482. free((void *)pOptDesc->optArg.argString);
  1483. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1484. }
  1485. pOptDesc->optArg.argInt = val;
  1486. }
  1487. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1488. *
  1489. * For the enet-vlan-tag option.
  1490. */
  1491. static void
  1492. doOptEnet_Vlan_Tag(tOptions* pOptions, tOptDesc* pOptDesc)
  1493. {
  1494. static const struct {long const rmin, rmax;} rng[1] = {
  1495. { 0, 4095 } };
  1496. long val;
  1497. int ix;
  1498. char * pzEnd;
  1499. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1500. goto emit_ranges;
  1501. errno = 0;
  1502. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1503. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1504. goto bad_value;
  1505. if (*pzEnd != '\0')
  1506. goto bad_value;
  1507. for (ix = 0; ix < 1; ix++) {
  1508. if (val < rng[ix].rmin)
  1509. continue; /* ranges need not be ordered. */
  1510. if (val == rng[ix].rmin)
  1511. goto valid_return;
  1512. if (rng[ix].rmax == LONG_MIN)
  1513. continue;
  1514. if (val <= rng[ix].rmax)
  1515. goto valid_return;
  1516. }
  1517. bad_value:
  1518. option_usage_fp = stderr;
  1519. emit_ranges:
  1520. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1521. return;
  1522. valid_return:
  1523. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1524. free((void *)pOptDesc->optArg.argString);
  1525. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1526. }
  1527. pOptDesc->optArg.argInt = val;
  1528. }
  1529. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1530. *
  1531. * For the enet-vlan-cfi option.
  1532. */
  1533. static void
  1534. doOptEnet_Vlan_Cfi(tOptions* pOptions, tOptDesc* pOptDesc)
  1535. {
  1536. static const struct {long const rmin, rmax;} rng[1] = {
  1537. { 0, 1 } };
  1538. long val;
  1539. int ix;
  1540. char * pzEnd;
  1541. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1542. goto emit_ranges;
  1543. errno = 0;
  1544. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1545. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1546. goto bad_value;
  1547. if (*pzEnd != '\0')
  1548. goto bad_value;
  1549. for (ix = 0; ix < 1; ix++) {
  1550. if (val < rng[ix].rmin)
  1551. continue; /* ranges need not be ordered. */
  1552. if (val == rng[ix].rmin)
  1553. goto valid_return;
  1554. if (rng[ix].rmax == LONG_MIN)
  1555. continue;
  1556. if (val <= rng[ix].rmax)
  1557. goto valid_return;
  1558. }
  1559. bad_value:
  1560. option_usage_fp = stderr;
  1561. emit_ranges:
  1562. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1563. return;
  1564. valid_return:
  1565. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1566. free((void *)pOptDesc->optArg.argString);
  1567. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1568. }
  1569. pOptDesc->optArg.argInt = val;
  1570. }
  1571. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1572. *
  1573. * For the enet-vlan-pri option.
  1574. */
  1575. static void
  1576. doOptEnet_Vlan_Pri(tOptions* pOptions, tOptDesc* pOptDesc)
  1577. {
  1578. static const struct {long const rmin, rmax;} rng[1] = {
  1579. { 0, 7 } };
  1580. long val;
  1581. int ix;
  1582. char * pzEnd;
  1583. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1584. goto emit_ranges;
  1585. errno = 0;
  1586. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1587. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1588. goto bad_value;
  1589. if (*pzEnd != '\0')
  1590. goto bad_value;
  1591. for (ix = 0; ix < 1; ix++) {
  1592. if (val < rng[ix].rmin)
  1593. continue; /* ranges need not be ordered. */
  1594. if (val == rng[ix].rmin)
  1595. goto valid_return;
  1596. if (rng[ix].rmax == LONG_MIN)
  1597. continue;
  1598. if (val <= rng[ix].rmax)
  1599. goto valid_return;
  1600. }
  1601. bad_value:
  1602. option_usage_fp = stderr;
  1603. emit_ranges:
  1604. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1605. return;
  1606. valid_return:
  1607. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1608. free((void *)pOptDesc->optArg.argString);
  1609. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1610. }
  1611. pOptDesc->optArg.argInt = val;
  1612. }
  1613. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1614. *
  1615. * For the dbug option, when DEBUG is #define-d.
  1616. */
  1617. #ifdef DEBUG
  1618. static void
  1619. doOptDbug(tOptions* pOptions, tOptDesc* pOptDesc)
  1620. {
  1621. static const struct {long const rmin, rmax;} rng[1] = {
  1622. { 0, 5 } };
  1623. long val;
  1624. int ix;
  1625. char * pzEnd;
  1626. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1627. goto emit_ranges;
  1628. errno = 0;
  1629. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1630. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1631. goto bad_value;
  1632. if (*pzEnd != '\0')
  1633. goto bad_value;
  1634. for (ix = 0; ix < 1; ix++) {
  1635. if (val < rng[ix].rmin)
  1636. continue; /* ranges need not be ordered. */
  1637. if (val == rng[ix].rmin)
  1638. goto valid_return;
  1639. if (rng[ix].rmax == LONG_MIN)
  1640. continue;
  1641. if (val <= rng[ix].rmax)
  1642. goto valid_return;
  1643. }
  1644. bad_value:
  1645. option_usage_fp = stderr;
  1646. emit_ranges:
  1647. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1648. return;
  1649. valid_return:
  1650. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1651. free((void *)pOptDesc->optArg.argString);
  1652. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1653. }
  1654. pOptDesc->optArg.argInt = val;
  1655. }
  1656. #endif /* defined DEBUG */
  1657. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1658. *
  1659. * For the listnics option, when ENABLE_PCAP_FINDALLDEVS is #define-d.
  1660. */
  1661. #ifdef ENABLE_PCAP_FINDALLDEVS
  1662. static void
  1663. doOptListnics(tOptions* pOptions, tOptDesc* pOptDesc)
  1664. {
  1665. /* extracted from tcpreplay_opts.def, line 256 */
  1666. interface_list_t *list = get_interface_list();
  1667. list_interfaces(list);
  1668. free(list);
  1669. exit(0);
  1670. }
  1671. #endif /* defined ENABLE_PCAP_FINDALLDEVS */
  1672. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1673. *
  1674. * For the loop option.
  1675. */
  1676. static void
  1677. doOptLoop(tOptions* pOptions, tOptDesc* pOptDesc)
  1678. {
  1679. static const struct {long const rmin, rmax;} rng[1] = {
  1680. { 0, LONG_MAX } };
  1681. long val;
  1682. int ix;
  1683. char * pzEnd;
  1684. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1685. goto emit_ranges;
  1686. errno = 0;
  1687. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1688. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1689. goto bad_value;
  1690. if (*pzEnd != '\0')
  1691. goto bad_value;
  1692. for (ix = 0; ix < 1; ix++) {
  1693. if (val < rng[ix].rmin)
  1694. continue; /* ranges need not be ordered. */
  1695. if (val == rng[ix].rmin)
  1696. goto valid_return;
  1697. if (rng[ix].rmax == LONG_MIN)
  1698. continue;
  1699. if (val <= rng[ix].rmax)
  1700. goto valid_return;
  1701. }
  1702. bad_value:
  1703. option_usage_fp = stderr;
  1704. emit_ranges:
  1705. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1706. return;
  1707. valid_return:
  1708. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1709. free((void *)pOptDesc->optArg.argString);
  1710. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1711. }
  1712. pOptDesc->optArg.argInt = val;
  1713. }
  1714. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1715. *
  1716. * For the limit option.
  1717. */
  1718. static void
  1719. doOptLimit(tOptions* pOptions, tOptDesc* pOptDesc)
  1720. {
  1721. static const struct {long const rmin, rmax;} rng[1] = {
  1722. { 1, LONG_MAX } };
  1723. long val;
  1724. int ix;
  1725. char * pzEnd;
  1726. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1727. goto emit_ranges;
  1728. errno = 0;
  1729. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1730. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1731. goto bad_value;
  1732. if (*pzEnd != '\0')
  1733. goto bad_value;
  1734. for (ix = 0; ix < 1; ix++) {
  1735. if (val < rng[ix].rmin)
  1736. continue; /* ranges need not be ordered. */
  1737. if (val == rng[ix].rmin)
  1738. goto valid_return;
  1739. if (rng[ix].rmax == LONG_MIN)
  1740. continue;
  1741. if (val <= rng[ix].rmax)
  1742. goto valid_return;
  1743. }
  1744. bad_value:
  1745. option_usage_fp = stderr;
  1746. emit_ranges:
  1747. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1748. return;
  1749. valid_return:
  1750. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1751. free((void *)pOptDesc->optArg.argString);
  1752. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1753. }
  1754. pOptDesc->optArg.argInt = val;
  1755. }
  1756. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1757. *
  1758. * For the pps-multi option.
  1759. */
  1760. static void
  1761. doOptPps_Multi(tOptions* pOptions, tOptDesc* pOptDesc)
  1762. {
  1763. static const struct {long const rmin, rmax;} rng[1] = {
  1764. { 1, LONG_MAX } };
  1765. long val;
  1766. int ix;
  1767. char * pzEnd;
  1768. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1769. goto emit_ranges;
  1770. errno = 0;
  1771. val = strtol(pOptDesc->optArg.argString, &pzEnd, 0);
  1772. if ((pOptDesc->optArg.argString == pzEnd) || (errno != 0))
  1773. goto bad_value;
  1774. if (*pzEnd != '\0')
  1775. goto bad_value;
  1776. for (ix = 0; ix < 1; ix++) {
  1777. if (val < rng[ix].rmin)
  1778. continue; /* ranges need not be ordered. */
  1779. if (val == rng[ix].rmin)
  1780. goto valid_return;
  1781. if (rng[ix].rmax == LONG_MIN)
  1782. continue;
  1783. if (val <= rng[ix].rmax)
  1784. goto valid_return;
  1785. }
  1786. bad_value:
  1787. option_usage_fp = stderr;
  1788. emit_ranges:
  1789. optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
  1790. return;
  1791. valid_return:
  1792. if ((pOptDesc->fOptState & OPTST_ALLOC_ARG) != 0) {
  1793. free((void *)pOptDesc->optArg.argString);
  1794. pOptDesc->fOptState &= ~OPTST_ALLOC_ARG;
  1795. }
  1796. pOptDesc->optArg.argInt = val;
  1797. }
  1798. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1799. *
  1800. * For the pid option.
  1801. */
  1802. static void
  1803. doOptPid(tOptions* pOptions, tOptDesc* pOptDesc)
  1804. {
  1805. /* extracted from tcpreplay_opts.def, line 406 */
  1806. fprintf(stderr, "PID: %hu\n", getpid());
  1807. }
  1808. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1809. *
  1810. * For the version option.
  1811. */
  1812. static void
  1813. doOptVersion(tOptions* pOptions, tOptDesc* pOptDesc)
  1814. {
  1815. /* extracted from tcpreplay_opts.def, line 418 */
  1816. fprintf(stderr, "tcpreplay version: %s (build %s)", VERSION, svn_version());
  1817. #ifdef DEBUG
  1818. fprintf(stderr, " (debug)");
  1819. #endif
  1820. fprintf(stderr, "\n");
  1821. fprintf(stderr, "Copyright 2001-2009 by Aaron Turner <aturner at synfin dot net>\n");
  1822. fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
  1823. #ifdef HAVE_LIBDNET
  1824. fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
  1825. #else
  1826. fprintf(stderr, "Not compiled with libdnet.\n");
  1827. #endif
  1828. #ifdef HAVE_WINPCAP
  1829. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  1830. #else
  1831. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  1832. #endif
  1833. #ifdef ENABLE_64BITS
  1834. fprintf(stderr, "64 bit packet counters: enabled\n");
  1835. #else
  1836. fprintf(stderr, "64 bit packet counters: disabled\n");
  1837. #endif
  1838. #ifdef ENABLE_VERBOSE
  1839. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  1840. #else
  1841. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  1842. #endif
  1843. #ifdef TCPREPLAY_EDIT
  1844. fprintf(stderr, "Packet editing: enabled\n");
  1845. #else
  1846. fprintf(stderr, "Packet editing: disabled\n");
  1847. #endif
  1848. #ifdef ENABLE_FRAGROUTE
  1849. fprintf(stderr, "Fragroute engine: enabled\n");
  1850. #else
  1851. fprintf(stderr, "Fragroute engine: disabled\n");
  1852. #endif
  1853. fprintf(stderr, "Injection method: %s\n", sendpacket_get_method());
  1854. exit(0);
  1855. }
  1856. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1857. *
  1858. * For the less-help option.
  1859. */
  1860. static void
  1861. doOptLess_Help(tOptions* pOptions, tOptDesc* pOptDesc)
  1862. {
  1863. /* extracted from tcpreplay_opts.def, line 469 */
  1864. USAGE(EXIT_FAILURE);
  1865. }
  1866. /* extracted from /usr/local/share/autogen/optcode.tpl near line 629 */
  1867. #if ENABLE_NLS
  1868. #include <stdio.h>
  1869. #include <stdlib.h>
  1870. #include <string.h>
  1871. #include <unistd.h>
  1872. #include <autoopts/usage-txt.h>
  1873. static char* AO_gettext( char const* pz );
  1874. static void coerce_it(void** s);
  1875. static char*
  1876. AO_gettext( char const* pz )
  1877. {
  1878. char* pzRes;
  1879. if (pz == NULL)
  1880. return NULL;
  1881. pzRes = _(pz);
  1882. if (pzRes == pz)
  1883. return pzRes;
  1884. pzRes = strdup( pzRes );
  1885. if (pzRes == NULL) {
  1886. fputs( _("No memory for duping translated strings\n"), stderr );
  1887. exit( EXIT_FAILURE );
  1888. }
  1889. return pzRes;
  1890. }
  1891. static void coerce_it(void** s) { *s = AO_gettext(*s); }
  1892. #define COERSION(_f) \
  1893. coerce_it((void*)&(tcpreplayOptions._f))
  1894. /*
  1895. * This invokes the translation code (e.g. gettext(3)).
  1896. */
  1897. static void
  1898. translate_option_strings( void )
  1899. {
  1900. /*
  1901. * Guard against re-translation. It won't work. The strings will have
  1902. * been changed by the first pass through this code. One shot only.
  1903. */
  1904. if (option_usage_text.field_ct != 0) {
  1905. /*
  1906. * Do the translations. The first pointer follows the field count
  1907. * field. The field count field is the size of a pointer.
  1908. */
  1909. tOptDesc* pOD = tcpreplayOptions.pOptDesc;
  1910. char** ppz = (char**)(void*)&(option_usage_text);
  1911. int ix = option_usage_text.field_ct;
  1912. do {
  1913. ppz++;
  1914. *ppz = AO_gettext(*ppz);
  1915. } while (--ix > 0);
  1916. COERSION(pzCopyright);
  1917. COERSION(pzCopyNotice);
  1918. COERSION(pzFullVersion);
  1919. COERSION(pzUsageTitle);
  1920. COERSION(pzExplain);
  1921. COERSION(pzDetail);
  1922. option_usage_text.field_ct = 0;
  1923. for (ix = tcpreplayOptions.optCt; ix > 0; ix--, pOD++)
  1924. coerce_it((void*)&(pOD->pzText));
  1925. }
  1926. if ((tcpreplayOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
  1927. tOptDesc* pOD = tcpreplayOptions.pOptDesc;
  1928. int ix;
  1929. for (ix = tcpreplayOptions.optCt; ix > 0; ix--, pOD++) {
  1930. coerce_it((void*)&(pOD->pz_Name));
  1931. coerce_it((void*)&(pOD->pz_DisableName));
  1932. coerce_it((void*)&(pOD->pz_DisablePfx));
  1933. }
  1934. /* prevent re-translation */
  1935. tcpreplayOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
  1936. }
  1937. }
  1938. #endif /* ENABLE_NLS */
  1939. #ifdef __cplusplus
  1940. }
  1941. #endif
  1942. /* tcpreplay_edit_opts.c ends here */