@@ -34,7 +34,7 @@ Out-of-tree build (used by CI):
3434```
3535mkdir build && cd build
3636../autogen.sh
37- ../configure --disable-local-libopts -- enable-debug --enable-test-hexdump
37+ ../configure --enable-debug --enable-test-hexdump
3838make
3939```
4040
@@ -47,8 +47,9 @@ Useful `./configure` flags when working on specific areas:
4747 OS-specific, e.g. ` eth0 ` on Linux, ` en0 ` on macOS — see ` configure.ac ` )
4848- ` --enable-test-hexdump ` - hexdump the pcap on test failure
4949
50- Requires ` libpcap ` (and ` autogen ` /AutoOpts to regenerate ` *_opts.def ` derived files). On Debian/Ubuntu:
51- ` apt install autogen libpcap-dev automake autoconf libtool ` .
50+ Requires ` libpcap ` . ` asciidoctor ` (Ruby) is only needed to (re)generate the man pages from their
51+ ` docs/*.adoc ` sources — release tarballs ship prebuilt man pages. On Debian/Ubuntu:
52+ ` apt install libpcap-dev automake autoconf libtool asciidoctor ` .
5253
5354## Tests
5455
@@ -96,26 +97,34 @@ Notes:
9697 packet headers belongs here, not in ` tcprewrite.c ` directly, since ` tcpbridge ` depends on the same logic.
9798- ` src/tcpedit/plugins/ ` - DLT (link-layer type) plugins (` dlt_en10mb ` , ` dlt_ieee80211 ` , ` dlt_raw ` ,
9899 ` dlt_linuxsll ` , ` dlt_hdlc ` , ` dlt_loop ` , ` dlt_null ` , ` dlt_pppserial ` , ` dlt_radiotap ` , ` dlt_jnpr_ether ` ,
99- ` dlt_user ` , ...) — each implements the same interface (see ` dlt_plugins.c ` / ` dlt_opts.def ` ) to translate
100+ ` dlt_user ` , ...) — each implements the same interface (see ` dlt_plugins.c ` ) to translate
100101 a given link layer to/from Ethernet-equivalent processing. ` dlt_template ` /` dlt_template.sh ` scaffold a
101102 new plugin. Adding a new DLT means adding a plugin here, not branching in generic code.
102103- ` src/fragroute/ ` - vendored/adapted fragroute packet-mangling modules (delay, drop, dup, IP/TCP option
103104 and fragmentation mangling, chaff, reordering) used for traffic-shaping tests.
104105- ` lib/ ` - small vendored utility code (` strlcpy ` /` strlcat ` , ` queue.h ` , ` sll.h ` , ` tree.h ` ).
105- - ` libopts/ ` - GNU AutoOpts "tearoff" used to generate CLI parsing.
106106- ` test/ ` - fixtures and autotools test targets (see Tests section).
107- - ` docs/ ` - ` HACKING ` (contribution/coding-standard doc), ` CHANGELOG ` , ` INSTALL ` , ` SECURITY.md ` , plus a
108- ` Makefile.am ` that renders the already-built man pages (generated into ` src/ ` from the ` *_opts.def `
109- files, see below) to HTML for the website.
110-
111- ### CLI option definitions (` *_opts.def ` )
112- Each binary's command-line options are declared declaratively in an AutoOpts ` .def ` file
113- (` src/tcpreplay_opts.def ` , ` src/tcpprep_opts.def ` , ` src/tcprewrite_opts.def ` ,
114- ` src/tcpedit/tcpedit_opts.def ` , etc.), not hand-written ` getopt ` code. ` autogen ` (AutoGen, from the
115- same project as AutoOpts) turns these into generated ` *_opts.c ` /` .h ` and man pages at build time (see
116- the ` .def ` dependency rules in ` src/Makefile.am ` ). When adding/changing a CLI flag, edit the relevant
117- ` .def ` file rather than the generated ` _opts.c ` . ` tcprewrite ` /` tcpbridge ` include both their own opts
118- file and ` tcpedit/tcpedit_opts.def ` since they expose libtcpedit's rewrite options directly.
107+ - ` docs/ ` - ` HACKING ` (contribution/coding-standard doc), ` CHANGELOG ` , ` INSTALL ` , ` SECURITY.md ` , the
108+ ` *.1.adoc ` AsciiDoc man-page sources (see below), plus a ` Makefile.am ` that renders the man pages to
109+ HTML for the website with ` asciidoctor ` .
110+
111+ ### CLI option parsing (` *_args.c ` /` *_args.h ` )
112+ Each binary parses its command line with hand-written ` getopt_long(3) ` code in a matching
113+ ` src/<tool>_args.c ` /` .h ` pair (` tcpreplay_args.c ` , ` tcpprep_args.c ` , ` tcprewrite_args.c ` , ...), with
114+ shared helpers in ` src/common/args.c ` . The headers expose AutoOpts-style accessor macros (` HAVE_OPT ` ,
115+ ` OPT_ARG ` , ` OPT_VALUE_* ` ) so the consuming code (` *_api.c ` , ` send_packets.c ` , the tcpedit tree) reads
116+ options the same way it did before the AutoOpts removal. The shared libtcpedit rewrite options
117+ (` --portmap ` , ` --enet-* ` , DLT plugin options, ...) live in ` src/tcpedit/tcpedit_args.c ` and are pulled
118+ into ` tcprewrite ` , ` tcpbridge ` , and ` tcpreplay-edit ` 's option tables via
119+ ` tcpedit_args_long_options() ` /` tcpedit_args_handle() ` ; plugin code consumes them through the macros in
120+ ` src/tcpedit/tcpedit_stub.h ` (` tcpedit_optvals[] ` ). Option constraints (mutually exclusive flags,
121+ "requires" relationships) are enforced in each parser's ` validate_constraints() ` .
122+
123+ ** Documentation is no longer generated from the option definitions.** Man pages are hand-maintained
124+ AsciiDoc in ` docs/*.1.adoc ` (shared tcpedit options in ` docs/tcpedit_options.adoc ` ) and rendered with
125+ ` asciidoctor ` (see the rules in ` src/Makefile.am ` ). When adding/changing a CLI flag you must update
126+ ** three** places in tandem: the ` *_args.c ` option table + handler + ` validate_constraints() ` , the
127+ usage text in the same file's ` print_usage() ` , and the corresponding ` docs/*.adoc ` man-page source.
119128
120129### Packet injection abstraction (` sendpacket_type_t ` )
121130` src/common/sendpacket.c ` /` sendpacket.h ` abstract over the many OS-specific ways to inject packets:
0 commit comments