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