4 This file contains some notes on building and using libpcap for MS-DOS.
5 Look in `README' and `pcap.man' for usage and details. These targets are
8 - Borland C 4.0+ small or large model.
9 - Metaware HighC 3.1+ with PharLap DOS-extender
10 - GNU C 2.7+ with djgpp 2.01+ DOS extender
11 - Watcom C 11.x with DOS4GW extender
13 Note: the files in the libpcap.zip contains short trucated filenames.
14 So for djgpp to work with these, disable the use of long file names by
15 setting "LFN=n" in the environment.
17 Files specific to DOS are pcap-dos.[ch] and the assembly and C files in
18 the MSDOS sub-directory. Remember to built lipcap libraries from the top
19 install directory. And not from the MSDOS sub-directory.
25 DOS-libpcap currently only works reliably with a real-mode Ethernet packet-
26 driver. This driver must be installed prior to using any program (e.g.
27 tcpdump) compiled with libpcap. Work is underway to implement protected-
28 mode drivers for 32-bit targets (djgpp only). The 3Com 3c509 driver is
29 working almost perfectly. Due to lack of LAN-cards, I've not had the
30 opporunity to test other drivers. These 32-bit drivers are modified
37 The following packages and tools must be present for all targets.
39 1. Watt-32 tcp/ip library. This library is *not* used to send or
40 receive network data. It's mostly used to access the 'hosts'
41 file and other <netdb.h> features. Get 'watt32s*.zip' at:
43 http://www.bgnett.no/~giva/
45 2. Exception handler and disassember library (libexc.a) is needed if
46 "USE_EXCEPT = 1" in common.dj. Available at:
48 http://www.bgnett.no/~giva/misc/exc_dx07.zip
50 3. Flex & Bison is used to generate parser for the filter handler
53 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/flx254b.zip
54 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsn128b.zip
56 4. NASM assembler v 0.98 or later is required when building djgpp and
59 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/nasm098p.zip
61 5. sed (Stream Editor) is required for doing `make depend'.
63 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed*.zip
65 A touch tool to update the time-stamp of a file. E.g.
66 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/grep*.zip
68 6. For djgpp rm.exe and cp.exe are required. These should already be
69 part of your djgpp installation. Also required (experimental at the
70 time) for djgpp is DLX 2.91 or later. This tool is for the generation
71 of dynamically loadable modules.
77 Follow these steps in building libpcap:
79 1. Make sure you've installed Watt-32 properly (see it's `INSTALL' file).
80 During that installation a environment variable `WATT_ROOT' is set.
81 This variable is used for building libpcap also (`WATT_INC' is
82 deducted from `WATT_ROOT'). djgpp users should also define environment
83 variables `C_INCLUDE_PATH' and `LIBRARY_PATH' to point to the include
84 directory and library directory respectively. E.g. put this in your
86 set C_INCLUDE_PATH=c:/net/watt/inc
87 set LIBRARY_PATH=c:/net/watt/lib
89 2. Revise the msdos/common.dj file for your djgpp/gcc installation;
90 - change the value of `GCCLIB' to match location of libgcc.a.
91 - set `USE_32BIT_DRIVERS = 1' to build 32-bit driver objects.
94 3. Build pcap by using appropriate makefile. For djgpp, use:
95 `make -f msdos/makefile.dj' (i.e. GNU `make')
97 For a Watcom target say:
98 `wmake -f msdos\makefile.wc'
100 For a Borland target say:
101 `maker -f msdos\Makefile pcap_bc.lib' (Borland's `maker.exe')
103 And for a HighC/Pharlap target say:
104 `maker -f msdos\Makefile pcap_hc.lib' (Borland's `maker.exe')
106 You might like to change some `CFLAGS' -- only `DEBUG' define currently
107 have any effect. It shows a rotating "fan" in upper right corner of
108 screen. Remove `DEBUG' if you don't like it. You could add
109 `-fomit-frame-pointer' to `CFLAGS' to speed up the generated code.
110 But note, this makes debugging and crash-traceback difficult. Only
111 add it if you're fully confident your application is 100% stable.
113 Note: Code in `USE_NDIS2' does not work at the moment.
115 4. The resulting libraries are put in current directory. There's no
116 test-program for `libpcap'. Linking the library with `tcpdump' is
117 the ultimate test anyway.
121 Extensions to libpcap
122 ---------------------
124 I've included some extra functions to DOS-libpcap:
126 `pcap_config_hook (const char *name, const char *value)'
128 Allows an application to set values of internal libpcap variables.
129 `name' is typically a left-side keyword with an associated `value'
130 that is called from application's configure process (see tcpdump's
131 config.c file). libpcap keeps a set of tables that are searched for
132 a name/value match. Currently only used to set debug-levels and
133 parameters for the 32-bit network drivers.
135 `pcap_set_wait (pcap_t *, void (*)(void), int)' :
137 Only effective when reading offline traffic from dump-files.
138 Function `pcap_offline_read()' will wait (and optionally yield)
139 before printing next packet. This will simulate the pace the packets
140 where actually recorded.
142 `pcap_verbose (int mode)' :
143 Sets the internal verbosity mode. Currently only effective while
144 capturing packets to file (the `-w' option in tcpdump). `pcap_dump()'
145 will print to `stderr' number of packets dumped.
152 Gisle Vanem <giva@bgnett.no>
153 <gvanem@broadpark.no>