12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009 |
- /* -*- buffer-read-only: t -*- vi: set ro:
- *
- * DO NOT EDIT THIS FILE (tcpreplay_edit_opts.c)
- *
- * It has been AutoGen-ed Monday June 9, 2008 at 11:05:43 AM PDT
- * From the definitions tcpreplay_opts.def
- * and the template file options
- *
- * Generated from AutoOpts 30:0:5 templates.
- */
- /*
- * This file was produced by an AutoOpts template. AutoOpts is a
- * copyrighted work. This source file is not encumbered by AutoOpts
- * licensing, but is provided under the licensing terms chosen by the
- * tcpreplay author or copyright holder. AutoOpts is licensed under
- * the terms of the LGPL. The redistributable library (``libopts'') is
- * licensed under the terms of either the LGPL or, at the users discretion,
- * the BSD license. See the AutoOpts and/or libopts sources for details.
- *
- * This source file is copyrighted and licensed under the following terms:
- *
- * tcpreplay copyright 2000-2008 Aaron Turner - all rights reserved
- *
- * tcpreplay is free software copyrighted by Aaron Turner.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name ``Aaron Turner'' nor the name of any other
- * contributor may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * tcpreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #include <limits.h>
- #include <stdio.h>
- #define OPTION_CODE_COMPILE 1
- #include "tcpreplay_edit_opts.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- tSCC zCopyright[] =
- "tcpreplay copyright (c) 2000-2008 Aaron Turner, all rights reserved";
- tSCC zCopyrightNotice[] =
- "tcpreplay is free software copyrighted by Aaron Turner.\n\n\
- Redistribution and use in source and binary forms, with or without\n\
- modification, are permitted provided that the following conditions\n\
- are met:\n\
- 1. Redistributions of source code must retain the above copyright\n\
- notice, this list of conditions and the following disclaimer.\n\
- 2. Redistributions in binary form must reproduce the above copyright\n\
- notice, this list of conditions and the following disclaimer in the\n\
- documentation and/or other materials provided with the distribution.\n\
- 3. Neither the name ``Aaron Turner'' nor the name of any other\n\
- contributor may be used to endorse or promote products derived\n\
- from this software without specific prior written permission.\n\n\
- tcpreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS\n\
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
- ARE DISCLAIMED. IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS\n\
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n\
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n\
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n\
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n\
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n\
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n\
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
- extern tUsageProc optionUsage;
- /*
- * global included definitions
- */
- #include "defines.h"
- #include "tcpreplay.h"
- #include "common.h"
- #include "config.h"
- #include <stdlib.h>
- #include <sys/types.h>
- #include <unistd.h>
- extern tcpreplay_opt_t options;
- #ifndef NULL
- # define NULL 0
- #endif
- #ifndef EXIT_SUCCESS
- # define EXIT_SUCCESS 0
- #endif
- #ifndef EXIT_FAILURE
- # define EXIT_FAILURE 1
- #endif
- /*
- * Tcpedit option description:
- */
- tSCC zTcpeditText[] =
- "";
- #define TCPEDIT_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
- /*
- * Portmap option description:
- */
- tSCC zPortmapText[] =
- "Rewrite TCP/UDP ports";
- tSCC zPortmap_NAME[] = "PORTMAP";
- tSCC zPortmap_Name[] = "portmap";
- #define PORTMAP_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Seed option description:
- */
- tSCC zSeedText[] =
- "Randomize src/dst IP addresses w/ given seed";
- tSCC zSeed_NAME[] = "SEED";
- tSCC zSeed_Name[] = "seed";
- #define SEED_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Pnat option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zPnatText[] =
- "Rewrite IP addresses using pseudo-NAT";
- tSCC zPnat_NAME[] = "PNAT";
- tSCC zPnat_Name[] = "pnat";
- static const int
- aPnatCantList[] = {
- INDEX_OPT_SRCIPMAP, NO_EQUIVALENT };
- #define PNAT_FLAGS (OPTST_DISABLED | OPTST_STACKED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Srcipmap option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zSrcipmapText[] =
- "Rewrite source IP addresses using pseudo-NAT";
- tSCC zSrcipmap_NAME[] = "SRCIPMAP";
- tSCC zSrcipmap_Name[] = "srcipmap";
- static const int
- aSrcipmapCantList[] = {
- INDEX_OPT_PNAT, NO_EQUIVALENT };
- #define SRCIPMAP_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Dstipmap option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zDstipmapText[] =
- "Rewrite destination IP addresses using pseudo-NAT";
- tSCC zDstipmap_NAME[] = "DSTIPMAP";
- tSCC zDstipmap_Name[] = "dstipmap";
- static const int
- aDstipmapCantList[] = {
- INDEX_OPT_PNAT, NO_EQUIVALENT };
- #define DSTIPMAP_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Endpoints option description with
- * "Must also have options" and "Incompatible options":
- */
- #ifdef HAVE_CACHEFILE_SUPPORT
- tSCC zEndpointsText[] =
- "Rewrite IP addresses to be between two endpoints";
- tSCC zEndpoints_NAME[] = "ENDPOINTS";
- tSCC zEndpoints_Name[] = "endpoints";
- static const int
- aEndpointsMustList[] = {
- INDEX_OPT_CACHEFILE, NO_EQUIVALENT };
- #define ENDPOINTS_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- #else /* disable Endpoints */
- #define VALUE_OPT_ENDPOINTS NO_EQUIVALENT
- #define ENDPOINTS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
- #define aEndpointsMustList NULL
- #define zEndpointsText NULL
- #define zEndpoints_NAME NULL
- #define zEndpoints_Name NULL
- #endif /* HAVE_CACHEFILE_SUPPORT */
- /*
- * Skipbroadcast option description:
- */
- tSCC zSkipbroadcastText[] =
- "Skip rewriting broadcast/multicast IP's";
- tSCC zSkipbroadcast_NAME[] = "SKIPBROADCAST";
- tSCC zSkipbroadcast_Name[] = "skipbroadcast";
- #define SKIPBROADCAST_FLAGS (OPTST_DISABLED)
- /*
- * Fixcsum option description:
- */
- tSCC zFixcsumText[] =
- "Force recalculation of IP/TCP/UDP checksums";
- tSCC zFixcsum_NAME[] = "FIXCSUM";
- tSCC zFixcsum_Name[] = "fixcsum";
- #define FIXCSUM_FLAGS (OPTST_DISABLED)
- /*
- * Mtu option description:
- */
- tSCC zMtuText[] =
- "Override default MTU length (1500 bytes)";
- tSCC zMtu_NAME[] = "MTU";
- tSCC zMtu_Name[] = "mtu";
- #define MTU_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Efcs option description:
- */
- tSCC zEfcsText[] =
- "Remove Ethernet checksums (FCS) from end of frames";
- tSCC zEfcs_NAME[] = "EFCS";
- tSCC zEfcs_Name[] = "efcs";
- #define EFCS_FLAGS (OPTST_DISABLED)
- /*
- * Ttl option description:
- */
- tSCC zTtlText[] =
- "Modify the IPv4 TTL";
- tSCC zTtl_NAME[] = "TTL";
- tSCC zTtl_Name[] = "ttl";
- #define TTL_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Fixlen option description:
- */
- tSCC zFixlenText[] =
- "Pad or truncate packet data to match header length";
- tSCC zFixlen_NAME[] = "FIXLEN";
- tSCC zFixlen_Name[] = "fixlen";
- #define FIXLEN_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Skipl2broadcast option description:
- */
- tSCC zSkipl2broadcastText[] =
- "Skip rewriting broadcast/multicast Layer 2 addresses";
- tSCC zSkipl2broadcast_NAME[] = "SKIPL2BROADCAST";
- tSCC zSkipl2broadcast_Name[] = "skipl2broadcast";
- #define SKIPL2BROADCAST_FLAGS (OPTST_DISABLED)
- /*
- * Dlt option description:
- */
- tSCC zDltText[] =
- "Override output DLT encapsulation";
- tSCC zDlt_NAME[] = "DLT";
- tSCC zDlt_Name[] = "dlt";
- #define DLT_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Enet_Dmac option description:
- */
- tSCC zEnet_DmacText[] =
- "Override destination ethernet MAC addresses";
- tSCC zEnet_Dmac_NAME[] = "ENET_DMAC";
- tSCC zEnet_Dmac_Name[] = "enet-dmac";
- #define ENET_DMAC_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Enet_Smac option description:
- */
- tSCC zEnet_SmacText[] =
- "Override source ethernet MAC addresses";
- tSCC zEnet_Smac_NAME[] = "ENET_SMAC";
- tSCC zEnet_Smac_Name[] = "enet-smac";
- #define ENET_SMAC_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Enet_Vlan option description:
- */
- tSCC zEnet_VlanText[] =
- "Specify ethernet 802.1q VLAN tag mode";
- tSCC zEnet_Vlan_NAME[] = "ENET_VLAN";
- tSCC zEnet_Vlan_Name[] = "enet-vlan";
- #define ENET_VLAN_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Enet_Vlan_Tag option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zEnet_Vlan_TagText[] =
- "Specify the new ethernet 802.1q VLAN tag value";
- tSCC zEnet_Vlan_Tag_NAME[] = "ENET_VLAN_TAG";
- tSCC zEnet_Vlan_Tag_Name[] = "enet-vlan-tag";
- static const int
- aEnet_Vlan_TagMustList[] = {
- INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
- #define ENET_VLAN_TAG_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Enet_Vlan_Cfi option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zEnet_Vlan_CfiText[] =
- "Specify the ethernet 802.1q VLAN CFI value";
- tSCC zEnet_Vlan_Cfi_NAME[] = "ENET_VLAN_CFI";
- tSCC zEnet_Vlan_Cfi_Name[] = "enet-vlan-cfi";
- static const int
- aEnet_Vlan_CfiMustList[] = {
- INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
- #define ENET_VLAN_CFI_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Enet_Vlan_Pri option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zEnet_Vlan_PriText[] =
- "Specify the ethernet 802.1q VLAN priority";
- tSCC zEnet_Vlan_Pri_NAME[] = "ENET_VLAN_PRI";
- tSCC zEnet_Vlan_Pri_Name[] = "enet-vlan-pri";
- static const int
- aEnet_Vlan_PriMustList[] = {
- INDEX_OPT_ENET_VLAN, NO_EQUIVALENT };
- #define ENET_VLAN_PRI_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Hdlc_Control option description:
- */
- tSCC zHdlc_ControlText[] =
- "Specify HDLC control value";
- tSCC zHdlc_Control_NAME[] = "HDLC_CONTROL";
- tSCC zHdlc_Control_Name[] = "hdlc-control";
- #define HDLC_CONTROL_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Hdlc_Address option description:
- */
- tSCC zHdlc_AddressText[] =
- "Specify HDLC address";
- tSCC zHdlc_Address_NAME[] = "HDLC_ADDRESS";
- tSCC zHdlc_Address_Name[] = "hdlc-address";
- #define HDLC_ADDRESS_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * User_Dlt option description:
- */
- tSCC zUser_DltText[] =
- "Set output file DLT type";
- tSCC zUser_Dlt_NAME[] = "USER_DLT";
- tSCC zUser_Dlt_Name[] = "user-dlt";
- #define USER_DLT_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * User_Dlink option description:
- */
- tSCC zUser_DlinkText[] =
- "Rewrite Data-Link layer with user specified data";
- tSCC zUser_Dlink_NAME[] = "USER_DLINK";
- tSCC zUser_Dlink_Name[] = "user-dlink";
- #define USER_DLINK_FLAGS (OPTST_DISABLED | OPTST_STACKED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Dbug option description:
- */
- #ifdef DEBUG
- tSCC zDbugText[] =
- "Enable debugging output";
- tSCC zDbug_NAME[] = "DBUG";
- tSCC zDbug_Name[] = "dbug";
- #define zDbugDefaultArg ((char const*)0)
- #define DBUG_FLAGS (OPTST_DISABLED | OPTST_IMM \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- #else /* disable Dbug */
- #define VALUE_OPT_DBUG NO_EQUIVALENT
- #define DBUG_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
- #define zDbugDefaultArg NULL
- #define zDbugText NULL
- #define zDbug_NAME NULL
- #define zDbug_Name NULL
- #endif /* DEBUG */
- /*
- * Quiet option description:
- */
- tSCC zQuietText[] =
- "Quiet mode";
- tSCC zQuiet_NAME[] = "QUIET";
- tSCC zQuiet_Name[] = "quiet";
- #define QUIET_FLAGS (OPTST_DISABLED)
- /*
- * Timer option description:
- */
- tSCC zTimerText[] =
- "Select packet timing mode: select, ioport, rdtsc, gtod, nano, abstime";
- tSCC zTimer_NAME[] = "TIMER";
- tSCC zTimer_Name[] = "timer";
- tSCC zTimerDefaultArg[] = "gtod";
- #define TIMER_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Sleep_Accel option description:
- */
- tSCC zSleep_AccelText[] =
- "Reduce the amount of time to sleep by specified usec";
- tSCC zSleep_Accel_NAME[] = "SLEEP_ACCEL";
- tSCC zSleep_Accel_Name[] = "sleep-accel";
- #define zSleep_AccelDefaultArg ((char const*)0)
- #define SLEEP_ACCEL_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Rdtsc_Clicks option description:
- */
- tSCC zRdtsc_ClicksText[] =
- "Specify the RDTSC clicks/usec";
- tSCC zRdtsc_Clicks_NAME[] = "RDTSC_CLICKS";
- tSCC zRdtsc_Clicks_Name[] = "rdtsc-clicks";
- #define zRdtsc_ClicksDefaultArg ((char const*)0)
- #define RDTSC_CLICKS_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Verbose option description:
- */
- #ifdef ENABLE_VERBOSE
- tSCC zVerboseText[] =
- "Print decoded packets via tcpdump to STDOUT";
- tSCC zVerbose_NAME[] = "VERBOSE";
- tSCC zVerbose_Name[] = "verbose";
- #define VERBOSE_FLAGS (OPTST_DISABLED | OPTST_IMM)
- #else /* disable Verbose */
- #define VALUE_OPT_VERBOSE NO_EQUIVALENT
- #define VERBOSE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
- #define zVerboseText NULL
- #define zVerbose_NAME NULL
- #define zVerbose_Name NULL
- #endif /* ENABLE_VERBOSE */
- /*
- * Decode option description with
- * "Must also have options" and "Incompatible options":
- */
- #ifdef ENABLE_VERBOSE
- tSCC zDecodeText[] =
- "Arguments passed to tcpdump decoder";
- tSCC zDecode_NAME[] = "DECODE";
- tSCC zDecode_Name[] = "decode";
- static const int
- aDecodeMustList[] = {
- INDEX_OPT_VERBOSE, NO_EQUIVALENT };
- #define DECODE_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- #else /* disable Decode */
- #define VALUE_OPT_DECODE NO_EQUIVALENT
- #define DECODE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
- #define aDecodeMustList NULL
- #define zDecodeText NULL
- #define zDecode_NAME NULL
- #define zDecode_Name NULL
- #endif /* ENABLE_VERBOSE */
- /*
- * Enable_File_Cache option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zEnable_File_CacheText[] =
- "Enable caching of packets to internal memory";
- tSCC zEnable_File_Cache_NAME[] = "ENABLE_FILE_CACHE";
- tSCC zEnable_File_Cache_Name[] = "enable-file-cache";
- static const int
- aEnable_File_CacheMustList[] = {
- INDEX_OPT_LOOP, NO_EQUIVALENT };
- #define ENABLE_FILE_CACHE_FLAGS (OPTST_DISABLED)
- /*
- * Cachefile option description:
- */
- tSCC zCachefileText[] =
- "Split traffic via a tcpprep cache file";
- tSCC zCachefile_NAME[] = "CACHEFILE";
- tSCC zCachefile_Name[] = "cachefile";
- #define CACHEFILE_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Intf1 option description:
- */
- tSCC zIntf1Text[] =
- "Server/primary traffic output interface";
- tSCC zIntf1_NAME[] = "INTF1";
- tSCC zIntf1_Name[] = "intf1";
- #define INTF1_FLAGS (OPTST_DISABLED | OPTST_MUST_SET \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Intf2 option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zIntf2Text[] =
- "Client/secondary traffic output interface";
- tSCC zIntf2_NAME[] = "INTF2";
- tSCC zIntf2_Name[] = "intf2";
- static const int
- aIntf2MustList[] = {
- INDEX_OPT_CACHEFILE, NO_EQUIVALENT };
- #define INTF2_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Listnics option description:
- */
- #ifdef ENABLE_PCAP_FINDALLDEVS
- tSCC zListnicsText[] =
- "List available network interfaces and exit";
- tSCC zListnics_NAME[] = "LISTNICS";
- tSCC zListnics_Name[] = "listnics";
- #define LISTNICS_FLAGS (OPTST_DISABLED | OPTST_IMM)
- #else /* disable Listnics */
- #define VALUE_OPT_LISTNICS NO_EQUIVALENT
- #define LISTNICS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
- #define zListnicsText NULL
- #define zListnics_NAME NULL
- #define zListnics_Name NULL
- #endif /* ENABLE_PCAP_FINDALLDEVS */
- /*
- * Loop option description:
- */
- tSCC zLoopText[] =
- "Loop through the capture file X times";
- tSCC zLoop_NAME[] = "LOOP";
- tSCC zLoop_Name[] = "loop";
- #define zLoopDefaultArg ((char const*)1)
- #define LOOP_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Pktlen option description:
- */
- tSCC zPktlenText[] =
- "Override the snaplen and use the actual packet len";
- tSCC zPktlen_NAME[] = "PKTLEN";
- tSCC zPktlen_Name[] = "pktlen";
- #define PKTLEN_FLAGS (OPTST_DISABLED)
- /*
- * Limit option description:
- */
- tSCC zLimitText[] =
- "Limit the number of packets to send";
- tSCC zLimit_NAME[] = "LIMIT";
- tSCC zLimit_Name[] = "limit";
- #define zLimitDefaultArg ((char const*)-1)
- #define LIMIT_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Multiplier option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zMultiplierText[] =
- "Modify replay speed to a given multiple";
- tSCC zMultiplier_NAME[] = "MULTIPLIER";
- tSCC zMultiplier_Name[] = "multiplier";
- static const int
- aMultiplierCantList[] = {
- INDEX_OPT_PPS,
- INDEX_OPT_MBPS,
- INDEX_OPT_ONEATATIME,
- INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
- #define MULTIPLIER_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Pps option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zPpsText[] =
- "Replay packets at a given packets/sec";
- tSCC zPps_NAME[] = "PPS";
- tSCC zPps_Name[] = "pps";
- static const int
- aPpsCantList[] = {
- INDEX_OPT_MULTIPLIER,
- INDEX_OPT_MBPS,
- INDEX_OPT_ONEATATIME,
- INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
- #define PPS_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
- /*
- * Mbps option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zMbpsText[] =
- "Replay packets at a given Mbps";
- tSCC zMbps_NAME[] = "MBPS";
- tSCC zMbps_Name[] = "mbps";
- static const int
- aMbpsCantList[] = {
- INDEX_OPT_MULTIPLIER,
- INDEX_OPT_PPS,
- INDEX_OPT_ONEATATIME,
- INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
- #define MBPS_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
- /*
- * Topspeed option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zTopspeedText[] =
- "Replay packets as fast as possible";
- tSCC zTopspeed_NAME[] = "TOPSPEED";
- tSCC zTopspeed_Name[] = "topspeed";
- static const int
- aTopspeedCantList[] = {
- INDEX_OPT_MBPS,
- INDEX_OPT_MULTIPLIER,
- INDEX_OPT_PPS,
- INDEX_OPT_ONEATATIME, NO_EQUIVALENT };
- #define TOPSPEED_FLAGS (OPTST_DISABLED)
- /*
- * Oneatatime option description with
- * "Must also have options" and "Incompatible options":
- */
- tSCC zOneatatimeText[] =
- "Replay one packet at a time for each user input";
- tSCC zOneatatime_NAME[] = "ONEATATIME";
- tSCC zOneatatime_Name[] = "oneatatime";
- static const int
- aOneatatimeCantList[] = {
- INDEX_OPT_MBPS,
- INDEX_OPT_PPS,
- INDEX_OPT_MULTIPLIER,
- INDEX_OPT_TOPSPEED, NO_EQUIVALENT };
- #define ONEATATIME_FLAGS (OPTST_DISABLED)
- /*
- * Pid option description:
- */
- tSCC zPidText[] =
- "Print the PID of tcpreplay at startup";
- tSCC zPid_NAME[] = "PID";
- tSCC zPid_Name[] = "pid";
- #define PID_FLAGS (OPTST_DISABLED)
- /*
- * Version option description:
- */
- tSCC zVersionText[] =
- "Print version information";
- tSCC zVersion_NAME[] = "VERSION";
- tSCC zVersion_Name[] = "version";
- #define VERSION_FLAGS (OPTST_DISABLED)
- /*
- * Less_Help option description:
- */
- tSCC zLess_HelpText[] =
- "Display less usage information and exit";
- tSCC zLess_Help_NAME[] = "LESS_HELP";
- tSCC zLess_Help_Name[] = "less-help";
- #define LESS_HELP_FLAGS (OPTST_DISABLED | OPTST_IMM)
- /*
- * Help/More_Help option descriptions:
- */
- tSCC zHelpText[] = "Display usage information and exit";
- tSCC zHelp_Name[] = "help";
- tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
- tSCC zMore_Help_Name[] = "more-help";
- /*
- * Save/Load_Opts option description:
- */
- tSCC zSave_OptsText[] = "Save the option state to a config file";
- tSCC zSave_Opts_Name[] = "save-opts";
- tSCC zLoad_OptsText[] = "Load options from a config file";
- tSCC zLoad_Opts_NAME[] = "LOAD_OPTS";
- tSCC zNotLoad_Opts_Name[] = "no-load-opts";
- tSCC zNotLoad_Opts_Pfx[] = "no";
- #define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
- /*
- * Declare option callback procedures
- */
- #ifdef DEBUG
- static tOptProc doOptDbug;
- #else /* not DEBUG */
- # define doOptDbug NULL
- #endif /* def/not DEBUG */
- #ifdef ENABLE_PCAP_FINDALLDEVS
- static tOptProc doOptListnics;
- #else /* not ENABLE_PCAP_FINDALLDEVS */
- # define doOptListnics NULL
- #endif /* def/not ENABLE_PCAP_FINDALLDEVS */
- extern tOptProc
- optionNumericVal, optionPagedUsage, optionStackArg;
- static tOptProc
- doOptEnet_Vlan_Cfi, doOptEnet_Vlan_Pri, doOptEnet_Vlan_Tag,
- doOptLess_Help, doOptLimit, doOptLoop,
- doOptMtu, doOptPid, doOptVersion,
- doUsageOpt;
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Define the Tcpreplay Option Descriptions.
- */
- static tOptDesc optDesc[ OPTION_CT ] = {
- { /* entry idx, value */ 0, 0,
- /* equiv idx, value */ 0, 0,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 0, 0,
- /* opt state flags */ TCPEDIT_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zTcpeditText, NULL, NULL,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 1, VALUE_OPT_PORTMAP,
- /* equiv idx, value */ 1, VALUE_OPT_PORTMAP,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ PORTMAP_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zPortmapText, zPortmap_NAME, zPortmap_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 2, VALUE_OPT_SEED,
- /* equiv idx, value */ 2, VALUE_OPT_SEED,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SEED_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zSeedText, zSeed_NAME, zSeed_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 3, VALUE_OPT_PNAT,
- /* equiv idx, value */ 3, VALUE_OPT_PNAT,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 2, 0,
- /* opt state flags */ PNAT_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aPnatCantList,
- /* option proc */ optionStackArg,
- /* desc, NAME, name */ zPnatText, zPnat_NAME, zPnat_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 4, VALUE_OPT_SRCIPMAP,
- /* equiv idx, value */ 4, VALUE_OPT_SRCIPMAP,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SRCIPMAP_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aSrcipmapCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zSrcipmapText, zSrcipmap_NAME, zSrcipmap_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 5, VALUE_OPT_DSTIPMAP,
- /* equiv idx, value */ 5, VALUE_OPT_DSTIPMAP,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ DSTIPMAP_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aDstipmapCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zDstipmapText, zDstipmap_NAME, zDstipmap_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 6, VALUE_OPT_ENDPOINTS,
- /* equiv idx, value */ 6, VALUE_OPT_ENDPOINTS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENDPOINTS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aEndpointsMustList, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEndpointsText, zEndpoints_NAME, zEndpoints_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 7, VALUE_OPT_SKIPBROADCAST,
- /* equiv idx, value */ 7, VALUE_OPT_SKIPBROADCAST,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SKIPBROADCAST_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zSkipbroadcastText, zSkipbroadcast_NAME, zSkipbroadcast_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 8, VALUE_OPT_FIXCSUM,
- /* equiv idx, value */ 8, VALUE_OPT_FIXCSUM,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ FIXCSUM_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zFixcsumText, zFixcsum_NAME, zFixcsum_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 9, VALUE_OPT_MTU,
- /* equiv idx, value */ 9, VALUE_OPT_MTU,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ MTU_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptMtu,
- /* desc, NAME, name */ zMtuText, zMtu_NAME, zMtu_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 10, VALUE_OPT_EFCS,
- /* equiv idx, value */ 10, VALUE_OPT_EFCS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ EFCS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEfcsText, zEfcs_NAME, zEfcs_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 11, VALUE_OPT_TTL,
- /* equiv idx, value */ 11, VALUE_OPT_TTL,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ TTL_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zTtlText, zTtl_NAME, zTtl_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 12, VALUE_OPT_FIXLEN,
- /* equiv idx, value */ 12, VALUE_OPT_FIXLEN,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ FIXLEN_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zFixlenText, zFixlen_NAME, zFixlen_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 13, VALUE_OPT_SKIPL2BROADCAST,
- /* equiv idx, value */ 13, VALUE_OPT_SKIPL2BROADCAST,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SKIPL2BROADCAST_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zSkipl2broadcastText, zSkipl2broadcast_NAME, zSkipl2broadcast_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 14, VALUE_OPT_DLT,
- /* equiv idx, value */ 14, VALUE_OPT_DLT,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ DLT_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zDltText, zDlt_NAME, zDlt_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 15, VALUE_OPT_ENET_DMAC,
- /* equiv idx, value */ 15, VALUE_OPT_ENET_DMAC,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_DMAC_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEnet_DmacText, zEnet_Dmac_NAME, zEnet_Dmac_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 16, VALUE_OPT_ENET_SMAC,
- /* equiv idx, value */ 16, VALUE_OPT_ENET_SMAC,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_SMAC_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEnet_SmacText, zEnet_Smac_NAME, zEnet_Smac_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 17, VALUE_OPT_ENET_VLAN,
- /* equiv idx, value */ 17, VALUE_OPT_ENET_VLAN,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_VLAN_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEnet_VlanText, zEnet_Vlan_NAME, zEnet_Vlan_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 18, VALUE_OPT_ENET_VLAN_TAG,
- /* equiv idx, value */ 18, VALUE_OPT_ENET_VLAN_TAG,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_VLAN_TAG_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aEnet_Vlan_TagMustList, NULL,
- /* option proc */ doOptEnet_Vlan_Tag,
- /* desc, NAME, name */ zEnet_Vlan_TagText, zEnet_Vlan_Tag_NAME, zEnet_Vlan_Tag_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 19, VALUE_OPT_ENET_VLAN_CFI,
- /* equiv idx, value */ 19, VALUE_OPT_ENET_VLAN_CFI,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_VLAN_CFI_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aEnet_Vlan_CfiMustList, NULL,
- /* option proc */ doOptEnet_Vlan_Cfi,
- /* desc, NAME, name */ zEnet_Vlan_CfiText, zEnet_Vlan_Cfi_NAME, zEnet_Vlan_Cfi_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 20, VALUE_OPT_ENET_VLAN_PRI,
- /* equiv idx, value */ 20, VALUE_OPT_ENET_VLAN_PRI,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENET_VLAN_PRI_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aEnet_Vlan_PriMustList, NULL,
- /* option proc */ doOptEnet_Vlan_Pri,
- /* desc, NAME, name */ zEnet_Vlan_PriText, zEnet_Vlan_Pri_NAME, zEnet_Vlan_Pri_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 21, VALUE_OPT_HDLC_CONTROL,
- /* equiv idx, value */ 21, VALUE_OPT_HDLC_CONTROL,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ HDLC_CONTROL_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zHdlc_ControlText, zHdlc_Control_NAME, zHdlc_Control_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 22, VALUE_OPT_HDLC_ADDRESS,
- /* equiv idx, value */ 22, VALUE_OPT_HDLC_ADDRESS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ HDLC_ADDRESS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zHdlc_AddressText, zHdlc_Address_NAME, zHdlc_Address_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 23, VALUE_OPT_USER_DLT,
- /* equiv idx, value */ 23, VALUE_OPT_USER_DLT,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ USER_DLT_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zUser_DltText, zUser_Dlt_NAME, zUser_Dlt_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 24, VALUE_OPT_USER_DLINK,
- /* equiv idx, value */ 24, VALUE_OPT_USER_DLINK,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 2, 0,
- /* opt state flags */ USER_DLINK_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionStackArg,
- /* desc, NAME, name */ zUser_DlinkText, zUser_Dlink_NAME, zUser_Dlink_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 25, VALUE_OPT_DBUG,
- /* equiv idx, value */ 25, VALUE_OPT_DBUG,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ DBUG_FLAGS, 0,
- /* last opt argumnt */ { zDbugDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptDbug,
- /* desc, NAME, name */ zDbugText, zDbug_NAME, zDbug_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 26, VALUE_OPT_QUIET,
- /* equiv idx, value */ 26, VALUE_OPT_QUIET,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ QUIET_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zQuietText, zQuiet_NAME, zQuiet_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 27, VALUE_OPT_TIMER,
- /* equiv idx, value */ 27, VALUE_OPT_TIMER,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ TIMER_FLAGS, 0,
- /* last opt argumnt */ { zTimerDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zTimerText, zTimer_NAME, zTimer_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 28, VALUE_OPT_SLEEP_ACCEL,
- /* equiv idx, value */ 28, VALUE_OPT_SLEEP_ACCEL,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SLEEP_ACCEL_FLAGS, 0,
- /* last opt argumnt */ { zSleep_AccelDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zSleep_AccelText, zSleep_Accel_NAME, zSleep_Accel_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 29, VALUE_OPT_RDTSC_CLICKS,
- /* equiv idx, value */ 29, VALUE_OPT_RDTSC_CLICKS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ RDTSC_CLICKS_FLAGS, 0,
- /* last opt argumnt */ { zRdtsc_ClicksDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zRdtsc_ClicksText, zRdtsc_Clicks_NAME, zRdtsc_Clicks_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 30, VALUE_OPT_VERBOSE,
- /* equiv idx, value */ 30, VALUE_OPT_VERBOSE,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ VERBOSE_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 31, VALUE_OPT_DECODE,
- /* equiv idx, value */ 31, VALUE_OPT_DECODE,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ DECODE_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aDecodeMustList, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zDecodeText, zDecode_NAME, zDecode_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 32, VALUE_OPT_ENABLE_FILE_CACHE,
- /* equiv idx, value */ 32, VALUE_OPT_ENABLE_FILE_CACHE,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ENABLE_FILE_CACHE_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aEnable_File_CacheMustList, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zEnable_File_CacheText, zEnable_File_Cache_NAME, zEnable_File_Cache_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 33, VALUE_OPT_CACHEFILE,
- /* equiv idx, value */ 33, VALUE_OPT_CACHEFILE,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ CACHEFILE_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zCachefileText, zCachefile_NAME, zCachefile_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 34, VALUE_OPT_INTF1,
- /* equiv idx, value */ 34, VALUE_OPT_INTF1,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 1, 1, 0,
- /* opt state flags */ INTF1_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zIntf1Text, zIntf1_NAME, zIntf1_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 35, VALUE_OPT_INTF2,
- /* equiv idx, value */ 35, VALUE_OPT_INTF2,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ INTF2_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ aIntf2MustList, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zIntf2Text, zIntf2_NAME, zIntf2_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 36, VALUE_OPT_LISTNICS,
- /* equiv idx, value */ 36, VALUE_OPT_LISTNICS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ LISTNICS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptListnics,
- /* desc, NAME, name */ zListnicsText, zListnics_NAME, zListnics_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 37, VALUE_OPT_LOOP,
- /* equiv idx, value */ 37, VALUE_OPT_LOOP,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ LOOP_FLAGS, 0,
- /* last opt argumnt */ { zLoopDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptLoop,
- /* desc, NAME, name */ zLoopText, zLoop_NAME, zLoop_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 38, VALUE_OPT_PKTLEN,
- /* equiv idx, value */ 38, VALUE_OPT_PKTLEN,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ PKTLEN_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zPktlenText, zPktlen_NAME, zPktlen_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 39, VALUE_OPT_LIMIT,
- /* equiv idx, value */ 39, VALUE_OPT_LIMIT,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ LIMIT_FLAGS, 0,
- /* last opt argumnt */ { zLimitDefaultArg },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptLimit,
- /* desc, NAME, name */ zLimitText, zLimit_NAME, zLimit_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 40, VALUE_OPT_MULTIPLIER,
- /* equiv idx, value */ 40, VALUE_OPT_MULTIPLIER,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ MULTIPLIER_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aMultiplierCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zMultiplierText, zMultiplier_NAME, zMultiplier_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 41, VALUE_OPT_PPS,
- /* equiv idx, value */ 41, VALUE_OPT_PPS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ PPS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aPpsCantList,
- /* option proc */ optionNumericVal,
- /* desc, NAME, name */ zPpsText, zPps_NAME, zPps_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 42, VALUE_OPT_MBPS,
- /* equiv idx, value */ 42, VALUE_OPT_MBPS,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ MBPS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aMbpsCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zMbpsText, zMbps_NAME, zMbps_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 43, VALUE_OPT_TOPSPEED,
- /* equiv idx, value */ 43, VALUE_OPT_TOPSPEED,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ TOPSPEED_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aTopspeedCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zTopspeedText, zTopspeed_NAME, zTopspeed_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 44, VALUE_OPT_ONEATATIME,
- /* equiv idx, value */ 44, VALUE_OPT_ONEATATIME,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ ONEATATIME_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aOneatatimeCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zOneatatimeText, zOneatatime_NAME, zOneatatime_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 45, VALUE_OPT_PID,
- /* equiv idx, value */ 45, VALUE_OPT_PID,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ PID_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptPid,
- /* desc, NAME, name */ zPidText, zPid_NAME, zPid_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 46, VALUE_OPT_VERSION,
- /* equiv idx, value */ 46, VALUE_OPT_VERSION,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ VERSION_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptVersion,
- /* desc, NAME, name */ zVersionText, zVersion_NAME, zVersion_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 47, VALUE_OPT_LESS_HELP,
- /* equiv idx, value */ 47, VALUE_OPT_LESS_HELP,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ LESS_HELP_FLAGS, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doOptLess_Help,
- /* desc, NAME, name */ zLess_HelpText, zLess_Help_NAME, zLess_Help_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
- /* equiv idx value */ NO_EQUIVALENT, 0,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ doUsageOpt,
- /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
- /* equiv idx value */ NO_EQUIVALENT, 0,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionPagedUsage,
- /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
- /* equiv idx value */ NO_EQUIVALENT, 0,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
- | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ NULL,
- /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
- /* disablement strs */ NULL, NULL },
- { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
- /* equiv idx value */ NO_EQUIVALENT, 0,
- /* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, NOLIMIT, 0,
- /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
- | OPTST_DISABLE_IMM, 0,
- /* last opt argumnt */ { NULL },
- /* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ optionLoadOpt,
- /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
- /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
- };
- tOptDesc * const tcpedit_tcpedit_optDesc_p = optDesc + 0;
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Define the Tcpreplay Option Environment
- */
- tSCC zPROGNAME[] = "TCPREPLAY";
- tSCC zUsageTitle[] =
- "tcpreplay (tcpreplay) - Replay network traffic stored in pcap files\n\
- USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>\n";
- tSCC zRcName[] = ".tcpreplayrc";
- tSCC* apzHomeList[] = {
- "$$/",
- NULL };
- #define zBugsAddr NULL
- tSCC zExplain[] = "\n\
- tcpreplay is a tool for replaying network traffic from files saved with\n\
- tcpdump or other tools which write pcap(3) files.\n";
- tSCC zDetail[] = "\n\
- The basic operation of tcpreplay is to resend all packets from the\n\
- input file(s) at the speed at which they were recorded, or a specified \n\
- data rate, up to as fast as the hardware is capable.\n\n\
- Optionally, the traffic can be split between two interfaces, written to\n\
- files, filtered and edited in various ways, providing the means to test\n\
- firewalls, NIDS and other network devices.\n\n\
- For more details, please see the Tcpreplay Manual at:\n\
- http://tcpreplay.synfin.net/trac/wiki/manual\n";
- #define zFullVersion NULL
- /* extracted from /opt/local/share/autogen/optcode.tpl near line 428 */
- #if defined(ENABLE_NLS)
- # define OPTPROC_BASE OPTPROC_TRANSLATE
- static tOptionXlateProc translate_option_strings;
- #else
- # define OPTPROC_BASE OPTPROC_NONE
- # define translate_option_strings NULL
- #endif /* ENABLE_NLS */
- #define tcpreplay_full_usage NULL
- #define tcpreplay_short_usage NULL
- tOptions tcpreplayOptions = {
- OPTIONS_STRUCT_VERSION,
- 0, NULL, /* original argc + argv */
- ( OPTPROC_BASE
- + OPTPROC_ERRSTOP
- + OPTPROC_SHORTOPT
- + OPTPROC_LONGOPT
- + OPTPROC_NO_REQ_OPT
- + OPTPROC_ARGS_REQ
- + OPTPROC_GNUUSAGE
- + OPTPROC_HAS_IMMED ),
- 0, NULL, /* current option index, current option */
- NULL, NULL, zPROGNAME,
- zRcName, zCopyright, zCopyrightNotice,
- zFullVersion, apzHomeList, zUsageTitle,
- zExplain, zDetail, optDesc,
- zBugsAddr, /* address to send bugs to */
- NULL, NULL, /* extensions/saved state */
- optionUsage, /* usage procedure */
- translate_option_strings, /* translation procedure */
- /*
- * Indexes to special options
- */
- { INDEX_OPT_MORE_HELP,
- INDEX_OPT_SAVE_OPTS,
- NO_EQUIVALENT /* index of '-#' option */,
- 9 /* index of default opt */
- },
- 52 /* full option count */, 48 /* user option count */,
- tcpreplay_full_usage, tcpreplay_short_usage
- };
- /*
- * Create the static procedure(s) declared above.
- */
- static void
- doUsageOpt(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- USAGE( EXIT_SUCCESS );
- }
- /* * * * * * *
- *
- * For the mtu option.
- */
- static void
- doOptMtu(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 1, MAXPACKET } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the enet-vlan-tag option.
- */
- static void
- doOptEnet_Vlan_Tag(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 0, 4095 } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the enet-vlan-cfi option.
- */
- static void
- doOptEnet_Vlan_Cfi(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 0, 1 } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the enet-vlan-pri option.
- */
- static void
- doOptEnet_Vlan_Pri(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 0, 7 } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the dbug option, when DEBUG is #define-d.
- */
- #ifdef DEBUG
- static void
- doOptDbug(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 0, 5 } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- #endif /* defined DEBUG */
- /* * * * * * *
- *
- * For the listnics option, when ENABLE_PCAP_FINDALLDEVS is #define-d.
- */
- #ifdef ENABLE_PCAP_FINDALLDEVS
- static void
- doOptListnics(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- /* extracted from tcpreplay_opts.def, line 256 */
- interface_list_t *list = get_interface_list();
- list_interfaces(list);
- free(list);
- exit(0);
- }
- #endif /* defined ENABLE_PCAP_FINDALLDEVS */
- /* * * * * * *
- *
- * For the loop option.
- */
- static void
- doOptLoop(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 0, INT_MAX } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the limit option.
- */
- static void
- doOptLimit(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- static const struct {const int rmin, rmax;} rng[ 1 ] = {
- { 1, INT_MAX } };
- int val;
- int ix;
- char const* pzIndent = "\t\t\t\t ";
- extern FILE* option_usage_fp;
- if (pOptDesc == NULL) /* usage is requesting range list
- option_usage_fp has already been set */
- goto emit_ranges;
- val = atoi( pOptDesc->optArg.argString );
- for (ix = 0; ix < 1; ix++) {
- if (val < rng[ix].rmin)
- continue; /* ranges need not be ordered. */
- if (val == rng[ix].rmin)
- goto valid_return;
- if (rng[ix].rmax == INT_MIN)
- continue;
- if (val <= rng[ix].rmax)
- goto valid_return;
- }
- option_usage_fp = stderr;
- fprintf(stderr, _("%s error: %s option value ``%s''is out of range.\n"),
- pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
- pzIndent = "\t";
- emit_ranges:
- fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
- pzIndent, rng[0].rmin, rng[0].rmax );
- if (pOptDesc == NULL)
- return;
- USAGE( EXIT_FAILURE );
- /* NOTREACHED */
- return;
- valid_return:
- pOptDesc->optArg.argInt = val;
- }
- /* * * * * * *
- *
- * For the pid option.
- */
- static void
- doOptPid(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- /* extracted from tcpreplay_opts.def, line 391 */
-
- fprintf(stderr, "PID: %hu\n", getpid());
-
- }
- /* * * * * * *
- *
- * For the version option.
- */
- static void
- doOptVersion(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- /* extracted from tcpreplay_opts.def, line 403 */
-
- fprintf(stderr, "tcpreplay version: %s (build %s)", VERSION, svn_version());
- #ifdef DEBUG
- fprintf(stderr, " (debug)");
- #endif
- fprintf(stderr, "\n");
- fprintf(stderr, "Copyright 2001-2008 by Aaron Turner <aturner at synfin dot net>\n");
- fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
- #ifdef HAVE_LIBNET
- fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
- #else
- fprintf(stderr, "Not compiled with libnet.\n");
- #endif
- #ifdef HAVE_WINPCAP
- fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
- #else
- fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
- #endif
- #ifdef ENABLE_64BITS
- fprintf(stderr, "64 bit packet counters: enabled\n");
- #else
- fprintf(stderr, "64 bit packet counters: disabled\n");
- #endif
- #ifdef ENABLE_VERBOSE
- fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
- #else
- fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
- #endif
- #ifdef TCPREPLAY_EDIT
- fprintf(stderr, "Packet editing: enabled\n");
- #else
- fprintf(stderr, "Packet editing: disabled\n");
- #endif
- #ifdef ENABLE_FRAGROUTE
- fprintf(stderr, "Fragroute engine: enabled\n");
- #else
- fprintf(stderr, "Fragroute engine: disabled\n");
- #endif
- exit(0);
-
- }
- /* * * * * * *
- *
- * For the less-help option.
- */
- static void
- doOptLess_Help(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
- {
- /* extracted from tcpreplay_opts.def, line 453 */
-
- USAGE(EXIT_FAILURE);
- }
- /* extracted from /opt/local/share/autogen/optcode.tpl near line 537 */
- #if ENABLE_NLS
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <autoopts/usage-txt.h>
- static char* AO_gettext( char const* pz );
- static void coerce_it(void** s);
- static char*
- AO_gettext( char const* pz )
- {
- char* pzRes;
- if (pz == NULL)
- return NULL;
- pzRes = _(pz);
- if (pzRes == pz)
- return pzRes;
- pzRes = strdup( pzRes );
- if (pzRes == NULL) {
- fputs( _("No memory for duping translated strings\n"), stderr );
- exit( EXIT_FAILURE );
- }
- return pzRes;
- }
- static void coerce_it(void** s) { *s = AO_gettext(*s); }
- #define COERSION(_f) \
- coerce_it((void*)&(tcpreplayOptions._f))
- /*
- * This invokes the translation code (e.g. gettext(3)).
- */
- static void
- translate_option_strings( void )
- {
- /*
- * Guard against re-translation. It won't work. The strings will have
- * been changed by the first pass through this code. One shot only.
- */
- if (option_usage_text.field_ct == 0)
- return;
- /*
- * Do the translations. The first pointer follows the field count field.
- * The field count field is the size of a pointer.
- */
- {
- char** ppz = (char**)(void*)&(option_usage_text);
- int ix = option_usage_text.field_ct;
- do {
- ppz++;
- *ppz = AO_gettext(*ppz);
- } while (--ix > 0);
- }
- option_usage_text.field_ct = 0;
- {
- tOptDesc* pOD = tcpreplayOptions.pOptDesc;
- int ix = tcpreplayOptions.optCt;
- for (;;) {
- pOD->pzText = AO_gettext(pOD->pzText);
- pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
- pOD->pz_Name = AO_gettext(pOD->pz_Name);
- pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
- pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
- if (--ix <= 0)
- break;
- pOD++;
- }
- }
- COERSION(pzCopyright);
- COERSION(pzCopyNotice);
- COERSION(pzFullVersion);
- COERSION(pzUsageTitle);
- COERSION(pzExplain);
- COERSION(pzDetail);
- }
- #endif /* ENABLE_NLS */
- #ifdef __cplusplus
- }
- #endif
- /* tcpreplay_edit_opts.c ends here */
|