tcpprep_opts.c 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpprep_opts.c)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions tcpprep_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 41:1:16 templates.
  10. *
  11. * AutoOpts is a copyrighted work. This source file is not encumbered
  12. * by AutoOpts licensing, but is provided under the licensing terms chosen
  13. * by the tcpprep author or copyright holder. AutoOpts is
  14. * licensed under the terms of the LGPL. The redistributable library
  15. * (``libopts'') is licensed under the terms of either the LGPL or, at the
  16. * users discretion, the BSD license. See the AutoOpts and/or libopts sources
  17. * for details.
  18. *
  19. * The tcpprep program is copyrighted and licensed
  20. * under the following terms:
  21. *
  22. * Copyright (C) 2000-2018 Aaron Turner and Fred Klassen, all rights reserved.
  23. * This is free software. It is licensed for use, modification and
  24. * redistribution under the terms of the GNU General Public License,
  25. * version 3 or later <http://gnu.org/licenses/gpl.html>
  26. *
  27. * tcpprep is free software: you can redistribute it and/or modify it
  28. * under the terms of the GNU General Public License as published by the
  29. * Free Software Foundation, either version 3 of the License, or
  30. * (at your option) any later version.
  31. *
  32. * tcpprep is distributed in the hope that it will be useful, but
  33. * WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  35. * See the GNU General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU General Public License along
  38. * with this program. If not, see <http://www.gnu.org/licenses/>.
  39. */
  40. #ifndef __doxygen__
  41. #define OPTION_CODE_COMPILE 1
  42. #include "tcpprep_opts.h"
  43. #include <sys/types.h>
  44. #include <limits.h>
  45. #include <stdio.h>
  46. #include <stdlib.h>
  47. #include <errno.h>
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. extern FILE * option_usage_fp;
  52. #define zCopyright (tcpprep_opt_strs+0)
  53. #define zLicenseDescrip (tcpprep_opt_strs+279)
  54. /*
  55. * global included definitions
  56. */
  57. #include "defines.h"
  58. #include "common.h"
  59. #include "config.h"
  60. #include "tcpprep.h"
  61. #include <stdlib.h>
  62. #include <string.h>
  63. #include "tcpprep_api.h"
  64. extern tcpprep_t *tcpprep;
  65. #ifndef NULL
  66. # define NULL 0
  67. #endif
  68. /**
  69. * static const strings for tcpprep options
  70. */
  71. static char const tcpprep_opt_strs[3078] =
  72. /* 0 */ "tcpprep (tcpprep)\n"
  73. "Copyright (C) 2000-2018 Aaron Turner and Fred Klassen, all rights reserved.\n"
  74. "This is free software. It is licensed for use, modification and\n"
  75. "redistribution under the terms of the GNU General Public License,\n"
  76. "version 3 or later <http://gnu.org/licenses/gpl.html>\n\0"
  77. /* 279 */ "tcpprep is free software: you can redistribute it and/or modify it under\n"
  78. "the terms of the GNU General Public License as published by the Free\n"
  79. "Software Foundation, either version 3 of the License, or (at your option)\n"
  80. "any later version.\n\n"
  81. "tcpprep is distributed in the hope that it will be useful, but WITHOUT ANY\n"
  82. "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
  83. "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n"
  84. "details.\n\n"
  85. "You should have received a copy of the GNU General Public License along\n"
  86. "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
  87. /* 882 */ "Enable debugging output\0"
  88. /* 906 */ "DBUG\0"
  89. /* 911 */ "dbug\0"
  90. /* 916 */ "Auto-split mode\0"
  91. /* 932 */ "AUTO\0"
  92. /* 937 */ "auto\0"
  93. /* 942 */ "CIDR-split mode\0"
  94. /* 958 */ "CIDR\0"
  95. /* 963 */ "cidr\0"
  96. /* 968 */ "Regex-split mode\0"
  97. /* 985 */ "REGEX\0"
  98. /* 991 */ "regex\0"
  99. /* 997 */ "Port-split mode\0"
  100. /* 1013 */ "PORT\0"
  101. /* 1018 */ "port\0"
  102. /* 1023 */ "Source MAC split mode\0"
  103. /* 1045 */ "MAC\0"
  104. /* 1049 */ "mac\0"
  105. /* 1053 */ "Matches to be client instead of server\0"
  106. /* 1092 */ "REVERSE\0"
  107. /* 1100 */ "reverse\0"
  108. /* 1108 */ "Embedded cache file comment\0"
  109. /* 1136 */ "COMMENT\0"
  110. /* 1144 */ "comment\0"
  111. /* 1152 */ "Do not embed any cache file comment\0"
  112. /* 1188 */ "NO_ARG_COMMENT\0"
  113. /* 1203 */ "no-arg-comment\0"
  114. /* 1218 */ "Include only packets matching rule\0"
  115. /* 1253 */ "INCLUDE\0"
  116. /* 1261 */ "include\0"
  117. /* 1269 */ "Exclude any packet matching this rule\0"
  118. /* 1307 */ "EXCLUDE\0"
  119. /* 1315 */ "exclude\0"
  120. /* 1323 */ "Output cache file\0"
  121. /* 1341 */ "CACHEFILE\0"
  122. /* 1351 */ "cachefile\0"
  123. /* 1361 */ "Input pcap file to process\0"
  124. /* 1388 */ "PCAP\0"
  125. /* 1393 */ "pcap\0"
  126. /* 1398 */ "Print embedded comment in the specified cache file\0"
  127. /* 1449 */ "PRINT_COMMENT\0"
  128. /* 1463 */ "print-comment\0"
  129. /* 1477 */ "Print basic info from the specified cache file\0"
  130. /* 1524 */ "PRINT_INFO\0"
  131. /* 1535 */ "print-info\0"
  132. /* 1546 */ "Print statistical information about the specified cache file\0"
  133. /* 1607 */ "PRINT_STATS\0"
  134. /* 1619 */ "print-stats\0"
  135. /* 1631 */ "Load services file for server ports\0"
  136. /* 1667 */ "SERVICES\0"
  137. /* 1676 */ "services\0"
  138. /* 1685 */ "Send non-IP traffic out server interface\0"
  139. /* 1726 */ "NONIP\0"
  140. /* 1732 */ "nonip\0"
  141. /* 1738 */ "Ratio of client to server packets\0"
  142. /* 1772 */ "RATIO\0"
  143. /* 1778 */ "ratio\0"
  144. /* 1784 */ "2.0\0"
  145. /* 1788 */ "Minimum network mask length in auto mode\0"
  146. /* 1829 */ "MINMASK\0"
  147. /* 1837 */ "minmask\0"
  148. /* 1845 */ "Maximum network mask length in auto mode\0"
  149. /* 1886 */ "MAXMASK\0"
  150. /* 1894 */ "maxmask\0"
  151. /* 1902 */ "Print decoded packets via tcpdump to STDOUT\0"
  152. /* 1946 */ "VERBOSE\0"
  153. /* 1954 */ "verbose\0"
  154. /* 1962 */ "Arguments passed to tcpdump decoder\0"
  155. /* 1998 */ "DECODE\0"
  156. /* 2005 */ "decode\0"
  157. /* 2012 */ "Print version information\0"
  158. /* 2038 */ "VERSION\0"
  159. /* 2046 */ "version\0"
  160. /* 2054 */ "Display less usage information and exit\0"
  161. /* 2094 */ "LESS_HELP\0"
  162. /* 2104 */ "less-help\0"
  163. /* 2114 */ "display extended usage information and exit\0"
  164. /* 2158 */ "help\0"
  165. /* 2163 */ "extended usage information passed thru pager\0"
  166. /* 2208 */ "more-help\0"
  167. /* 2218 */ "save the option state to a config file\0"
  168. /* 2257 */ "save-opts\0"
  169. /* 2267 */ "load options from a config file\0"
  170. /* 2299 */ "LOAD_OPTS\0"
  171. /* 2309 */ "no-load-opts\0"
  172. /* 2322 */ "no\0"
  173. /* 2325 */ "TCPPREP\0"
  174. /* 2333 */ "tcpprep (tcpprep) - Create a tcpreplay cache cache file from a pcap file.\n"
  175. "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
  176. /* 2465 */ "$$/\0"
  177. /* 2469 */ ".tcppreprc\0"
  178. /* 2480 */ "tcpreplay-users@lists.sourceforge.net\0"
  179. /* 2518 */ "tcpprep is a 'pcap(3)' file pre-processor which creates a cache file which\n"
  180. "provides \"rules\" for 'tcprewrite(1)' and 'tcpreplay(1)' on how to process\n"
  181. "and send packets.\n\0"
  182. /* 2686 */ "The basic operation of tcpreplay is to resend all packets from the input\n"
  183. "file(s) out a single file. Tcpprep processes a pcap file and applies a set\n"
  184. "of user-specified rules to create a cache file which tells tcpreplay\n"
  185. "whether or not to send each packet and which interface the packet should be\n"
  186. "sent out of.\n\n"
  187. "For more details, please see the Tcpreplay Manual at:\n"
  188. "http://tcpreplay.appneta.com\n";
  189. /**
  190. * dbug option description:
  191. */
  192. #ifdef DEBUG
  193. /** Descriptive text for the dbug option */
  194. #define DBUG_DESC (tcpprep_opt_strs+882)
  195. /** Upper-cased name for the dbug option */
  196. #define DBUG_NAME (tcpprep_opt_strs+906)
  197. /** Name string for the dbug option */
  198. #define DBUG_name (tcpprep_opt_strs+911)
  199. /** The compiled in default value for the dbug option argument */
  200. #define DBUG_DFT_ARG ((char const*)0)
  201. /** Compiled in flag settings for the dbug option */
  202. #define DBUG_FLAGS (OPTST_DISABLED | OPTST_IMM \
  203. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  204. #else /* disable dbug */
  205. #define DBUG_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  206. #define DBUG_DFT_ARG NULL
  207. #define DBUG_NAME NULL
  208. #define DBUG_DESC NULL
  209. #define DBUG_name NULL
  210. #endif /* DEBUG */
  211. /**
  212. * auto option description with
  213. * "Must also have options" and "Incompatible options":
  214. */
  215. /** Descriptive text for the auto option */
  216. #define AUTO_DESC (tcpprep_opt_strs+916)
  217. /** Upper-cased name for the auto option */
  218. #define AUTO_NAME (tcpprep_opt_strs+932)
  219. /** Name string for the auto option */
  220. #define AUTO_name (tcpprep_opt_strs+937)
  221. /** Other options that appear in conjunction with the auto option */
  222. static int const aAutoCantList[] = {
  223. INDEX_OPT_CIDR,
  224. INDEX_OPT_PORT,
  225. INDEX_OPT_REGEX,
  226. INDEX_OPT_MAC, NO_EQUIVALENT };
  227. /** Compiled in flag settings for the auto option */
  228. #define AUTO_FLAGS (OPTST_DISABLED \
  229. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  230. /**
  231. * cidr option description with
  232. * "Must also have options" and "Incompatible options":
  233. */
  234. /** Descriptive text for the cidr option */
  235. #define CIDR_DESC (tcpprep_opt_strs+942)
  236. /** Upper-cased name for the cidr option */
  237. #define CIDR_NAME (tcpprep_opt_strs+958)
  238. /** Name string for the cidr option */
  239. #define CIDR_name (tcpprep_opt_strs+963)
  240. /** Other options that appear in conjunction with the cidr option */
  241. static int const aCidrCantList[] = {
  242. INDEX_OPT_AUTO,
  243. INDEX_OPT_PORT,
  244. INDEX_OPT_REGEX,
  245. INDEX_OPT_MAC, NO_EQUIVALENT };
  246. /** Compiled in flag settings for the cidr option */
  247. #define CIDR_FLAGS (OPTST_DISABLED \
  248. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  249. /**
  250. * regex option description with
  251. * "Must also have options" and "Incompatible options":
  252. */
  253. /** Descriptive text for the regex option */
  254. #define REGEX_DESC (tcpprep_opt_strs+968)
  255. /** Upper-cased name for the regex option */
  256. #define REGEX_NAME (tcpprep_opt_strs+985)
  257. /** Name string for the regex option */
  258. #define REGEX_name (tcpprep_opt_strs+991)
  259. /** Other options that appear in conjunction with the regex option */
  260. static int const aRegexCantList[] = {
  261. INDEX_OPT_AUTO,
  262. INDEX_OPT_PORT,
  263. INDEX_OPT_CIDR,
  264. INDEX_OPT_MAC, NO_EQUIVALENT };
  265. /** Compiled in flag settings for the regex option */
  266. #define REGEX_FLAGS (OPTST_DISABLED \
  267. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  268. /**
  269. * port option description with
  270. * "Must also have options" and "Incompatible options":
  271. */
  272. /** Descriptive text for the port option */
  273. #define PORT_DESC (tcpprep_opt_strs+997)
  274. /** Upper-cased name for the port option */
  275. #define PORT_NAME (tcpprep_opt_strs+1013)
  276. /** Name string for the port option */
  277. #define PORT_name (tcpprep_opt_strs+1018)
  278. /** Other options that appear in conjunction with the port option */
  279. static int const aPortCantList[] = {
  280. INDEX_OPT_AUTO,
  281. INDEX_OPT_REGEX,
  282. INDEX_OPT_CIDR,
  283. INDEX_OPT_MAC, NO_EQUIVALENT };
  284. /** Compiled in flag settings for the port option */
  285. #define PORT_FLAGS (OPTST_DISABLED)
  286. /**
  287. * mac option description with
  288. * "Must also have options" and "Incompatible options":
  289. */
  290. /** Descriptive text for the mac option */
  291. #define MAC_DESC (tcpprep_opt_strs+1023)
  292. /** Upper-cased name for the mac option */
  293. #define MAC_NAME (tcpprep_opt_strs+1045)
  294. /** Name string for the mac option */
  295. #define MAC_name (tcpprep_opt_strs+1049)
  296. /** Other options that appear in conjunction with the mac option */
  297. static int const aMacCantList[] = {
  298. INDEX_OPT_AUTO,
  299. INDEX_OPT_REGEX,
  300. INDEX_OPT_CIDR,
  301. INDEX_OPT_PORT, NO_EQUIVALENT };
  302. /** Compiled in flag settings for the mac option */
  303. #define MAC_FLAGS (OPTST_DISABLED \
  304. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  305. /**
  306. * reverse option description:
  307. */
  308. /** Descriptive text for the reverse option */
  309. #define REVERSE_DESC (tcpprep_opt_strs+1053)
  310. /** Upper-cased name for the reverse option */
  311. #define REVERSE_NAME (tcpprep_opt_strs+1092)
  312. /** Name string for the reverse option */
  313. #define REVERSE_name (tcpprep_opt_strs+1100)
  314. /** Compiled in flag settings for the reverse option */
  315. #define REVERSE_FLAGS (OPTST_DISABLED)
  316. /**
  317. * comment option description:
  318. */
  319. /** Descriptive text for the comment option */
  320. #define COMMENT_DESC (tcpprep_opt_strs+1108)
  321. /** Upper-cased name for the comment option */
  322. #define COMMENT_NAME (tcpprep_opt_strs+1136)
  323. /** Name string for the comment option */
  324. #define COMMENT_name (tcpprep_opt_strs+1144)
  325. /** Compiled in flag settings for the comment option */
  326. #define COMMENT_FLAGS (OPTST_DISABLED \
  327. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  328. /**
  329. * no-arg-comment option description:
  330. */
  331. /** Descriptive text for the no-arg-comment option */
  332. #define NO_ARG_COMMENT_DESC (tcpprep_opt_strs+1152)
  333. /** Upper-cased name for the no-arg-comment option */
  334. #define NO_ARG_COMMENT_NAME (tcpprep_opt_strs+1188)
  335. /** Name string for the no-arg-comment option */
  336. #define NO_ARG_COMMENT_name (tcpprep_opt_strs+1203)
  337. /** Compiled in flag settings for the no-arg-comment option */
  338. #define NO_ARG_COMMENT_FLAGS (OPTST_DISABLED)
  339. /**
  340. * include option description with
  341. * "Must also have options" and "Incompatible options":
  342. */
  343. /** Descriptive text for the include option */
  344. #define INCLUDE_DESC (tcpprep_opt_strs+1218)
  345. /** Upper-cased name for the include option */
  346. #define INCLUDE_NAME (tcpprep_opt_strs+1253)
  347. /** Name string for the include option */
  348. #define INCLUDE_name (tcpprep_opt_strs+1261)
  349. /** Other options that appear in conjunction with the include option */
  350. static int const aIncludeCantList[] = {
  351. INDEX_OPT_EXCLUDE, NO_EQUIVALENT };
  352. /** Compiled in flag settings for the include option */
  353. #define INCLUDE_FLAGS (OPTST_DISABLED \
  354. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  355. /**
  356. * exclude option description with
  357. * "Must also have options" and "Incompatible options":
  358. */
  359. /** Descriptive text for the exclude option */
  360. #define EXCLUDE_DESC (tcpprep_opt_strs+1269)
  361. /** Upper-cased name for the exclude option */
  362. #define EXCLUDE_NAME (tcpprep_opt_strs+1307)
  363. /** Name string for the exclude option */
  364. #define EXCLUDE_name (tcpprep_opt_strs+1315)
  365. /** Other options that appear in conjunction with the exclude option */
  366. static int const aExcludeCantList[] = {
  367. INDEX_OPT_INCLUDE, NO_EQUIVALENT };
  368. /** Compiled in flag settings for the exclude option */
  369. #define EXCLUDE_FLAGS (OPTST_DISABLED \
  370. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  371. /**
  372. * cachefile option description:
  373. */
  374. /** Descriptive text for the cachefile option */
  375. #define CACHEFILE_DESC (tcpprep_opt_strs+1323)
  376. /** Upper-cased name for the cachefile option */
  377. #define CACHEFILE_NAME (tcpprep_opt_strs+1341)
  378. /** Name string for the cachefile option */
  379. #define CACHEFILE_name (tcpprep_opt_strs+1351)
  380. /** Compiled in flag settings for the cachefile option */
  381. #define CACHEFILE_FLAGS (OPTST_DISABLED \
  382. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  383. /**
  384. * pcap option description:
  385. */
  386. /** Descriptive text for the pcap option */
  387. #define PCAP_DESC (tcpprep_opt_strs+1361)
  388. /** Upper-cased name for the pcap option */
  389. #define PCAP_NAME (tcpprep_opt_strs+1388)
  390. /** Name string for the pcap option */
  391. #define PCAP_name (tcpprep_opt_strs+1393)
  392. /** Compiled in flag settings for the pcap option */
  393. #define PCAP_FLAGS (OPTST_DISABLED \
  394. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  395. /**
  396. * print-comment option description:
  397. */
  398. /** Descriptive text for the print-comment option */
  399. #define PRINT_COMMENT_DESC (tcpprep_opt_strs+1398)
  400. /** Upper-cased name for the print-comment option */
  401. #define PRINT_COMMENT_NAME (tcpprep_opt_strs+1449)
  402. /** Name string for the print-comment option */
  403. #define PRINT_COMMENT_name (tcpprep_opt_strs+1463)
  404. /** Compiled in flag settings for the print-comment option */
  405. #define PRINT_COMMENT_FLAGS (OPTST_DISABLED \
  406. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  407. /**
  408. * print-info option description:
  409. */
  410. /** Descriptive text for the print-info option */
  411. #define PRINT_INFO_DESC (tcpprep_opt_strs+1477)
  412. /** Upper-cased name for the print-info option */
  413. #define PRINT_INFO_NAME (tcpprep_opt_strs+1524)
  414. /** Name string for the print-info option */
  415. #define PRINT_INFO_name (tcpprep_opt_strs+1535)
  416. /** Compiled in flag settings for the print-info option */
  417. #define PRINT_INFO_FLAGS (OPTST_DISABLED \
  418. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  419. /**
  420. * print-stats option description:
  421. */
  422. /** Descriptive text for the print-stats option */
  423. #define PRINT_STATS_DESC (tcpprep_opt_strs+1546)
  424. /** Upper-cased name for the print-stats option */
  425. #define PRINT_STATS_NAME (tcpprep_opt_strs+1607)
  426. /** Name string for the print-stats option */
  427. #define PRINT_STATS_name (tcpprep_opt_strs+1619)
  428. /** Compiled in flag settings for the print-stats option */
  429. #define PRINT_STATS_FLAGS (OPTST_DISABLED \
  430. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  431. /**
  432. * services option description with
  433. * "Must also have options" and "Incompatible options":
  434. */
  435. /** Descriptive text for the services option */
  436. #define SERVICES_DESC (tcpprep_opt_strs+1631)
  437. /** Upper-cased name for the services option */
  438. #define SERVICES_NAME (tcpprep_opt_strs+1667)
  439. /** Name string for the services option */
  440. #define SERVICES_name (tcpprep_opt_strs+1676)
  441. /** Other options that are required by the services option */
  442. static int const aServicesMustList[] = {
  443. INDEX_OPT_PORT, NO_EQUIVALENT };
  444. /** Compiled in flag settings for the services option */
  445. #define SERVICES_FLAGS (OPTST_DISABLED \
  446. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  447. /**
  448. * nonip option description:
  449. */
  450. /** Descriptive text for the nonip option */
  451. #define NONIP_DESC (tcpprep_opt_strs+1685)
  452. /** Upper-cased name for the nonip option */
  453. #define NONIP_NAME (tcpprep_opt_strs+1726)
  454. /** Name string for the nonip option */
  455. #define NONIP_name (tcpprep_opt_strs+1732)
  456. /** Compiled in flag settings for the nonip option */
  457. #define NONIP_FLAGS (OPTST_DISABLED)
  458. /**
  459. * ratio option description with
  460. * "Must also have options" and "Incompatible options":
  461. */
  462. /** Descriptive text for the ratio option */
  463. #define RATIO_DESC (tcpprep_opt_strs+1738)
  464. /** Upper-cased name for the ratio option */
  465. #define RATIO_NAME (tcpprep_opt_strs+1772)
  466. /** Name string for the ratio option */
  467. #define RATIO_name (tcpprep_opt_strs+1778)
  468. /** The compiled in default value for the ratio option argument */
  469. #define RATIO_DFT_ARG (tcpprep_opt_strs+1784)
  470. /** Other options that are required by the ratio option */
  471. static int const aRatioMustList[] = {
  472. INDEX_OPT_AUTO, NO_EQUIVALENT };
  473. /** Compiled in flag settings for the ratio option */
  474. #define RATIO_FLAGS (OPTST_DISABLED \
  475. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  476. /**
  477. * minmask option description with
  478. * "Must also have options" and "Incompatible options":
  479. */
  480. /** Descriptive text for the minmask option */
  481. #define MINMASK_DESC (tcpprep_opt_strs+1788)
  482. /** Upper-cased name for the minmask option */
  483. #define MINMASK_NAME (tcpprep_opt_strs+1829)
  484. /** Name string for the minmask option */
  485. #define MINMASK_name (tcpprep_opt_strs+1837)
  486. /** The compiled in default value for the minmask option argument */
  487. #define MINMASK_DFT_ARG ((char const*)30)
  488. /** Other options that are required by the minmask option */
  489. static int const aMinmaskMustList[] = {
  490. INDEX_OPT_AUTO, NO_EQUIVALENT };
  491. /** Compiled in flag settings for the minmask option */
  492. #define MINMASK_FLAGS (OPTST_DISABLED \
  493. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  494. /**
  495. * maxmask option description with
  496. * "Must also have options" and "Incompatible options":
  497. */
  498. /** Descriptive text for the maxmask option */
  499. #define MAXMASK_DESC (tcpprep_opt_strs+1845)
  500. /** Upper-cased name for the maxmask option */
  501. #define MAXMASK_NAME (tcpprep_opt_strs+1886)
  502. /** Name string for the maxmask option */
  503. #define MAXMASK_name (tcpprep_opt_strs+1894)
  504. /** The compiled in default value for the maxmask option argument */
  505. #define MAXMASK_DFT_ARG ((char const*)8)
  506. /** Other options that are required by the maxmask option */
  507. static int const aMaxmaskMustList[] = {
  508. INDEX_OPT_AUTO, NO_EQUIVALENT };
  509. /** Compiled in flag settings for the maxmask option */
  510. #define MAXMASK_FLAGS (OPTST_DISABLED \
  511. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  512. /**
  513. * verbose option description:
  514. */
  515. #ifdef ENABLE_VERBOSE
  516. /** Descriptive text for the verbose option */
  517. #define VERBOSE_DESC (tcpprep_opt_strs+1902)
  518. /** Upper-cased name for the verbose option */
  519. #define VERBOSE_NAME (tcpprep_opt_strs+1946)
  520. /** Name string for the verbose option */
  521. #define VERBOSE_name (tcpprep_opt_strs+1954)
  522. /** Compiled in flag settings for the verbose option */
  523. #define VERBOSE_FLAGS (OPTST_DISABLED | OPTST_IMM)
  524. #else /* disable verbose */
  525. #define VERBOSE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  526. #define VERBOSE_NAME NULL
  527. #define VERBOSE_DESC NULL
  528. #define VERBOSE_name NULL
  529. #endif /* ENABLE_VERBOSE */
  530. /**
  531. * decode option description with
  532. * "Must also have options" and "Incompatible options":
  533. */
  534. #ifdef ENABLE_VERBOSE
  535. /** Descriptive text for the decode option */
  536. #define DECODE_DESC (tcpprep_opt_strs+1962)
  537. /** Upper-cased name for the decode option */
  538. #define DECODE_NAME (tcpprep_opt_strs+1998)
  539. /** Name string for the decode option */
  540. #define DECODE_name (tcpprep_opt_strs+2005)
  541. /** Other options that are required by the decode option */
  542. static int const aDecodeMustList[] = {
  543. INDEX_OPT_VERBOSE, NO_EQUIVALENT };
  544. /** Compiled in flag settings for the decode option */
  545. #define DECODE_FLAGS (OPTST_DISABLED \
  546. | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
  547. #else /* disable decode */
  548. #define DECODE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  549. #define aDecodeMustList NULL
  550. #define DECODE_NAME NULL
  551. #define DECODE_DESC NULL
  552. #define DECODE_name NULL
  553. #endif /* ENABLE_VERBOSE */
  554. /**
  555. * version option description:
  556. */
  557. /** Descriptive text for the version option */
  558. #define VERSION_DESC (tcpprep_opt_strs+2012)
  559. /** Upper-cased name for the version option */
  560. #define VERSION_NAME (tcpprep_opt_strs+2038)
  561. /** Name string for the version option */
  562. #define VERSION_name (tcpprep_opt_strs+2046)
  563. /** Compiled in flag settings for the version option */
  564. #define VERSION_FLAGS (OPTST_DISABLED)
  565. /**
  566. * less-help option description:
  567. */
  568. /** Descriptive text for the less-help option */
  569. #define LESS_HELP_DESC (tcpprep_opt_strs+2054)
  570. /** Upper-cased name for the less-help option */
  571. #define LESS_HELP_NAME (tcpprep_opt_strs+2094)
  572. /** Name string for the less-help option */
  573. #define LESS_HELP_name (tcpprep_opt_strs+2104)
  574. /** Compiled in flag settings for the less-help option */
  575. #define LESS_HELP_FLAGS (OPTST_DISABLED | OPTST_IMM)
  576. /*
  577. * Help/More_Help option descriptions:
  578. */
  579. #define HELP_DESC (tcpprep_opt_strs+2114)
  580. #define HELP_name (tcpprep_opt_strs+2158)
  581. #ifdef HAVE_WORKING_FORK
  582. #define MORE_HELP_DESC (tcpprep_opt_strs+2163)
  583. #define MORE_HELP_name (tcpprep_opt_strs+2208)
  584. #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
  585. #else
  586. #define MORE_HELP_DESC HELP_DESC
  587. #define MORE_HELP_name HELP_name
  588. #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  589. #endif
  590. #define SAVE_OPTS_DESC (tcpprep_opt_strs+2218)
  591. #define SAVE_OPTS_name (tcpprep_opt_strs+2257)
  592. #define LOAD_OPTS_DESC (tcpprep_opt_strs+2267)
  593. #define LOAD_OPTS_NAME (tcpprep_opt_strs+2299)
  594. #define NO_LOAD_OPTS_name (tcpprep_opt_strs+2309)
  595. #define LOAD_OPTS_pfx (tcpprep_opt_strs+2322)
  596. #define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
  597. /**
  598. * Declare option callback procedures
  599. */
  600. #ifdef DEBUG
  601. static tOptProc doOptDbug;
  602. #else /* not DEBUG */
  603. # define doOptDbug NULL
  604. #endif /* def/not DEBUG */
  605. extern tOptProc
  606. optionBooleanVal, optionNestedVal, optionNumericVal,
  607. optionPagedUsage, optionPrintVersion, optionResetOpt,
  608. optionStackArg, optionTimeDate, optionTimeVal,
  609. optionUnstackArg, optionVendorOption;
  610. static tOptProc
  611. doOptAuto, doOptCidr, doOptComment,
  612. doOptExclude, doOptInclude, doOptLess_Help,
  613. doOptMac, doOptMaxmask, doOptMinmask,
  614. doOptNo_Arg_Comment, doOptNonip, doOptPort,
  615. doOptRegex, doOptServices, doOptVersion,
  616. doUsageOpt;
  617. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  618. /**
  619. * Define the tcpprep Option Descriptions.
  620. * This is an array of OPTION_CT entries, one for each
  621. * option that the tcpprep program responds to.
  622. */
  623. static tOptDesc optDesc[OPTION_CT] = {
  624. { /* entry idx, value */ 0, VALUE_OPT_DBUG,
  625. /* equiv idx, value */ 0, VALUE_OPT_DBUG,
  626. /* equivalenced to */ NO_EQUIVALENT,
  627. /* min, max, act ct */ 0, 1, 0,
  628. /* opt state flags */ DBUG_FLAGS, 0,
  629. /* last opt argumnt */ { DBUG_DFT_ARG },
  630. /* arg list/cookie */ NULL,
  631. /* must/cannot opts */ NULL, NULL,
  632. /* option proc */ doOptDbug,
  633. /* desc, NAME, name */ DBUG_DESC, DBUG_NAME, DBUG_name,
  634. /* disablement strs */ NULL, NULL },
  635. { /* entry idx, value */ 1, VALUE_OPT_AUTO,
  636. /* equiv idx, value */ 1, VALUE_OPT_AUTO,
  637. /* equivalenced to */ NO_EQUIVALENT,
  638. /* min, max, act ct */ 0, 1, 0,
  639. /* opt state flags */ AUTO_FLAGS, 0,
  640. /* last opt argumnt */ { NULL }, /* --auto */
  641. /* arg list/cookie */ NULL,
  642. /* must/cannot opts */ NULL, aAutoCantList,
  643. /* option proc */ doOptAuto,
  644. /* desc, NAME, name */ AUTO_DESC, AUTO_NAME, AUTO_name,
  645. /* disablement strs */ NULL, NULL },
  646. { /* entry idx, value */ 2, VALUE_OPT_CIDR,
  647. /* equiv idx, value */ 2, VALUE_OPT_CIDR,
  648. /* equivalenced to */ NO_EQUIVALENT,
  649. /* min, max, act ct */ 0, 1, 0,
  650. /* opt state flags */ CIDR_FLAGS, 0,
  651. /* last opt argumnt */ { NULL }, /* --cidr */
  652. /* arg list/cookie */ NULL,
  653. /* must/cannot opts */ NULL, aCidrCantList,
  654. /* option proc */ doOptCidr,
  655. /* desc, NAME, name */ CIDR_DESC, CIDR_NAME, CIDR_name,
  656. /* disablement strs */ NULL, NULL },
  657. { /* entry idx, value */ 3, VALUE_OPT_REGEX,
  658. /* equiv idx, value */ 3, VALUE_OPT_REGEX,
  659. /* equivalenced to */ NO_EQUIVALENT,
  660. /* min, max, act ct */ 0, 1, 0,
  661. /* opt state flags */ REGEX_FLAGS, 0,
  662. /* last opt argumnt */ { NULL }, /* --regex */
  663. /* arg list/cookie */ NULL,
  664. /* must/cannot opts */ NULL, aRegexCantList,
  665. /* option proc */ doOptRegex,
  666. /* desc, NAME, name */ REGEX_DESC, REGEX_NAME, REGEX_name,
  667. /* disablement strs */ NULL, NULL },
  668. { /* entry idx, value */ 4, VALUE_OPT_PORT,
  669. /* equiv idx, value */ 4, VALUE_OPT_PORT,
  670. /* equivalenced to */ NO_EQUIVALENT,
  671. /* min, max, act ct */ 0, 1, 0,
  672. /* opt state flags */ PORT_FLAGS, 0,
  673. /* last opt argumnt */ { NULL }, /* --port */
  674. /* arg list/cookie */ NULL,
  675. /* must/cannot opts */ NULL, aPortCantList,
  676. /* option proc */ doOptPort,
  677. /* desc, NAME, name */ PORT_DESC, PORT_NAME, PORT_name,
  678. /* disablement strs */ NULL, NULL },
  679. { /* entry idx, value */ 5, VALUE_OPT_MAC,
  680. /* equiv idx, value */ 5, VALUE_OPT_MAC,
  681. /* equivalenced to */ NO_EQUIVALENT,
  682. /* min, max, act ct */ 0, 1, 0,
  683. /* opt state flags */ MAC_FLAGS, 0,
  684. /* last opt argumnt */ { NULL }, /* --mac */
  685. /* arg list/cookie */ NULL,
  686. /* must/cannot opts */ NULL, aMacCantList,
  687. /* option proc */ doOptMac,
  688. /* desc, NAME, name */ MAC_DESC, MAC_NAME, MAC_name,
  689. /* disablement strs */ NULL, NULL },
  690. { /* entry idx, value */ 6, VALUE_OPT_REVERSE,
  691. /* equiv idx, value */ 6, VALUE_OPT_REVERSE,
  692. /* equivalenced to */ NO_EQUIVALENT,
  693. /* min, max, act ct */ 0, 1, 0,
  694. /* opt state flags */ REVERSE_FLAGS, 0,
  695. /* last opt argumnt */ { NULL }, /* --reverse */
  696. /* arg list/cookie */ NULL,
  697. /* must/cannot opts */ NULL, NULL,
  698. /* option proc */ NULL,
  699. /* desc, NAME, name */ REVERSE_DESC, REVERSE_NAME, REVERSE_name,
  700. /* disablement strs */ NULL, NULL },
  701. { /* entry idx, value */ 7, VALUE_OPT_COMMENT,
  702. /* equiv idx, value */ 7, VALUE_OPT_COMMENT,
  703. /* equivalenced to */ NO_EQUIVALENT,
  704. /* min, max, act ct */ 0, 1, 0,
  705. /* opt state flags */ COMMENT_FLAGS, 0,
  706. /* last opt argumnt */ { NULL }, /* --comment */
  707. /* arg list/cookie */ NULL,
  708. /* must/cannot opts */ NULL, NULL,
  709. /* option proc */ doOptComment,
  710. /* desc, NAME, name */ COMMENT_DESC, COMMENT_NAME, COMMENT_name,
  711. /* disablement strs */ NULL, NULL },
  712. { /* entry idx, value */ 8, VALUE_OPT_NO_ARG_COMMENT,
  713. /* equiv idx, value */ 8, VALUE_OPT_NO_ARG_COMMENT,
  714. /* equivalenced to */ NO_EQUIVALENT,
  715. /* min, max, act ct */ 0, 1, 0,
  716. /* opt state flags */ NO_ARG_COMMENT_FLAGS, 0,
  717. /* last opt argumnt */ { NULL }, /* --no-arg-comment */
  718. /* arg list/cookie */ NULL,
  719. /* must/cannot opts */ NULL, NULL,
  720. /* option proc */ doOptNo_Arg_Comment,
  721. /* desc, NAME, name */ NO_ARG_COMMENT_DESC, NO_ARG_COMMENT_NAME, NO_ARG_COMMENT_name,
  722. /* disablement strs */ NULL, NULL },
  723. { /* entry idx, value */ 9, VALUE_OPT_INCLUDE,
  724. /* equiv idx, value */ 9, VALUE_OPT_INCLUDE,
  725. /* equivalenced to */ NO_EQUIVALENT,
  726. /* min, max, act ct */ 0, 1, 0,
  727. /* opt state flags */ INCLUDE_FLAGS, 0,
  728. /* last opt argumnt */ { NULL }, /* --include */
  729. /* arg list/cookie */ NULL,
  730. /* must/cannot opts */ NULL, aIncludeCantList,
  731. /* option proc */ doOptInclude,
  732. /* desc, NAME, name */ INCLUDE_DESC, INCLUDE_NAME, INCLUDE_name,
  733. /* disablement strs */ NULL, NULL },
  734. { /* entry idx, value */ 10, VALUE_OPT_EXCLUDE,
  735. /* equiv idx, value */ 10, VALUE_OPT_EXCLUDE,
  736. /* equivalenced to */ NO_EQUIVALENT,
  737. /* min, max, act ct */ 0, 1, 0,
  738. /* opt state flags */ EXCLUDE_FLAGS, 0,
  739. /* last opt argumnt */ { NULL }, /* --exclude */
  740. /* arg list/cookie */ NULL,
  741. /* must/cannot opts */ NULL, aExcludeCantList,
  742. /* option proc */ doOptExclude,
  743. /* desc, NAME, name */ EXCLUDE_DESC, EXCLUDE_NAME, EXCLUDE_name,
  744. /* disablement strs */ NULL, NULL },
  745. { /* entry idx, value */ 11, VALUE_OPT_CACHEFILE,
  746. /* equiv idx, value */ 11, VALUE_OPT_CACHEFILE,
  747. /* equivalenced to */ NO_EQUIVALENT,
  748. /* min, max, act ct */ 0, 1, 0,
  749. /* opt state flags */ CACHEFILE_FLAGS, 0,
  750. /* last opt argumnt */ { NULL }, /* --cachefile */
  751. /* arg list/cookie */ NULL,
  752. /* must/cannot opts */ NULL, NULL,
  753. /* option proc */ NULL,
  754. /* desc, NAME, name */ CACHEFILE_DESC, CACHEFILE_NAME, CACHEFILE_name,
  755. /* disablement strs */ NULL, NULL },
  756. { /* entry idx, value */ 12, VALUE_OPT_PCAP,
  757. /* equiv idx, value */ 12, VALUE_OPT_PCAP,
  758. /* equivalenced to */ NO_EQUIVALENT,
  759. /* min, max, act ct */ 0, 1, 0,
  760. /* opt state flags */ PCAP_FLAGS, 0,
  761. /* last opt argumnt */ { NULL }, /* --pcap */
  762. /* arg list/cookie */ NULL,
  763. /* must/cannot opts */ NULL, NULL,
  764. /* option proc */ NULL,
  765. /* desc, NAME, name */ PCAP_DESC, PCAP_NAME, PCAP_name,
  766. /* disablement strs */ NULL, NULL },
  767. { /* entry idx, value */ 13, VALUE_OPT_PRINT_COMMENT,
  768. /* equiv idx, value */ 13, VALUE_OPT_PRINT_COMMENT,
  769. /* equivalenced to */ NO_EQUIVALENT,
  770. /* min, max, act ct */ 0, 1, 0,
  771. /* opt state flags */ PRINT_COMMENT_FLAGS, 0,
  772. /* last opt argumnt */ { NULL }, /* --print-comment */
  773. /* arg list/cookie */ NULL,
  774. /* must/cannot opts */ NULL, NULL,
  775. /* option proc */ NULL,
  776. /* desc, NAME, name */ PRINT_COMMENT_DESC, PRINT_COMMENT_NAME, PRINT_COMMENT_name,
  777. /* disablement strs */ NULL, NULL },
  778. { /* entry idx, value */ 14, VALUE_OPT_PRINT_INFO,
  779. /* equiv idx, value */ 14, VALUE_OPT_PRINT_INFO,
  780. /* equivalenced to */ NO_EQUIVALENT,
  781. /* min, max, act ct */ 0, 1, 0,
  782. /* opt state flags */ PRINT_INFO_FLAGS, 0,
  783. /* last opt argumnt */ { NULL }, /* --print-info */
  784. /* arg list/cookie */ NULL,
  785. /* must/cannot opts */ NULL, NULL,
  786. /* option proc */ NULL,
  787. /* desc, NAME, name */ PRINT_INFO_DESC, PRINT_INFO_NAME, PRINT_INFO_name,
  788. /* disablement strs */ NULL, NULL },
  789. { /* entry idx, value */ 15, VALUE_OPT_PRINT_STATS,
  790. /* equiv idx, value */ 15, VALUE_OPT_PRINT_STATS,
  791. /* equivalenced to */ NO_EQUIVALENT,
  792. /* min, max, act ct */ 0, 1, 0,
  793. /* opt state flags */ PRINT_STATS_FLAGS, 0,
  794. /* last opt argumnt */ { NULL }, /* --print-stats */
  795. /* arg list/cookie */ NULL,
  796. /* must/cannot opts */ NULL, NULL,
  797. /* option proc */ NULL,
  798. /* desc, NAME, name */ PRINT_STATS_DESC, PRINT_STATS_NAME, PRINT_STATS_name,
  799. /* disablement strs */ NULL, NULL },
  800. { /* entry idx, value */ 16, VALUE_OPT_SERVICES,
  801. /* equiv idx, value */ 16, VALUE_OPT_SERVICES,
  802. /* equivalenced to */ NO_EQUIVALENT,
  803. /* min, max, act ct */ 0, 1, 0,
  804. /* opt state flags */ SERVICES_FLAGS, 0,
  805. /* last opt argumnt */ { NULL }, /* --services */
  806. /* arg list/cookie */ NULL,
  807. /* must/cannot opts */ aServicesMustList, NULL,
  808. /* option proc */ doOptServices,
  809. /* desc, NAME, name */ SERVICES_DESC, SERVICES_NAME, SERVICES_name,
  810. /* disablement strs */ NULL, NULL },
  811. { /* entry idx, value */ 17, VALUE_OPT_NONIP,
  812. /* equiv idx, value */ 17, VALUE_OPT_NONIP,
  813. /* equivalenced to */ NO_EQUIVALENT,
  814. /* min, max, act ct */ 0, 1, 0,
  815. /* opt state flags */ NONIP_FLAGS, 0,
  816. /* last opt argumnt */ { NULL }, /* --nonip */
  817. /* arg list/cookie */ NULL,
  818. /* must/cannot opts */ NULL, NULL,
  819. /* option proc */ doOptNonip,
  820. /* desc, NAME, name */ NONIP_DESC, NONIP_NAME, NONIP_name,
  821. /* disablement strs */ NULL, NULL },
  822. { /* entry idx, value */ 18, VALUE_OPT_RATIO,
  823. /* equiv idx, value */ 18, VALUE_OPT_RATIO,
  824. /* equivalenced to */ NO_EQUIVALENT,
  825. /* min, max, act ct */ 0, 1, 0,
  826. /* opt state flags */ RATIO_FLAGS, 0,
  827. /* last opt argumnt */ { RATIO_DFT_ARG },
  828. /* arg list/cookie */ NULL,
  829. /* must/cannot opts */ aRatioMustList, NULL,
  830. /* option proc */ NULL,
  831. /* desc, NAME, name */ RATIO_DESC, RATIO_NAME, RATIO_name,
  832. /* disablement strs */ NULL, NULL },
  833. { /* entry idx, value */ 19, VALUE_OPT_MINMASK,
  834. /* equiv idx, value */ 19, VALUE_OPT_MINMASK,
  835. /* equivalenced to */ NO_EQUIVALENT,
  836. /* min, max, act ct */ 0, 1, 0,
  837. /* opt state flags */ MINMASK_FLAGS, 0,
  838. /* last opt argumnt */ { MINMASK_DFT_ARG },
  839. /* arg list/cookie */ NULL,
  840. /* must/cannot opts */ aMinmaskMustList, NULL,
  841. /* option proc */ doOptMinmask,
  842. /* desc, NAME, name */ MINMASK_DESC, MINMASK_NAME, MINMASK_name,
  843. /* disablement strs */ NULL, NULL },
  844. { /* entry idx, value */ 20, VALUE_OPT_MAXMASK,
  845. /* equiv idx, value */ 20, VALUE_OPT_MAXMASK,
  846. /* equivalenced to */ NO_EQUIVALENT,
  847. /* min, max, act ct */ 0, 1, 0,
  848. /* opt state flags */ MAXMASK_FLAGS, 0,
  849. /* last opt argumnt */ { MAXMASK_DFT_ARG },
  850. /* arg list/cookie */ NULL,
  851. /* must/cannot opts */ aMaxmaskMustList, NULL,
  852. /* option proc */ doOptMaxmask,
  853. /* desc, NAME, name */ MAXMASK_DESC, MAXMASK_NAME, MAXMASK_name,
  854. /* disablement strs */ NULL, NULL },
  855. { /* entry idx, value */ 21, VALUE_OPT_VERBOSE,
  856. /* equiv idx, value */ 21, VALUE_OPT_VERBOSE,
  857. /* equivalenced to */ NO_EQUIVALENT,
  858. /* min, max, act ct */ 0, 1, 0,
  859. /* opt state flags */ VERBOSE_FLAGS, 0,
  860. /* last opt argumnt */ { NULL }, /* --verbose */
  861. /* arg list/cookie */ NULL,
  862. /* must/cannot opts */ NULL, NULL,
  863. /* option proc */ NULL,
  864. /* desc, NAME, name */ VERBOSE_DESC, VERBOSE_NAME, VERBOSE_name,
  865. /* disablement strs */ NULL, NULL },
  866. { /* entry idx, value */ 22, VALUE_OPT_DECODE,
  867. /* equiv idx, value */ 22, VALUE_OPT_DECODE,
  868. /* equivalenced to */ NO_EQUIVALENT,
  869. /* min, max, act ct */ 0, 1, 0,
  870. /* opt state flags */ DECODE_FLAGS, 0,
  871. /* last opt argumnt */ { NULL }, /* --decode */
  872. /* arg list/cookie */ NULL,
  873. /* must/cannot opts */ aDecodeMustList, NULL,
  874. /* option proc */ NULL,
  875. /* desc, NAME, name */ DECODE_DESC, DECODE_NAME, DECODE_name,
  876. /* disablement strs */ NULL, NULL },
  877. { /* entry idx, value */ 23, VALUE_OPT_VERSION,
  878. /* equiv idx, value */ 23, VALUE_OPT_VERSION,
  879. /* equivalenced to */ NO_EQUIVALENT,
  880. /* min, max, act ct */ 0, 1, 0,
  881. /* opt state flags */ VERSION_FLAGS, 0,
  882. /* last opt argumnt */ { NULL }, /* --version */
  883. /* arg list/cookie */ NULL,
  884. /* must/cannot opts */ NULL, NULL,
  885. /* option proc */ doOptVersion,
  886. /* desc, NAME, name */ VERSION_DESC, VERSION_NAME, VERSION_name,
  887. /* disablement strs */ NULL, NULL },
  888. { /* entry idx, value */ 24, VALUE_OPT_LESS_HELP,
  889. /* equiv idx, value */ 24, VALUE_OPT_LESS_HELP,
  890. /* equivalenced to */ NO_EQUIVALENT,
  891. /* min, max, act ct */ 0, 1, 0,
  892. /* opt state flags */ LESS_HELP_FLAGS, 0,
  893. /* last opt argumnt */ { NULL }, /* --less-help */
  894. /* arg list/cookie */ NULL,
  895. /* must/cannot opts */ NULL, NULL,
  896. /* option proc */ doOptLess_Help,
  897. /* desc, NAME, name */ LESS_HELP_DESC, LESS_HELP_NAME, LESS_HELP_name,
  898. /* disablement strs */ NULL, NULL },
  899. { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
  900. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
  901. /* equivalenced to */ NO_EQUIVALENT,
  902. /* min, max, act ct */ 0, 1, 0,
  903. /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
  904. /* last opt argumnt */ { NULL },
  905. /* arg list/cookie */ NULL,
  906. /* must/cannot opts */ NULL, NULL,
  907. /* option proc */ doUsageOpt,
  908. /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
  909. /* disablement strs */ NULL, NULL },
  910. { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
  911. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
  912. /* equivalenced to */ NO_EQUIVALENT,
  913. /* min, max, act ct */ 0, 1, 0,
  914. /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
  915. /* last opt argumnt */ { NULL },
  916. /* arg list/cookie */ NULL,
  917. /* must/cannot opts */ NULL, NULL,
  918. /* option proc */ optionPagedUsage,
  919. /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
  920. /* disablement strs */ NULL, NULL },
  921. { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
  922. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
  923. /* equivalenced to */ NO_EQUIVALENT,
  924. /* min, max, act ct */ 0, 1, 0,
  925. /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
  926. | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
  927. /* last opt argumnt */ { NULL },
  928. /* arg list/cookie */ NULL,
  929. /* must/cannot opts */ NULL, NULL,
  930. /* option proc */ NULL,
  931. /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
  932. /* disablement strs */ NULL, NULL },
  933. { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
  934. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
  935. /* equivalenced to */ NO_EQUIVALENT,
  936. /* min, max, act ct */ 0, NOLIMIT, 0,
  937. /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
  938. | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS,
  939. /* last opt argumnt */ { NULL },
  940. /* arg list/cookie */ NULL,
  941. /* must/cannot opts */ NULL, NULL,
  942. /* option proc */ optionLoadOpt,
  943. /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
  944. /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
  945. };
  946. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  947. /** Reference to the upper cased version of tcpprep. */
  948. #define zPROGNAME (tcpprep_opt_strs+2325)
  949. /** Reference to the title line for tcpprep usage. */
  950. #define zUsageTitle (tcpprep_opt_strs+2333)
  951. /** tcpprep configuration file name. */
  952. #define zRcName (tcpprep_opt_strs+2469)
  953. /** Directories to search for tcpprep config files. */
  954. static char const * const apzHomeList[2] = {
  955. tcpprep_opt_strs+2465,
  956. NULL };
  957. /** The tcpprep program bug email address. */
  958. #define zBugsAddr (tcpprep_opt_strs+2480)
  959. /** Clarification/explanation of what tcpprep does. */
  960. #define zExplain (tcpprep_opt_strs+2518)
  961. /** Extra detail explaining what tcpprep does. */
  962. #define zDetail (tcpprep_opt_strs+2686)
  963. /** The full version string for tcpprep. */
  964. #define zFullVersion (NULL)
  965. /* extracted from optcode.tlib near line 364 */
  966. #if defined(ENABLE_NLS)
  967. # define OPTPROC_BASE OPTPROC_TRANSLATE
  968. static tOptionXlateProc translate_option_strings;
  969. #else
  970. # define OPTPROC_BASE OPTPROC_NONE
  971. # define translate_option_strings NULL
  972. #endif /* ENABLE_NLS */
  973. #define tcpprep_full_usage (NULL)
  974. #define tcpprep_short_usage (NULL)
  975. #endif /* not defined __doxygen__ */
  976. /*
  977. * Create the static procedure(s) declared above.
  978. */
  979. /**
  980. * The callout function that invokes the optionUsage function.
  981. *
  982. * @param[in] opts the AutoOpts option description structure
  983. * @param[in] od the descriptor for the "help" (usage) option.
  984. * @noreturn
  985. */
  986. static void
  987. doUsageOpt(tOptions * opts, tOptDesc * od)
  988. {
  989. int ex_code;
  990. ex_code = TCPPREP_EXIT_SUCCESS;
  991. optionUsage(&tcpprepOptions, ex_code);
  992. /* NOTREACHED */
  993. exit(TCPPREP_EXIT_FAILURE);
  994. (void)opts;
  995. (void)od;
  996. }
  997. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  998. /**
  999. * Code to handle the dbug option, when DEBUG is #define-d.
  1000. * If configured with --enable-debug, then you can specify a verbosity
  1001. * level for debugging output. Higher numbers increase verbosity.
  1002. * @param[in] pOptions the tcpprep options data structure
  1003. * @param[in,out] pOptDesc the option descriptor for this option.
  1004. */
  1005. #ifdef DEBUG
  1006. static void
  1007. doOptDbug(tOptions* pOptions, tOptDesc* pOptDesc)
  1008. {
  1009. static struct {long rmin, rmax;} const rng[1] = {
  1010. { 0, 5 } };
  1011. int ix;
  1012. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1013. goto emit_ranges;
  1014. optionNumericVal(pOptions, pOptDesc);
  1015. for (ix = 0; ix < 1; ix++) {
  1016. if (pOptDesc->optArg.argInt < rng[ix].rmin)
  1017. continue; /* ranges need not be ordered. */
  1018. if (pOptDesc->optArg.argInt == rng[ix].rmin)
  1019. return;
  1020. if (rng[ix].rmax == LONG_MIN)
  1021. continue;
  1022. if (pOptDesc->optArg.argInt <= rng[ix].rmax)
  1023. return;
  1024. }
  1025. option_usage_fp = stderr;
  1026. emit_ranges:
  1027. optionShowRange(pOptions, pOptDesc, VOIDP(rng), 1);
  1028. }
  1029. #endif /* defined DEBUG */
  1030. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1031. /**
  1032. * Code to handle the auto option.
  1033. * Tcpprep will try to automatically determine the primary function of hosts
  1034. * based on the traffic captured and classify each host as client or server.
  1035. * In order to do so, you must provide a hint to tcpprep as to how to search
  1036. * for clients and servers. Valid hints are:
  1037. *
  1038. * @table @bullet
  1039. * @item
  1040. * @var{bridge}
  1041. * Bridge mode processes each packet to try to determine if the sender is a
  1042. * client or server. Once all the packets are processed, the results are weighed
  1043. * according to the server/client ratio (@samp{--ratio}) and systems are assigned an
  1044. * interface. If tcpprep is unable to determine what role a system plays, tcpprep
  1045. * will abort.
  1046. * @item
  1047. * @var{router}
  1048. * Router mode works just like bridge mode, except that after weighing is done,
  1049. * systems which are undetermined are considered a server if they fall inside a
  1050. * network known to contain other servers. Router has a greater chance of
  1051. * successfully splitting clients and servers but is not 100% foolproof.
  1052. * @item
  1053. * @var{client}
  1054. * Client mode works just like bridge mode, except that unclassified systems are
  1055. * treated as clients. Client mode should always complete successfully.
  1056. * @item
  1057. * @var{server}
  1058. * Server mode works just like bridge mode, except that unclassified systems are
  1059. * treated as servers. Server mode should always complete successfully.
  1060. * @item
  1061. * @var{first}
  1062. * First mode works by looking at the first time each IP is seen in the SRC and DST
  1063. * fields in the IP header. If the host is first seen in the SRC field, it is a
  1064. * client and if it's first seen in the DST field, it is marked as a server. This
  1065. * effectively replicates the processing of the tomahawk test tool. First
  1066. * mode should always complete successfully.
  1067. * @end table
  1068. * @param[in] pOptions the tcpprep options data structure
  1069. * @param[in,out] pOptDesc the option descriptor for this option.
  1070. */
  1071. static void
  1072. doOptAuto(tOptions* pOptions, tOptDesc* pOptDesc)
  1073. {
  1074. /*
  1075. * Be sure the flag-code[0] handles special values for the options pointer
  1076. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1077. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1078. * reset its state.
  1079. */
  1080. /* extracted from tcpprep_opts.def, line 113 */
  1081. tcpprep->options->mode = AUTO_MODE;
  1082. if (strcmp(OPT_ARG(AUTO), "bridge") == 0) {
  1083. tcpprep->options->automode = BRIDGE_MODE;
  1084. }
  1085. else if (strcmp(OPT_ARG(AUTO), "router") == 0) {
  1086. tcpprep->options->automode = ROUTER_MODE;
  1087. }
  1088. else if (strcmp(OPT_ARG(AUTO), "client") == 0) {
  1089. tcpprep->options->automode = CLIENT_MODE;
  1090. }
  1091. else if (strcmp(OPT_ARG(AUTO), "server") == 0) {
  1092. tcpprep->options->automode = SERVER_MODE;
  1093. }
  1094. else if (strcmp(OPT_ARG(AUTO), "first") == 0) {
  1095. tcpprep->options->automode = FIRST_MODE;
  1096. }
  1097. else {
  1098. errx(-1, "Invalid auto mode type: %s", OPT_ARG(AUTO));
  1099. }
  1100. (void)pOptDesc;
  1101. (void)pOptions;
  1102. }
  1103. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1104. /**
  1105. * Code to handle the cidr option.
  1106. * Specify a comma delimited list of CIDR netblocks to match against
  1107. * the source IP of each packet. Packets matching any of the CIDR's
  1108. * are classified as servers.
  1109. *
  1110. * IPv4 Example:
  1111. * @example
  1112. * --cidr=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8
  1113. * @end example
  1114. * IPv6 Example:
  1115. * @example
  1116. * --cidr=[::ffff:0:0/96],[fe80::/16]
  1117. * @end example
  1118. * @param[in] pOptions the tcpprep options data structure
  1119. * @param[in,out] pOptDesc the option descriptor for this option.
  1120. */
  1121. static void
  1122. doOptCidr(tOptions* pOptions, tOptDesc* pOptDesc)
  1123. {
  1124. /*
  1125. * Be sure the flag-code[0] handles special values for the options pointer
  1126. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1127. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1128. * reset its state.
  1129. */
  1130. /* extracted from tcpprep_opts.def, line 185 */
  1131. char *cidr = safe_strdup(OPT_ARG(CIDR));
  1132. tcpprep->options->mode = CIDR_MODE;
  1133. if (!parse_cidr(&tcpprep->options->cidrdata, cidr, ","))
  1134. errx(-1, "Unable to parse CIDR map: %s", OPT_ARG(CIDR));
  1135. free(cidr);
  1136. (void)pOptDesc;
  1137. (void)pOptions;
  1138. }
  1139. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1140. /**
  1141. * Code to handle the regex option.
  1142. * Specify a regular expression to match against the source IP of each
  1143. * packet. Packets matching the regex are classified as servers.
  1144. * @param[in] pOptions the tcpprep options data structure
  1145. * @param[in,out] pOptDesc the option descriptor for this option.
  1146. */
  1147. static void
  1148. doOptRegex(tOptions* pOptions, tOptDesc* pOptDesc)
  1149. {
  1150. /*
  1151. * Be sure the flag-code[0] handles special values for the options pointer
  1152. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1153. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1154. * reset its state.
  1155. */
  1156. /* extracted from tcpprep_opts.def, line 220 */
  1157. int regex_error;
  1158. char ebuf[EBUF_SIZE];
  1159. tcpprep->options->mode = REGEX_MODE;
  1160. if ((regex_error = regcomp(&tcpprep->options->preg, OPT_ARG(REGEX),
  1161. REG_EXTENDED|REG_NOSUB))) {
  1162. regerror(regex_error, &tcpprep->options->preg, ebuf, EBUF_SIZE);
  1163. errx(-1, "Unable to compile regex: %s", ebuf);
  1164. }
  1165. (void)pOptDesc;
  1166. (void)pOptions;
  1167. }
  1168. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1169. /**
  1170. * Code to handle the port option.
  1171. * Specifies that TCP and UDP traffic over IPv4 and IPv6 should be classified
  1172. * as client or server based upon the destination port of the header.
  1173. * @param[in] pOptions the tcpprep options data structure
  1174. * @param[in,out] pOptDesc the option descriptor for this option.
  1175. */
  1176. static void
  1177. doOptPort(tOptions* pOptions, tOptDesc* pOptDesc)
  1178. {
  1179. /*
  1180. * Be sure the flag-code[0] handles special values for the options pointer
  1181. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1182. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1183. * reset its state.
  1184. */
  1185. /* extracted from tcpprep_opts.def, line 248 */
  1186. tcpprep->options->mode = PORT_MODE;
  1187. (void)pOptDesc;
  1188. (void)pOptions;
  1189. }
  1190. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1191. /**
  1192. * Code to handle the mac option.
  1193. * Specify a list of MAC addresses to match against the source MAC
  1194. * of each packet. Packets matching one of the values are classified
  1195. * as servers.
  1196. * @param[in] pOptions the tcpprep options data structure
  1197. * @param[in,out] pOptDesc the option descriptor for this option.
  1198. */
  1199. static void
  1200. doOptMac(tOptions* pOptions, tOptDesc* pOptDesc)
  1201. {
  1202. /*
  1203. * Be sure the flag-code[0] handles special values for the options pointer
  1204. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1205. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1206. * reset its state.
  1207. */
  1208. /* extracted from tcpprep_opts.def, line 269 */
  1209. tcpprep->options->mode = MAC_MODE;
  1210. tcpprep->options->maclist = safe_strdup(OPT_ARG(MAC));
  1211. (void)pOptDesc;
  1212. (void)pOptions;
  1213. }
  1214. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1215. /**
  1216. * Code to handle the comment option.
  1217. * Specify a comment to be imbedded within the output cache file and later
  1218. * viewed.
  1219. * @param[in] pOptions the tcpprep options data structure
  1220. * @param[in,out] pOptDesc the option descriptor for this option.
  1221. */
  1222. static void
  1223. doOptComment(tOptions* pOptions, tOptDesc* pOptDesc)
  1224. {
  1225. /*
  1226. * Be sure the flag-code[0] handles special values for the options pointer
  1227. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1228. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1229. * reset its state.
  1230. */
  1231. /* extracted from tcpprep_opts.def, line 300 */
  1232. /* our comment_len is only 16bit - myargs[] */
  1233. if (strlen(OPT_ARG(COMMENT)) > ((1 << 16) - 1 - MYARGS_LEN))
  1234. errx(-1, "Comment length %zu is longer then max allowed (%d)",
  1235. strlen(OPT_ARG(COMMENT)), (1 << 16) - 1 - MYARGS_LEN);
  1236. /* save the comment */
  1237. tcpprep->options->comment = (char *)safe_malloc(strlen(OPT_ARG(COMMENT)) + 1);
  1238. strcpy(tcpprep->options->comment, OPT_ARG(COMMENT));
  1239. (void)pOptDesc;
  1240. (void)pOptions;
  1241. }
  1242. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1243. /**
  1244. * Code to handle the no-arg-comment option.
  1245. * By default, tcpprep includes the arguments passed on the command line
  1246. * in the cache file comment (in addition to any user specified --comment).
  1247. * If for some reason you do not wish to include this, specify this option.
  1248. * @param[in] pOptions the tcpprep options data structure
  1249. * @param[in,out] pOptDesc the option descriptor for this option.
  1250. */
  1251. static void
  1252. doOptNo_Arg_Comment(tOptions* pOptions, tOptDesc* pOptDesc)
  1253. {
  1254. /*
  1255. * Be sure the flag-code[0] handles special values for the options pointer
  1256. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1257. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1258. * reset its state.
  1259. */
  1260. /* extracted from tcpprep_opts.def, line 322 */
  1261. tcpprep->options->nocomment = 1;
  1262. (void)pOptDesc;
  1263. (void)pOptions;
  1264. }
  1265. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1266. /**
  1267. * Code to handle the include option.
  1268. * Override default of processing all packets stored in the capture file and only
  1269. * send/edit packets which match the provided rule. Rules can be one of:
  1270. *
  1271. * @table @bullet
  1272. * @item S:<CIDR1>,...
  1273. * - Source IP must match specified IPv4/v6 CIDR(s)
  1274. * @item D:<CIDR1>,...
  1275. * - Destination IP must match specified IPv4/v6 CIDR(s)
  1276. * @item B:<CIDR1>,...
  1277. * - Both source and destination IP must match specified IPv4/v6 CIDR(s)
  1278. * @item E:<CIDR1>,...
  1279. * - Either IP must match specified IPv4/v6 CIDR(s)
  1280. * @item P:<LIST>
  1281. * - Must be one of the listed packets where the list
  1282. * corresponds to the packet number in the capture file.
  1283. * @example
  1284. * -x P:1-5,9,15,72-
  1285. * @end example
  1286. * would process packets 1 through 5, the 9th and 15th packet, and packets 72 until the
  1287. * end of the file
  1288. * @item F:'<bpf>'
  1289. * - BPF filter. See the @file{tcpdump(8)} man page for syntax.
  1290. * @end table
  1291. * @param[in] pOptions the tcpprep options data structure
  1292. * @param[in,out] pOptDesc the option descriptor for this option.
  1293. */
  1294. static void
  1295. doOptInclude(tOptions* pOptions, tOptDesc* pOptDesc)
  1296. {
  1297. /*
  1298. * Be sure the flag-code[0] handles special values for the options pointer
  1299. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1300. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1301. * reset its state.
  1302. */
  1303. /* extracted from tcpprep_opts.def, line 342 */
  1304. char *include;
  1305. include = safe_strdup(OPT_ARG(INCLUDE));
  1306. tcpprep->options->xX.mode = xX_MODE_INCLUDE;
  1307. if ((tcpprep->options->xX.mode = parse_xX_str(&tcpprep->options->xX, include, &tcpprep->options->bpf)) == xXError)
  1308. errx(-1, "Unable to parse include/exclude rule: %s", OPT_ARG(INCLUDE));
  1309. free(include);
  1310. (void)pOptDesc;
  1311. (void)pOptions;
  1312. }
  1313. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1314. /**
  1315. * Code to handle the exclude option.
  1316. * Override default of processing all packets stored in the capture file and only
  1317. * send/edit packets which do NOT match the provided rule. Rules can be one of:
  1318. *
  1319. * @table @bullet
  1320. * @item S:<CIDR1>,...
  1321. * - Source IP must not match specified IPv4/v6 CIDR(s)
  1322. * @item D:<CIDR1>,...
  1323. * - Destination IP must not match specified IPv4/v6 CIDR(s)
  1324. * @item B:<CIDR1>,...
  1325. * - Both source and destination IP must not match specified IPv4/v6 CIDR(s)
  1326. * @item E:<CIDR1>,...
  1327. * - Either IP must not match specified IPv4/v6 CIDR(s)
  1328. * @item P:<LIST>
  1329. * - Must not be one of the listed packets where the list
  1330. * corresponds to the packet number in the capture file.
  1331. * @example
  1332. * -x P:1-5,9,15,72-
  1333. * @end example
  1334. * would skip packets 1 through 5, the 9th and 15th packet, and packets 72 until the
  1335. * end of the file
  1336. * @end table
  1337. * @param[in] pOptions the tcpprep options data structure
  1338. * @param[in,out] pOptDesc the option descriptor for this option.
  1339. */
  1340. static void
  1341. doOptExclude(tOptions* pOptions, tOptDesc* pOptDesc)
  1342. {
  1343. /*
  1344. * Be sure the flag-code[0] handles special values for the options pointer
  1345. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1346. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1347. * reset its state.
  1348. */
  1349. /* extracted from tcpprep_opts.def, line 389 */
  1350. char *exclude;
  1351. exclude = safe_strdup(OPT_ARG(EXCLUDE));
  1352. tcpprep->options->xX.mode = xX_MODE_EXCLUDE;
  1353. if ((tcpprep->options->xX.mode = parse_xX_str(&tcpprep->options->xX, exclude, &tcpprep->options->bpf)) == xXError)
  1354. errx(-1, "Unable to parse include/exclude rule: %s", OPT_ARG(EXCLUDE));
  1355. free(exclude);
  1356. (void)pOptDesc;
  1357. (void)pOptions;
  1358. }
  1359. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1360. /**
  1361. * Code to handle the services option.
  1362. * Uses a list of ports used by servers in the same format as of /etc/services:
  1363. * <service_name> <port>/<protocol> # comment
  1364. *
  1365. * Example:
  1366. * http 80/tcp
  1367. * @param[in] pOptions the tcpprep options data structure
  1368. * @param[in,out] pOptDesc the option descriptor for this option.
  1369. */
  1370. static void
  1371. doOptServices(tOptions* pOptions, tOptDesc* pOptDesc)
  1372. {
  1373. /*
  1374. * Be sure the flag-code[0] handles special values for the options pointer
  1375. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1376. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1377. * reset its state.
  1378. */
  1379. /* extracted from tcpprep_opts.def, line 486 */
  1380. parse_services(OPT_ARG(SERVICES), &tcpprep->options->services);
  1381. (void)pOptDesc;
  1382. (void)pOptions;
  1383. }
  1384. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1385. /**
  1386. * Code to handle the nonip option.
  1387. * By default, non-IP traffic which can not be classified as client
  1388. * or server is classified as "client". Specifying @samp{--nonip}
  1389. * will reclassify non-IP traffic as "server". Note that the meaning
  1390. * of this flag is reversed if @samp{--reverse} is used.
  1391. * @param[in] pOptions the tcpprep options data structure
  1392. * @param[in,out] pOptDesc the option descriptor for this option.
  1393. */
  1394. static void
  1395. doOptNonip(tOptions* pOptions, tOptDesc* pOptDesc)
  1396. {
  1397. /*
  1398. * Be sure the flag-code[0] handles special values for the options pointer
  1399. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1400. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1401. * reset its state.
  1402. */
  1403. /* extracted from tcpprep_opts.def, line 497 */
  1404. tcpprep->options->nonip = DIR_SERVER;
  1405. (void)pOptDesc;
  1406. (void)pOptions;
  1407. }
  1408. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1409. /**
  1410. * Code to handle the minmask option.
  1411. * By default, auto modes use a minimum network mask length of 30 bits
  1412. * to build networks containing clients and servers. This allows you
  1413. * to override this value. Larger values will increase performance but
  1414. * may provide inaccurate results.
  1415. * @param[in] pOptions the tcpprep options data structure
  1416. * @param[in,out] pOptDesc the option descriptor for this option.
  1417. */
  1418. static void
  1419. doOptMinmask(tOptions* pOptions, tOptDesc* pOptDesc)
  1420. {
  1421. static struct {long rmin, rmax;} const rng[1] = {
  1422. { 0, 32 } };
  1423. int ix;
  1424. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1425. goto emit_ranges;
  1426. optionNumericVal(pOptions, pOptDesc);
  1427. for (ix = 0; ix < 1; ix++) {
  1428. if (pOptDesc->optArg.argInt < rng[ix].rmin)
  1429. continue; /* ranges need not be ordered. */
  1430. if (pOptDesc->optArg.argInt == rng[ix].rmin)
  1431. return;
  1432. if (rng[ix].rmax == LONG_MIN)
  1433. continue;
  1434. if (pOptDesc->optArg.argInt <= rng[ix].rmax)
  1435. return;
  1436. }
  1437. option_usage_fp = stderr;
  1438. emit_ranges:
  1439. optionShowRange(pOptions, pOptDesc, VOIDP(rng), 1);
  1440. }
  1441. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1442. /**
  1443. * Code to handle the maxmask option.
  1444. * By default, auto modes use a maximum network mask length of 8 bits
  1445. * to build networks containing clients and servers. This allows you
  1446. * to override this value. Larger values will decrease performance
  1447. * and accuracy but will provide greater chance of success.
  1448. * @param[in] pOptions the tcpprep options data structure
  1449. * @param[in,out] pOptDesc the option descriptor for this option.
  1450. */
  1451. static void
  1452. doOptMaxmask(tOptions* pOptions, tOptDesc* pOptDesc)
  1453. {
  1454. static struct {long rmin, rmax;} const rng[1] = {
  1455. { 0, 32 } };
  1456. int ix;
  1457. if (pOptions <= OPTPROC_EMIT_LIMIT)
  1458. goto emit_ranges;
  1459. optionNumericVal(pOptions, pOptDesc);
  1460. for (ix = 0; ix < 1; ix++) {
  1461. if (pOptDesc->optArg.argInt < rng[ix].rmin)
  1462. continue; /* ranges need not be ordered. */
  1463. if (pOptDesc->optArg.argInt == rng[ix].rmin)
  1464. return;
  1465. if (rng[ix].rmax == LONG_MIN)
  1466. continue;
  1467. if (pOptDesc->optArg.argInt <= rng[ix].rmax)
  1468. return;
  1469. }
  1470. option_usage_fp = stderr;
  1471. emit_ranges:
  1472. optionShowRange(pOptions, pOptDesc, VOIDP(rng), 1);
  1473. }
  1474. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1475. /**
  1476. * Code to handle the version option.
  1477. *
  1478. * @param[in] pOptions the tcpprep options data structure
  1479. * @param[in,out] pOptDesc the option descriptor for this option.
  1480. */
  1481. static void
  1482. doOptVersion(tOptions* pOptions, tOptDesc* pOptDesc)
  1483. {
  1484. /*
  1485. * Be sure the flag-code[0] handles special values for the options pointer
  1486. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1487. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1488. * reset its state.
  1489. */
  1490. /* extracted from tcpprep_opts.def, line 598 */
  1491. fprintf(stderr, "tcpprep version: %s (build %s)", VERSION, git_version());
  1492. #ifdef DEBUG
  1493. fprintf(stderr, " (debug)");
  1494. #endif
  1495. fprintf(stderr, "\n");
  1496. fprintf(stderr, "Copyright 2013-2018 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta\n");
  1497. fprintf(stderr, "Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>\n");
  1498. fprintf(stderr, "The entire Tcpreplay Suite is licensed under the GPLv3\n");
  1499. fprintf(stderr, "Cache file supported: %s\n", CACHEVERSION);
  1500. #ifdef HAVE_LIBDNET
  1501. fprintf(stderr, "Compiled against libdnet: %s\n", LIBDNET_VERSION);
  1502. #else
  1503. fprintf(stderr, "Not compiled with libdnet.\n");
  1504. #endif
  1505. #ifdef HAVE_WINPCAP
  1506. fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
  1507. #elif defined HAVE_PF_RING_PCAP
  1508. fprintf(stderr, "Compiled against PF_RING libpcap: %s\n", get_pcap_version());
  1509. #else
  1510. fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
  1511. #endif
  1512. #ifdef ENABLE_64BITS
  1513. fprintf(stderr, "64 bit packet counters: enabled\n");
  1514. #else
  1515. fprintf(stderr, "64 bit packet counters: disabled\n");
  1516. #endif
  1517. #ifdef ENABLE_VERBOSE
  1518. fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
  1519. #else
  1520. fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
  1521. #endif
  1522. exit(0);
  1523. (void)pOptDesc;
  1524. (void)pOptions;
  1525. }
  1526. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1527. /**
  1528. * Code to handle the less-help option.
  1529. *
  1530. * @param[in] pOptions the tcpprep options data structure
  1531. * @param[in,out] pOptDesc the option descriptor for this option.
  1532. */
  1533. static void
  1534. doOptLess_Help(tOptions* pOptions, tOptDesc* pOptDesc)
  1535. {
  1536. /*
  1537. * Be sure the flag-code[0] handles special values for the options pointer
  1538. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  1539. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  1540. * reset its state.
  1541. */
  1542. /* extracted from tcpprep_opts.def, line 642 */
  1543. USAGE(EXIT_FAILURE);
  1544. (void)pOptDesc;
  1545. (void)pOptions;
  1546. }
  1547. /* extracted from optmain.tlib near line 1250 */
  1548. /**
  1549. * The directory containing the data associated with tcpprep.
  1550. */
  1551. #ifndef PKGDATADIR
  1552. # define PKGDATADIR ""
  1553. #endif
  1554. /**
  1555. * Information about the person or institution that packaged tcpprep
  1556. * for the current distribution.
  1557. */
  1558. #ifndef WITH_PACKAGER
  1559. # define tcpprep_packager_info NULL
  1560. #else
  1561. /** Packager information for tcpprep. */
  1562. static char const tcpprep_packager_info[] =
  1563. "Packaged by " WITH_PACKAGER
  1564. # ifdef WITH_PACKAGER_VERSION
  1565. " ("WITH_PACKAGER_VERSION")"
  1566. # endif
  1567. # ifdef WITH_PACKAGER_BUG_REPORTS
  1568. "\nReport tcpprep bugs to " WITH_PACKAGER_BUG_REPORTS
  1569. # endif
  1570. "\n";
  1571. #endif
  1572. #ifndef __doxygen__
  1573. #endif /* __doxygen__ */
  1574. /**
  1575. * The option definitions for tcpprep. The one structure that
  1576. * binds them all.
  1577. */
  1578. tOptions tcpprepOptions = {
  1579. OPTIONS_STRUCT_VERSION,
  1580. 0, NULL, /* original argc + argv */
  1581. ( OPTPROC_BASE
  1582. + OPTPROC_ERRSTOP
  1583. + OPTPROC_SHORTOPT
  1584. + OPTPROC_LONGOPT
  1585. + OPTPROC_NO_REQ_OPT
  1586. + OPTPROC_NO_ARGS
  1587. + OPTPROC_GNUUSAGE ),
  1588. 0, NULL, /* current option index, current option */
  1589. NULL, NULL, zPROGNAME,
  1590. zRcName, zCopyright, zLicenseDescrip,
  1591. zFullVersion, apzHomeList, zUsageTitle,
  1592. zExplain, zDetail, optDesc,
  1593. zBugsAddr, /* address to send bugs to */
  1594. NULL, NULL, /* extensions/saved state */
  1595. optionUsage, /* usage procedure */
  1596. translate_option_strings, /* translation procedure */
  1597. /*
  1598. * Indexes to special options
  1599. */
  1600. { INDEX_OPT_MORE_HELP, /* more-help option index */
  1601. INDEX_OPT_SAVE_OPTS, /* save option index */
  1602. NO_EQUIVALENT, /* '-#' option index */
  1603. NO_EQUIVALENT /* index of default opt */
  1604. },
  1605. 29 /* full option count */, 25 /* user option count */,
  1606. tcpprep_full_usage, tcpprep_short_usage,
  1607. NULL, NULL,
  1608. PKGDATADIR, tcpprep_packager_info
  1609. };
  1610. #if ENABLE_NLS
  1611. /**
  1612. * This code is designed to translate translatable option text for the
  1613. * tcpprep program. These translations happen upon entry
  1614. * to optionProcess().
  1615. */
  1616. #include <stdio.h>
  1617. #include <stdlib.h>
  1618. #include <string.h>
  1619. #include <unistd.h>
  1620. #ifdef HAVE_DCGETTEXT
  1621. # include <gettext.h>
  1622. #endif
  1623. #include <autoopts/usage-txt.h>
  1624. static char * AO_gettext(char const * pz);
  1625. static void coerce_it(void ** s);
  1626. /**
  1627. * AutoGen specific wrapper function for gettext. It relies on the macro _()
  1628. * to convert from English to the target language, then strdup-duplicates the
  1629. * result string. It tries the "libopts" domain first, then whatever has been
  1630. * set via the \a textdomain(3) call.
  1631. *
  1632. * @param[in] pz the input text used as a lookup key.
  1633. * @returns the translated text (if there is one),
  1634. * or the original text (if not).
  1635. */
  1636. static char *
  1637. AO_gettext(char const * pz)
  1638. {
  1639. char * res;
  1640. if (pz == NULL)
  1641. return NULL;
  1642. #ifdef HAVE_DCGETTEXT
  1643. /*
  1644. * While processing the option_xlateable_txt data, try to use the
  1645. * "libopts" domain. Once we switch to the option descriptor data,
  1646. * do *not* use that domain.
  1647. */
  1648. if (option_xlateable_txt.field_ct != 0) {
  1649. res = dgettext("libopts", pz);
  1650. if (res == pz)
  1651. res = (char *)VOIDP(_(pz));
  1652. } else
  1653. res = (char *)VOIDP(_(pz));
  1654. #else
  1655. res = (char *)VOIDP(_(pz));
  1656. #endif
  1657. if (res == pz)
  1658. return res;
  1659. res = strdup(res);
  1660. if (res == NULL) {
  1661. fputs(_("No memory for duping translated strings\n"), stderr);
  1662. exit(TCPPREP_EXIT_FAILURE);
  1663. }
  1664. return res;
  1665. }
  1666. /**
  1667. * All the pointers we use are marked "* const", but they are stored in
  1668. * writable memory. Coerce the mutability and set the pointer.
  1669. */
  1670. static void coerce_it(void ** s) { *s = AO_gettext(*s);
  1671. }
  1672. /**
  1673. * Translate all the translatable strings in the tcpprepOptions
  1674. * structure defined above. This is done only once.
  1675. */
  1676. static void
  1677. translate_option_strings(void)
  1678. {
  1679. tOptions * const opts = &tcpprepOptions;
  1680. /*
  1681. * Guard against re-translation. It won't work. The strings will have
  1682. * been changed by the first pass through this code. One shot only.
  1683. */
  1684. if (option_xlateable_txt.field_ct != 0) {
  1685. /*
  1686. * Do the translations. The first pointer follows the field count
  1687. * field. The field count field is the size of a pointer.
  1688. */
  1689. char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
  1690. int ix = option_xlateable_txt.field_ct;
  1691. do {
  1692. ppz++; /* skip over field_ct */
  1693. *ppz = AO_gettext(*ppz);
  1694. } while (--ix > 0);
  1695. /* prevent re-translation and disable "libopts" domain lookup */
  1696. option_xlateable_txt.field_ct = 0;
  1697. coerce_it(VOIDP(&(opts->pzCopyright)));
  1698. coerce_it(VOIDP(&(opts->pzCopyNotice)));
  1699. coerce_it(VOIDP(&(opts->pzFullVersion)));
  1700. coerce_it(VOIDP(&(opts->pzUsageTitle)));
  1701. coerce_it(VOIDP(&(opts->pzExplain)));
  1702. coerce_it(VOIDP(&(opts->pzDetail)));
  1703. {
  1704. tOptDesc * od = opts->pOptDesc;
  1705. for (ix = opts->optCt; ix > 0; ix--, od++)
  1706. coerce_it(VOIDP(&(od->pzText)));
  1707. }
  1708. }
  1709. }
  1710. #endif /* ENABLE_NLS */
  1711. #ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
  1712. /** I18N function strictly for xgettext. Do not compile. */
  1713. static void bogus_function(void) {
  1714. /* TRANSLATORS:
  1715. The following dummy function was crated solely so that xgettext can
  1716. extract the correct strings. These strings are actually referenced
  1717. by a field name in the tcpprepOptions structure noted in the
  1718. comments below. The literal text is defined in tcpprep_opt_strs.
  1719. NOTE: the strings below are segmented with respect to the source string
  1720. tcpprep_opt_strs. The strings above are handed off for translation
  1721. at run time a paragraph at a time. Consequently, they are presented here
  1722. for translation a paragraph at a time.
  1723. ALSO: often the description for an option will reference another option
  1724. by name. These are set off with apostrophe quotes (I hope). Do not
  1725. translate option names.
  1726. */
  1727. /* referenced via tcpprepOptions.pzCopyright */
  1728. puts(_("tcpprep (tcpprep)\n\
  1729. Copyright (C) 2000-2018 Aaron Turner and Fred Klassen, all rights reserved.\n\
  1730. This is free software. It is licensed for use, modification and\n\
  1731. redistribution under the terms of the GNU General Public License,\n\
  1732. version 3 or later <http://gnu.org/licenses/gpl.html>\n"));
  1733. /* referenced via tcpprepOptions.pzCopyNotice */
  1734. puts(_("tcpprep is free software: you can redistribute it and/or modify it under\n\
  1735. the terms of the GNU General Public License as published by the Free\n\
  1736. Software Foundation, either version 3 of the License, or (at your option)\n\
  1737. any later version.\n\n"));
  1738. puts(_("tcpprep is distributed in the hope that it will be useful, but WITHOUT ANY\n\
  1739. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n\
  1740. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n\
  1741. details.\n\n"));
  1742. puts(_("You should have received a copy of the GNU General Public License along\n\
  1743. with this program. If not, see <http://www.gnu.org/licenses/>.\n"));
  1744. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1745. puts(_("Enable debugging output"));
  1746. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1747. puts(_("Auto-split mode"));
  1748. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1749. puts(_("CIDR-split mode"));
  1750. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1751. puts(_("Regex-split mode"));
  1752. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1753. puts(_("Port-split mode"));
  1754. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1755. puts(_("Source MAC split mode"));
  1756. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1757. puts(_("Matches to be client instead of server"));
  1758. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1759. puts(_("Embedded cache file comment"));
  1760. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1761. puts(_("Do not embed any cache file comment"));
  1762. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1763. puts(_("Include only packets matching rule"));
  1764. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1765. puts(_("Exclude any packet matching this rule"));
  1766. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1767. puts(_("Output cache file"));
  1768. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1769. puts(_("Input pcap file to process"));
  1770. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1771. puts(_("Print embedded comment in the specified cache file"));
  1772. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1773. puts(_("Print basic info from the specified cache file"));
  1774. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1775. puts(_("Print statistical information about the specified cache file"));
  1776. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1777. puts(_("Load services file for server ports"));
  1778. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1779. puts(_("Send non-IP traffic out server interface"));
  1780. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1781. puts(_("Ratio of client to server packets"));
  1782. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1783. puts(_("Minimum network mask length in auto mode"));
  1784. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1785. puts(_("Maximum network mask length in auto mode"));
  1786. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1787. puts(_("Print decoded packets via tcpdump to STDOUT"));
  1788. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1789. puts(_("Arguments passed to tcpdump decoder"));
  1790. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1791. puts(_("Print version information"));
  1792. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1793. puts(_("Display less usage information and exit"));
  1794. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1795. puts(_("display extended usage information and exit"));
  1796. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1797. puts(_("extended usage information passed thru pager"));
  1798. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1799. puts(_("save the option state to a config file"));
  1800. /* referenced via tcpprepOptions.pOptDesc->pzText */
  1801. puts(_("load options from a config file"));
  1802. /* referenced via tcpprepOptions.pzUsageTitle */
  1803. puts(_("tcpprep (tcpprep) - Create a tcpreplay cache cache file from a pcap file.\n\
  1804. Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
  1805. /* referenced via tcpprepOptions.pzExplain */
  1806. puts(_("tcpprep is a 'pcap(3)' file pre-processor which creates a cache file which\n\
  1807. provides \"rules\" for 'tcprewrite(1)' and 'tcpreplay(1)' on how to process\n\
  1808. and send packets.\n"));
  1809. /* referenced via tcpprepOptions.pzDetail */
  1810. puts(_("The basic operation of tcpreplay is to resend all packets from the input\n\
  1811. file(s) out a single file. Tcpprep processes a pcap file and applies a set\n\
  1812. of user-specified rules to create a cache file which tells tcpreplay\n\
  1813. whether or not to send each packet and which interface the packet should be\n\
  1814. sent out of.\n\n"));
  1815. puts(_("For more details, please see the Tcpreplay Manual at:\n\
  1816. http://tcpreplay.appneta.com\n"));
  1817. /* referenced via tcpprepOptions.pzFullUsage */
  1818. puts(_("<<<NOT-FOUND>>>"));
  1819. /* referenced via tcpprepOptions.pzShortUsage */
  1820. puts(_("<<<NOT-FOUND>>>"));
  1821. /* LIBOPTS-MESSAGES: */
  1822. #line 67 "../autoopts.c"
  1823. puts(_("allocation of %d bytes failed\n"));
  1824. #line 93 "../autoopts.c"
  1825. puts(_("allocation of %d bytes failed\n"));
  1826. #line 53 "../init.c"
  1827. puts(_("AutoOpts function called without option descriptor\n"));
  1828. #line 86 "../init.c"
  1829. puts(_("\tThis exceeds the compiled library version: "));
  1830. #line 84 "../init.c"
  1831. puts(_("Automated Options Processing Error!\n"
  1832. "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
  1833. #line 80 "../autoopts.c"
  1834. puts(_("realloc of %d bytes at 0x%p failed\n"));
  1835. #line 88 "../init.c"
  1836. puts(_("\tThis is less than the minimum library version: "));
  1837. #line 121 "../version.c"
  1838. puts(_("Automated Options version %s\n"
  1839. "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
  1840. #line 87 "../makeshell.c"
  1841. puts(_("(AutoOpts bug): %s.\n"));
  1842. #line 90 "../reset.c"
  1843. puts(_("optionResetOpt() called, but reset-option not configured"));
  1844. #line 295 "../usage.c"
  1845. puts(_("could not locate the 'help' option"));
  1846. #line 336 "../autoopts.c"
  1847. puts(_("optionProcess() was called with invalid data"));
  1848. #line 751 "../usage.c"
  1849. puts(_("invalid argument type specified"));
  1850. #line 598 "../find.c"
  1851. puts(_("defaulted to option with optional arg"));
  1852. #line 76 "../alias.c"
  1853. puts(_("aliasing option is out of range."));
  1854. #line 235 "../enum.c"
  1855. puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
  1856. #line 108 "../find.c"
  1857. puts(_(" The following options match:\n"));
  1858. #line 293 "../find.c"
  1859. puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
  1860. #line 161 "../check.c"
  1861. puts(_("%s: Command line arguments required\n"));
  1862. #line 43 "../alias.c"
  1863. puts(_("%d %s%s options allowed\n"));
  1864. #line 94 "../makeshell.c"
  1865. puts(_("%s error %d (%s) calling %s for '%s'\n"));
  1866. #line 306 "../makeshell.c"
  1867. puts(_("interprocess pipe"));
  1868. #line 168 "../version.c"
  1869. puts(_("error: version option argument '%c' invalid. Use:\n"
  1870. "\t'v' - version only\n"
  1871. "\t'c' - version and copyright\n"
  1872. "\t'n' - version and full copyright notice\n"));
  1873. #line 58 "../check.c"
  1874. puts(_("%s error: the '%s' and '%s' options conflict\n"));
  1875. #line 217 "../find.c"
  1876. puts(_("%s: The '%s' option has been disabled."));
  1877. #line 430 "../find.c"
  1878. puts(_("%s: The '%s' option has been disabled."));
  1879. #line 38 "../alias.c"
  1880. puts(_("-equivalence"));
  1881. #line 469 "../find.c"
  1882. puts(_("%s: illegal option -- %c\n"));
  1883. #line 110 "../reset.c"
  1884. puts(_("%s: illegal option -- %c\n"));
  1885. #line 271 "../find.c"
  1886. puts(_("%s: illegal option -- %s\n"));
  1887. #line 755 "../find.c"
  1888. puts(_("%s: illegal option -- %s\n"));
  1889. #line 118 "../reset.c"
  1890. puts(_("%s: illegal option -- %s\n"));
  1891. #line 335 "../find.c"
  1892. puts(_("%s: unknown vendor extension option -- %s\n"));
  1893. #line 160 "../enum.c"
  1894. puts(_(" or an integer from %d through %d\n"));
  1895. #line 170 "../enum.c"
  1896. puts(_(" or an integer from %d through %d\n"));
  1897. #line 750 "../usage.c"
  1898. puts(_("%s error: invalid option descriptor for %s\n"));
  1899. #line 1084 "../usage.c"
  1900. puts(_("%s error: invalid option descriptor for %s\n"));
  1901. #line 385 "../find.c"
  1902. puts(_("%s: invalid option name: %s\n"));
  1903. #line 527 "../find.c"
  1904. puts(_("%s: The '%s' option requires an argument.\n"));
  1905. #line 156 "../autoopts.c"
  1906. puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
  1907. "\t'%s' and '%s'."));
  1908. #line 94 "../check.c"
  1909. puts(_("%s error: The %s option is required\n"));
  1910. #line 632 "../find.c"
  1911. puts(_("%s: The '%s' option cannot have an argument.\n"));
  1912. #line 151 "../check.c"
  1913. puts(_("%s: Command line arguments are not allowed.\n"));
  1914. #line 536 "../save.c"
  1915. puts(_("error %d (%s) creating %s\n"));
  1916. #line 235 "../enum.c"
  1917. puts(_("%s error: '%s' does not match any %s keywords.\n"));
  1918. #line 93 "../reset.c"
  1919. puts(_("%s error: The '%s' option requires an argument.\n"));
  1920. #line 186 "../save.c"
  1921. puts(_("error %d (%s) stat-ing %s\n"));
  1922. #line 239 "../save.c"
  1923. puts(_("error %d (%s) stat-ing %s\n"));
  1924. #line 143 "../restore.c"
  1925. puts(_("%s error: no saved option state\n"));
  1926. #line 231 "../autoopts.c"
  1927. puts(_("'%s' is not a command line option.\n"));
  1928. #line 113 "../time.c"
  1929. puts(_("%s error: '%s' is not a recognizable date/time.\n"));
  1930. #line 131 "../save.c"
  1931. puts(_("'%s' not defined\n"));
  1932. #line 50 "../time.c"
  1933. puts(_("%s error: '%s' is not a recognizable time duration.\n"));
  1934. #line 92 "../check.c"
  1935. puts(_("%s error: The %s option must appear %d times.\n"));
  1936. #line 165 "../numeric.c"
  1937. puts(_("%s error: '%s' is not a recognizable number.\n"));
  1938. #line 201 "../enum.c"
  1939. puts(_("%s error: %s exceeds %s keyword count\n"));
  1940. #line 333 "../usage.c"
  1941. puts(_("Try '%s %s' for more information.\n"));
  1942. #line 45 "../alias.c"
  1943. puts(_("one %s%s option allowed\n"));
  1944. #line 208 "../makeshell.c"
  1945. puts(_("standard output"));
  1946. #line 943 "../makeshell.c"
  1947. puts(_("standard output"));
  1948. #line 277 "../usage.c"
  1949. puts(_("standard output"));
  1950. #line 418 "../usage.c"
  1951. puts(_("standard output"));
  1952. #line 628 "../usage.c"
  1953. puts(_("standard output"));
  1954. #line 175 "../version.c"
  1955. puts(_("standard output"));
  1956. #line 277 "../usage.c"
  1957. puts(_("standard error"));
  1958. #line 418 "../usage.c"
  1959. puts(_("standard error"));
  1960. #line 628 "../usage.c"
  1961. puts(_("standard error"));
  1962. #line 175 "../version.c"
  1963. puts(_("standard error"));
  1964. #line 208 "../makeshell.c"
  1965. puts(_("write"));
  1966. #line 943 "../makeshell.c"
  1967. puts(_("write"));
  1968. #line 276 "../usage.c"
  1969. puts(_("write"));
  1970. #line 417 "../usage.c"
  1971. puts(_("write"));
  1972. #line 627 "../usage.c"
  1973. puts(_("write"));
  1974. #line 174 "../version.c"
  1975. puts(_("write"));
  1976. #line 60 "../numeric.c"
  1977. puts(_("%s error: %s option value %ld is out of range.\n"));
  1978. #line 44 "../check.c"
  1979. puts(_("%s error: %s option requires the %s option\n"));
  1980. #line 130 "../save.c"
  1981. puts(_("%s warning: cannot save options - %s not regular file\n"));
  1982. #line 185 "../save.c"
  1983. puts(_("%s warning: cannot save options - %s not regular file\n"));
  1984. #line 238 "../save.c"
  1985. puts(_("%s warning: cannot save options - %s not regular file\n"));
  1986. #line 257 "../save.c"
  1987. puts(_("%s warning: cannot save options - %s not regular file\n"));
  1988. #line 535 "../save.c"
  1989. puts(_("%s warning: cannot save options - %s not regular file\n"));
  1990. /* END-LIBOPTS-MESSAGES */
  1991. /* USAGE-TEXT: */
  1992. #line 876 "../usage.c"
  1993. puts(_("\t\t\t\t- an alternate for '%s'\n"));
  1994. #line 1151 "../usage.c"
  1995. puts(_("Version, usage and configuration options:"));
  1996. #line 927 "../usage.c"
  1997. puts(_("\t\t\t\t- default option for unnamed options\n"));
  1998. #line 840 "../usage.c"
  1999. puts(_("\t\t\t\t- disabled as '--%s'\n"));
  2000. #line 1120 "../usage.c"
  2001. puts(_(" --- %-14s %s\n"));
  2002. #line 1118 "../usage.c"
  2003. puts(_("This option has been disabled"));
  2004. #line 867 "../usage.c"
  2005. puts(_("\t\t\t\t- enabled by default\n"));
  2006. #line 40 "../alias.c"
  2007. puts(_("%s error: only "));
  2008. #line 1197 "../usage.c"
  2009. puts(_(" - examining environment variables named %s_*\n"));
  2010. #line 168 "../file.c"
  2011. puts(_("\t\t\t\t- file must not pre-exist\n"));
  2012. #line 172 "../file.c"
  2013. puts(_("\t\t\t\t- file must pre-exist\n"));
  2014. #line 383 "../usage.c"
  2015. puts(_("Options are specified by doubled hyphens and their name or by a single\n"
  2016. "hyphen and the flag character.\n"));
  2017. #line 921 "../makeshell.c"
  2018. puts(_("\n"
  2019. "= = = = = = = =\n\n"
  2020. "This incarnation of genshell will produce\n"
  2021. "a shell script to parse the options for %s:\n\n"));
  2022. #line 167 "../enum.c"
  2023. puts(_(" or an integer mask with any of the lower %d bits set\n"));
  2024. #line 900 "../usage.c"
  2025. puts(_("\t\t\t\t- is a set membership option\n"));
  2026. #line 921 "../usage.c"
  2027. puts(_("\t\t\t\t- must appear between %d and %d times\n"));
  2028. #line 385 "../usage.c"
  2029. puts(_("Options are specified by single or double hyphens and their name.\n"));
  2030. #line 907 "../usage.c"
  2031. puts(_("\t\t\t\t- may appear multiple times\n"));
  2032. #line 894 "../usage.c"
  2033. puts(_("\t\t\t\t- may not be preset\n"));
  2034. #line 1312 "../usage.c"
  2035. puts(_(" Arg Option-Name Description\n"));
  2036. #line 1248 "../usage.c"
  2037. puts(_(" Flg Arg Option-Name Description\n"));
  2038. #line 1306 "../usage.c"
  2039. puts(_(" Flg Arg Option-Name Description\n"));
  2040. #line 1307 "../usage.c"
  2041. puts(_(" %3s %s"));
  2042. #line 1313 "../usage.c"
  2043. puts(_(" %3s %s"));
  2044. #line 390 "../usage.c"
  2045. puts(_("The '-#<number>' option may omit the hash char\n"));
  2046. #line 386 "../usage.c"
  2047. puts(_("All arguments are named options.\n"));
  2048. #line 974 "../usage.c"
  2049. puts(_(" - reading file %s"));
  2050. #line 412 "../usage.c"
  2051. puts(_("\n"
  2052. "Please send bug reports to: <%s>\n"));
  2053. #line 100 "../version.c"
  2054. puts(_("\n"
  2055. "Please send bug reports to: <%s>\n"));
  2056. #line 129 "../version.c"
  2057. puts(_("\n"
  2058. "Please send bug reports to: <%s>\n"));
  2059. #line 906 "../usage.c"
  2060. puts(_("\t\t\t\t- may NOT appear - preset only\n"));
  2061. #line 947 "../usage.c"
  2062. puts(_("\n"
  2063. "The following option preset mechanisms are supported:\n"));
  2064. #line 1195 "../usage.c"
  2065. puts(_("\n"
  2066. "The following option preset mechanisms are supported:\n"));
  2067. #line 685 "../usage.c"
  2068. puts(_("prohibits these options:\n"));
  2069. #line 680 "../usage.c"
  2070. puts(_("prohibits the option '%s'\n"));
  2071. #line 81 "../numeric.c"
  2072. puts(_("%s%ld to %ld"));
  2073. #line 79 "../numeric.c"
  2074. puts(_("%sgreater than or equal to %ld"));
  2075. #line 75 "../numeric.c"
  2076. puts(_("%s%ld exactly"));
  2077. #line 68 "../numeric.c"
  2078. puts(_("%sit must lie in one of the ranges:\n"));
  2079. #line 68 "../numeric.c"
  2080. puts(_("%sit must be in the range:\n"));
  2081. #line 88 "../numeric.c"
  2082. puts(_(", or\n"));
  2083. #line 66 "../numeric.c"
  2084. puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
  2085. #line 77 "../numeric.c"
  2086. puts(_("%sless than or equal to %ld"));
  2087. #line 393 "../usage.c"
  2088. puts(_("Operands and options may be intermixed. They will be reordered.\n"));
  2089. #line 655 "../usage.c"
  2090. puts(_("requires the option '%s'\n"));
  2091. #line 658 "../usage.c"
  2092. puts(_("requires these options:\n"));
  2093. #line 1324 "../usage.c"
  2094. puts(_(" Arg Option-Name Req? Description\n"));
  2095. #line 1318 "../usage.c"
  2096. puts(_(" Flg Arg Option-Name Req? Description\n"));
  2097. #line 168 "../enum.c"
  2098. puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
  2099. "will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
  2100. "will set them all. Multiple entries may be passed as an option\n"
  2101. "argument list.\n"));
  2102. #line 913 "../usage.c"
  2103. puts(_("\t\t\t\t- may appear up to %d times\n"));
  2104. #line 77 "../enum.c"
  2105. puts(_("The valid \"%s\" option keywords are:\n"));
  2106. #line 1155 "../usage.c"
  2107. puts(_("The next option supports vendor supported extra options:"));
  2108. #line 776 "../usage.c"
  2109. puts(_("These additional options are:"));
  2110. /* END-USAGE-TEXT */
  2111. }
  2112. #endif /* uncompilable code */
  2113. #ifdef __cplusplus
  2114. }
  2115. #endif
  2116. /* tcpprep_opts.c ends here */