From e2646b8f68eb2c416000d12011eda825437fb821 Mon Sep 17 00:00:00 2001 From: rpaulo Date: Fri, 29 Oct 2010 18:50:38 +0000 Subject: Remove unused files. --- contrib/libpcap/ChmodBPF/ChmodBPF | 33 - contrib/libpcap/ChmodBPF/StartupParameters.plist | 4 - contrib/libpcap/FREEBSD-Xlist | 7 - contrib/libpcap/FREEBSD-upgrade | 35 - contrib/libpcap/README.Win32 | 46 - contrib/libpcap/README.aix | 81 -- contrib/libpcap/README.macosx | 74 -- contrib/libpcap/README.tru64 | 49 - contrib/libpcap/SUNOS4/nit_if.o.sparc | Bin 5212 -> 0 bytes contrib/libpcap/SUNOS4/nit_if.o.sun3 | Bin 4267 -> 0 bytes contrib/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c | Bin 5291 -> 0 bytes contrib/libpcap/Win32/Include/Gnuc.h | 46 - contrib/libpcap/Win32/Include/addrinfo.h | 146 --- contrib/libpcap/Win32/Include/arpa/nameser.h | 349 ------ contrib/libpcap/Win32/Include/bittypes.h | 139 --- contrib/libpcap/Win32/Include/cdecl_ext.h | 37 - contrib/libpcap/Win32/Include/inetprivate.h | 67 - contrib/libpcap/Win32/Include/ip6_misc.h | 163 --- contrib/libpcap/Win32/Include/net/if.h | 230 ---- contrib/libpcap/Win32/Include/net/netdb.h | 164 --- contrib/libpcap/Win32/Include/net/paths.h | 105 -- contrib/libpcap/Win32/Include/sockstorage.h | 38 - contrib/libpcap/Win32/Prj/libpcap.dsp | 168 --- contrib/libpcap/Win32/Prj/libpcap.dsw | 29 - contrib/libpcap/Win32/Src/ffs.c | 54 - contrib/libpcap/Win32/Src/gai_strerror.c | 83 -- contrib/libpcap/Win32/Src/getaddrinfo.c | 1120 ----------------- contrib/libpcap/Win32/Src/getnetbynm.c | 44 - contrib/libpcap/Win32/Src/getnetent.c | 119 -- contrib/libpcap/Win32/Src/getopt.c | 121 -- contrib/libpcap/Win32/Src/getservent.c | 125 -- contrib/libpcap/Win32/Src/inet_aton.c | 61 - contrib/libpcap/Win32/Src/inet_net.c | 101 -- contrib/libpcap/Win32/Src/inet_pton.c | 71 -- contrib/libpcap/msdos/bin2c.c | 43 - contrib/libpcap/msdos/common.dj | 80 -- contrib/libpcap/msdos/makefile | 184 --- contrib/libpcap/msdos/makefile.dj | 152 --- contrib/libpcap/msdos/makefile.wc | 131 -- contrib/libpcap/msdos/ndis2.c | 860 ------------- contrib/libpcap/msdos/ndis2.h | 559 --------- contrib/libpcap/msdos/ndis_0.asm | 188 --- contrib/libpcap/msdos/pkt_rx0.asm | 197 --- contrib/libpcap/msdos/pkt_rx1.s | 155 --- contrib/libpcap/msdos/pktdrvr.c | 1436 ---------------------- contrib/libpcap/msdos/pktdrvr.h | 153 --- contrib/libpcap/msdos/readme.dos | 162 --- contrib/libpcap/org.tcpdump.chmod_bpf.plist | 16 - 48 files changed, 8225 deletions(-) delete mode 100755 contrib/libpcap/ChmodBPF/ChmodBPF delete mode 100644 contrib/libpcap/ChmodBPF/StartupParameters.plist delete mode 100644 contrib/libpcap/FREEBSD-Xlist delete mode 100644 contrib/libpcap/FREEBSD-upgrade delete mode 100644 contrib/libpcap/README.Win32 delete mode 100644 contrib/libpcap/README.aix delete mode 100644 contrib/libpcap/README.macosx delete mode 100644 contrib/libpcap/README.tru64 delete mode 100644 contrib/libpcap/SUNOS4/nit_if.o.sparc delete mode 100644 contrib/libpcap/SUNOS4/nit_if.o.sun3 delete mode 100644 contrib/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c delete mode 100644 contrib/libpcap/Win32/Include/Gnuc.h delete mode 100644 contrib/libpcap/Win32/Include/addrinfo.h delete mode 100644 contrib/libpcap/Win32/Include/arpa/nameser.h delete mode 100644 contrib/libpcap/Win32/Include/bittypes.h delete mode 100644 contrib/libpcap/Win32/Include/cdecl_ext.h delete mode 100644 contrib/libpcap/Win32/Include/inetprivate.h delete mode 100644 contrib/libpcap/Win32/Include/ip6_misc.h delete mode 100644 contrib/libpcap/Win32/Include/net/if.h delete mode 100644 contrib/libpcap/Win32/Include/net/netdb.h delete mode 100644 contrib/libpcap/Win32/Include/net/paths.h delete mode 100644 contrib/libpcap/Win32/Include/sockstorage.h delete mode 100644 contrib/libpcap/Win32/Prj/libpcap.dsp delete mode 100644 contrib/libpcap/Win32/Prj/libpcap.dsw delete mode 100644 contrib/libpcap/Win32/Src/ffs.c delete mode 100644 contrib/libpcap/Win32/Src/gai_strerror.c delete mode 100644 contrib/libpcap/Win32/Src/getaddrinfo.c delete mode 100644 contrib/libpcap/Win32/Src/getnetbynm.c delete mode 100644 contrib/libpcap/Win32/Src/getnetent.c delete mode 100644 contrib/libpcap/Win32/Src/getopt.c delete mode 100644 contrib/libpcap/Win32/Src/getservent.c delete mode 100644 contrib/libpcap/Win32/Src/inet_aton.c delete mode 100644 contrib/libpcap/Win32/Src/inet_net.c delete mode 100644 contrib/libpcap/Win32/Src/inet_pton.c delete mode 100644 contrib/libpcap/msdos/bin2c.c delete mode 100644 contrib/libpcap/msdos/common.dj delete mode 100644 contrib/libpcap/msdos/makefile delete mode 100644 contrib/libpcap/msdos/makefile.dj delete mode 100644 contrib/libpcap/msdos/makefile.wc delete mode 100644 contrib/libpcap/msdos/ndis2.c delete mode 100644 contrib/libpcap/msdos/ndis2.h delete mode 100644 contrib/libpcap/msdos/ndis_0.asm delete mode 100644 contrib/libpcap/msdos/pkt_rx0.asm delete mode 100644 contrib/libpcap/msdos/pkt_rx1.s delete mode 100644 contrib/libpcap/msdos/pktdrvr.c delete mode 100644 contrib/libpcap/msdos/pktdrvr.h delete mode 100644 contrib/libpcap/msdos/readme.dos delete mode 100644 contrib/libpcap/org.tcpdump.chmod_bpf.plist diff --git a/contrib/libpcap/ChmodBPF/ChmodBPF b/contrib/libpcap/ChmodBPF/ChmodBPF deleted file mode 100755 index ee37121..0000000 --- a/contrib/libpcap/ChmodBPF/ChmodBPF +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh - -. /etc/rc.common - -StartService () -{ - # - # Unfortunately, Mac OS X's devfs is based on the old FreeBSD - # one, not the current one, so there's no way to configure it - # to create BPF devices with particular owners or groups. - # This startup item will make it owned by the admin group, - # with permissions rw-rw----, so that anybody in the admin - # group can use programs that capture or send raw packets. - # - # Change this as appropriate for your site, e.g. to make - # it owned by a particular user without changing the permissions, - # so only that user and the super-user can capture or send raw - # packets, or give it the permissions rw-r-----, so that - # only the super-user can send raw packets but anybody in the - # admin group can capture packets. - # - chgrp admin /dev/bpf* - chmod g+rw /dev/bpf* -} - -StopService () -{ - return 0; -} - -RestartService () { StartService; } - -RunService "$1" diff --git a/contrib/libpcap/ChmodBPF/StartupParameters.plist b/contrib/libpcap/ChmodBPF/StartupParameters.plist deleted file mode 100644 index cba2166..0000000 --- a/contrib/libpcap/ChmodBPF/StartupParameters.plist +++ /dev/null @@ -1,4 +0,0 @@ -{ - Description = "Change BPF permissions"; - Provides = ("ChmodBPF"); -} diff --git a/contrib/libpcap/FREEBSD-Xlist b/contrib/libpcap/FREEBSD-Xlist deleted file mode 100644 index 948318c..0000000 --- a/contrib/libpcap/FREEBSD-Xlist +++ /dev/null @@ -1,7 +0,0 @@ -$FreeBSD$ -*/README.* -*/msdos -*/SUNOS4 -*/Win32 -*/ChmodBPF -*/*.plist diff --git a/contrib/libpcap/FREEBSD-upgrade b/contrib/libpcap/FREEBSD-upgrade deleted file mode 100644 index eea75c2..0000000 --- a/contrib/libpcap/FREEBSD-upgrade +++ /dev/null @@ -1,35 +0,0 @@ -$FreeBSD$ - -This directory contains virgin copies of the original distribution files -on a "vendor" branch. Do not, under any circumstances, attempt to upgrade -the files in this directory via patches and a cvs commit. - -To upgrade to a newer version of libpcap, when it is available: - 1. Unpack the new version into an empty directory. - [Do not make ANY changes to the files.] - - 2. Use the command: - cvs import -m 'Import of libpcap v' \ - -I SUNOS4 -I msdos -I Win32 -I missing \ - -I ChmodBPF -I linux-include \ - src/contrib/libpcap TCPDUMP_ORG v - - For example, to do the import of version 0.9.4, I typed: - cvs import -m 'Import of libpcap v0.9.4 \ - -I SUNOS4 -I msdos -I Win32 -I missing \ - -I ChmodBPF -I linux-include \ - src/contrib/libpcap TCPDUMP_ORG v0_9_4 - - 3. Follow the instructions printed out in step 2 to resolve any - conflicts between local FreeBSD changes and the newer version. - 4. Bump __FreeBSD_version in sys/param.h as appropriate - -Do not, under any circumstances, deviate from this procedure. - -To make local changes to libpcap, simply patch and commit to the main -branch (aka HEAD). Never make local changes on the TCPDUMP_ORG branch. - -All local changes should be submitted to "tcpdump-workers@tcpdump.org" for -inclusion in the next vendor release of tcpdump and libpcap. - -sam@freebsd.org - 4 September 2006 diff --git a/contrib/libpcap/README.Win32 b/contrib/libpcap/README.Win32 deleted file mode 100644 index 503836e..0000000 --- a/contrib/libpcap/README.Win32 +++ /dev/null @@ -1,46 +0,0 @@ -Under Win32, libpcap is integrated in the WinPcap packet capture system. -WinPcap provides a framework that allows libpcap to capture the packets -under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000 -and Windows XP. -WinPcap binaries and source code can be found at http://winpcap.polito.it: -they include also a developer's pack with all the necessary to compile -libpcap-based applications under Windows. - -How to compile libpcap with Visual Studio ------------------------------------------ - -In order to compile libpcap you will need: - -- version 6 (or higher) of Microsoft Visual Studio -- The November 2001 (or later) edition of Microsoft Platform -Software Development Kit (SDK), that contains some necessary includes -for IPv6 support. You can download it from http://www.microsoft.com/sdk -- the latest WinPcap sources from http://winpcap.polito.it/install - -The WinPcap source code already contains a recent (usually the latest -stable) version of libpcap. If you need to compile a different one, -simply download it from www.tcpdump.org and copy the sources in the -winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to -compile a libpcap source retrieved from the tcpdump.org Git, you will -have to create the scanner and the grammar by hand (with lex and yacc) -or with the cygnus makefile, since The Visual Studio project is not able -to build them. - -Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and -build wpcap.dll. wpcap.lib, the library file to link with the applications, -will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in -winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type -of binary that is being created. - -How to compile libpcap with Cygnus ----------------------------------- - -To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code -distribution and type "make". libwpcap.a, the library file to link with the -applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be -generated in winpcap\wpcap\prj. - -Remember, you CANNOT use the MSVC-generated .lib files with gcc, use -libwpcap.a instead. - -"make install" installs wpcap.dll in the Windows system folder. diff --git a/contrib/libpcap/README.aix b/contrib/libpcap/README.aix deleted file mode 100644 index b32fa58..0000000 --- a/contrib/libpcap/README.aix +++ /dev/null @@ -1,81 +0,0 @@ -Using BPF: - -(1) AIX 4.x's version of BPF is undocumented and somewhat unstandard; the - current BPF support code includes changes that should work around - that; it appears to compile and work on at least one AIX 4.3.3 - machine. - - Note that the BPF driver and the "/dev/bpf" devices might not exist - on your machine; AIX's tcpdump loads the driver and creates the - devices if they don't already exist. Our libpcap should do the - same, and the configure script should detect that it's on an AIX - system and choose BPF even if the devices aren't there. - -(2) If libpcap doesn't compile on your machine when configured to use - BPF, or if the workarounds fail to make it work correctly, you - should send to tcpdump-workers@lists.tcpdump.org a detailed bug - report (if the compile fails, send us the compile error messages; - if it compiles but fails to work correctly, send us as detailed as - possible a description of the symptoms, including indications of the - network link-layer type being wrong or time stamps being wrong). - - If you fix the problems yourself, please submit a patch to - - http://sourceforge.net/projects/libpcap/ - - so we can incorporate them into the next release. - - If you don't fix the problems yourself, you can, as a workaround, - make libpcap use DLPI instead of BPF. - - This can be done by specifying the flag: - - --with-pcap=dlpi - - to the "configure" script for libpcap. - -If you use DLPI: - -(1) It is a good idea to have the latest version of the DLPI driver on - your system, since certain versions may be buggy and cause your AIX - system to crash. DLPI is included in the fileset bos.rte.tty. I - found that the DLPI driver that came with AIX 4.3.2 was buggy, and - had to upgrade to bos.rte.tty 4.3.2.4: - - lslpp -l bos.rte.tty - - bos.rte.tty 4.3.2.4 COMMITTED Base TTY Support and Commands - - Updates for AIX filesets can be obtained from: - ftp://service.software.ibm.com/aix/fixes/ - - These updates can be installed with the smit program. - -(2) After compiling libpcap, you need to make sure that the DLPI driver - is loaded. Type: - - strload -q -d dlpi - - If the result is: - - dlpi: yes - - then the DLPI driver is loaded correctly. - - If it is: - - dlpi: no - - Then you need to type: - - strload -f /etc/dlpi.conf - - Check again with strload -q -d dlpi that the dlpi driver is loaded. - - Alternatively, you can uncomment the lines for DLPI in - /etc/pse.conf and reboot the machine; this way DLPI will always - be loaded when you boot your system. - -(3) There appears to be a problem in the DLPI code in some versions of - AIX, causing a warning about DL_PROMISC_MULTI failing; this might - be responsible for DLPI not being able to capture outgoing packets. diff --git a/contrib/libpcap/README.macosx b/contrib/libpcap/README.macosx deleted file mode 100644 index 3dc9211..0000000 --- a/contrib/libpcap/README.macosx +++ /dev/null @@ -1,74 +0,0 @@ -As with other systems using BPF, Mac OS X allows users with read access -to the BPF devices to capture packets with libpcap and allows users with -write access to the BPF devices to send packets with libpcap. - -On some systems that use BPF, the BPF devices live on the root file -system, and the permissions and/or ownership on those devices can be -changed to give users other than root permission to read or write those -devices. - -On newer versions of FreeBSD, the BPF devices live on devfs, and devfs -can be configured to set the permissions and/or ownership of those -devices to give users other than root permission to read or write those -devices. - -On Mac OS X, the BPF devices live on devfs, but the OS X version of -devfs is based on an older (non-default) FreeBSD devfs, and that version -of devfs cannot be configured to set the permissions and/or ownership of -those devices. - -Therefore, we supply: - - a "startup item" for older versions of Mac OS X; - - a launchd daemon for Tiger and later versions of Mac OS X; - -Both of them will change the ownership of the BPF devices so that the -"admin" group owns them, and will change the permission of the BPF -devices to rw-rw----, so that all users in the "admin" group - i.e., all -users with "Allow user to administer this computer" turned on - have -both read and write access to them. - -The startup item is in the ChmodBPF directory in the source tree. A -/Library/StartupItems directory should be created if it doesn't already -exist, and the ChmodBPF directory should be copied to the -/Library/StartupItems directory (copy the entire directory, so that -there's a /Library/StartupItems/ChmodBPF directory, containing all the -files in the source tree's ChmodBPF directory; don't copy the individual -items in that directory to /Library/StartupItems). The ChmodBPF -directory, and all files under it, must be owned by root. Installing -the files won't immediately cause the startup item to be executed; it -will be executed on the next reboot. To change the permissions before -the reboot, run - - sudo SystemStarter start ChmodBPF - -The launchd daemon is the chmod_bpf script, plus the -org.tcpdump.chmod_bpf.plist launchd plist file. chmod_bpf should be -installed in /usr/local/bin/chmod_bpf, and org.tcpdump.chmod_bpf.plist -should be installed in /Library/LaunchDaemons. chmod_bpf, and -org.tcpdump.chmod_bpf.plist, must be owned by root. Installing the -script and plist file won't immediately cause the script to be executed; -it will be executed on the next reboot. To change the permissions -before the reboot, run - - sudo /usr/local/bin/chmod_bpf - -or - - sudo launchctl load /Library/LaunchDaemons/org.tcpdump.chmod_bpf.plist - -If you want to give a particular user permission to access the BPF -devices, rather than giving all administrative users permission to -access them, you can have the ChmodBPF/ChmodBPF script change the -ownership of /dev/bpf* without changing the permissions. If you want to -give a particular user permission to read and write the BPF devices and -give the administrative users permission to read but not write the BPF -devices, you can have the script change the owner to that user, the -group to "admin", and the permissions to rw-r-----. Other possibilities -are left as an exercise for the reader. - -(NOTE: due to a bug in Snow Leopard, if you change the permissions not -to grant write permission to everybody who should be allowed to capture -traffic, non-root users who cannot open the BPF devices for writing will -not be able to capture outgoing packets.) diff --git a/contrib/libpcap/README.tru64 b/contrib/libpcap/README.tru64 deleted file mode 100644 index 7fe1ef0..0000000 --- a/contrib/libpcap/README.tru64 +++ /dev/null @@ -1,49 +0,0 @@ -The following instructions are applicable to Tru64 UNIX -(formerly Digital UNIX (formerly DEC OSF/1)) version 4.0, and -probably to later versions as well; at least some options apply to -Digital UNIX 3.2 - perhaps all do. - -In order to use kernel packet filtering on this system, you have -to configure it in such a way: - -Kernel configuration --------------------- - -The packet filtering kernel option must be enabled at kernel -installation. If it was not the case, you can rebuild the kernel with -"doconfig -c" after adding the following line in the kernel -configuration file (/sys/conf/): - - option PACKETFILTER - -or use "doconfig" without any arguments to add the packet filter driver -option via the kernel option menu (see the system administration -documentation for information on how to do this). - -Device configuration --------------------- - -Devices used for packet filtering must be created thanks to -the following command (executed in the /dev directory): - - ./MAKEDEV pfilt - -Interface configuration ------------------------ - -In order to capture all packets on a network, you may want to allow -applications to put the interface on that network into "local copy" -mode, so that tcpdump can see packets sent by the host on which it's -running as well as packets received by that host, and to put the -interface into "promiscuous" mode, so that tcpdump can see packets on -the network segment not sent to the host on which it's running, by using -the pfconfig(1) command: - - pfconfig +c +p - -or allow application to put any interface into "local copy" or -"promiscuous" mode by using the command: - - pfconfig +c +p -a - -Note: all instructions given require root privileges. diff --git a/contrib/libpcap/SUNOS4/nit_if.o.sparc b/contrib/libpcap/SUNOS4/nit_if.o.sparc deleted file mode 100644 index d05073e..0000000 Binary files a/contrib/libpcap/SUNOS4/nit_if.o.sparc and /dev/null differ diff --git a/contrib/libpcap/SUNOS4/nit_if.o.sun3 b/contrib/libpcap/SUNOS4/nit_if.o.sun3 deleted file mode 100644 index c393fc6..0000000 Binary files a/contrib/libpcap/SUNOS4/nit_if.o.sun3 and /dev/null differ diff --git a/contrib/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c b/contrib/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c deleted file mode 100644 index ef01039..0000000 Binary files a/contrib/libpcap/SUNOS4/nit_if.o.sun4c.4.0.3c and /dev/null differ diff --git a/contrib/libpcap/Win32/Include/Gnuc.h b/contrib/libpcap/Win32/Include/Gnuc.h deleted file mode 100644 index 0bf4b73..0000000 --- a/contrib/libpcap/Win32/Include/Gnuc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/Gnuc.h,v 1.1 2002-08-01 08:33:05 risso Exp $ (LBL) */ - -/* Define __P() macro, if necessary */ - -#ifndef __P -#if __STDC__ -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -/* inline foo */ -#ifndef __cplusplus -#ifdef __GNUC__ -#define inline __inline -#else -#define inline -#endif -#endif - -/* - * Handle new and old "dead" routine prototypes - * - * For example: - * - * __dead void foo(void) __attribute__((volatile)); - * - */ -#ifdef __GNUC__ -#ifndef __dead -#define __dead volatile -#endif -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif -#else -#ifndef __dead -#define __dead -#endif -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif diff --git a/contrib/libpcap/Win32/Include/addrinfo.h b/contrib/libpcap/Win32/Include/addrinfo.h deleted file mode 100644 index 8cb2e65..0000000 --- a/contrib/libpcap/Win32/Include/addrinfo.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: addrinfo.h,v 1.1 2002-08-01 08:33:05 risso Exp $ */ - -#ifndef HAVE_ADDRINFO - -/* - * Error return codes from getaddrinfo() - */ -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_MAX 14 - -/* internal error */ -#define NETDB_INTERNAL -1 /* see errno */ - -/* - * Flag values for getaddrinfo() - */ -#define AI_PASSIVE 0x00000001 /* get address to use bind() */ -#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ -#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ -/* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) - -#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ -#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ -#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ -#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ -/* special recommended flags for getipnodebyname */ -#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) - -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; - -extern void freeaddrinfo (struct addrinfo *); -extern void freehostent (struct hostent *); -extern char *gai_strerror (int); -extern int getaddrinfo (const char *, const char *, - const struct addrinfo *, struct addrinfo **); -extern int getnameinfo (const struct sockaddr *, size_t, char *, - size_t, char *, size_t, int); -extern struct hostent *getipnodebyaddr (const void *, size_t, int, int *); -extern struct hostent *getipnodebyname (const char *, int, int, int *); -extern int inet_pton (int, const char *, void *); -extern const char *inet_ntop (int, const void *, char *, size_t); -#else - -#ifndef EAI_BADHINTS -#define EAI_BADHINTS 12 -#endif - -#ifndef EAI_PROTOCOL -#define EAI_PROTOCOL 13 -#endif - -#ifndef EAI_MAX -#define EAI_MAX 14 -#endif - -#ifndef NETDB_INTERNAL -#define NETDB_INTERNAL -1 /* see errno */ -#endif - -#ifndef AI_MASK -/* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) -#endif - -#endif /* HAVE_ADDRINFO */ - -/* - * Constants for getnameinfo() - */ -#ifndef NI_MAXHOST -#define NI_MAXHOST 1025 -#endif -#ifndef NI_MAXSERV -#define NI_MAXSERV 32 -#endif - -/* - * Flag values for getnameinfo() - */ -#ifndef NI_NOFQDN -#define NI_NOFQDN 0x00000001 -#endif -#ifndef NI_NUMERICHOST -#define NI_NUMERICHOST 0x00000002 -#endif -#ifndef NI_NAMEREQD -#define NI_NAMEREQD 0x00000004 -#endif -#ifndef NI_NUMERICSERV -#define NI_NUMERICSERV 0x00000008 -#endif -#ifndef NI_DGRAM -#define NI_DGRAM 0x00000010 -#endif - diff --git a/contrib/libpcap/Win32/Include/arpa/nameser.h b/contrib/libpcap/Win32/Include/arpa/nameser.h deleted file mode 100644 index 18f185c..0000000 --- a/contrib/libpcap/Win32/Include/arpa/nameser.h +++ /dev/null @@ -1,349 +0,0 @@ -/* - * ++Copyright++ 1983, 1989, 1993 - * - - * Copyright (c) 1983, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -/* - * @(#)nameser.h 8.1 (Berkeley) 6/2/93 - * nameser.h,v 1.2 1995/05/06 14:23:54 hjl Exp - */ - -#ifndef _NAMESER_H_ -#define _NAMESER_H_ - -#ifndef WIN32 -#include -#if (!defined(BSD)) || (BSD < 199306) -# include -#else -# include -#endif -#include -#else -#include -#define __LITTLE_ENDIAN 1 -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif - -/* - * revision information. this is the release date in YYYYMMDD format. - * it can change every day so the right thing to do with it is use it - * in preprocessor commands such as "#if (__BIND > 19931104)". do not - * compare for equality; rather, use it to determine whether your resolver - * is new enough to contain a certain feature. - */ - -#define __BIND 19940417 /* interface version stamp */ - -/* - * Define constants based on rfc883 - */ -#define PACKETSZ 512 /* maximum packet size */ -#define MAXDNAME 256 /* maximum domain name */ -#define MAXCDNAME 255 /* maximum compressed domain name */ -#define MAXLABEL 63 /* maximum length of domain label */ -#define HFIXEDSZ 12 /* #/bytes of fixed data in header */ -#define QFIXEDSZ 4 /* #/bytes of fixed data in query */ -#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#define INT32SZ 4 /* for systems without 32-bit ints */ -#define INT16SZ 2 /* for systems without 16-bit ints */ -#define INADDRSZ 4 /* for sizeof(struct inaddr) != 4 */ - -/* - * Internet nameserver port number - */ -#define NAMESERVER_PORT 53 - -/* - * Currently defined opcodes - */ -#define QUERY 0x0 /* standard query */ -#define IQUERY 0x1 /* inverse query */ -#define STATUS 0x2 /* nameserver status query */ -/*#define xxx 0x3 *//* 0x3 reserved */ -#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */ -#ifdef ALLOW_UPDATES - /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */ -# define UPDATEA 0x9 /* add resource record */ -# define UPDATED 0xa /* delete a specific resource record */ -# define UPDATEDA 0xb /* delete all named resource record */ -# define UPDATEM 0xc /* modify a specific resource record */ -# define UPDATEMA 0xd /* modify all named resource record */ -# define ZONEINIT 0xe /* initial zone transfer */ -# define ZONEREF 0xf /* incremental zone referesh */ -#endif - -/* - * Currently defined response codes - */ -#ifdef HAVE_ADDRINFO -#define NOERROR 0 /* no error */ -#endif /* HAVE_ADDRINFO */ -#define FORMERR 1 /* format error */ -#define SERVFAIL 2 /* server failure */ -#define NXDOMAIN 3 /* non existent domain */ -#define NOTIMP 4 /* not implemented */ -#define REFUSED 5 /* query refused */ -#ifdef ALLOW_UPDATES - /* non standard */ -# define NOCHANGE 0xf /* update failed to change db */ -#endif - -/* - * Type values for resources and queries - */ -#define T_A 1 /* host address */ -#define T_NS 2 /* authoritative server */ -#define T_MD 3 /* mail destination */ -#define T_MF 4 /* mail forwarder */ -#define T_CNAME 5 /* canonical name */ -#define T_SOA 6 /* start of authority zone */ -#define T_MB 7 /* mailbox domain name */ -#define T_MG 8 /* mail group member */ -#define T_MR 9 /* mail rename name */ -#define T_NULL 10 /* null resource record */ -#define T_WKS 11 /* well known service */ -#define T_PTR 12 /* domain name pointer */ -#define T_HINFO 13 /* host information */ -#define T_MINFO 14 /* mailbox information */ -#define T_MX 15 /* mail routing information */ -#define T_TXT 16 /* text strings */ -#define T_RP 17 /* responsible person */ -#define T_AFSDB 18 /* AFS cell database */ -#define T_X25 19 /* X_25 calling address */ -#define T_ISDN 20 /* ISDN calling address */ -#define T_RT 21 /* router */ -#define T_NSAP 22 /* NSAP address */ -#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ -#define T_SIG 24 /* security signature */ -#define T_KEY 25 /* security key */ -#define T_PX 26 /* X.400 mail mapping */ -#define T_GPOS 27 /* geographical position (withdrawn) */ -#define T_AAAA 28 /* IP6 Address */ -#define T_LOC 29 /* Location Information */ - /* non standard */ -#define T_UINFO 100 /* user (finger) information */ -#define T_UID 101 /* user ID */ -#define T_GID 102 /* group ID */ -#define T_UNSPEC 103 /* Unspecified format (binary data) */ - /* Query type values which do not appear in resource records */ -#define T_AXFR 252 /* transfer zone of authority */ -#define T_MAILB 253 /* transfer mailbox records */ -#define T_MAILA 254 /* transfer mail agent records */ -#define T_ANY 255 /* wildcard match */ - -/* - * Values for class field - */ - -#define C_IN 1 /* the arpa internet */ -#define C_CHAOS 3 /* for chaos net (MIT) */ -#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ - /* Query class values which do not appear in resource records */ -#define C_ANY 255 /* wildcard match */ - -/* - * Status return codes for T_UNSPEC conversion routines - */ -#define CONV_SUCCESS 0 -#define CONV_OVERFLOW (-1) -#define CONV_BADFMT (-2) -#define CONV_BADCKSUM (-3) -#define CONV_BADBUFLEN (-4) - -#ifndef __BYTE_ORDER -#if (BSD >= 199103) -# include -#else -#ifdef linux -# include -#else -#define __LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ -#define __BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ -#define __PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ - -#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ - defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ - defined(__alpha__) || defined(__alpha) -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif - -#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ - defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ - defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ - defined(apollo) || defined(__convex__) || defined(_CRAY) || \ - defined(__hppa) || defined(__hp9000) || \ - defined(__hp9000s300) || defined(__hp9000s700) || \ - defined (BIT_ZERO_ON_LEFT) || defined(m68k) -#define __BYTE_ORDER __BIG_ENDIAN -#endif -#endif /* linux */ -#endif /* BSD */ -#endif /* __BYTE_ORDER */ - -#if !defined(__BYTE_ORDER) || \ - (__BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN && \ - __BYTE_ORDER != __PDP_ENDIAN) - /* you must determine what the correct bit order is for - * your compiler - the next line is an intentional error - * which will force your compiles to bomb until you fix - * the above macros. - */ - error "Undefined or invalid __BYTE_ORDER"; -#endif - -/* - * Structure for query header. The order of the fields is machine- and - * compiler-dependent, depending on the byte/bit order and the layout - * of bit fields. We use bit fields only in int variables, as this - * is all ANSI requires. This requires a somewhat confusing rearrangement. - */ - -typedef struct { - unsigned id :16; /* query identification number */ -#if __BYTE_ORDER == __BIG_ENDIAN - /* fields in third byte */ - unsigned qr: 1; /* response flag */ - unsigned opcode: 4; /* purpose of message */ - unsigned aa: 1; /* authoritive answer */ - unsigned tc: 1; /* truncated message */ - unsigned rd: 1; /* recursion desired */ - /* fields in fourth byte */ - unsigned ra: 1; /* recursion available */ - unsigned pr: 1; /* primary server req'd (!standard) */ - unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned rcode :4; /* response code */ -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN - /* fields in third byte */ - unsigned rd :1; /* recursion desired */ - unsigned tc :1; /* truncated message */ - unsigned aa :1; /* authoritive answer */ - unsigned opcode :4; /* purpose of message */ - unsigned qr :1; /* response flag */ - /* fields in fourth byte */ - unsigned rcode :4; /* response code */ - unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned pr :1; /* primary server req'd (!standard) */ - unsigned ra :1; /* recursion available */ -#endif - /* remaining bytes */ - unsigned qdcount :16; /* number of question entries */ - unsigned ancount :16; /* number of answer entries */ - unsigned nscount :16; /* number of authority entries */ - unsigned arcount :16; /* number of resource entries */ -} HEADER; - -/* - * Defines for handling compressed domain names - */ -#define INDIR_MASK 0xc0 - -/* - * Structure for passing resource records around. - */ -struct rrec { - int16_t r_zone; /* zone number */ - int16_t r_class; /* class number */ - int16_t r_type; /* type number */ - u_int32_t r_ttl; /* time to live */ - int r_size; /* size of data area */ - char *r_data; /* pointer to data */ -}; - -//extern u_int16_t _getshort __P((const u_char *)); -//extern u_int32_t _getlong __P((const u_char *)); - -/* - * Inline versions of get/put short/long. Pointer is advanced. - * - * These macros demonstrate the property of C whereby it can be - * portable or it can be elegant but rarely both. - */ -#define GETSHORT(s, cp) { \ - register u_char *t_cp = (u_char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) \ - | ((u_int16_t)t_cp[1]) \ - ; \ - (cp) += INT16SZ; \ -} - -#define GETLONG(l, cp) { \ - register u_char *t_cp = (u_char *)(cp); \ - (l) = ((u_int32_t)t_cp[0] << 24) \ - | ((u_int32_t)t_cp[1] << 16) \ - | ((u_int32_t)t_cp[2] << 8) \ - | ((u_int32_t)t_cp[3]) \ - ; \ - (cp) += INT32SZ; \ -} - -#define PUTSHORT(s, cp) { \ - register u_int16_t t_s = (u_int16_t)(s); \ - register u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_s >> 8; \ - *t_cp = t_s; \ - (cp) += INT16SZ; \ -} - -#define PUTLONG(l, cp) { \ - register u_int32_t t_l = (u_int32_t)(l); \ - register u_char *t_cp = (u_char *)(cp); \ - *t_cp++ = t_l >> 24; \ - *t_cp++ = t_l >> 16; \ - *t_cp++ = t_l >> 8; \ - *t_cp = t_l; \ - (cp) += INT32SZ; \ -} - -#endif /* !_NAMESER_H_ */ diff --git a/contrib/libpcap/Win32/Include/bittypes.h b/contrib/libpcap/Win32/Include/bittypes.h deleted file mode 100644 index 8c3f69f..0000000 --- a/contrib/libpcap/Win32/Include/bittypes.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _BITTYPES_H -#define _BITTYPES_H - -#ifndef HAVE_U_INT8_T - -#if SIZEOF_CHAR == 1 -typedef unsigned char u_int8_t; -typedef signed char int8_t; -#elif SIZEOF_INT == 1 -typedef unsigned int u_int8_t; -typedef signed int int8_t; -#else /* XXX */ -#error "there's no appropriate type for u_int8_t" -#endif -#define HAVE_U_INT8_T 1 -#define HAVE_INT8_T 1 - -#endif /* HAVE_U_INT8_T */ - -#ifndef HAVE_U_INT16_T - -#if SIZEOF_SHORT == 2 -typedef unsigned short u_int16_t; -typedef signed short int16_t; -#elif SIZEOF_INT == 2 -typedef unsigned int u_int16_t; -typedef signed int int16_t; -#elif SIZEOF_CHAR == 2 -typedef unsigned char u_int16_t; -typedef signed char int16_t; -#else /* XXX */ -#error "there's no appropriate type for u_int16_t" -#endif -#define HAVE_U_INT16_T 1 -#define HAVE_INT16_T 1 - -#endif /* HAVE_U_INT16_T */ - -#ifndef HAVE_U_INT32_T - -#if SIZEOF_INT == 4 -typedef unsigned int u_int32_t; -typedef signed int int32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long u_int32_t; -typedef signed long int32_t; -#elif SIZEOF_SHORT == 4 -typedef unsigned short u_int32_t; -typedef signed short int32_t; -#else /* XXX */ -#error "there's no appropriate type for u_int32_t" -#endif -#define HAVE_U_INT32_T 1 -#define HAVE_INT32_T 1 - -#endif /* HAVE_U_INT32_T */ - -#ifndef HAVE_U_INT64_T -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long u_int64_t; -typedef long long int64_t; -#elif defined(_MSC_EXTENSIONS) -typedef unsigned _int64 u_int64_t; -typedef _int64 int64_t; -#elif SIZEOF_INT == 8 -typedef unsigned int u_int64_t; -#elif SIZEOF_LONG == 8 -typedef unsigned long u_int64_t; -#elif SIZEOF_SHORT == 8 -typedef unsigned short u_int64_t; -#else /* XXX */ -#error "there's no appropriate type for u_int64_t" -#endif -#define HAVE_U_INT64_T 1 -#define HAVE_INT64_T 1 - -#endif /* HAVE_U_INT64_T */ - -#ifndef PRId64 -#ifdef _MSC_EXTENSIONS -#define PRId64 "I64d" -#else /* _MSC_EXTENSIONS */ -#define PRId64 "lld" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRId64 */ - -#ifndef PRIo64 -#ifdef _MSC_EXTENSIONS -#define PRIo64 "I64o" -#else /* _MSC_EXTENSIONS */ -#define PRIo64 "llo" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIo64 */ - -#ifndef PRIx64 -#ifdef _MSC_EXTENSIONS -#define PRIx64 "I64x" -#else /* _MSC_EXTENSIONS */ -#define PRIx64 "llx" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIx64 */ - -#ifndef PRIu64 -#ifdef _MSC_EXTENSIONS -#define PRIu64 "I64u" -#else /* _MSC_EXTENSIONS */ -#define PRIu64 "llu" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIu64 */ - -#endif /* _BITTYPES_H */ diff --git a/contrib/libpcap/Win32/Include/cdecl_ext.h b/contrib/libpcap/Win32/Include/cdecl_ext.h deleted file mode 100644 index 9591db2..0000000 --- a/contrib/libpcap/Win32/Include/cdecl_ext.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef HAVE_PORTABLE_PROTOTYPE - -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#else -#define __P(protos) () /* traditional C preprocessor */ -#endif - -#endif /* !HAVE_PORTABLE_PROTOTYPE */ diff --git a/contrib/libpcap/Win32/Include/inetprivate.h b/contrib/libpcap/Win32/Include/inetprivate.h deleted file mode 100644 index e25ed3d..0000000 --- a/contrib/libpcap/Win32/Include/inetprivate.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -extern void _sethtent(int f); -extern void _endhtent(void); -extern struct hostent *_gethtent(void); -extern struct hostent *_gethtbyname(const char *name); -extern struct hostent *_gethtbyaddr(const char *addr, int len, - int type); -extern int _validuser(FILE *hostf, const char *rhost, - const char *luser, const char *ruser, int baselen); -extern int _checkhost(const char *rhost, const char *lhost, int len); -#if 0 -extern void putlong(u_long l, u_char *msgp); -extern void putshort(u_short l, u_char *msgp); -extern u_int32_t _getlong(register const u_char *msgp); -extern u_int16_t _getshort(register const u_char *msgp); -extern void p_query(char *msg); -extern void fp_query(char *msg, FILE *file); -extern char *p_cdname(char *cp, char *msg, FILE *file); -extern char *p_rr(char *cp, char *msg, FILE *file); -extern char *p_type(int type); -extern char * p_class(int class); -extern char *p_time(u_long value); -#endif -extern char * hostalias(const char *name); -extern void sethostfile(char *name); -extern void _res_close (void); -extern void ruserpass(const char *host, char **aname, char **apass); diff --git a/contrib/libpcap/Win32/Include/ip6_misc.h b/contrib/libpcap/Win32/Include/ip6_misc.h deleted file mode 100644 index 562fa61..0000000 --- a/contrib/libpcap/Win32/Include/ip6_misc.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1993, 1994, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL) - */ - -/* - * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows - */ - -#include - -#include - -#ifndef __MINGW32__ -#define IN_MULTICAST(a) IN_CLASSD(a) -#endif - -#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) - -#define IN_LOOPBACKNET 127 - -#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) -/* IPv6 address */ -struct in6_addr - { - union - { - u_int8_t u6_addr8[16]; - u_int16_t u6_addr16[8]; - u_int32_t u6_addr32[4]; - } in6_u; -#define s6_addr in6_u.u6_addr8 -#define s6_addr16 in6_u.u6_addr16 -#define s6_addr32 in6_u.u6_addr32 -#define s6_addr64 in6_u.u6_addr64 - }; - -#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } -#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } -#endif /* __MINGW32__ */ - - -#if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)) -typedef unsigned short sa_family_t; -#endif - - -#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) - -#define __SOCKADDR_COMMON(sa_prefix) \ - sa_family_t sa_prefix##family - -/* Ditto, for IPv6. */ -struct sockaddr_in6 - { - __SOCKADDR_COMMON (sin6_); - u_int16_t sin6_port; /* Transport layer port # */ - u_int32_t sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ - }; - -#define IN6_IS_ADDR_V4MAPPED(a) \ - ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ - (((u_int32_t *) (a))[2] == htonl (0xffff))) - -#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) - -#define IN6_IS_ADDR_LINKLOCAL(a) \ - ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) - -#define IN6_IS_ADDR_LOOPBACK(a) \ - (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ - ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) -#endif /* __MINGW32__ */ - -#define ip6_vfc ip6_ctlun.ip6_un2_vfc -#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow -#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen -#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt -#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim -#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim - -#define nd_rd_type nd_rd_hdr.icmp6_type -#define nd_rd_code nd_rd_hdr.icmp6_code -#define nd_rd_cksum nd_rd_hdr.icmp6_cksum -#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] - -/* - * IPV6 extension headers - */ -#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ -#define IPPROTO_IPV6 41 /* IPv6 header. */ -#define IPPROTO_ROUTING 43 /* IPv6 routing header */ -#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ -#define IPPROTO_ESP 50 /* encapsulating security payload */ -#define IPPROTO_AH 51 /* authentication header */ -#define IPPROTO_ICMPV6 58 /* ICMPv6 */ -#define IPPROTO_NONE 59 /* IPv6 no next header */ -#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ -#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ - -#define IPV6_RTHDR_TYPE_0 0 - -/* Option types and related macros */ -#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ -#define IP6OPT_PADN 0x01 /* 00 0 00001 */ -#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ -#define IP6OPT_JUMBO_LEN 6 -#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ - -#define IP6OPT_RTALERT_LEN 4 -#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ -#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ -#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ -#define IP6OPT_MINLEN 2 - -#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ -#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ -#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ -#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ -#define IP6OPT_EID 0x8a /* 10 0 01010 */ - -#define IP6OPT_TYPE(o) ((o) & 0xC0) -#define IP6OPT_TYPE_SKIP 0x00 -#define IP6OPT_TYPE_DISCARD 0x40 -#define IP6OPT_TYPE_FORCEICMP 0x80 -#define IP6OPT_TYPE_ICMP 0xC0 - -#define IP6OPT_MUTABLE 0x20 - - -#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) -#ifndef EAI_ADDRFAMILY -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif -#endif /* __MINGW32__ */ diff --git a/contrib/libpcap/Win32/Include/net/if.h b/contrib/libpcap/Win32/Include/net/if.h deleted file mode 100644 index 7f835fb..0000000 --- a/contrib/libpcap/Win32/Include/net/if.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ - */ - -#ifndef _NET_IF_H_ -#define _NET_IF_H_ - -/* - * does not depend on on most other systems. This - * helps userland compatability. (struct timeval ifi_lastchange) - */ -#ifndef KERNEL -#include -#endif - -/* - * Structure describing information about an interface - * which may be of interest to management entities. - */ -struct if_data { - /* generic interface information */ - u_char ifi_type; /* ethernet, tokenring, etc */ - u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ - u_char ifi_addrlen; /* media address length */ - u_char ifi_hdrlen; /* media header length */ - u_char ifi_recvquota; /* polling quota for receive intrs */ - u_char ifi_xmitquota; /* polling quota for xmit intrs */ - u_long ifi_mtu; /* maximum transmission unit */ - u_long ifi_metric; /* routing metric (external only) */ - u_long ifi_baudrate; /* linespeed */ - /* volatile statistics */ - u_long ifi_ipackets; /* packets received on interface */ - u_long ifi_ierrors; /* input errors on interface */ - u_long ifi_opackets; /* packets sent on interface */ - u_long ifi_oerrors; /* output errors on interface */ - u_long ifi_collisions; /* collisions on csma interfaces */ - u_long ifi_ibytes; /* total number of octets received */ - u_long ifi_obytes; /* total number of octets sent */ - u_long ifi_imcasts; /* packets received via multicast */ - u_long ifi_omcasts; /* packets sent via multicast */ - u_long ifi_iqdrops; /* dropped on input, this interface */ - u_long ifi_noproto; /* destined for unsupported protocol */ - u_long ifi_recvtiming; /* usec spent receiving when timing */ - u_long ifi_xmittiming; /* usec spent xmitting when timing */ - struct timeval ifi_lastchange; /* time of last administrative change */ -}; - -/* ws2tcpip.h has interface flags: IFF_* */ -#if 0 -#define IFF_UP 0x1 /* interface is up */ -#define IFF_BROADCAST 0x2 /* broadcast address valid */ -#define IFF_DEBUG 0x4 /* turn on debugging */ -#define IFF_LOOPBACK 0x8 /* is a loopback net */ -#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ -/*#define IFF_NOTRAILERS 0x20 * obsolete: avoid use of trailers */ -#define IFF_RUNNING 0x40 /* resources allocated */ -#define IFF_NOARP 0x80 /* no address resolution protocol */ -#define IFF_PROMISC 0x100 /* receive all packets */ -#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ -#define IFF_OACTIVE 0x400 /* transmission in progress */ -#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ -#define IFF_LINK0 0x1000 /* per link layer defined bit */ -#define IFF_LINK1 0x2000 /* per link layer defined bit */ -#define IFF_LINK2 0x4000 /* per link layer defined bit */ -#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ -#define IFF_MULTICAST 0x8000 /* supports multicast */ -#endif /* 0 */ - -/* flags set internally only: */ -#define IFF_CANTCHANGE \ - (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ - IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) - -#define IFQ_MAXLEN 50 -#define IFNET_SLOWHZ 1 /* granularity is 1 second */ - -/* - * Message format for use in obtaining information about interfaces - * from getkerninfo and the routing socket - */ -struct if_msghdr { - u_short ifm_msglen; /* to skip over non-understood messages */ - u_char ifm_version; /* future binary compatability */ - u_char ifm_type; /* message type */ - int ifm_addrs; /* like rtm_addrs */ - int ifm_flags; /* value of if_flags */ - u_short ifm_index; /* index for associated ifp */ - struct if_data ifm_data;/* statistics and other data about if */ -}; - -/* - * Message format for use in obtaining information about interface addresses - * from getkerninfo and the routing socket - */ -struct ifa_msghdr { - u_short ifam_msglen; /* to skip over non-understood messages */ - u_char ifam_version; /* future binary compatability */ - u_char ifam_type; /* message type */ - int ifam_addrs; /* like rtm_addrs */ - int ifam_flags; /* value of ifa_flags */ - u_short ifam_index; /* index for associated ifp */ - int ifam_metric; /* value of ifa_metric */ -}; - -/* - * Message format for use in obtaining information about multicast addresses - * from the routing socket - */ -struct ifma_msghdr { - u_short ifmam_msglen; /* to skip over non-understood messages */ - u_char ifmam_version; /* future binary compatability */ - u_char ifmam_type; /* message type */ - int ifmam_addrs; /* like rtm_addrs */ - int ifmam_flags; /* value of ifa_flags */ - u_short ifmam_index; /* index for associated ifp */ -}; - -/* - * Interface request structure used for socket - * ioctl's. All interface ioctl's must have parameter - * definitions which begin with ifr_name. The - * remainder may be interface specific. - */ -struct ifreq { -#define IFNAMSIZ 16 - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - int ifru_mtu; - int ifru_phys; - int ifru_media; - caddr_t ifru_data; - } ifr_ifru; -#define ifr_addr ifr_ifru.ifru_addr /* address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ -#define ifr_flags ifr_ifru.ifru_flags /* flags */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ -#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ -#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ -#define ifr_media ifr_ifru.ifru_media /* physical media */ -#define ifr_data ifr_ifru.ifru_data /* for use by interface */ -}; - -#define _SIZEOF_ADDR_IFREQ(ifr) \ - ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ - (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ - (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) - -struct ifaliasreq { - char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct sockaddr ifra_addr; - struct sockaddr ifra_broadaddr; - struct sockaddr ifra_mask; -}; - -struct ifmediareq { - char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - int ifm_current; /* current media options */ - int ifm_mask; /* don't care mask */ - int ifm_status; /* media status */ - int ifm_active; /* active options */ - int ifm_count; /* # entries in ifm_ulist array */ - int *ifm_ulist; /* media words */ -}; -/* - * Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* size of associated buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#ifdef KERNEL -#ifdef MALLOC_DECLARE -MALLOC_DECLARE(M_IFADDR); -MALLOC_DECLARE(M_IFMADDR); -#endif -#endif - -/* XXX - this should go away soon */ -#ifdef KERNEL -#include -#endif - -#endif /* !_NET_IF_H_ */ diff --git a/contrib/libpcap/Win32/Include/net/netdb.h b/contrib/libpcap/Win32/Include/net/netdb.h deleted file mode 100644 index b9d45ac..0000000 --- a/contrib/libpcap/Win32/Include/net/netdb.h +++ /dev/null @@ -1,164 +0,0 @@ -/*- - * Copyright (c) 1980, 1983, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * netdb.h,v 1.4 1995/08/14 04:05:04 hjl Exp - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#ifndef _NETDB_H_ -#define _NETDB_H_ - -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) -#include -#include -#endif - -#include -#include - -#define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv" -#define _PATH_HOSTS __PATH_ETC_INET"/hosts" -#define _PATH_NETWORKS __PATH_ETC_INET"/networks" -#define _PATH_PROTOCOLS __PATH_ETC_INET"/protocols" -#define _PATH_SERVICES __PATH_ETC_INET"/services" -#define _PATH_RESCONF __PATH_ETC_INET"/resolv.conf" -#define _PATH_RPC __PATH_ETC_INET"/rpc" - -struct rpcent { - char *r_name; /* name of server for this rpc program */ - char **r_aliases; /* alias list */ - int r_number; /* rpc program number */ -}; - -#ifndef WIN32 -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) - -#define __NETDB_MAXALIASES 35 -#define __NETDB_MAXADDRS 35 - -/* - * Error return codes from gethostbyname() and gethostbyaddr() - * (left in extern int h_errno). - */ -#define h_errno (*__h_errno_location ()) -#else -extern int h_errno; -#endif -#endif - -#define NETDB_INTERNAL -1 /* see errno */ -#define NETDB_SUCCESS 0 /* no problem */ - -//#include - -void endhostent (void); -void endnetent (void); -void endprotoent (void); -void endservent (void); -void endrpcent (void); -struct hostent *gethostent (void); -struct netent *getnetbyaddr (long, int); /* u_long? */ -struct netent *getnetbyname (const char *); -struct netent *getnetent (void); -struct protoent *getprotoent (void); -struct servent *getservent (void); -struct rpcent *getrpcent (void); -struct rpcent *getrpcbyname (const char *); -struct rpcent *getrpcbynumber (int); -void herror (const char *); -void sethostent (int); -/* void sethostfile (const char *); */ -void setnetent (int); -void setprotoent (int); -void setservent (int); -void setrpcent (int); - -#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) -struct hostent *gethostbyaddr_r (const char *__addr, - int __length, int __type, - struct hostent *__result, - char *__buffer, int __buflen, int *__h_errnop); -struct hostent *gethostbyname_r (const char * __name, - struct hostent *__result, char *__buffer, - int __buflen, int *__h_errnop); -struct hostent *gethostent_r (struct hostent *__result, - char *__buffer, int __buflen, int *__h_errnop); -struct netent *getnetbyaddr_r (long __net, int __type, - struct netent *__result, char *__buffer, - int __buflen); -struct netent *getnetbyname_r (const char * __name, - struct netent *__result, char *__buffer, - int __buflen); -struct netent *getnetent_r (struct netent *__result, - char *__buffer, int __buflen); -struct protoent *getprotobyname_r (const char * __name, - struct protoent *__result, char *__buffer, - int __buflen); -struct protoent *getprotobynumber_r (int __proto, - struct protoent *__result, char *__buffer, - int __buflen); -struct protoent *getprotoent_r (struct protoent *__result, - char *__buffer, int __buflen); -struct servent *getservbyname_r (const char * __name, - const char *__proto, struct servent *__result, - char *__buffer, int __buflen); -struct servent *getservbyport_r (int __port, - const char *__proto, struct servent *__result, - char *__buffer, int __buflen); -struct servent *getservent_r (struct servent *__result, - char *__buffer, int __buflen); - -int *__h_errno_location (void); - -#endif - -#endif /* !_NETDB_H_ */ diff --git a/contrib/libpcap/Win32/Include/net/paths.h b/contrib/libpcap/Win32/Include/net/paths.h deleted file mode 100644 index 987de4f..0000000 --- a/contrib/libpcap/Win32/Include/net/paths.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1989 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)paths.h 5.15 (Berkeley) 5/29/91 - */ - -#ifndef _PATHS_H_ -#define _PATHS_H_ - -#if 0 -#define __PATH_ETC_INET "/usr/etc/inet" -#else -#define __PATH_ETC_INET "/etc" -#endif - -/* Default search path. */ -#define _PATH_DEFPATH "/usr/local/bin:/usr/bin:/bin:." -#define _PATH_DEFPATH_ROOT "/sbin:/bin:/usr/sbin:/usr/bin" - -#define _PATH_BSHELL "/bin/sh" -#define _PATH_CONSOLE "/dev/console" -#define _PATH_CSHELL "/bin/csh" -#define _PATH_DEVDB "/var/run/dev.db" -#define _PATH_DEVNULL "/dev/null" -#define _PATH_DRUM "/dev/drum" -#define _PATH_HEQUIV __PATH_ETC_INET"/hosts.equiv" -#define _PATH_KMEM "/dev/kmem" -#define _PATH_MAILDIR "/var/spool/mail" -#define _PATH_MAN "/usr/man" -#define _PATH_MEM "/dev/mem" -#define _PATH_LOGIN "/bin/login" -#define _PATH_NOLOGIN "/etc/nologin" -#define _PATH_SENDMAIL "/usr/sbin/sendmail" -#define _PATH_SHELLS "/etc/shells" -#define _PATH_TTY "/dev/tty" -#define _PATH_UNIX "/vmlinux" -#define _PATH_VI "/usr/bin/vi" - -/* Provide trailing slash, since mostly used for building pathnames. */ -#define _PATH_DEV "/dev/" -#define _PATH_TMP "/tmp/" -#define _PATH_VARRUN "/var/run/" -#define _PATH_VARTMP "/var/tmp/" - -#define _PATH_KLOG "/proc/kmsg" -#define _PATH_LOGCONF __PATH_ETC_INET"/syslog.conf" -#if 0 -#define _PATH_LOGPID __PATH_ETC_INET"/syslog.pid" -#else -#define _PATH_LOGPID "/var/run/syslog.pid" -#endif -#define _PATH_LOG "/dev/log" -#define _PATH_CONSOLE "/dev/console" - -#if 0 -#define _PATH_UTMP "/var/adm/utmp" -#define _PATH_WTMP "/var/adm/wtmp" -#define _PATH_LASTLOG "/var/adm/lastlog" -#else -#define _PATH_UTMP "/var/run/utmp" -#define _PATH_WTMP "/var/log/wtmp" -#define _PATH_LASTLOG "/var/log/lastlog" -#endif - -#define _PATH_LOCALE "/usr/lib/locale" - -#define _PATH_RWHODIR "/var/spool/rwho" - -#if _MIT_POSIX_THREADS -/* For the MIT pthreads */ -#define _PATH_PTY "/dev/" -#define _PATH_TZDIR "/usr/lib/zoneinfo" -#define _PATH_TZFILE "/usr/lib/zoneinfo/localtime" -#endif - -#endif /* !_PATHS_H_ */ diff --git a/contrib/libpcap/Win32/Include/sockstorage.h b/contrib/libpcap/Win32/Include/sockstorage.h deleted file mode 100644 index 557eb4d..0000000 --- a/contrib/libpcap/Win32/Include/sockstorage.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -struct sockaddr_storage { -#ifdef HAVE_SOCKADDR_SA_LEN - u_int8_t __ss_len; - u_int8_t __ss_family; - u_int8_t fill[126]; -#else - u_int8_t __ss_family; - u_int8_t fill[127]; -#endif /* HAVE_SOCKADDR_SA_LEN */ -}; diff --git a/contrib/libpcap/Win32/Prj/libpcap.dsp b/contrib/libpcap/Win32/Prj/libpcap.dsp deleted file mode 100644 index e5168f7..0000000 --- a/contrib/libpcap/Win32/Prj/libpcap.dsp +++ /dev/null @@ -1,168 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libpcap" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libpcap - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libpcap.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libpcap - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../" /I "../../lbl/" /I "../../bpf/" /I "../include/" /I "../../../../common" /I "../../../../dag/include" /I "../../../../dag/drv/windows" /D "NDEBUG" /D "YY_NEVER_INTERACTIVE" /D yylval=pcap_lval /D "_USRDLL" /D "LIBPCAP_EXPORTS" /D "HAVE_STRERROR" /D "__STDC__" /D "INET6" /D "_WINDOWS" /D "_MBCS" /D SIZEOF_CHAR=1 /D SIZEOF_SHORT=2 /D SIZEOF_INT=4 /D "HAVE_ADDRINFO" /D "WIN32" /D _U_= /D "HAVE_SNPRINTF" /D "HAVE_VSNPRINTF" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "libpcap - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../" /I "../../lbl/" /I "../../bpf/" /I "../include/" /I "../../../../common" /I "../../../../dag/include" /I "../../../../dag/drv/windows" /D "_DEBUG" /D "YY_NEVER_INTERACTIVE" /D yylval=pcap_lval /D "_USRDLL" /D "LIBPCAP_EXPORTS" /D "HAVE_STRERROR" /D "__STDC__" /D "INET6" /D "_WINDOWS" /D "_MBCS" /D SIZEOF_CHAR=1 /D SIZEOF_SHORT=2 /D SIZEOF_INT=4 /D "HAVE_ADDRINFO" /D "WIN32" /D _U_= /D "HAVE_SNPRINTF" /D "HAVE_VSNPRINTF" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "libpcap - Win32 Release" -# Name "libpcap - Win32 Debug" -# Begin Source File - -SOURCE=..\..\bpf_dump.c -# End Source File -# Begin Source File - -SOURCE=..\..\bpf\net\bpf_filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\bpf_image.c -# End Source File -# Begin Source File - -SOURCE=..\..\etherent.c -# End Source File -# Begin Source File - -SOURCE="..\..\fad-win32.c" -# End Source File -# Begin Source File - -SOURCE=..\Src\ffs.c -# End Source File -# Begin Source File - -SOURCE=..\..\gencode.c -# End Source File -# Begin Source File - -SOURCE=..\Src\getnetbynm.c -# End Source File -# Begin Source File - -SOURCE=..\Src\getnetent.c -# End Source File -# Begin Source File - -SOURCE=..\Src\getservent.c -# End Source File -# Begin Source File - -SOURCE=..\..\grammar.c -# End Source File -# Begin Source File - -SOURCE=..\..\inet.c -# End Source File -# Begin Source File - -SOURCE=..\Src\inet_aton.c -# End Source File -# Begin Source File - -SOURCE=..\Src\inet_net.c -# End Source File -# Begin Source File - -SOURCE=..\Src\inet_pton.c -# End Source File -# Begin Source File - -SOURCE=..\..\nametoaddr.c -# End Source File -# Begin Source File - -SOURCE=..\..\optimize.c -# End Source File -# Begin Source File - -SOURCE="..\..\Pcap-win32.c" -# End Source File -# Begin Source File - -SOURCE=..\..\pcap.c -# End Source File -# Begin Source File - -SOURCE=..\..\savefile.c -# End Source File -# Begin Source File - -SOURCE=..\..\scanner.c -# End Source File -# End Target -# End Project diff --git a/contrib/libpcap/Win32/Prj/libpcap.dsw b/contrib/libpcap/Win32/Prj/libpcap.dsw deleted file mode 100644 index 8cdff2d..0000000 --- a/contrib/libpcap/Win32/Prj/libpcap.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "libpcap"=".\libpcap.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/contrib/libpcap/Win32/Src/ffs.c b/contrib/libpcap/Win32/Src/ffs.c deleted file mode 100644 index 099ff8e..0000000 --- a/contrib/libpcap/Win32/Src/ffs.c +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include - -/* - * ffs -- vax ffs instruction - */ -int -ffs(mask) - register int mask; -{ - register int bit; - - if (mask == 0) - return(0); - for (bit = 1; !(mask & 1); bit++) - mask >>= 1; - return(bit); -} diff --git a/contrib/libpcap/Win32/Src/gai_strerror.c b/contrib/libpcap/Win32/Src/gai_strerror.c deleted file mode 100644 index e90245a..0000000 --- a/contrib/libpcap/Win32/Src/gai_strerror.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* -#include - -__FBSDID("$FreeBSD$"); - -*/ - -#ifdef WIN32 - -#include - -#else - -#include - -#endif - -/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */ -/* for backward compatibility with userland code prior to 2553bis-02 */ -static char *ai_errlist[] = { - "Success", /* 0 */ - "Address family for hostname not supported", /* 1 */ - "Temporary failure in name resolution", /* EAI_AGAIN */ - "Invalid value for ai_flags", /* EAI_BADFLAGS */ - "Non-recoverable failure in name resolution", /* EAI_FAIL */ - "ai_family not supported", /* EAI_FAMILY */ - "Memory allocation failure", /* EAI_MEMORY */ - "No address associated with hostname", /* 7 */ - "hostname nor servname provided, or not known", /* EAI_NONAME */ - "servname not supported for ai_socktype", /* EAI_SERVICE */ - "ai_socktype not supported", /* EAI_SOCKTYPE */ - "System error returned in errno", /* EAI_SYSTEM */ - "Invalid value for hints", /* EAI_BADHINTS */ - "Resolved protocol is unknown" /* EAI_PROTOCOL */ -}; - -#ifndef EAI_MAX -#define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0])) -#endif - -/* on MingW, gai_strerror is available. - We need to compile gai_strerrorA only for Cygwin - */ -#ifndef gai_strerror - -char * -WSAAPI gai_strerrorA(int ecode) -{ - if (ecode >= 0 && ecode < EAI_MAX) - return ai_errlist[ecode]; - return "Unknown error"; -} - -#endif /* gai_strerror */ \ No newline at end of file diff --git a/contrib/libpcap/Win32/Src/getaddrinfo.c b/contrib/libpcap/Win32/Src/getaddrinfo.c deleted file mode 100644 index 8e8ad85..0000000 --- a/contrib/libpcap/Win32/Src/getaddrinfo.c +++ /dev/null @@ -1,1120 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator. - * - * Issues to be discussed: - * - Thread safe-ness must be checked. - * - Return values. There are nonstandard return values defined and used - * in the source code. This is because RFC2553 is silent about which error - * code must be returned for which situation. - * Note: - * - We use getipnodebyname() just for thread-safeness. There's no intent - * to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to - * getipnodebyname(). - * - The code filters out AFs that are not supported by the kernel, - * when globbing NULL hostname (to loopback, or wildcard). Is it the right - * thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG - * in ai_flags? - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/getaddrinfo.c,v 1.3 2008-09-15 23:37:51 guy Exp $"; -#endif - -#include -#if 0 -#include -#endif -#ifndef __MINGW32__ -#include -#endif -#include -#include -#include -#include -#include -#include - -#ifndef HAVE_PORTABLE_PROTOTYPE -#include "cdecl_ext.h" -#endif - -#ifndef HAVE_U_INT32_T -#include "bittypes.h" -#endif - -#ifndef HAVE_SOCKADDR_STORAGE -#ifndef __MINGW32__ -#include "sockstorage.h" -#endif -#endif - -#ifdef NEED_ADDRINFO_H -#include "addrinfo.h" -#ifdef WIN32 -#include "IP6_misc.h" -#endif -#endif - - -#if defined(__KAME__) && defined(INET6) -# define FAITH -#endif - -#define SUCCESS 0 -#define ANY 0 -#define YES 1 -#define NO 0 - -#ifdef FAITH -static int translate = NO; -static struct in6_addr faith_prefix = IN6ADDR_ANY_INIT; -#endif - -static const char in_addrany[] = { 0, 0, 0, 0 }; -static const char in6_addrany[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -static const char in_loopback[] = { 127, 0, 0, 1 }; -static const char in6_loopback[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 -}; - -struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; - u_int32_t si_scope_id; -}; - -static const struct afd { - int a_af; - int a_addrlen; - int a_socklen; - int a_off; - const char *a_addrany; - const char *a_loopback; - int a_scoped; -} afdl [] = { -#ifdef INET6 - {PF_INET6, sizeof(struct in6_addr), - sizeof(struct sockaddr_in6), - offsetof(struct sockaddr_in6, sin6_addr), - in6_addrany, in6_loopback, 1}, -#endif - {PF_INET, sizeof(struct in_addr), - sizeof(struct sockaddr_in), - offsetof(struct sockaddr_in, sin_addr), - in_addrany, in_loopback, 0}, - {0, 0, 0, 0, NULL, NULL, 0}, -}; - -struct explore { - int e_af; - int e_socktype; - int e_protocol; - const char *e_protostr; - int e_wild; -#define WILD_AF(ex) ((ex)->e_wild & 0x01) -#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02) -#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04) -}; - -static const struct explore explore[] = { -#if 0 - { PF_LOCAL, 0, ANY, ANY, NULL, 0x01 }, -#endif -#ifdef INET6 - { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, - { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, - { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 }, -#endif - { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, - { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, - { PF_INET, SOCK_RAW, ANY, NULL, 0x05 }, - { -1, 0, 0, NULL, 0 }, -}; - -#ifdef INET6 -#define PTON_MAX 16 -#else -#define PTON_MAX 4 -#endif - - -static int str_isnumber __P((const char *)); -static int explore_fqdn __P((const struct addrinfo *, const char *, - const char *, struct addrinfo **)); -static int explore_null __P((const struct addrinfo *, const char *, - const char *, struct addrinfo **)); -static int explore_numeric __P((const struct addrinfo *, const char *, - const char *, struct addrinfo **)); -static int explore_numeric_scope __P((const struct addrinfo *, const char *, - const char *, struct addrinfo **)); -static int get_name __P((const char *, const struct afd *, struct addrinfo **, - char *, const struct addrinfo *, const char *)); -static int get_canonname __P((const struct addrinfo *, - struct addrinfo *, const char *)); -static struct addrinfo *get_ai __P((const struct addrinfo *, - const struct afd *, const char *)); -static int get_portmatch __P((const struct addrinfo *, const char *)); -static int get_port __P((struct addrinfo *, const char *, int)); -static const struct afd *find_afd __P((int)); - -static char *ai_errlist[] = { - "Success", - "Address family for hostname not supported", /* EAI_ADDRFAMILY */ - "Temporary failure in name resolution", /* EAI_AGAIN */ - "Invalid value for ai_flags", /* EAI_BADFLAGS */ - "Non-recoverable failure in name resolution", /* EAI_FAIL */ - "ai_family not supported", /* EAI_FAMILY */ - "Memory allocation failure", /* EAI_MEMORY */ - "No address associated with hostname", /* EAI_NODATA */ - "hostname nor servname provided, or not known", /* EAI_NONAME */ - "servname not supported for ai_socktype", /* EAI_SERVICE */ - "ai_socktype not supported", /* EAI_SOCKTYPE */ - "System error returned in errno", /* EAI_SYSTEM */ - "Invalid value for hints", /* EAI_BADHINTS */ - "Resolved protocol is unknown", /* EAI_PROTOCOL */ - "Unknown error", /* EAI_MAX */ -}; - -/* XXX macros that make external reference is BAD. */ - -#define GET_AI(ai, afd, addr) \ -do { \ - /* external reference: pai, error, and label free */ \ - (ai) = get_ai(pai, (afd), (addr)); \ - if ((ai) == NULL) { \ - error = EAI_MEMORY; \ - goto free; \ - } \ -} while (0) - -#define GET_PORT(ai, serv) \ -do { \ - /* external reference: error and label free */ \ - error = get_port((ai), (serv), 0); \ - if (error != 0) \ - goto free; \ -} while (0) - -#define GET_CANONNAME(ai, str) \ -do { \ - /* external reference: pai, error and label free */ \ - error = get_canonname(pai, (ai), (str)); \ - if (error != 0) \ - goto free; \ -} while (0) - -#define ERR(err) \ -do { \ - /* external reference: error, and label bad */ \ - error = (err); \ - goto bad; \ -} while (0) - -#define MATCH_FAMILY(x, y, w) \ - ((x) == (y) || ((w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC))) -#define MATCH(x, y, w) \ - ((x) == (y) || ((w) && ((x) == ANY || (y) == ANY))) - -#if defined(DEFINE_ADDITIONAL_IPV6_STUFF) -char * -gai_strerror(ecode) - int ecode; -{ - if (ecode < 0 || ecode > EAI_MAX) - ecode = EAI_MAX; - return ai_errlist[ecode]; -} -#endif - -void -freeaddrinfo(ai) - struct addrinfo *ai; -{ - struct addrinfo *next; - - do { - next = ai->ai_next; - if (ai->ai_canonname) - free(ai->ai_canonname); - /* no need to free(ai->ai_addr) */ - free(ai); - } while ((ai = next) != NULL); -} - -static int -str_isnumber(p) - const char *p; -{ - char *q = (char *)p; - while (*q) { - if (! isdigit(*q)) - return NO; - q++; - } - return YES; -} - -int -getaddrinfo(hostname, servname, hints, res) - const char *hostname, *servname; - const struct addrinfo *hints; - struct addrinfo **res; -{ - struct addrinfo sentinel; - struct addrinfo *cur; - int error = 0; - struct addrinfo ai; - struct addrinfo ai0; - struct addrinfo *pai; - const struct afd *afd; - const struct explore *ex; - -#ifdef FAITH - static int firsttime = 1; - - if (firsttime) { - /* translator hack */ - char *q = getenv("GAI"); - if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1) - translate = YES; - firsttime = 0; - } -#endif - - sentinel.ai_next = NULL; - cur = &sentinel; - pai = &ai; - pai->ai_flags = 0; - pai->ai_family = PF_UNSPEC; - pai->ai_socktype = ANY; - pai->ai_protocol = ANY; - pai->ai_addrlen = 0; - pai->ai_canonname = NULL; - pai->ai_addr = NULL; - pai->ai_next = NULL; - - if (hostname == NULL && servname == NULL) - return EAI_NONAME; - if (hints) { - /* error check for hints */ - if (hints->ai_addrlen || hints->ai_canonname || - hints->ai_addr || hints->ai_next) - ERR(EAI_BADHINTS); /* xxx */ - if (hints->ai_flags & ~AI_MASK) - ERR(EAI_BADFLAGS); - switch (hints->ai_family) { - case PF_UNSPEC: - case PF_INET: -#ifdef INET6 - case PF_INET6: -#endif - break; - default: - ERR(EAI_FAMILY); - } - memcpy(pai, hints, sizeof(*pai)); - - /* - * if both socktype/protocol are specified, check if they - * are meaningful combination. - */ - if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) { - for (ex = explore; ex->e_af >= 0; ex++) { - if (pai->ai_family != ex->e_af) - continue; - if (ex->e_socktype == ANY) - continue; - if (ex->e_protocol == ANY) - continue; - if (pai->ai_socktype == ex->e_socktype - && pai->ai_protocol != ex->e_protocol) { - ERR(EAI_BADHINTS); - } - } - } - } - - /* - * check for special cases. (1) numeric servname is disallowed if - * socktype/protocol are left unspecified. (2) servname is disallowed - * for raw and other inet{,6} sockets. - */ - if (MATCH_FAMILY(pai->ai_family, PF_INET, 1) -#ifdef PF_INET6 - || MATCH_FAMILY(pai->ai_family, PF_INET6, 1) -#endif - ) { - ai0 = *pai; - - if (pai->ai_family == PF_UNSPEC) { -#ifdef PF_INET6 - pai->ai_family = PF_INET6; -#else - pai->ai_family = PF_INET; -#endif - } - error = get_portmatch(pai, servname); - if (error) - ERR(error); - - *pai = ai0; - } - - ai0 = *pai; - - /* NULL hostname, or numeric hostname */ - for (ex = explore; ex->e_af >= 0; ex++) { - *pai = ai0; - - if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) - continue; - if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex))) - continue; - if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex))) - continue; - - if (pai->ai_family == PF_UNSPEC) - pai->ai_family = ex->e_af; - if (pai->ai_socktype == ANY && ex->e_socktype != ANY) - pai->ai_socktype = ex->e_socktype; - if (pai->ai_protocol == ANY && ex->e_protocol != ANY) - pai->ai_protocol = ex->e_protocol; - - if (hostname == NULL) - error = explore_null(pai, hostname, servname, &cur->ai_next); - else - error = explore_numeric_scope(pai, hostname, servname, &cur->ai_next); - - if (error) - goto free; - - while (cur && cur->ai_next) - cur = cur->ai_next; - } - - /* - * XXX - * If numreic representation of AF1 can be interpreted as FQDN - * representation of AF2, we need to think again about the code below. - */ - if (sentinel.ai_next) - goto good; - - if (pai->ai_flags & AI_NUMERICHOST) - ERR(EAI_NONAME); - if (hostname == NULL) - ERR(EAI_NONAME); - - /* - * hostname as alphabetical name. - * we would like to prefer AF_INET6 than AF_INET, so we'll make a - * outer loop by AFs. - */ - for (afd = afdl; afd->a_af; afd++) { - *pai = ai0; - - if (!MATCH_FAMILY(pai->ai_family, afd->a_af, 1)) - continue; - - for (ex = explore; ex->e_af >= 0; ex++) { - *pai = ai0; - - if (pai->ai_family == PF_UNSPEC) - pai->ai_family = afd->a_af; - - if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) - continue; - if (!MATCH(pai->ai_socktype, ex->e_socktype, - WILD_SOCKTYPE(ex))) { - continue; - } - if (!MATCH(pai->ai_protocol, ex->e_protocol, - WILD_PROTOCOL(ex))) { - continue; - } - - if (pai->ai_family == PF_UNSPEC) - pai->ai_family = ex->e_af; - if (pai->ai_socktype == ANY && ex->e_socktype != ANY) - pai->ai_socktype = ex->e_socktype; - if (pai->ai_protocol == ANY && ex->e_protocol != ANY) - pai->ai_protocol = ex->e_protocol; - - error = explore_fqdn(pai, hostname, servname, - &cur->ai_next); - - while (cur && cur->ai_next) - cur = cur->ai_next; - } - } - - /* XXX */ - if (sentinel.ai_next) - error = 0; - - if (error) - goto free; - if (error == 0) { - if (sentinel.ai_next) { - good: - *res = sentinel.ai_next; - return SUCCESS; - } else - error = EAI_FAIL; - } - free: - bad: - if (sentinel.ai_next) - freeaddrinfo(sentinel.ai_next); - *res = NULL; - return error; -} - -/* - * FQDN hostname, DNS lookup - */ -static int -explore_fqdn(pai, hostname, servname, res) - const struct addrinfo *pai; - const char *hostname; - const char *servname; - struct addrinfo **res; -{ - struct hostent *hp; - int h_error; - int af; - char **aplist = NULL, *apbuf = NULL; - char *ap; - struct addrinfo sentinel, *cur; - int i; -#ifndef USE_GETIPNODEBY - int naddrs; -#endif - const struct afd *afd; - int error; - - *res = NULL; - sentinel.ai_next = NULL; - cur = &sentinel; - - /* - * Do not filter unsupported AFs here. We need to honor content of - * databases (/etc/hosts, DNS and others). Otherwise we cannot - * replace gethostbyname() by getaddrinfo(). - */ - - /* - * if the servname does not match socktype/protocol, ignore it. - */ - if (get_portmatch(pai, servname) != 0) - return 0; - - afd = find_afd(pai->ai_family); - - /* - * post-RFC2553: should look at (pai->ai_flags & AI_ADDRCONFIG) - * rather than hardcoding it. we may need to add AI_ADDRCONFIG - * handling code by ourselves in case we don't have getipnodebyname(). - */ -#ifdef USE_GETIPNODEBY - hp = getipnodebyname(hostname, pai->ai_family, AI_ADDRCONFIG, &h_error); -#else -#ifdef HAVE_GETHOSTBYNAME2 - hp = gethostbyname2(hostname, pai->ai_family); -#else - if (pai->ai_family != AF_INET) - return 0; - hp = gethostbyname(hostname); -#ifdef HAVE_H_ERRNO - h_error = h_errno; -#else - h_error = EINVAL; -#endif -#endif /*HAVE_GETHOSTBYNAME2*/ -#endif /*USE_GETIPNODEBY*/ - - if (hp == NULL) { - switch (h_error) { - case HOST_NOT_FOUND: - case NO_DATA: - error = EAI_NODATA; - break; - case TRY_AGAIN: - error = EAI_AGAIN; - break; - case NO_RECOVERY: - case NETDB_INTERNAL: - default: - error = EAI_FAIL; - break; - } - } else if ((hp->h_name == NULL) || (hp->h_name[0] == 0) - || (hp->h_addr_list[0] == NULL)) { -#ifdef USE_GETIPNODEBY - freehostent(hp); -#endif - hp = NULL; - error = EAI_FAIL; - } - - if (hp == NULL) - goto free; - -#ifdef USE_GETIPNODEBY - aplist = hp->h_addr_list; -#else - /* - * hp will be overwritten if we use gethostbyname2(). - * always deep copy for simplification. - */ - for (naddrs = 0; hp->h_addr_list[naddrs] != NULL; naddrs++) - ; - naddrs++; - aplist = (char **)malloc(sizeof(aplist[0]) * naddrs); - apbuf = (char *)malloc(hp->h_length * naddrs); - if (aplist == NULL || apbuf == NULL) { - error = EAI_MEMORY; - goto free; - } - memset(aplist, 0, sizeof(aplist[0]) * naddrs); - for (i = 0; i < naddrs; i++) { - if (hp->h_addr_list[i] == NULL) { - aplist[i] = NULL; - continue; - } - memcpy(&apbuf[i * hp->h_length], hp->h_addr_list[i], - hp->h_length); - aplist[i] = &apbuf[i * hp->h_length]; - } -#endif - - for (i = 0; aplist[i] != NULL; i++) { - af = hp->h_addrtype; - ap = aplist[i]; -#ifdef AF_INET6 - if (af == AF_INET6 - && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) { - af = AF_INET; - ap = ap + sizeof(struct in6_addr) - - sizeof(struct in_addr); - } -#endif - - if (af != pai->ai_family) - continue; - - if ((pai->ai_flags & AI_CANONNAME) == 0) { - GET_AI(cur->ai_next, afd, ap); - GET_PORT(cur->ai_next, servname); - } else { - /* - * if AI_CANONNAME and if reverse lookup - * fail, return ai anyway to pacify - * calling application. - * - * XXX getaddrinfo() is a name->address - * translation function, and it looks - * strange that we do addr->name - * translation here. - */ - get_name(ap, afd, &cur->ai_next, - ap, pai, servname); - } - - while (cur && cur->ai_next) - cur = cur->ai_next; - } - - *res = sentinel.ai_next; - return 0; - -free: -#ifdef USE_GETIPNODEBY - if (hp) - freehostent(hp); -#endif - if (aplist) - free(aplist); - if (apbuf) - free(apbuf); - if (sentinel.ai_next) - freeaddrinfo(sentinel.ai_next); - return error; -} - -/* - * hostname == NULL. - * passive socket -> anyaddr (0.0.0.0 or ::) - * non-passive socket -> localhost (127.0.0.1 or ::1) - */ -static int -explore_null(pai, hostname, servname, res) - const struct addrinfo *pai; - const char *hostname; - const char *servname; - struct addrinfo **res; -{ - int s; - const struct afd *afd; - struct addrinfo *cur; - struct addrinfo sentinel; - int error; - - *res = NULL; - sentinel.ai_next = NULL; - cur = &sentinel; - - /* - * filter out AFs that are not supported by the kernel - * XXX errno? - */ - s = socket(pai->ai_family, SOCK_DGRAM, 0); - if (s < 0) { - if (errno != EMFILE) - return 0; - } else - close(s); - - /* - * if the servname does not match socktype/protocol, ignore it. - */ - if (get_portmatch(pai, servname) != 0) - return 0; - - afd = find_afd(pai->ai_family); - - if (pai->ai_flags & AI_PASSIVE) { - GET_AI(cur->ai_next, afd, afd->a_addrany); - /* xxx meaningless? - * GET_CANONNAME(cur->ai_next, "anyaddr"); - */ - GET_PORT(cur->ai_next, servname); - } else { - GET_AI(cur->ai_next, afd, afd->a_loopback); - /* xxx meaningless? - * GET_CANONNAME(cur->ai_next, "localhost"); - */ - GET_PORT(cur->ai_next, servname); - } - cur = cur->ai_next; - - *res = sentinel.ai_next; - return 0; - -free: - if (sentinel.ai_next) - freeaddrinfo(sentinel.ai_next); - return error; -} - -/* - * numeric hostname - */ -static int -explore_numeric(pai, hostname, servname, res) - const struct addrinfo *pai; - const char *hostname; - const char *servname; - struct addrinfo **res; -{ - const struct afd *afd; - struct addrinfo *cur; - struct addrinfo sentinel; - int error; - char pton[PTON_MAX]; - int flags; - - *res = NULL; - sentinel.ai_next = NULL; - cur = &sentinel; - - /* - * if the servname does not match socktype/protocol, ignore it. - */ - if (get_portmatch(pai, servname) != 0) - return 0; - - afd = find_afd(pai->ai_family); - flags = pai->ai_flags; - - if (inet_pton(afd->a_af, hostname, pton) == 1) { - u_int32_t v4a; -#ifdef INET6 - u_char pfx; -#endif - - switch (afd->a_af) { - case AF_INET: - v4a = (u_int32_t)ntohl(((struct in_addr *)pton)->s_addr); - if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) - flags &= ~AI_CANONNAME; - v4a >>= IN_CLASSA_NSHIFT; - if (v4a == 0 || v4a == IN_LOOPBACKNET) - flags &= ~AI_CANONNAME; - break; -#ifdef INET6 - case AF_INET6: - pfx = ((struct in6_addr *)pton)->s6_addr[0]; - if (pfx == 0 || pfx == 0xfe || pfx == 0xff) - flags &= ~AI_CANONNAME; - break; -#endif - } - - if (pai->ai_family == afd->a_af || - pai->ai_family == PF_UNSPEC /*?*/) { - if ((flags & AI_CANONNAME) == 0) { - GET_AI(cur->ai_next, afd, pton); - GET_PORT(cur->ai_next, servname); - } else { - /* - * if AI_CANONNAME and if reverse lookup - * fail, return ai anyway to pacify - * calling application. - * - * XXX getaddrinfo() is a name->address - * translation function, and it looks - * strange that we do addr->name - * translation here. - */ - get_name(pton, afd, &cur->ai_next, - pton, pai, servname); - } - while (cur && cur->ai_next) - cur = cur->ai_next; - } else - ERR(EAI_FAMILY); /*xxx*/ - } - - *res = sentinel.ai_next; - return 0; - -free: -bad: - if (sentinel.ai_next) - freeaddrinfo(sentinel.ai_next); - return error; -} - -/* - * numeric hostname with scope - */ -static int -explore_numeric_scope(pai, hostname, servname, res) - const struct addrinfo *pai; - const char *hostname; - const char *servname; - struct addrinfo **res; -{ -#ifndef SCOPE_DELIMITER - return explore_numeric(pai, hostname, servname, res); -#else - const struct afd *afd; - struct addrinfo *cur; - int error; - char *cp, *hostname2 = NULL; - int scope; - struct sockaddr_in6 *sin6; - - /* - * if the servname does not match socktype/protocol, ignore it. - */ - if (get_portmatch(pai, servname) != 0) - return 0; - - afd = find_afd(pai->ai_family); - if (!afd->a_scoped) - return explore_numeric(pai, hostname, servname, res); - - cp = strchr(hostname, SCOPE_DELIMITER); - if (cp == NULL) - return explore_numeric(pai, hostname, servname, res); - - /* - * Handle special case of - */ - hostname2 = strdup(hostname); - if (hostname2 == NULL) - return EAI_MEMORY; - /* terminate at the delimiter */ - hostname2[cp - hostname] = '\0'; - - cp++; - switch (pai->ai_family) { -#ifdef INET6 - case AF_INET6: - scope = if_nametoindex(cp); - if (scope == 0) { - free(hostname2); - return (EAI_NONAME); - } - break; -#endif - } - - error = explore_numeric(pai, hostname2, servname, res); - if (error == 0) { - for (cur = *res; cur; cur = cur->ai_next) { - if (cur->ai_family != AF_INET6) - continue; - sin6 = (struct sockaddr_in6 *)cur->ai_addr; - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr)) - sin6->sin6_scope_id = scope; - } - } - - free(hostname2); - - return error; -#endif -} - -static int -get_name(addr, afd, res, numaddr, pai, servname) - const char *addr; - const struct afd *afd; - struct addrinfo **res; - char *numaddr; - const struct addrinfo *pai; - const char *servname; -{ - struct hostent *hp = NULL; - struct addrinfo *cur = NULL; - int error = 0; - char *ap = NULL, *cn = NULL; -#ifdef USE_GETIPNODEBY - int h_error; - - hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); -#else - hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); -#endif - if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { -#ifdef USE_GETIPNODEBY - GET_AI(cur, afd, hp->h_addr_list[0]); - GET_PORT(cur, servname); - GET_CANONNAME(cur, hp->h_name); -#else - /* hp will be damaged if we use gethostbyaddr() */ - if ((ap = (char *)malloc(hp->h_length)) == NULL) { - error = EAI_MEMORY; - goto free; - } - memcpy(ap, hp->h_addr_list[0], hp->h_length); - if ((cn = strdup(hp->h_name)) == NULL) { - error = EAI_MEMORY; - goto free; - } - - GET_AI(cur, afd, ap); - GET_PORT(cur, servname); - GET_CANONNAME(cur, cn); - free(ap); ap = NULL; - free(cn); cn = NULL; -#endif - } else { - GET_AI(cur, afd, numaddr); - GET_PORT(cur, servname); - } - -#ifdef USE_GETIPNODEBY - if (hp) - freehostent(hp); -#endif - *res = cur; - return SUCCESS; - free: - if (cur) - freeaddrinfo(cur); - if (ap) - free(ap); - if (cn) - free(cn); -#ifdef USE_GETIPNODEBY - if (hp) - freehostent(hp); -#endif - *res = NULL; - return error; -} - -static int -get_canonname(pai, ai, str) - const struct addrinfo *pai; - struct addrinfo *ai; - const char *str; -{ - if ((pai->ai_flags & AI_CANONNAME) != 0) { - ai->ai_canonname = strdup(str); - if (ai->ai_canonname == NULL) - return EAI_MEMORY; - } - return 0; -} - -static struct addrinfo * -get_ai(pai, afd, addr) - const struct addrinfo *pai; - const struct afd *afd; - const char *addr; -{ - char *p; - struct addrinfo *ai; - - ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) - + (afd->a_socklen)); - if (ai == NULL) - return NULL; - - memcpy(ai, pai, sizeof(struct addrinfo)); - ai->ai_addr = (struct sockaddr *)(ai + 1); - memset(ai->ai_addr, 0, afd->a_socklen); -#ifdef HAVE_SOCKADDR_SA_LEN - ai->ai_addr->sa_len = afd->a_socklen; -#endif - ai->ai_addrlen = afd->a_socklen; - ai->ai_addr->sa_family = ai->ai_family = afd->a_af; - p = (char *)(ai->ai_addr); - memcpy(p + afd->a_off, addr, afd->a_addrlen); - return ai; -} - -static int -get_portmatch(ai, servname) - const struct addrinfo *ai; - const char *servname; -{ - - /* get_port does not touch first argument. when matchonly == 1. */ - return get_port((struct addrinfo *)ai, servname, 1); -} - -static int -get_port(ai, servname, matchonly) - struct addrinfo *ai; - const char *servname; - int matchonly; -{ - const char *proto; - struct servent *sp; - int port; - int allownumeric; - - if (servname == NULL) - return 0; - switch (ai->ai_family) { - case AF_INET: -#ifdef AF_INET6 - case AF_INET6: -#endif - break; - default: - return 0; - } - - switch (ai->ai_socktype) { - case SOCK_RAW: - return EAI_SERVICE; - case SOCK_DGRAM: - case SOCK_STREAM: - allownumeric = 1; - break; - case ANY: - allownumeric = 0; - break; - default: - return EAI_SOCKTYPE; - } - - if (str_isnumber(servname)) { - if (!allownumeric) - return EAI_SERVICE; - port = htons(atoi(servname)); - if (port < 0 || port > 65535) - return EAI_SERVICE; - } else { - switch (ai->ai_socktype) { - case SOCK_DGRAM: - proto = "udp"; - break; - case SOCK_STREAM: - proto = "tcp"; - break; - default: - proto = NULL; - break; - } - - if ((sp = getservbyname(servname, proto)) == NULL) - return EAI_SERVICE; - port = sp->s_port; - } - - if (!matchonly) { - switch (ai->ai_family) { - case AF_INET: - ((struct sockaddr_in *)ai->ai_addr)->sin_port = port; - break; -#ifdef INET6 - case AF_INET6: - ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port = port; - break; -#endif - } - } - - return 0; -} - -static const struct afd * -find_afd(af) - int af; -{ - const struct afd *afd; - - if (af == PF_UNSPEC) - return NULL; - for (afd = afdl; afd->a_af; afd++) { - if (afd->a_af == af) - return afd; - } - return NULL; -} diff --git a/contrib/libpcap/Win32/Src/getnetbynm.c b/contrib/libpcap/Win32/Src/getnetbynm.c deleted file mode 100644 index fa4d398..0000000 --- a/contrib/libpcap/Win32/Src/getnetbynm.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getnetbyname.c 5.5 (Berkeley) 6/27/88"; -#endif /* LIBC_SCCS and not lint */ - -#include "inetprivate.h" - -extern int _net_stayopen; - -struct netent * -getnetbyname(const char *name) -{ - register struct netent *p; - register char **cp; - - setnetent(_net_stayopen); - while (p = getnetent()) { - if (strcmp(p->n_name, name) == 0) - break; - for (cp = p->n_aliases; *cp != 0; cp++) - if (strcmp(*cp, name) == 0) - goto found; - } -found: - if (!_net_stayopen) - endnetent(); - return (p); -} diff --git a/contrib/libpcap/Win32/Src/getnetent.c b/contrib/libpcap/Win32/Src/getnetent.c deleted file mode 100644 index d4cceb3..0000000 --- a/contrib/libpcap/Win32/Src/getnetent.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getnetent.c 5.5 (Berkeley) 6/27/88"; -#endif /* LIBC_SCCS and not lint */ - -#include "inetprivate.h" - -#define MAXALIASES 35 - -static char NETDB[] = _PATH_NETWORKS; -static FILE *netf = NULL; -static char line[BUFSIZ+1]; -static struct netent net; -static char *net_aliases[MAXALIASES]; -static char *any(char *, char *); - -int _net_stayopen; -extern u_int32_t inet_network(const char *cp); - -void -setnetent(f) - int f; -{ - if (netf == NULL) - netf = fopen(NETDB, "r" ); - else - rewind(netf); - _net_stayopen |= f; -} - -void -endnetent() -{ - if (netf) { - fclose(netf); - netf = NULL; - } - _net_stayopen = 0; -} - -struct netent * -getnetent() -{ - char *p; - register char *cp, **q; - - if (netf == NULL && (netf = fopen(NETDB, "r" )) == NULL) - return (NULL); -again: - p = fgets(line, BUFSIZ, netf); - if (p == NULL) - return (NULL); - if (*p == '#') - goto again; - cp = any(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; - net.n_name = p; - cp = any(p, " \t"); - if (cp == NULL) - goto again; - *cp++ = '\0'; - while (*cp == ' ' || *cp == '\t') - cp++; - p = any(cp, " \t"); - if (p != NULL) - *p++ = '\0'; - net.n_net = inet_network(cp); - net.n_addrtype = AF_INET; - q = net.n_aliases = net_aliases; - if (p != NULL) - cp = p; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &net_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = any(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&net); -} - -static char * -any(cp, match) - register char *cp; - char *match; -{ - register char *mp, c; - - while (c = *cp) { - for (mp = match; *mp; mp++) - if (*mp == c) - return (cp); - cp++; - } - return ((char *)0); -} diff --git a/contrib/libpcap/Win32/Src/getopt.c b/contrib/libpcap/Win32/Src/getopt.c deleted file mode 100644 index 03c2086..0000000 --- a/contrib/libpcap/Win32/Src/getopt.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt, /* character checked for validity */ - optreset; /* reset getopt */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define BADARG (int)':' -#define EMSG "" - -/* - * getopt -- - * Parse argc/argv argument vector. - */ -int -getopt(nargc, nargv, ostr) - int nargc; - char * const *nargv; - const char *ostr; -{ -#ifdef WIN32 - char *__progname="windump"; -#else - extern char *__progname; -#endif - static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ - - if (optreset || !*place) { /* update scanning pointer */ - optreset = 0; - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return (-1); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return (-1); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = strchr(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means -1. - */ - if (optopt == (int)'-') - return (-1); - if (!*place) - ++optind; - if (opterr && *ostr != ':') - (void)fprintf(stderr, - "%s: illegal option -- %c\n", __progname, optopt); - return (BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (*ostr == ':') - return (BADARG); - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - __progname, optopt); - return (BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return (optopt); /* dump back option letter */ -} diff --git a/contrib/libpcap/Win32/Src/getservent.c b/contrib/libpcap/Win32/Src/getservent.c deleted file mode 100644 index 61b8cb0..0000000 --- a/contrib/libpcap/Win32/Src/getservent.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#define MAXALIASES 35 - -static char SERVDB[] = _PATH_SERVICES; -static FILE *servf = NULL; -static char line[BUFSIZ+1]; -static struct servent serv; -static char *serv_aliases[MAXALIASES]; -int _serv_stayopen; - -void -setservent(f) - int f; -{ - if (servf == NULL) - servf = fopen(SERVDB, "r" ); - else - rewind(servf); - _serv_stayopen |= f; -} - -void -endservent() -{ - if (servf) { - fclose(servf); - servf = NULL; - } - _serv_stayopen = 0; -} - -struct servent * -getservent() -{ - char *p; - register char *cp, **q; - - if (servf == NULL && (servf = fopen(SERVDB, "r" )) == NULL) - return (NULL); -again: - if ((p = fgets(line, BUFSIZ, servf)) == NULL) - return (NULL); - if (*p == '#') - goto again; - cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; - serv.s_name = p; - p = strpbrk(p, " \t"); - if (p == NULL) - goto again; - *p++ = '\0'; - while (*p == ' ' || *p == '\t') - p++; - cp = strpbrk(p, ",/"); - if (cp == NULL) - goto again; - *cp++ = '\0'; - serv.s_port = htons((u_short)atoi(p)); - serv.s_proto = cp; - q = serv.s_aliases = serv_aliases; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &serv_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; - } - *q = NULL; - return (&serv); -} diff --git a/contrib/libpcap/Win32/Src/inet_aton.c b/contrib/libpcap/Win32/Src/inet_aton.c deleted file mode 100644 index 3da6667..0000000 --- a/contrib/libpcap/Win32/Src/inet_aton.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $ */ - -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $"; -#endif - -#include -#include - -/* Minimal implementation of inet_aton. - * Cannot distinguish between failure and a local broadcast address. */ - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -int -inet_aton(const char *cp, struct in_addr *addr) -{ - addr->s_addr = inet_addr(cp); - return (addr->s_addr == INADDR_NONE) ? 0 : 1; -} diff --git a/contrib/libpcap/Win32/Src/inet_net.c b/contrib/libpcap/Win32/Src/inet_net.c deleted file mode 100644 index 5bbe391..0000000 --- a/contrib/libpcap/Win32/Src/inet_net.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include "inetprivate.h" - -/* - * Internet network address interpretation routine. - * The library routines call this routine to interpret - * network numbers. - */ -u_int32_t -inet_network(const char *cp) -{ - register u_long val, base, n; - register char c; - u_long parts[4], *pp = parts; - register int i; - -again: - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; base = 10; - /* - * The 4.4BSD version of this file also accepts 'x__' as a hexa - * number. I don't think this is correct. -- Uli - */ - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp)) { - if (isdigit(c)) { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit(c)) { - val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') { - if (pp >= parts + 4) - return (INADDR_NONE); - *pp++ = val, cp++; - goto again; - } - if (*cp && !isspace(*cp)) - return (INADDR_NONE); - *pp++ = val; - n = pp - parts; - if (n > 4) - return (INADDR_NONE); - for (val = 0, i = 0; i < (int)n; i++) { - val <<= 8; - val |= parts[i] & 0xff; - } - return (val); -} diff --git a/contrib/libpcap/Win32/Src/inet_pton.c b/contrib/libpcap/Win32/Src/inet_pton.c deleted file mode 100644 index 7933a4e..0000000 --- a/contrib/libpcap/Win32/Src/inet_pton.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1999 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $ */ - -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $"; -#endif - -#include - -#ifdef WIN32 -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT 97 /* not present in errno.h provided with VC */ -#endif -#endif - -#ifdef __MINGW32__ -int* _errno(); -#define errno (*_errno()) -#endif /* __MINGW32__ */ - -#include - -int inet_aton(const char *cp, struct in_addr *addr); - -int -inet_pton(int af, const char *src, void *dst) -{ - if (af != AF_INET) { - errno = EAFNOSUPPORT; - return -1; - } - return inet_aton (src, dst); -} diff --git a/contrib/libpcap/msdos/bin2c.c b/contrib/libpcap/msdos/bin2c.c deleted file mode 100644 index a6a3c88..0000000 --- a/contrib/libpcap/msdos/bin2c.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -static void Abort (char *fmt,...) -{ - va_list args; - va_start (args, fmt); - vfprintf (stderr, fmt, args); - va_end (args); - exit (1); -} - -int main (int argc, char **argv) -{ - FILE *inFile; - FILE *outFile = stdout; - time_t now = time (NULL); - int ch, i; - - if (argc != 2) - Abort ("Usage: %s bin-file [> result]", argv[0]); - - if ((inFile = fopen(argv[1],"rb")) == NULL) - Abort ("Cannot open %s\n", argv[1]); - - fprintf (outFile, - "/* data statements for file %s at %.24s */\n" - "/* Generated by BIN2C, G.Vanem 1995 */\n", - argv[1], ctime(&now)); - - i = 0; - while ((ch = fgetc(inFile)) != EOF) - { - if (i++ % 12 == 0) - fputs ("\n ", outFile); - fprintf (outFile, "0x%02X,", ch); - } - fputc ('\n', outFile); - fclose (inFile); - return (0); -} diff --git a/contrib/libpcap/msdos/common.dj b/contrib/libpcap/msdos/common.dj deleted file mode 100644 index 3f64d14..0000000 --- a/contrib/libpcap/msdos/common.dj +++ /dev/null @@ -1,80 +0,0 @@ -# -# Common defines for libpcap and 16/32-bit network drivers (djgpp) -# -# @(#) $Header: /tcpdump/master/libpcap/msdos/common.dj,v 1.2 2004-12-19 19:36:33 guy Exp $ (LBL) - -.SUFFIXES: .exe .wlm .dxe .l .y -.PHONY: check_gcclib - -default: check_gcclib all - -GCCLIB = /djgpp/lib/gcc-lib/djgpp/3.31 -MAKEFILE = Makefile.dj - -# -# DLX 2.91+ lib. Change path to suite. -# Not used anymore. Uses DXE3 now. -# -# DLX_LIB = $(DJDIR)/contrib/dlx.291/libdlx.a -# DLX_LINK = $(DJDIR)/bin/dlxgen.exe - -WATT32_ROOT = $(subst \,/,$(WATT_ROOT)) - - -ifeq ($(wildcard $(GCCLIB)/libgcc.a),) -check_gcclib: - @echo libgcc.a not found. Set \"$(GCCLIB)\" to \"/djgpp/lib/gcc-lib/djgpp/3.X\" -endif - - -# -# Include 32-bit driver support -# -USE_32BIT_DRIVERS = 0 - -# -# Use loadable driver modules instead of statically linking -# all drivers. -# -USE_32BIT_MODULES = 0 - -# -# Put interrupt sensitive code/data in locked sections -# Do `make clean' in all affected directories after changing this. -# -USE_SECTION_LOCKING = 0 - -# -# Set to 1 to use exception handler lib (only for me) -# -USE_EXCEPT = 0 - -CC = gcc.exe -LD = ld.exe -ASM = nasm.exe -fbin -dDEBUG -YACC = bison.exe -LEX = flex.exe - -CFLAGS = -g -gcoff -O2 -Wall -I. -I$(WATT32_ROOT)/inc - -ifeq ($(USE_EXCEPT),1) - CFLAGS += -DUSE_EXCEPT - EXC_LIB = d:/prog/mw/except/lib/libexc.a -endif - -ifeq ($(USE_SECTION_LOCKING),1) - CFLAGS += -DUSE_SECTION_LOCKING -endif - -ifeq ($(USE_32BIT_DRIVERS),1) - CFLAGS += -DUSE_32BIT_DRIVERS -endif - -%.o: %.c - $(CC) -c $(CFLAGS) $< - @echo - -%.o: %.s - $(CC) -c $(CFLAGS) -x assembler-with-cpp -o $@ $< - @echo - diff --git a/contrib/libpcap/msdos/makefile b/contrib/libpcap/msdos/makefile deleted file mode 100644 index f74684f..0000000 --- a/contrib/libpcap/msdos/makefile +++ /dev/null @@ -1,184 +0,0 @@ -# -# Makefile for dos-libpcap. NB. This makefile requires a Borland -# compatible make tool. -# -# Targets: -# Borland C 4.0+ (DOS large model) -# Metaware HighC 3.3+ (PharLap 386|DosX) -# - -.AUTODEPEND -.SWAP - -!if "$(WATT_ROOT)" == "" -!error Environment variable "WATT_ROOT" not set. -!endif - -WATT_INC = $(WATT_ROOT)\inc - -DEFS = -DMSDOS -DDEBUG -DNDIS_DEBUG -D_U_= -Dinline= \ - -DHAVE_STRERROR -DHAVE_LIMITS_H - -ASM = tasm.exe -t -l -mx -m2 -DDEBUG - -SOURCE = grammar.c scanner.c bpf_filt.c bpf_imag.c bpf_dump.c \ - etherent.c gencode.c nametoad.c pcap-dos.c optimize.c \ - savefile.c pcap.c inet.c msdos\ndis2.c msdos\pktdrvr.c \ - missing\snprintf.c - -BORLAND_OBJ = $(SOURCE:.c=.obj) msdos\pkt_rx0.obj msdos\ndis_0.obj - -HIGHC_OBJ = $(SOURCE:.c=.o32) msdos\pkt_rx0.o32 - -all: - @echo Usage: make pcap_bc.lib or pcap_hc.lib - - -pcap_bc.lib: bcc.arg $(BORLAND_OBJ) pcap_bc - - -pcap_hc.lib: hc386.arg $(HIGHC_OBJ) - 386lib $< @&&| - -nowarn -nobackup -twocase -replace $(HIGHC_OBJ) -| - -pcap_bc: $(BORLAND_OBJ) - @tlib pcap_bc.lib /C @&&| - -+$(**:.obj=-+) -| - -.c.obj: - bcc.exe @bcc.arg -o$*.obj $*.c - -.c.o32: - hc386.exe @hc386.arg -o $*.o32 $*.c - -.asm.obj: - $(ASM) $*.asm, $*.obj - -.asm.o32: - $(ASM) -DDOSX=1 $*.asm, $*.o32 - -scanner.c: scanner.l - flex -Ppcap_ -7 -oscanner.c scanner.l - -grammar.c tokdefs.h: grammar.y - bison --name-prefix=pcap_ --yacc --defines grammar.y - - @del grammar.c - - @del tokdefs.h - ren y_tab.c grammar.c - ren y_tab.h tokdefs.h - -bcc.arg: msdos\Makefile - @copy &&| - $(DEFS) -ml -c -v -3 -O2 -po -RT- -w- - -I$(WATT_INC) -I. -I.\msdos\pm_drvr -H=$(TEMP)\bcc.sym -| $< - -hc386.arg: msdos\Makefile - @copy &&| - # -DUSE_32BIT_DRIVERS - $(DEFS) -DDOSX=1 -w3 -c -g -O5 - -I$(WATT_INC) -I. -I.\msdos\pm_drvr - -Hsuffix=.o32 - -Hnocopyr - -Hpragma=Offwarn(491,553,572) - -Hon=Recognize_library # make memcpy/strlen etc. inline - -Hoff=Behaved # turn off some optimiser warnings -| $< - -clean: - @del *.obj - @del *.o32 - @del *.lst - @del *.map - @del bcc.arg - @del hc386.arg - @del grammar.c - @del tokdefs.h - @del scanner.c - @echo Cleaned - -# -# dependencies -# -pkt_rx0.obj: msdos\pkt_rx0.asm - -bpf_filt.obj: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h - -bpf_imag.obj: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h - -bpf_dump.obj: bpf_dump.c pcap.h pcap-bpf.h - -etherent.obj: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h - -optimize.obj: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h - -savefile.obj: savefile.c pcap-int.h pcap.h pcap-bpf.h - -pcap.obj: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h - -inet.obj: inet.c pcap-int.h pcap.h pcap-bpf.h - -grammar.obj: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pf.h pcap-namedb.h - -scanner.obj: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pcap-namedb.h tokdefs.h - -gencode.obj: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ - ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h ppp.h sll.h \ - arcnet.h pf.h pcap-namedb.h - -nametoad.obj: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pcap-namedb.h ethertype.h - -pcap-dos.obj: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h \ - msdos\pktdrvr.h - -pktdrvr.obj: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h \ - pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc - -ndis2.obj: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ - msdos\ndis2.h - -pkt_rx0.o32: msdos\pkt_rx0.asm - -bpf_filt.o32: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h - -bpf_imag.o32: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h - -bpf_dump.o32: bpf_dump.c pcap.h pcap-bpf.h - -etherent.o32: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h - -optimize.o32: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h - -savefile.o32: savefile.c pcap-int.h pcap.h pcap-bpf.h - -pcap.o32: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h - -inet.o32: inet.c pcap-int.h pcap.h pcap-bpf.h - -grammar.o32: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pf.h pcap-namedb.h - -scanner.o32: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pcap-namedb.h tokdefs.h - -gencode.o32: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ - ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h ppp.h sll.h \ - arcnet.h pf.h pcap-namedb.h - -nametoad.o32: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pcap-namedb.h ethertype.h - -pcap-dos.o32: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h \ - msdos\pktdrvr.h - -pktdrvr.o32: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h \ - pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc - -ndis2.o32: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h \ - msdos\ndis2.h - diff --git a/contrib/libpcap/msdos/makefile.dj b/contrib/libpcap/msdos/makefile.dj deleted file mode 100644 index 7ce58b4..0000000 --- a/contrib/libpcap/msdos/makefile.dj +++ /dev/null @@ -1,152 +0,0 @@ -# -# GNU Makefile for DOS-libpcap. djgpp version. -# -# Use this makefile from the libpcap root directory. -# E.g. like this: -# -# c:\net\pcap> make -f msdos/makefile.dj -# -# @(#) $Header: /tcpdump/master/libpcap/msdos/makefile.dj,v 1.2 2004-12-19 19:41:06 guy Exp $ (LBL) - -VPATH = missing msdos - -PREREQUISITES = scanner.c grammar.c tokdefs.h version.h msdos/pkt_stub.inc - -include msdos/common.dj - -DRIVER_DIR = ./msdos/pm_drvr - -CFLAGS += -DDEBUG -DNDIS_DEBUG -DHAVE_LIMITS_H -DHAVE_STRERROR \ - -D_U_='__attribute__((unused))' -DHAVE_VERSION_H - -# CFLAGS += -Dyylval=pcap_lval -DBDEBUG -DNDEBUG - -SOURCES = grammar.c scanner.c bpf_filt.c bpf_imag.c bpf_dump.c \ - etherent.c gencode.c nametoad.c pcap-dos.c optimize.c \ - savefile.c pcap.c inet.c msdos\pktdrvr.c msdos/ndis2.c \ - missing/snprintf.c - -OBJECTS = $(notdir $(SOURCES:.c=.o)) -TEMPBIN = tmp.bin - -ifeq ($(USE_32BIT_DRIVERS),1) - PM_OBJECTS = $(addprefix $(DRIVER_DIR)/, \ - printk.o pci.o pci-scan.o bios32.o dma.o irq.o intwrap.o \ - lock.o kmalloc.o quirks.o timer.o net_init.o) - # - # Static link of drivers - # - ifeq ($(USE_32BIT_MODULES),0) - PM_OBJECTS += $(addprefix $(DRIVER_DIR)/, \ - accton.o 8390.o 3c503.o 3c509.o 3c59x.o 3c515.o \ - 3c575_cb.o 3c90x.o ne.o wd.o cs89x0.o rtl8139.o) - endif -endif - -all: libpcap.a - -ifeq ($(USE_32BIT_DRIVERS),1) -$(PM_OBJECTS): - $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) $(notdir $@) -endif - -libpcap.a: version.h $(OBJECTS) $(PM_OBJECTS) - rm -f $@ - ar rs $@ $^ - -msdos/pkt_stub.inc: msdos/bin2c.exe msdos/pkt_rx1.S - $(ASM) -o $(TEMPBIN) -lmsdos/pkt_rx1.lst msdos/pkt_rx1.S - ./msdos/bin2c $(TEMPBIN) > $@ - rm -f $(TEMPBIN) - -grammar.c tokdefs.h: grammar.y - rm -f grammar.c tokdefs.h - $(YACC) --name-prefix=pcap_ --yacc --defines grammar.y - mv -f y_tab.c grammar.c - mv -f y_tab.h tokdefs.h - -version.h: ./VERSION - @echo '/* Generated from VERSION. Do not edit */' > $@ - sed -e 's/.*/static char pcap_version_string[] = "libpcap (&)";/' ./VERSION >> $@ - -scanner.c: scanner.l - $(LEX) -Ppcap_ -7 -t $^ > $@ - @echo - -msdos/bin2c.exe: msdos/bin2c.c - $(CC) $*.c -o $*.exe - -clean: - $(MAKE) -f Makefile.dj -C $(DRIVER_DIR) clean - $(MAKE) -f Makefile.dj -C libcpcap clean - rm -f $(OBJECTS) msdos/pkt_rx1.lst Makefile.bak $(PREREQUISITES) - -vclean: clean - rm -f libpcap.a msdos/bin2c.exe - -# -# Generated dependencies; Due to some hacks in gcc 2.95 and djgpp 2.03 -# we must prevent "$(DJDIR)/bin/../include/sys/version.h" from beeing -# included in dependency output (or else this makefile cannot be used on -# another machine). We therefore use a special 'specs' file during -# pre-processing. -# -MM_SPECS = specs.tmp -MAKEFILE = msdos/Makefile.dj - -depend: $(PREREQUISITES) - @echo Generating dependencies.. - @cp $(MAKEFILE) Makefile.bak - @echo "*cpp: %(cpp_cpu) %{posix:-D_POSIX_SOURCE} -remap" > $(MM_SPECS) - sed -e "/^# DO NOT DELETE THIS LINE/,$$d" < Makefile.bak > $(MAKEFILE) - echo "# DO NOT DELETE THIS LINE" >> $(MAKEFILE) - $(CC) -MM -specs=$(MM_SPECS) $(CFLAGS) $(SOURCES) >> $(MAKEFILE) - rm -f $(MM_SPECS) - -# -# Manually generated dependencies -# -msdos/pktdrvr.c: msdos/pkt_stub.inc -scanner.c: scanner.l -grammar.c tokdefs.h: grammar.y -grammar.h: grammar.y -scanner.l: pcap-int.h pcap-namedb.h gencode.h grammar.h gnuc.h -grammar.y: pcap-int.h gencode.h pcap-namedb.h gnuc.h - -# -# Automatically generated dependencies -# -# DO NOT DELETE THIS LINE -grammar.o: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h pf.h \ - pcap-namedb.h -scanner.o: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h pcap-namedb.h \ - tokdefs.h -bpf_filt.o: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h -bpf_imag.o: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h -bpf_dump.o: bpf_dump.c pcap.h pcap-bpf.h -etherent.o: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-namedb.h -gencode.o: gencode.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ - pcap-bpf.h ethertype.h nlpid.h llc.h gencode.h atmuni31.h sunatmpos.h \ - ppp.h sll.h arcnet.h pf.h pcap-namedb.h -nametoad.o: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h \ - pcap-namedb.h ethertype.h -pcap-dos.o: pcap-dos.c msdos/pm_drvr/pmdrvr.h msdos/pm_drvr/iface.h \ - msdos/pm_drvr/lock.h msdos/pm_drvr/ioport.h pcap-dos.h pcap-int.h \ - pcap.h pcap-bpf.h msdos/pm_drvr/kmalloc.h msdos/pm_drvr/bitops.h \ - msdos/pm_drvr/timer.h msdos/pm_drvr/dma.h msdos/pm_drvr/irq.h \ - msdos/pm_drvr/printk.h msdos/pm_drvr/pci.h msdos/pm_drvr/bios32.h \ - msdos/pm_drvr/module.h msdos/pm_drvr/3c501.h msdos/pm_drvr/3c503.h \ - msdos/pm_drvr/3c509.h msdos/pm_drvr/3c59x.h msdos/pm_drvr/3c515.h \ - msdos/pm_drvr/3c90x.h msdos/pm_drvr/3c575_cb.h msdos/pm_drvr/ne.h \ - msdos/pm_drvr/wd.h msdos/pm_drvr/accton.h msdos/pm_drvr/cs89x0.h \ - msdos/pm_drvr/rtl8139.h msdos/pm_drvr/ne2k-pci.h msdos/pktdrvr.h -optimize.o: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h -savefile.o: savefile.c pcap-int.h pcap.h pcap-bpf.h -pcap.o: pcap.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ - pcap-bpf.h -inet.o: inet.c pcap-int.h pcap.h pcap-bpf.h -pktdrvr.o: msdos/pktdrvr.c gnuc.h pcap-dos.h msdos/pm_drvr/lock.h \ - pcap-int.h pcap.h pcap-bpf.h msdos/pktdrvr.h msdos/pkt_stub.inc -ndis2.o: msdos/ndis2.c pcap-dos.h msdos/pm_drvr/lock.h pcap-int.h pcap.h \ - pcap-bpf.h msdos/ndis2.h -snprintf.o: missing/snprintf.c pcap-int.h pcap.h pcap-bpf.h diff --git a/contrib/libpcap/msdos/makefile.wc b/contrib/libpcap/msdos/makefile.wc deleted file mode 100644 index e7edde6..0000000 --- a/contrib/libpcap/msdos/makefile.wc +++ /dev/null @@ -1,131 +0,0 @@ -# -# Watcom Makefile for dos-libpcap. -# -# Specify MODEL = `3r' or `3s' -# Specify TARGET = `pharlap' or `dos4g' -# -# Use this makefile from the libpcap root directory. -# E.g. like this: -# -# c:\net\pcap> wmake -f msdos\makefile.wc -# - -MODEL = 3s -TARGET = dos4g - -OBJDIR = msdos\$(TARGET).w$(MODEL) -LIB = $(OBJDIR)\pcap.lib - -.EXTENSIONS: .l .y - -DEFS = -dDEBUG -dNDIS_DEBUG -d_U_= -dHAVE_LIMITS_H -dHAVE_STRERROR & - -dHAVE_SNPRINTF -dHAVE_VSNPRINTF - -CC = wcc386.exe -ASM = wasm.exe -$(MODEL) $(DEFS) -dDOSX -dDOS4GW -zq -bt=dos -fr=nul -d3 -s - -OBJS = $(OBJDIR)\grammar.obj $(OBJDIR)\scanner.obj $(OBJDIR)\pcap.obj & - $(OBJDIR)\bpf_filt.obj $(OBJDIR)\bpf_imag.obj $(OBJDIR)\bpf_dump.obj & - $(OBJDIR)\etherent.obj $(OBJDIR)\gencode.obj $(OBJDIR)\nametoad.obj & - $(OBJDIR)\pcap-dos.obj $(OBJDIR)\pktdrvr.obj $(OBJDIR)\optimize.obj & - $(OBJDIR)\savefile.obj $(OBJDIR)\inet.obj $(OBJDIR)\ndis2.obj - -CFLAGS = $(DEFS) $(YYDEFS) -I. -I$(%watt_root)\inc -I.\msdos\pm_drvr & - -$(MODEL) -mf -zff -zgf -zq -bt=dos -fr=nul -w6 -fpi & - -oilrtf -zm - -TEMPBIN = tmp.bin - -all: $(OBJDIR) $(OBJDIR)\pcap.lib - -$(OBJDIR): - - mkdir $(OBJDIR) - -$(OBJDIR)\pcap.lib: $(OBJS) wlib.arg - wlib -q -b -c $(OBJDIR)\pcap.lib @wlib.arg - -wlib.arg: msdos\makefile.wc - %create $^@ - for %f in ($(OBJS)) do %append $^@ +- %f - -$(OBJDIR)\pktdrvr.obj: msdos\pkt_stub.inc msdos\pktdrvr.c gnuc.h & - pcap-dos.h pcap-int.h pcap.h msdos\pktdrvr.h - *$(CC) $(CFLAGS) msdos\pktdrvr.c -fo=$@ - -$(OBJDIR)\ndis2.obj: msdos\ndis2.c - *$(CC) $(CFLAGS) msdos\ndis2.c -fo=$@ - -.ERASE -.c{$(OBJDIR)}.obj: - *$(CC) $(CFLAGS) $[@ -fo=$@ - -grammar.c tokdefs.h: grammar.y - bison --name-prefix=pcap_ --yacc --defines $[@ - - @del grammar.c - - @del tokdefs.h - ren y_tab.c grammar.c - ren y_tab.h tokdefs.h - -scanner.c: scanner.l - flex -Ppcap_ -7 -o$@ $[@ - -msdos\pkt_stub.inc: bin2c.exe msdos\pkt_rx1.S - nasm -fbin -dDEBUG -o $(TEMPBIN) -lmsdos\pkt_rx1.lst msdos\pkt_rx1.S - bin2c.exe $(TEMPBIN) > $@ - @del $(TEMPBIN) - -bin2c.exe: msdos\bin2c.c - wcl $[@ - -clean realclean vclean: .SYMBOLIC - for %f in (dos4g.w3r dos4g.w3s pharlap.w3r pharlap.w3s) do & - @del %f\*.obj - @del grammar.c - @del tokdefs.h - @del scanner.c - @del bin2c.exe - @del bin2c.obj - @del msdos\pkt_stub.inc - @echo Cleaned - -# -# dependencies -# -$(OBJDIR)\bpf_filt.obj: bpf_filt.c pcap-int.h pcap.h pcap-bpf.h gnuc.h - -$(OBJDIR)\bpf_imag.obj: bpf_imag.c pcap-int.h pcap.h pcap-bpf.h - -$(OBJDIR)\bpf_dump.obj: bpf_dump.c pcap.h pcap-bpf.h - -$(OBJDIR)\etherent.obj: etherent.c pcap-int.h pcap.h pcap-bpf.h pcap-nam.h - -$(OBJDIR)\optimize.obj: optimize.c pcap-int.h pcap.h pcap-bpf.h gencode.h - -$(OBJDIR)\savefile.obj: savefile.c pcap-int.h pcap.h pcap-bpf.h - -$(OBJDIR)\pcap.obj: pcap.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h - -$(OBJDIR)\inet.obj: inet.c pcap-int.h pcap.h pcap-bpf.h - -$(OBJDIR)\grammar.obj: grammar.c pcap-int.h pcap.h pcap-bpf.h gencode.h & - pf.h pcap-nam.h - -$(OBJDIR)\scanner.obj: scanner.c pcap-int.h pcap.h pcap-bpf.h gencode.h & - pcap-nam.h tokdefs.h - -$(OBJDIR)\gencode.obj: gencode.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h & - ethertyp.h nlpid.h llc.h gencode.h atmuni31.h sunatmpo.h ppp.h sll.h & - arcnet.h pf.h pcap-nam.h - -$(OBJDIR)\nametoad.obj: nametoad.c pcap-int.h pcap.h pcap-bpf.h gencode.h & - pcap-nam.h ethertyp.h - -$(OBJDIR)\pcap-dos.obj: pcap-dos.c pcap.h pcap-bpf.h pcap-dos.h pcap-int.h & - msdos\pktdrvr.h - -$(OBJDIR)\pktdrvr.obj: msdos\pktdrvr.c gnuc.h pcap-dos.h pcap-int.h & - pcap.h pcap-bpf.h msdos\pktdrvr.h msdos\pkt_stub.inc - -$(OBJDIR)\ndis2.obj: msdos\ndis2.c pcap-dos.h pcap-int.h pcap.h pcap-bpf.h & - msdos\ndis2.h - diff --git a/contrib/libpcap/msdos/ndis2.c b/contrib/libpcap/msdos/ndis2.c deleted file mode 100644 index 8cebe6e..0000000 --- a/contrib/libpcap/msdos/ndis2.c +++ /dev/null @@ -1,860 +0,0 @@ -/* - * Copyright (c) 1993,1994 - * Texas A&M University. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Texas A&M University - * and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Developers: - * David K. Hess, Douglas Lee Schales, David R. Safford - * - * Heavily modified for Metaware HighC + GNU C 2.8+ - * Gisle Vanem 1998 - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "pcap-dos.h" -#include "pcap-int.h" -#include "msdos/ndis2.h" - -#if defined(USE_NDIS2) - -/* - * Packet buffer handling - */ -extern int FreePktBuf (PktBuf *buf); -extern int EnquePktBuf (PktBuf *buf); -extern PktBuf* AllocPktBuf (void); - -/* - * Various defines - */ -#define MAX_NUM_DEBUG_STRINGS 90 -#define DEBUG_STRING_LENGTH 80 -#define STACK_POOL_SIZE 6 -#define STACK_SIZE 256 - -#define MEDIA_FDDI 1 -#define MEDIA_ETHERNET 2 -#define MEDIA_TOKEN 3 - -static int startDebug = 0; -static int stopDebug = 0; - -static DWORD droppedPackets = 0L; -static WORD frameSize = 0; -static WORD headerSize = 0; -static int mediaType = 0; -static char *lastErr = NULL; - -static BYTE debugStrings [MAX_NUM_DEBUG_STRINGS][DEBUG_STRING_LENGTH]; -static BYTE *freeStacks [STACK_POOL_SIZE]; -static int freeStackPtr = STACK_POOL_SIZE - 1; - -static ProtMan protManEntry = NULL; -static WORD protManDS = 0; -static volatile int xmitPending; - -static struct _PktBuf *txBufPending; -static struct _CardHandle *handle; -static struct _CommonChars common; -static struct _ProtocolChars protChars; -static struct _ProtDispatch lowerTable; - -static struct _FailingModules failingModules; -static struct _BindingsList bindings; - -static struct { - WORD err_num; - char *err_text; - } ndis_errlist[] = { - - { ERR_SUCCESS, - "The function completed successfully.\n" }, - - { ERR_WAIT_FOR_RELEASE, - "The ReceiveChain completed successfully but the protocol has\n" - "retained control of the buffer.\n" }, - - { ERR_REQUEST_QUEUED, - "The current request has been queued.\n" }, - - { ERR_FRAME_NOT_RECOGNIZED, - "Frame not recognized.\n" }, - - { ERR_FRAME_REJECTED, - "Frame was discarded.\n" }, - - { ERR_FORWARD_FRAME, - "Protocol wishes to forward frame to another protocol.\n" }, - - { ERR_OUT_OF_RESOURCE, - "Out of resource.\n" }, - - { ERR_INVALID_PARAMETER, - "Invalid parameter.\n" }, - - { ERR_INVALID_FUNCTION, - "Invalid function.\n" }, - - { ERR_NOT_SUPPORTED, - "Not supported.\n" }, - - { ERR_HARDWARE_ERROR, - "Hardware error.\n" }, - - { ERR_TRANSMIT_ERROR, - "The packet was not transmitted due to an error.\n" }, - - { ERR_NO_SUCH_DESTINATION, - "Token ring packet was not recognized when transmitted.\n" }, - - { ERR_BUFFER_TOO_SMALL, - "Provided buffer was too small.\n" }, - - { ERR_ALREADY_STARTED, - "Network drivers already started.\n" }, - - { ERR_INCOMPLETE_BINDING, - "Protocol driver could not complete its bindings.\n" }, - - { ERR_DRIVER_NOT_INITIALIZED, - "MAC did not initialize properly.\n" }, - - { ERR_HARDWARE_NOT_FOUND, - "Hardware not found.\n" }, - - { ERR_HARDWARE_FAILURE, - "Hardware failure.\n" }, - - { ERR_CONFIGURATION_FAILURE, - "Configuration failure.\n" }, - - { ERR_INTERRUPT_CONFLICT, - "Interrupt conflict.\n" }, - - { ERR_INCOMPATIBLE_MAC, - "The MAC is not compatible with the protocol.\n" }, - - { ERR_INITIALIZATION_FAILED, - "Initialization failed.\n" }, - - { ERR_NO_BINDING, - "Binding did not occur.\n" }, - - { ERR_NETWORK_MAY_NOT_BE_CONNECTED, - "The network may not be connected to the adapter.\n" }, - - { ERR_INCOMPATIBLE_OS_VERSION, - "The version of the operating system is incompatible with the protocol.\n" }, - - { ERR_ALREADY_REGISTERED, - "The protocol is already registered.\n" }, - - { ERR_PATH_NOT_FOUND, - "PROTMAN.EXE could not be found.\n" }, - - { ERR_INSUFFICIENT_MEMORY, - "Insufficient memory.\n" }, - - { ERR_INFO_NOT_FOUND, - "Protocol Mananger info structure is lost or corrupted.\n" }, - - { ERR_GENERAL_FAILURE, - "General failure.\n" } -}; - -/* - * Some handy macros - */ -#define PERROR(str) printf("%s (%d): %s\n", __FILE__,__LINE__,str) -#define DEBUG_RING() (debugStrings[stopDebug+1 == MAX_NUM_DEBUG_STRINGS ? \ - stopDebug = 0 : ++stopDebug]) - -/* - * needs rewrite for DOSX - */ -#define MAC_DISPATCH(hnd) ((struct _MacUpperDispatch*)(hnd)->common->upperDispatchTable) -#define MAC_STATUS(hnd) ((struct _MacStatusTable*) (hnd)->common->serviceStatus) -#define MAC_CHAR(hnd) ((struct _MacChars*) (hnd)->common->serviceChars) - -#ifdef NDIS_DEBUG - #define DEBUG0(str) printf (str) - #define DEBUG1(fmt,a) printf (fmt,a) - #define DEBUG2(fmt,a,b) printf (fmt,a,b) - #define TRACE0(str) sprintf (DEBUG_RING(),str) - #define TRACE1(fmt,a) sprintf (DEBUG_RING(),fmt,a) -#else - #define DEBUG0(str) ((void)0) - #define DEBUG1(fmt,a) ((void)0) - #define DEBUG2(fmt,a,b) ((void)0) - #define TRACE0(str) ((void)0) - #define TRACE1(fmt,a) ((void)0) -#endif - -/* - * This routine is called from both threads - */ -void NdisFreeStack (BYTE *aStack) -{ - GUARD(); - - if (freeStackPtr == STACK_POOL_SIZE - 1) - PERROR ("tried to free too many stacks"); - - freeStacks[++freeStackPtr] = aStack; - - if (freeStackPtr == 0) - TRACE0 ("freeStackPtr went positive\n"); - - UNGUARD(); -} - -/* - * This routine is called from callbacks to allocate local data - */ -BYTE *NdisAllocStack (void) -{ - BYTE *stack; - - GUARD(); - - if (freeStackPtr < 0) - { - /* Ran out of stack buffers. Return NULL which will start - * dropping packets - */ - TRACE0 ("freeStackPtr went negative\n"); - stack = 0; - } - else - stack = freeStacks[freeStackPtr--]; - - UNGUARD(); - return (stack); -} - -CALLBACK (NdisSystemRequest (DWORD param1, DWORD param2, WORD param3, - WORD opcode, WORD targetDS)) -{ - static int bindEntry = 0; - struct _CommonChars *macCommon; - volatile WORD result; - - switch (opcode) - { - case REQ_INITIATE_BIND: - macCommon = (struct _CommonChars*) param2; - if (macCommon == NULL) - { - printf ("There is an NDIS misconfiguration.\n"); - result = ERR_GENERAL_FAILURE; - break; - } - DEBUG2 ("module name %s\n" - "module type %s\n", - macCommon->moduleName, - ((MacChars*) macCommon->serviceChars)->macName); - - /* Binding to the MAC */ - result = macCommon->systemRequest ((DWORD)&common, (DWORD)&macCommon, - 0, REQ_BIND, - macCommon->moduleDS); - - if (!strcmp(bindings.moduleName[bindEntry], handle->moduleName)) - handle->common = macCommon; - else PERROR ("unknown module"); - ++bindEntry; - break; - - case REQ_INITIATE_UNBIND: - macCommon = (struct _CommonChars*) param2; - result = macCommon->systemRequest ((DWORD)&common, 0, - 0, REQ_UNBIND, - macCommon->moduleDS); - break; - - default: - result = ERR_GENERAL_FAILURE; - break; - } - ARGSUSED (param1); - ARGSUSED (param3); - ARGSUSED (targetDS); - return (result); -} - -CALLBACK (NdisRequestConfirm (WORD protId, WORD macId, WORD reqHandle, - WORD status, WORD request, WORD protDS)) -{ - ARGSUSED (protId); ARGSUSED (macId); - ARGSUSED (reqHandle); ARGSUSED (status); - ARGSUSED (request); ARGSUSED (protDS); - return (ERR_SUCCESS); -} - -CALLBACK (NdisTransmitConfirm (WORD protId, WORD macId, WORD reqHandle, - WORD status, WORD protDS)) -{ - xmitPending--; - FreePktBuf (txBufPending); /* Add passed ECB back to the free list */ - - ARGSUSED (reqHandle); - ARGSUSED (status); - ARGSUSED (protDS); - return (ERR_SUCCESS); -} - - -/* - * The primary function for receiving packets - */ -CALLBACK (NdisReceiveLookahead (WORD macId, WORD frameSize, - WORD bytesAvail, BYTE *buffer, - BYTE *indicate, WORD protDS)) -{ - int result; - PktBuf *pktBuf; - WORD bytesCopied; - struct _TDBufDescr tDBufDescr; - -#if 0 - TRACE1 ("lookahead length = %d, ", bytesAvail); - TRACE1 ("ecb = %08lX, ", *ecb); - TRACE1 ("count = %08lX\n", count); - TRACE1 ("offset = %08lX, ", offset); - TRACE1 ("timesAllowed = %d, ", timesAllowed); - TRACE1 ("packet size = %d\n", look->dataLookAheadLen); -#endif - - /* Allocate a buffer for the packet - */ - if ((pktBuf = AllocPktBuf()) == NULL) - { - droppedPackets++; - return (ERR_FRAME_REJECTED); - } - - /* - * Now kludge things. Note we will have to undo this later. This will - * make the packet contiguous after the MLID has done the requested copy. - */ - - tDBufDescr.tDDataCount = 1; - tDBufDescr.tDBufDescrRec[0].tDPtrType = NDIS_PTR_PHYSICAL; - tDBufDescr.tDBufDescrRec[0].tDDataPtr = pktBuf->buffer; - tDBufDescr.tDBufDescrRec[0].tDDataLen = pktBuf->length; - tDBufDescr.tDBufDescrRec[0].dummy = 0; - - result = MAC_DISPATCH(handle)->transferData (&bytesCopied, 0, &tDBufDescr, - handle->common->moduleDS); - pktBuf->packetLength = bytesCopied; - - if (result == ERR_SUCCESS) - EnquePktBuf(pktBuf); - else FreePktBuf (pktBuf); - - ARGSUSED (frameSize); - ARGSUSED (bytesAvail); - ARGSUSED (indicate); - ARGSUSED (protDS); - - return (ERR_SUCCESS); -} - -CALLBACK (NdisIndicationComplete (WORD macId, WORD protDS)) -{ - ARGSUSED (macId); - ARGSUSED (protDS); - - /* We don't give a hoot about these. Just return - */ - return (ERR_SUCCESS); -} - -/* - * This is the OTHER way we may receive packets - */ -CALLBACK (NdisReceiveChain (WORD macId, WORD frameSize, WORD reqHandle, - struct _RxBufDescr *rxBufDescr, - BYTE *indicate, WORD protDS)) -{ - struct _PktBuf *pktBuf; - int i; - - /* - * For now we copy the entire packet over to a PktBuf structure. This may be - * a performance hit but this routine probably isn't called very much, and - * it is a lot of work to do it otherwise. Also if it is a filter protocol - * packet we could end up sucking up MAC buffes. - */ - - if ((pktBuf = AllocPktBuf()) == NULL) - { - droppedPackets++; - return (ERR_FRAME_REJECTED); - } - pktBuf->packetLength = 0; - - /* Copy the packet to the buffer - */ - for (i = 0; i < rxBufDescr->rxDataCount; ++i) - { - struct _RxBufDescrRec *rxDescr = &rxBufDescr->rxBufDescrRec[i]; - - memcpy (pktBuf->buffer + pktBuf->packetLength, - rxDescr->rxDataPtr, rxDescr->rxDataLen); - pktBuf->packetLength += rxDescr->rxDataLen; - } - - EnquePktBuf (pktBuf); - - ARGSUSED (frameSize); - ARGSUSED (reqHandle); - ARGSUSED (indicate); - ARGSUSED (protDS); - - /* This frees up the buffer for the MAC to use - */ - return (ERR_SUCCESS); -} - -CALLBACK (NdisStatusProc (WORD macId, WORD param1, BYTE *indicate, - WORD opcode, WORD protDS)) -{ - switch (opcode) - { - case STATUS_RING_STATUS: - break; - case STATUS_ADAPTER_CHECK: - break; - case STATUS_START_RESET: - break; - case STATUS_INTERRUPT: - break; - case STATUS_END_RESET: - break; - default: - break; - } - ARGSUSED (macId); - ARGSUSED (param1); - ARGSUSED (indicate); - ARGSUSED (opcode); - ARGSUSED (protDS); - - /* We don't need to do anything about this stuff yet - */ - return (ERR_SUCCESS); -} - -/* - * Tell the NDIS driver to start the delivery of the packet - */ -int NdisSendPacket (struct _PktBuf *pktBuf, int macId) -{ - struct _TxBufDescr txBufDescr; - int result; - - xmitPending++; - txBufPending = pktBuf; /* we only have 1 pending Tx at a time */ - - txBufDescr.txImmedLen = 0; - txBufDescr.txImmedPtr = NULL; - txBufDescr.txDataCount = 1; - txBufDescr.txBufDescrRec[0].txPtrType = NDIS_PTR_PHYSICAL; - txBufDescr.txBufDescrRec[0].dummy = 0; - txBufDescr.txBufDescrRec[0].txDataLen = pktBuf->packetLength; - txBufDescr.txBufDescrRec[0].txDataPtr = pktBuf->buffer; - - result = MAC_DISPATCH(handle)->transmitChain (common.moduleId, - pktBuf->handle, - &txBufDescr, - handle->common->moduleDS); - switch (result) - { - case ERR_OUT_OF_RESOURCE: - /* Note that this should not happen but if it does there is not - * much we can do about it - */ - printf ("ERROR: transmit queue overflowed\n"); - return (0); - - case ERR_SUCCESS: - /* Everything was hunky dory and synchronous. Free up the - * packet buffer - */ - xmitPending--; - FreePktBuf (pktBuf); - return (1); - - case ERR_REQUEST_QUEUED: - /* Everything was hunky dory and asynchronous. Do nothing - */ - return (1); - - default: - printf ("Tx fail, code = %04X\n", result); - return (0); - } -} - - - -static int ndis_nerr = sizeof(ndis_errlist) / sizeof(ndis_errlist[0]); - -static char *Ndis_strerror (WORD errorCode) -{ - static char buf[30]; - int i; - - for (i = 0; i < ndis_nerr; i++) - if (errorCode == ndis_errlist[i].err_num) - return (ndis_errlist[i].err_text); - - sprintf (buf,"unknown error %d",errorCode); - return (buf); -} - - -char *NdisLastError (void) -{ - char *errStr = lastErr; - lastErr = NULL; - return (errStr); -} - -int NdisOpen (void) -{ - struct _ReqBlock reqBlock; - int result; - int ndisFd = open (NDIS_PATH, O_RDONLY); - - if (ndisFd < 0) - { - printf ("Could not open NDIS Protocol Manager device.\n"); - return (0); - } - - memset (&reqBlock, 0, sizeof(ReqBlock)); - - reqBlock.opcode = PM_GET_PROTOCOL_MANAGER_LINKAGE; - - result = NdisGetLinkage (ndisFd, (char*)&reqBlock, sizeof(ReqBlock)); - if (result != 0) - { - printf ("Could not get Protocol Manager linkage.\n"); - close (ndisFd); - return (0); - } - - close (ndisFd); - protManEntry = (ProtMan) reqBlock.pointer1; - protManDS = reqBlock.word1; - - DEBUG2 ("Entry Point = %04X:%04X\n", FP_SEG(protManEntry),FP_OFF(protManEntry)); - DEBUG1 ("ProtMan DS = %04X\n", protManDS); - return (1); -} - - -int NdisRegisterAndBind (int promis) -{ - struct _ReqBlock reqBlock; - WORD result; - - memset (&common,0,sizeof(common)); - - common.tableSize = sizeof (common); - - common.majorNdisVersion = 2; - common.minorNdisVersion = 0; - common.majorModuleVersion = 2; - common.minorModuleVersion = 0; - - /* Indicates binding from below and dynamically loaded - */ - common.moduleFlags = 0x00000006L; - - strcpy (common.moduleName, "PCAP"); - - common.protocolLevelUpper = 0xFF; - common.protocolLevelLower = 1; - common.interfaceLower = 1; -#ifdef __DJGPP__ - common.moduleDS = _dos_ds; /* the callback data segment */ -#else - common.moduleDS = _DS; -#endif - - common.systemRequest = (SystemRequest) systemRequestGlue; - common.serviceChars = (BYTE*) &protChars; - common.serviceStatus = NULL; - common.upperDispatchTable = NULL; - common.lowerDispatchTable = (BYTE*) &lowerTable; - - protChars.length = sizeof (protChars); - protChars.name[0] = 0; - protChars.type = 0; - - lowerTable.backPointer = &common; - lowerTable.requestConfirm = requestConfirmGlue; - lowerTable.transmitConfirm = transmitConfirmGlue; - lowerTable.receiveLookahead = receiveLookaheadGlue; - lowerTable.indicationComplete = indicationCompleteGlue; - lowerTable.receiveChain = receiveChainGlue; - lowerTable.status = statusGlue; - lowerTable.flags = 3; - if (promis) - lowerTable.flags |= 4; /* promiscous mode (receive everything) */ - - bindings.numBindings = 1; - strcpy (bindings.moduleName[0], handle->moduleName); - - /* Register ourselves with NDIS - */ - reqBlock.opcode = PM_REGISTER_MODULE; - reqBlock.pointer1 = (BYTE FAR*) &common; - reqBlock.pointer2 = (BYTE FAR*) &bindings; - - result = (*protManEntry) (&reqBlock, protManDS); - if (result) - { - printf ("Protman registering failed: %s\n", Ndis_strerror(result)); - return (0); - } - - /* Start the binding process - */ - reqBlock.opcode = PM_BIND_AND_START; - reqBlock.pointer1 = (BYTE FAR*) &failingModules; - - result = (*protManEntry) (&reqBlock, protManDS); - if (result) - { - printf ("Start binding failed: %s\n", Ndis_strerror(result)); - return (0); - } - return (1); -} - -static int CheckMacFeatures (CardHandle *card) -{ - DWORD serviceFlags; - BYTE _far *mediaString; - BYTE _far *mac_addr; - - DEBUG2 ("checking card features\n" - "common table address = %08lX, macId = %d\n", - card->common, card->common->moduleId); - - serviceFlags = MAC_CHAR (handle)->serviceFlags; - - if ((serviceFlags & SF_PROMISCUOUS) == 0) - { - printf ("The MAC %s does not support promiscuous mode.\n", - card->moduleName); - return (0); - } - - mediaString = MAC_CHAR (handle)->macName; - - DEBUG1 ("media type = %s\n",mediaString); - - /* Get the media type. And set the header size - */ - if (!strncmp(mediaString,"802.3",5) || - !strncmp(mediaString,"DIX",3) || - !strncmp(mediaString,"DIX+802.3",9)) - headerSize = sizeof (EthernetIIHeader); - - else if (!strncmp(mediaString,"FDDI",4)) - headerSize = sizeof (FddiHeader) + - sizeof (Ieee802Dot2SnapHeader); - else - { - printf ("Unsupported MAC type: `%s'\n", mediaString); - return (0); - } - - frameSize = MAC_CHAR (handle)->maxFrameSize; - mac_addr = MAC_CHAR (handle)->currentAddress; - - printf ("Hardware address: %02X:%02X:%02X:%02X:%02X:%02X\n", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5]); - return (1); -} - -static int NdisStartMac (CardHandle *card) -{ - WORD result; - - /* Set the lookahead length - */ - result = MAC_DISPATCH(handle)->request (common.moduleId, 0, - headerSize, 0, - REQ_SET_LOOKAHEAD, - card->common->moduleDS); - - /* We assume that if we got INVALID PARAMETER then either this - * is not supported or will work anyway. NE2000 does this. - */ - if (result != ERR_SUCCESS && result != ERR_INVALID_PARAMETER) - { - DEBUG1 ("Set lookahead failed: %s\n", Ndis_strerror(result)); - return (0); - } - - /* Set the packet filter. Note that for some medias and drivers we - * must specify all three flags or the card(s) will not operate correctly. - */ - result = MAC_DISPATCH(handle)->request (common.moduleId, 0, - /* all packets */ FILTER_PROMISCUOUS | - /* packets to us */ FILTER_DIRECTED | - /* broadcasts */ FILTER_BROADCAST, - 0, REQ_SET_PACKET_FILTER, - card->common->moduleDS); - if (result != ERR_SUCCESS) - { - DEBUG1 ("Set packet filter failed: %s\n", Ndis_strerror(result)); - return (0); - } - - /* If OPEN/CLOSE supported then open the adapter - */ - if (MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE) - { - result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, NULL, - REQ_OPEN_ADAPTER, - card->common->moduleDS); - if (result != ERR_SUCCESS) - { - DEBUG1 ("Opening the MAC failed: %s\n", Ndis_strerror(result)); - return (0); - } - } - return (1); -} - -void NdisShutdown (void) -{ - struct _ReqBlock reqBlock; - int result, i; - - if (!handle) - return; - - /* If the adapters support open and are open then close them - */ - if ((MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE) && - (MAC_STATUS(handle)->macStatus & MAC_OPEN)) - { - result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, 0, - REQ_CLOSE_ADAPTER, - handle->common->moduleDS); - if (result != ERR_SUCCESS) - { - printf ("Closing the MAC failed: %s\n", Ndis_strerror(result)); - return; - } - } - - /* Tell the Protocol Manager to unbind and stop - */ - reqBlock.opcode = PM_UNBIND_AND_STOP; - reqBlock.pointer1 = (BYTE FAR*) &failingModules; - reqBlock.pointer2 = NULL; - - result = (*protManEntry) (&reqBlock, protManDS); - if (result) - printf ("Unbind failed: %s\n", Ndis_strerror(result)); - - for (i = 0; i < STACK_POOL_SIZE; ++i) - free (freeStacks[i] - STACK_SIZE); - - handle = NULL; -} - -int NdisInit (int promis) -{ - int i, result; - - /* Allocate the real mode stacks used for NDIS callbacks - */ - for (i = 0; i < STACK_POOL_SIZE; ++i) - { - freeStacks[i] = malloc (STACK_SIZE); - if (!freeStacks[i]) - return (0); - freeStacks[i] += STACK_SIZE; - } - - if (!NdisOpen()) - return (0); - - if (!NdisRegisterAndBind(promis)) - return (0); - - DEBUG1 ("My module id: %d\n", common.moduleId); - DEBUG1 ("Handle id; %d\n", handle->common->moduleId); - DEBUG1 ("MAC card: %-16s - ", handle->moduleName); - - atexit (NdisShutdown); - - if (!CheckMacFeatures(&handle)) - return (0); - - switch (mediaType) - { - case MEDIA_FDDI: - DEBUG0 ("Media type: FDDI"); - break; - case MEDIA_ETHERNET: - DEBUG0 ("Media type: ETHERNET"); - break; - default: - DEBUG0 ("Unsupported media.\n"); - return (0); - } - - DEBUG1 (" - Frame size: %d\n", frameSize); - - if (!NdisStartMac(&handle)) - return (0); - return (1); -} -#endif /* USE_NDIS2 */ - diff --git a/contrib/libpcap/msdos/ndis2.h b/contrib/libpcap/msdos/ndis2.h deleted file mode 100644 index 958575f..0000000 --- a/contrib/libpcap/msdos/ndis2.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright (c) 1993,1994 - * Texas A&M University. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Texas A&M University - * and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Developers: - * David K. Hess, Douglas Lee Schales, David R. Safford - * - * Heavily modified for Metaware HighC + GNU C 2.8+ - * Gisle Vanem 1998 - */ - -#ifndef __PCAP_NDIS_H -#define __PCAP_NDIS_H - -#if defined (__HIGHC__) - #define pascal _CC(_CALLEE_POPS_STACK & ~_REVERSE_PARMS) /* calling convention */ - #define CALLBACK(foo) pascal WORD foo - #define PAS_PTR(x,arg) typedef FAR WORD pascal (*x) arg - #define GUARD() _inline (0x9C,0xFA) /* pushfd, cli */ - #define UNGUARD() _inline (0x9D) /* popfd */ - #define FAR _far - -#elif defined(__GNUC__) - #define CALLBACK(foo) WORD foo __attribute__((stdcall)) - #define PAS_PTR(x,arg) typedef WORD (*x) arg __attribute__((stdcall)) - #define GUARD() __asm__ __volatile__ ("pushfd; cli") - #define UNGUARD() __asm__ __volatile__ ("popfd") - #define FAR - -#elif defined (__TURBOC__) - #define CALLBACK(foo) WORD pascal foo - #define PAS_PTR(x,arg) typedef WORD pascal (_far *x) arg - #define GUARD() _asm { pushf; cli } - #define UNGUARD() _asm { popf } - #define FAR _far - -#elif defined (__WATCOMC__) - #define CALLBACK(foo) WORD pascal foo - #define PAS_PTR(x,arg) typedef WORD pascal (_far *x) arg - #define GUARD() _disable() - #define UNGUARD() _enable() - #define FAR _far - -#else - #error Unsupported compiler -#endif - - -/* - * Forwards - */ -struct _ReqBlock; -struct _TxBufDescr; -struct _TDBufDescr; - -/* - * Protocol Manager API - */ -PAS_PTR (ProtMan, (struct _ReqBlock FAR*, WORD)); - -/* - * System request - */ -PAS_PTR (SystemRequest, (DWORD, DWORD, WORD, WORD, WORD)); - -/* - * MAC API - */ -PAS_PTR (TransmitChain, (WORD, WORD, struct _TxBufDescr FAR*, WORD)); -PAS_PTR (TransferData, (WORD*,WORD, struct _TDBufDescr FAR*, WORD)); -PAS_PTR (Request, (WORD, WORD, WORD, DWORD, WORD, WORD)); -PAS_PTR (ReceiveRelease,(WORD, WORD)); -PAS_PTR (IndicationOn, (WORD)); -PAS_PTR (IndicationOff, (WORD)); - - -typedef enum { - HARDWARE_NOT_INSTALLED = 0, - HARDWARE_FAILED_DIAG = 1, - HARDWARE_FAILED_CONFIG = 2, - HARDWARE_HARD_FAULT = 3, - HARDWARE_SOFT_FAULT = 4, - HARDWARE_OK = 7, - HARDWARE_MASK = 0x0007, - MAC_BOUND = 0x0008, - MAC_OPEN = 0x0010, - DIAG_IN_PROGRESS = 0x0020 - } NdisMacStatus; - -typedef enum { - STATUS_RING_STATUS = 1, - STATUS_ADAPTER_CHECK = 2, - STATUS_START_RESET = 3, - STATUS_INTERRUPT = 4, - STATUS_END_RESET = 5 - } NdisStatus; - -typedef enum { - FILTER_DIRECTED = 1, - FILTER_BROADCAST = 2, - FILTER_PROMISCUOUS = 4, - FILTER_SOURCE_ROUTE = 8 - } NdisPacketFilter; - -typedef enum { - REQ_INITIATE_DIAGNOSTICS = 1, - REQ_READ_ERROR_LOG = 2, - REQ_SET_STATION_ADDRESS = 3, - REQ_OPEN_ADAPTER = 4, - REQ_CLOSE_ADAPTER = 5, - REQ_RESET_MAC = 6, - REQ_SET_PACKET_FILTER = 7, - REQ_ADD_MULTICAST_ADDRESS = 8, - REQ_DELETE_MULTICAST_ADDRESS = 9, - REQ_UPDATE_STATISTICS = 10, - REQ_CLEAR_STATISTICS = 11, - REQ_INTERRUPT_REQUEST = 12, - REQ_SET_FUNCTIONAL_ADDRESS = 13, - REQ_SET_LOOKAHEAD = 14 - } NdisGeneralRequest; - -typedef enum { - SF_BROADCAST = 0x00000001L, - SF_MULTICAST = 0x00000002L, - SF_FUNCTIONAL = 0x00000004L, - SF_PROMISCUOUS = 0x00000008L, - SF_SOFT_ADDRESS = 0x00000010L, - SF_STATS_CURRENT = 0x00000020L, - SF_INITIATE_DIAGS = 0x00000040L, - SF_LOOPBACK = 0x00000080L, - SF_RECEIVE_CHAIN = 0x00000100L, - SF_SOURCE_ROUTING = 0x00000200L, - SF_RESET_MAC = 0x00000400L, - SF_OPEN_CLOSE = 0x00000800L, - SF_INTERRUPT_REQUEST = 0x00001000L, - SF_SOURCE_ROUTING_BRIDGE = 0x00002000L, - SF_VIRTUAL_ADDRESSES = 0x00004000L - } NdisMacServiceFlags; - -typedef enum { - REQ_INITIATE_BIND = 1, - REQ_BIND = 2, - REQ_INITIATE_PREBIND = 3, - REQ_INITIATE_UNBIND = 4, - REQ_UNBIND = 5 - } NdisSysRequest; - -typedef enum { - PM_GET_PROTOCOL_MANAGER_INFO = 1, - PM_REGISTER_MODULE = 2, - PM_BIND_AND_START = 3, - PM_GET_PROTOCOL_MANAGER_LINKAGE = 4, - PM_GET_PROTOCOL_INI_PATH = 5, - PM_REGISTER_PROTOCOL_MANAGER_INFO = 6, - PM_INIT_AND_REGISTER = 7, - PM_UNBIND_AND_STOP = 8, - PM_BIND_STATUS = 9, - PM_REGISTER_STATUS = 10 - } NdisProtManager; - - -typedef enum { - ERR_SUCCESS = 0x00, - ERR_WAIT_FOR_RELEASE = 0x01, - ERR_REQUEST_QUEUED = 0x02, - ERR_FRAME_NOT_RECOGNIZED = 0x03, - ERR_FRAME_REJECTED = 0x04, - ERR_FORWARD_FRAME = 0x05, - ERR_OUT_OF_RESOURCE = 0x06, - ERR_INVALID_PARAMETER = 0x07, - ERR_INVALID_FUNCTION = 0x08, - ERR_NOT_SUPPORTED = 0x09, - ERR_HARDWARE_ERROR = 0x0A, - ERR_TRANSMIT_ERROR = 0x0B, - ERR_NO_SUCH_DESTINATION = 0x0C, - ERR_BUFFER_TOO_SMALL = 0x0D, - ERR_ALREADY_STARTED = 0x20, - ERR_INCOMPLETE_BINDING = 0x21, - ERR_DRIVER_NOT_INITIALIZED = 0x22, - ERR_HARDWARE_NOT_FOUND = 0x23, - ERR_HARDWARE_FAILURE = 0x24, - ERR_CONFIGURATION_FAILURE = 0x25, - ERR_INTERRUPT_CONFLICT = 0x26, - ERR_INCOMPATIBLE_MAC = 0x27, - ERR_INITIALIZATION_FAILED = 0x28, - ERR_NO_BINDING = 0x29, - ERR_NETWORK_MAY_NOT_BE_CONNECTED = 0x2A, - ERR_INCOMPATIBLE_OS_VERSION = 0x2B, - ERR_ALREADY_REGISTERED = 0x2C, - ERR_PATH_NOT_FOUND = 0x2D, - ERR_INSUFFICIENT_MEMORY = 0x2E, - ERR_INFO_NOT_FOUND = 0x2F, - ERR_GENERAL_FAILURE = 0xFF - } NdisError; - -#define NDIS_PARAM_INTEGER 0 -#define NDIS_PARAM_STRING 1 - -#define NDIS_TX_BUF_LENGTH 8 -#define NDIS_TD_BUF_LENGTH 1 -#define NDIS_RX_BUF_LENGTH 8 - -#define NDIS_PTR_PHYSICAL 0 -#define NDIS_PTR_VIRTUAL 2 - -#define NDIS_PATH "PROTMAN$" - - -typedef struct _CommonChars { - WORD tableSize; - BYTE majorNdisVersion; /* 2 - Latest version */ - BYTE minorNdisVersion; /* 0 */ - WORD reserved1; - BYTE majorModuleVersion; - BYTE minorModuleVersion; - DWORD moduleFlags; - /* 0 - Binding at upper boundary supported - * 1 - Binding at lower boundary supported - * 2 - Dynamically bound. - * 3-31 - Reserved, must be zero. - */ - BYTE moduleName[16]; - BYTE protocolLevelUpper; - /* 1 - MAC - * 2 - Data Link - * 3 - Network - * 4 - Transport - * 5 - Session - * -1 - Not specified - */ - BYTE interfaceUpper; - BYTE protocolLevelLower; - /* 0 - Physical - * 1 - MAC - * 2 - Data Link - * 3 - Network - * 4 - Transport - * 5 - Session - * -1 - Not specified - */ - BYTE interfaceLower; - WORD moduleId; - WORD moduleDS; - SystemRequest systemRequest; - BYTE *serviceChars; - BYTE *serviceStatus; - BYTE *upperDispatchTable; - BYTE *lowerDispatchTable; - BYTE *reserved2; /* Must be NULL */ - BYTE *reserved3; /* Must be NULL */ - } CommonChars; - - -typedef struct _MulticastList { - WORD maxMulticastAddresses; - WORD numberMulticastAddresses; - BYTE multicastAddress[16][16]; - } MulticastList; - - -typedef struct _MacChars { - WORD tableSize; - BYTE macName[16]; - WORD addressLength; - BYTE permanentAddress[16]; - BYTE currentAddress[16]; - DWORD currentFunctionalAddress; - MulticastList *multicastList; - DWORD linkSpeed; - DWORD serviceFlags; - WORD maxFrameSize; - DWORD txBufferSize; - WORD txBufferAllocSize; - DWORD rxBufferSize; - WORD rxBufferAllocSize; - BYTE ieeeVendor[3]; - BYTE vendorAdapter; - BYTE *vendorAdapterDescription; - WORD interruptLevel; - WORD txQueueDepth; - WORD maxDataBlocks; - } MacChars; - - -typedef struct _ProtocolChars { - WORD length; - BYTE name[16]; - WORD type; - } ProtocolChars; - - -typedef struct _MacUpperDispatch { - CommonChars *backPointer; - Request request; - TransmitChain transmitChain; - TransferData transferData; - ReceiveRelease receiveRelease; - IndicationOn indicationOn; - IndicationOff indicationOff; - } MacUpperDispatch; - - -typedef struct _MacStatusTable { - WORD tableSize; - DWORD lastDiag; - DWORD macStatus; - WORD packetFilter; - BYTE *mediaSpecificStats; - DWORD lastClear; - DWORD totalFramesRx; - DWORD totalFramesCrc; - DWORD totalBytesRx; - DWORD totalDiscardBufSpaceRx; - DWORD totalMulticastRx; - DWORD totalBroadcastRx; - DWORD obsolete1[5]; - DWORD totalDiscardHwErrorRx; - DWORD totalFramesTx; - DWORD totalBytesTx; - DWORD totalMulticastTx; - DWORD totalBroadcastTx; - DWORD obsolete2[2]; - DWORD totalDiscardTimeoutTx; - DWORD totalDiscardHwErrorTx; - } MacStatusTable; - - -typedef struct _ProtDispatch { - CommonChars *backPointer; - DWORD flags; - /* 0 - handles non-LLC frames - * 1 - handles specific-LSAP LLC frames - * 2 - handles specific-LSAP LLC frames - * 3-31 - reserved must be 0 - */ - void (*requestConfirm) (void); - void (*transmitConfirm) (void); - void (*receiveLookahead) (void); - void (*indicationComplete) (void); - void (*receiveChain) (void); - void (*status) (void); - } ProtDispatch; - - -typedef struct _ReqBlock { - WORD opcode; - WORD status; - BYTE FAR *pointer1; - BYTE FAR *pointer2; - WORD word1; - } ReqBlock; - - -typedef struct _TxBufDescrRec { - BYTE txPtrType; - BYTE dummy; - WORD txDataLen; - BYTE *txDataPtr; - } TxBufDescrRec; - - -typedef struct _TxBufDescr { - WORD txImmedLen; - BYTE *txImmedPtr; - WORD txDataCount; - TxBufDescrRec txBufDescrRec[NDIS_TX_BUF_LENGTH]; - } TxBufDescr; - - -typedef struct _TDBufDescrRec { - BYTE tDPtrType; - BYTE dummy; - WORD tDDataLen; - BYTE *tDDataPtr; - } TDBufDescrRec; - - -typedef struct _TDBufDescr { - WORD tDDataCount; - TDBufDescrRec tDBufDescrRec[NDIS_TD_BUF_LENGTH]; - } TDBufDescr; - - -typedef struct _RxBufDescrRec { - WORD rxDataLen; - BYTE *rxDataPtr; - } RxBufDescrRec; - - -typedef struct _RxBufDescr { - WORD rxDataCount; - RxBufDescrRec rxBufDescrRec[NDIS_RX_BUF_LENGTH]; - } RxBufDescr; - - -typedef struct _PktBuf { - struct _PktBuf *nextLink; - struct _PktBuf *prevLink; - int handle; - int length; - int packetLength; - DWORD sequence; - BYTE *buffer; - } PktBuf; - - -typedef struct _CardHandle { - BYTE moduleName[16]; - CommonChars *common; - } CardHandle; - - -typedef struct _BindingsList { - WORD numBindings; - BYTE moduleName[2][16]; - } BindingsList; - - -typedef struct _FailingModules { - BYTE upperModuleName[16]; - BYTE lowerModuleName[16]; - } FailingModules; - - -typedef union _HardwareAddress { - BYTE bytes[6]; - WORD words[3]; - struct { - BYTE bytes[6]; - } addr; - } HardwareAddress; - - -typedef struct _FddiHeader { - BYTE frameControl; - HardwareAddress etherDestHost; - HardwareAddress etherSrcHost; - } FddiHeader; - - -typedef struct _EthernetIIHeader { - HardwareAddress etherDestHost; - HardwareAddress etherSrcHost; - WORD etherType; - } EthernetIIHeader; - - -typedef struct _Ieee802Dot5Header { - HardwareAddress etherDestHost; - HardwareAddress etherSrcHost; - BYTE routeInfo[30]; - } Ieee802Dot5Header; - - -typedef struct _Ieee802Dot2SnapHeader { - BYTE dsap; /* 0xAA */ - BYTE ssap; /* 0xAA */ - BYTE control; /* 3 */ - BYTE protocolId[5]; - } Ieee802Dot2SnapHeader; - - -/* - * Prototypes - */ -extern char *NdisLastError (void); -extern int NdisOpen (void); -extern int NdisInit (int promis); -extern int NdisRegisterAndBind (int promis); -extern void NdisShutdown (void); -extern void NdisCheckMacFeatures (struct _CardHandle *card); -extern int NdisSendPacket (struct _PktBuf *pktBuf, int macId); - -/* - * Assembly "glue" functions - */ -extern int systemRequestGlue(); -extern int requestConfirmGlue(); -extern int transmitConfirmGlue(); -extern int receiveLookaheadGlue(); -extern int indicationCompleteGlue(); -extern int receiveChainGlue(); -extern int statusGlue(); - -/* - * IOCTL function - */ -#ifdef __SMALL__ -extern int _far NdisGetLinkage (int handle, char *data, int size); -#else -extern int NdisGetLinkage (int handle, char *data, int size); -#endif - -/* - * NDIS callback handlers - */ -CALLBACK (NdisSystemRequest (DWORD,DWORD, WORD, WORD, WORD)); -CALLBACK (NdisRequestConfirm ( WORD, WORD, WORD, WORD, WORD,WORD)); -CALLBACK (NdisTransmitConfirm ( WORD, WORD, WORD, WORD, WORD)); -CALLBACK (NdisReceiveLookahead ( WORD, WORD, WORD, BYTE*, BYTE*, WORD)); -CALLBACK (NdisReceiveChain ( WORD, WORD, WORD, struct _RxBufDescr*, BYTE*, WORD)); -CALLBACK (NdisStatusProc ( WORD, WORD, BYTE*, WORD,WORD)); -CALLBACK (NdisIndicationComplete( WORD, WORD)); - -BYTE *NdisAllocStack (void); -void NdisFreeStack (BYTE*); - -#ifdef __HIGHC__ - #define RENAME_ASM_SYM(x) pragma Alias(x,"@" #x "") /* prepend `@' */ - #define RENAME_C_SYM(x) pragma Alias(x,"_" #x "") /* prepend `_' */ - - RENAME_ASM_SYM (systemRequestGlue); - RENAME_ASM_SYM (requestConfirmGlue); - RENAME_ASM_SYM (transmitConfirmGlue); - RENAME_ASM_SYM (receiveLookaheadGlue); - RENAME_ASM_SYM (indicationCompleteGlue); - RENAME_ASM_SYM (receiveChainGlue); - RENAME_ASM_SYM (statusGlue); - RENAME_ASM_SYM (NdisGetLinkage); - RENAME_C_SYM (NdisSystemRequest); - RENAME_C_SYM (NdisRequestConfirm); - RENAME_C_SYM (NdisTransmitConfirm); - RENAME_C_SYM (NdisReceiveLookahead); - RENAME_C_SYM (NdisIndicationComplete); - RENAME_C_SYM (NdisReceiveChain); - RENAME_C_SYM (NdisStatusProc); - RENAME_C_SYM (NdisAllocStack); - RENAME_C_SYM (NdisFreeStack); -#endif - -#endif diff --git a/contrib/libpcap/msdos/ndis_0.asm b/contrib/libpcap/msdos/ndis_0.asm deleted file mode 100644 index 2990985..0000000 --- a/contrib/libpcap/msdos/ndis_0.asm +++ /dev/null @@ -1,188 +0,0 @@ -PAGE 60,132 -NAME NDIS_0 - -ifdef DOSX - .386 - _TEXT SEGMENT PUBLIC DWORD USE16 'CODE' - _TEXT ENDS - _DATA SEGMENT PUBLIC DWORD USE16 'CODE' - _DATA ENDS - _TEXT32 SEGMENT PUBLIC BYTE USE32 'CODE' - _TEXT32 ENDS - CB_DSEG EQU ; DOSX is tiny-model - D_SEG EQU <_TEXT SEGMENT> - D_END EQU <_TEXT ENDS> - ASSUME CS:_TEXT,DS:_TEXT - - PUSHREGS equ - POPREGS equ - - PUBPROC macro name - align 4 - public @&name - @&name label near - endm -else - .286 - _TEXT SEGMENT PUBLIC DWORD 'CODE' - _TEXT ENDS - _DATA SEGMENT PUBLIC DWORD 'DATA' - _DATA ENDS - CB_DSEG EQU ; 16bit is small/large model - D_SEG EQU <_DATA SEGMENT> - D_END EQU <_DATA ENDS> - ASSUME CS:_TEXT,DS:_DATA - - PUSHREGS equ - POPREGS equ - - PUBPROC macro name - public _&name - _&name label far - endm -endif - -;------------------------------------------- - -D_SEG - -D_END - - -_TEXT SEGMENT - -EXTRN _NdisSystemRequest : near -EXTRN _NdisRequestConfirm : near -EXTRN _NdisTransmitConfirm : near -EXTRN _NdisReceiveLookahead : near -EXTRN _NdisIndicationComplete : near -EXTRN _NdisReceiveChain : near -EXTRN _NdisStatusProc : near -EXTRN _NdisAllocStack : near -EXTRN _NdisFreeStack : near - -; -; *ALL* interrupt threads come through this macro. -; -CALLBACK macro callbackProc, argsSize - - pushf - PUSHREGS ;; Save the registers - - push es - push ds - mov ax,CB_DSEG ;; Load DS - mov ds,ax - call _NdisAllocStack ;; Get and install a stack. - - mov bx,ss ;; Save off the old stack in other regs - mov cx,sp - mov ss,dx ;; Install the new one - mov sp,ax - push bx ;; Save the old one on to the new stack - push cx - sub sp,&argsSize ;; Allocate space for arguments on the stack - - mov ax,ss ;; Set up the destination for the move - mov es,ax - mov di,sp - mov ds,bx ;; Set up the source for the move. - mov si,cx - add si,4+6+32 - - mov cx,&argsSize ;; Move the arguments to the stack. - shr cx,1 - cld - rep movsw - - mov ax,CB_DSEG ;; Set my data segment again. - mov ds,ax - - call &callbackProc ;; Call the real callback. - pop di ;; Pop off the old stack - pop si - mov bx,ss ;; Save off the current allocated stack. - mov cx,sp - mov ss,si ;; Restore the old stack - mov sp,di - push ax ;; Save the return code - push bx ;; Free the stack. Push the pointer to it - push cx - call _NdisFreeStack - add sp,4 - pop ax ;; Get the return code back - add di,32 ;; Get a pointer to ax on the stack - mov word ptr ss:[di],ax - pop ds - pop es - - POPREGS - popf -endm - -; -; Define all of the callbacks for the NDIS procs. -; - -PUBPROC systemRequestGlue -CALLBACK _NdisSystemRequest,14 -RETF - -PUBPROC requestConfirmGlue -CALLBACK _NdisRequestConfirm,12 -RETF - -PUBPROC transmitConfirmGlue -CALLBACK _NdisTransmitConfirm,10 -RETF - -PUBPROC receiveLookaheadGlue -CALLBACK _NdisReceiveLookahead,16 -RETF - -PUBPROC indicationCompleteGlue -CALLBACK _NdisIndicationComplete,4 -RETF - -PUBPROC receiveChainGlue -CALLBACK _NdisReceiveChain,16 -RETF - -PUBPROC statusGlue -CALLBACK _NdisStatusProc,12 -RETF - -; -; int FAR NdisGetLinkage (int handle, char *data, int size); -; - -ifdef DOSX - PUBPROC NdisGetLinkage - push ebx - mov ebx, [esp+8] ; device handle - mov eax, 4402h ; IOCTRL read function - mov edx, [esp+12] ; DS:EDX -> result data - mov ecx, [esp+16] ; ECX = length - int 21h - pop ebx - jc @fail - xor eax, eax - @fail: ret - -else - PUBPROC NdisGetLinkage - enter 0, 0 - mov bx, [bp+6] - mov ax, 4402h - mov dx, [bp+8] - mov cx, [bp+12] - int 21h - jc @fail - xor ax, ax - @fail: leave - retf -endif - -ENDS - -END diff --git a/contrib/libpcap/msdos/pkt_rx0.asm b/contrib/libpcap/msdos/pkt_rx0.asm deleted file mode 100644 index 94f3d09..0000000 --- a/contrib/libpcap/msdos/pkt_rx0.asm +++ /dev/null @@ -1,197 +0,0 @@ -PAGE 60,132 -NAME PKT_RX - -ifdef ??version ; using TASM - masm - jumps -endif - -PUBLIC _pktDrop, _pktRxBuf, _pktTxBuf, _pktTemp -PUBLIC _rxOutOfs, _rxInOfs, _PktReceiver, _pktRxEnd - -; -; these sizes MUST be equal to the sizes in PKTDRVR.H -; - -RX_BUF_SIZE = 1500 ; max message size on Ethernet -TX_BUF_SIZE = 1500 - -ifdef DOSX - .386 - NUM_RX_BUF = 32 ; # of RX element buffers - _TEXT SEGMENT PUBLIC DWORD USE16 'CODE' - _TEXT ENDS - _DATA SEGMENT PUBLIC DWORD USE16 'CODE' - _DATA ENDS - D_SEG EQU <_TEXT SEGMENT> - D_END EQU <_TEXT ENDS> - ASSUME CS:_TEXT,DS:_TEXT -else - .286 - NUM_RX_BUF = 10 - _TEXT SEGMENT PUBLIC DWORD 'CODE' - _TEXT ENDS - _DATA SEGMENT PUBLIC DWORD 'DATA' - _DATA ENDS - D_SEG EQU <_DATA SEGMENT> - D_END EQU <_DATA ENDS> - ASSUME CS:_TEXT,DS:_DATA -endif - -;------------------------------------------- - -D_SEG - -RX_ELEMENT STRUC - firstCount dw 0 ; # of bytes on 1st call - secondCount dw 0 ; # of bytes on 2nd call - handle dw 0 ; handle for upcall - destinAdr db 6 dup (0) ; packet destination address - sourceAdr db 6 dup (0) ; packet source address - protocol dw 0 ; packet protocol number - rxBuffer db RX_BUF_SIZE dup (0) ; RX buffer -ENDS - align 4 -_rxOutOfs dw offset _pktRxBuf ; ring buffer offsets -_rxInOfs dw offset _pktRxBuf ; into _pktRxBuf -_pktDrop dw 0,0 ; packet drop counter -_pktTemp db 20 dup (0) ; temp work area -_pktTxBuf db (TX_BUF_SIZE+14) dup (0) ; TX buffer -_pktRxBuf RX_ELEMENT NUM_RX_BUF dup (<>) ; RX structures - LAST_OFS = offset $ - - screenSeg dw 0B800h - newInOffset dw 0 - - fanChars db '-\|/' - fanIndex dw 0 - -D_END - -_TEXT SEGMENT - - -SHOW_RX MACRO - push es - push bx - mov bx, screenSeg - mov es, bx ;; r-mode segment of colour screen - mov di, 158 ;; upper right corner - 1 - mov bx, fanIndex - mov al, fanChars[bx] ;; get write char - mov ah, 15 ;; and white colour - stosw ;; write to screen at ES:EDI - inc fanIndex ;; update next index - and fanIndex, 3 - pop bx - pop es -ENDM - -;------------------------------------------------------------------------ -; -; This macro return ES:DI to tail of Rx queue - -ENQUEUE MACRO - LOCAL @noWrap - mov ax, _rxInOfs ;; DI = current in-offset - add ax, SIZE RX_ELEMENT ;; point to next _pktRxBuf buffer - cmp ax, LAST_OFS ;; pointing past last ? - jb @noWrap ;; no - jump - lea ax, _pktRxBuf ;; yes, point to 1st buffer - align 4 -@noWrap: cmp ax, _rxOutOfs ;; in-ofs = out-ofs ? - je @dump ;; yes, queue is full - mov di, _rxInOfs ;; ES:DI -> buffer at queue input - mov newInOffset, ax ;; remember new input offset - - ;; NOTE. rxInOfs is updated after the packet has been copied - ;; to ES:DI (= DS:SI on 2nd call) by the packet driver - -ENDM - -;------------------------------------------------------------------------ -; -; This routine gets called by the packet driver twice: -; 1st time (AX=0) it requests an address where to put the packet -; -; 2nd time (AX=1) the packet has been copied to this location (DS:SI) -; BX has client handle (stored in RX_ELEMENT.handle). -; CX has # of bytes in packet on both call. They should be equal. -; -; A test for equality is done by putting CX in _pktRxBuf [n].firstCount -; and _pktRxBuf[n].secondCount, and CL on first call in -; _pktRxBuf[n].rxBuffer[CX]. These values are checked in "PktReceive" -; (PKTDRVR.C) -; -;--------------------------------------------------------------------- - -_PktReceiver: - pushf - cli ; no distraction wanted ! - push ds - push bx -ifdef DOSX - mov bx, cs -else - mov bx, SEG _DATA -endif - mov ds, bx - mov es, bx ; ES = DS = CS or seg _DATA - pop bx ; restore handle - - cmp ax, 0 ; first call? (AX=0) - jne @post ; AX=1: second call, do post process - -ifdef DEBUG - SHOW_RX ; show that a packet is received -endif - cmp cx, RX_BUF_SIZE+14 ; size OK ? - ja @skip ; no, packet to large for us - - ENQUEUE ; ES:DI -> _pktRxBuf[n] - - mov [di].firstCount, cx ; remember the first count. - mov [di].handle, bx ; remember the handle. - add di, 6 ; ES:DI -> _pktRxBuf[n].destinAdr - pop ds - popf - retf ; far return to driver with ES:DI - - align 4 -@dump: inc _pktDrop[0] ; discard the packet on 1st call - adc _pktDrop[2], 0 ; increment packets lost - -@skip: xor di, di ; return ES:DI = NIL pointer - xor ax, ax - mov es, ax - pop ds - popf - retf - - align 4 -@post: or si, si ; DS:SI->_pktRxBuf[n][n].destinAdr - jz @discard ; make sure we don't use NULL-pointer - - sub si, 6 ; DS:SI -> _pktRxBuf[n].destinAdr - ; - ; push si - ; push [si].firstCount - ; call bpf_filter_match ; run the filter here some day? - ; add sp, 4 - ; cmp ax, 0 - ; je @discard - - mov [si].secondCount, cx - mov ax, newInOffset - mov _rxInOfs, ax ; update _pktRxBuf input offset - - align 4 -@discard:pop ds - popf - retf - -_pktRxEnd db 0 ; marker for end of r-mode code/data - -_TEXT ENDS - -END diff --git a/contrib/libpcap/msdos/pkt_rx1.s b/contrib/libpcap/msdos/pkt_rx1.s deleted file mode 100644 index 98eafaf..0000000 --- a/contrib/libpcap/msdos/pkt_rx1.s +++ /dev/null @@ -1,155 +0,0 @@ -; -; This file requires NASM 0.97+ to assemble -; -; Currently used only for djgpp + DOS4GW targets -; -; these sizes MUST be equal to the sizes in PKTDRVR.H -; -%define ETH_MTU 1500 ; max data size on Ethernet -%define ETH_MIN 60 ; min/max total frame size -%define ETH_MAX (ETH_MTU+2*6+2) -%define NUM_RX_BUF 32 ; # of RX element buffers -%define RX_SIZE (ETH_MAX+6) ; sizeof(RX_ELEMENT) = 1514+6 -%idefine offset - -struc RX_ELEMENT - .firstCount resw 1 ; # of bytes on 1st call - .secondCount resw 1 ; # of bytes on 2nd call - .handle resw 1 ; handle for upcall - ; .timeStamp resw 4 ; 64-bit RDTSC value - .destinAdr resb 6 ; packet destination address - .sourceAdr resb 6 ; packet source address - .protocol resw 1 ; packet protocol number - .rxBuffer resb ETH_MTU ; RX buffer -endstruc - -;------------------------------------------- - -[org 0] ; assemble to .bin file - -_rxOutOfs dw offset _pktRxBuf ; ring buffer offsets -_rxInOfs dw offset _pktRxBuf ; into _pktRxBuf -_pktDrop dw 0,0 ; packet drop counter -_pktTemp resb 20 ; temp work area -_pktTxBuf resb (ETH_MAX) ; TX buffer -_pktRxBuf resb (RX_SIZE*NUM_RX_BUF) ; RX structures - LAST_OFS equ $ - -screenSeg dw 0B800h -newInOffset dw 0 - -fanChars db '-\|/' -fanIndex dw 0 - -%macro SHOW_RX 0 - push es - push bx - mov bx, [screenSeg] - mov es, bx ;; r-mode segment of colour screen - mov di, 158 ;; upper right corner - 1 - mov bx, [fanIndex] - mov al, [fanChars+bx] ;; get write char - mov ah, 15 ;; and white colour - cld ;; Needed? - stosw ;; write to screen at ES:EDI - inc word [fanIndex] ;; update next index - and word [fanIndex], 3 - pop bx - pop es -%endmacro - -;PutTimeStamp -; rdtsc -; mov [si].timeStamp, eax -; mov [si+4].timeStamp, edx -; ret - - -;------------------------------------------------------------------------ -; -; This routine gets called by the packet driver twice: -; 1st time (AX=0) it requests an address where to put the packet -; -; 2nd time (AX=1) the packet has been copied to this location (DS:SI) -; BX has client handle (stored in RX_ELEMENT.handle). -; CX has # of bytes in packet on both call. They should be equal. -; A test for equality is done by putting CX in _pktRxBuf [n].firstCount -; and _pktRxBuf[n].secondCount, and CL on first call in -; _pktRxBuf[n].rxBuffer[CX]. These values are checked in "PktReceive" -; (PKTDRVR.C) -; -;--------------------------------------------------------------------- - -_PktReceiver: - pushf - cli ; no distraction wanted ! - push ds - push bx - mov bx, cs - mov ds, bx - mov es, bx ; ES = DS = CS or seg _DATA - pop bx ; restore handle - - cmp ax, 0 ; first call? (AX=0) - jne @post ; AX=1: second call, do post process - -%ifdef DEBUG - SHOW_RX ; show that a packet is received -%endif - - cmp cx, ETH_MAX ; size OK ? - ja @skip ; no, too big - - mov ax, [_rxInOfs] - add ax, RX_SIZE - cmp ax, LAST_OFS - jb @noWrap - mov ax, offset _pktRxBuf -@noWrap: - cmp ax, [_rxOutOfs] - je @dump - mov di, [_rxInOfs] ; ES:DI -> _pktRxBuf[n] - mov [newInOffset], ax - - mov [di], cx ; remember firstCount. - mov [di+4], bx ; remember handle. - add di, 6 ; ES:DI -> _pktRxBuf[n].destinAdr - pop ds - popf - retf ; far return to driver with ES:DI - -@dump: add word [_pktDrop+0], 1 ; discard the packet on 1st call - adc word [_pktDrop+2], 0 ; increment packets lost - -@skip: xor di, di ; return ES:DI = NIL pointer - xor ax, ax - mov es, ax - pop ds - popf - retf - -@post: or si, si ; DS:SI->_pktRxBuf[n][n].destinAdr - jz @discard ; make sure we don't use NULL-pointer - - ; - ; push si - ; call bpf_filter_match ; run the filter here some day - ; pop si - ; cmp ax, 0 - ; je @discard - - mov [si-6+2], cx ; store _pktRxBuf[n].secondCount - mov ax, [newInOffset] - mov [_rxInOfs], ax ; update _pktRxBuf input offset - - ; call PutTimeStamp - -@discard: - pop ds - popf - retf - -_pktRxEnd db 0 ; marker for end of r-mode code/data - -END - diff --git a/contrib/libpcap/msdos/pktdrvr.c b/contrib/libpcap/msdos/pktdrvr.c deleted file mode 100644 index 360c893..0000000 --- a/contrib/libpcap/msdos/pktdrvr.c +++ /dev/null @@ -1,1436 +0,0 @@ -/* - * File.........: pktdrvr.c - * - * Responsible..: Gisle Vanem, giva@bgnett.no - * - * Created......: 26.Sept 1995 - * - * Description..: Packet-driver interface for 16/32-bit C : - * Borland C/C++ 3.0+ small/large model - * Watcom C/C++ 11+, DOS4GW flat model - * Metaware HighC 3.1+ and PharLap 386|DosX - * GNU C/C++ 2.7+ and djgpp 2.x extender - * - * References...: PC/TCP Packet driver Specification. rev 1.09 - * FTP Software Inc. - * - */ - -#include -#include -#include -#include - -#include "pcap-dos.h" -#include "pcap-int.h" -#include "msdos/pktdrvr.h" - -#if (DOSX) -#define NUM_RX_BUF 32 /* # of buffers in Rx FIFO queue */ -#else -#define NUM_RX_BUF 10 -#endif - -#define DIM(x) (sizeof((x)) / sizeof(x[0])) -#define PUTS(s) do { \ - if (!pktInfo.quiet) \ - pktInfo.error ? \ - printf ("%s: %s\n", s, pktInfo.error) : \ - printf ("%s\n", pktInfo.error = s); \ - } while (0) - -#if defined(__HIGHC__) - extern UINT _mwenv; - -#elif defined(__DJGPP__) - #include - #include - #include - #include - #include - -#elif defined(__WATCOMC__) - #include - #include - extern char _Extender; - -#else - extern void far PktReceiver (void); -#endif - - -#if (DOSX & (DJGPP|DOS4GW)) - #include - - struct DPMI_regs { - DWORD r_di; - DWORD r_si; - DWORD r_bp; - DWORD reserved; - DWORD r_bx; - DWORD r_dx; - DWORD r_cx; - DWORD r_ax; - WORD r_flags; - WORD r_es, r_ds, r_fs, r_gs; - WORD r_ip, r_cs, r_sp, r_ss; - }; - - /* Data located in a real-mode segment. This becomes far at runtime - */ - typedef struct { /* must match data/code in pkt_rx1.s */ - WORD _rxOutOfs; - WORD _rxInOfs; - DWORD _pktDrop; - BYTE _pktTemp [20]; - TX_ELEMENT _pktTxBuf[1]; - RX_ELEMENT _pktRxBuf[NUM_RX_BUF]; - WORD _dummy[2]; /* screenSeg,newInOffset */ - BYTE _fanChars[4]; - WORD _fanIndex; - BYTE _PktReceiver[15]; /* starts on a paragraph (16byte) */ - } PktRealStub; - #include - - static BYTE real_stub_array [] = { - #include "pkt_stub.inc" /* generated opcode array */ - }; - - #define rxOutOfs offsetof (PktRealStub,_rxOutOfs) - #define rxInOfs offsetof (PktRealStub,_rxInOfs) - #define PktReceiver offsetof (PktRealStub,_PktReceiver [para_skip]) - #define pktDrop offsetof (PktRealStub,_pktDrop) - #define pktTemp offsetof (PktRealStub,_pktTemp) - #define pktTxBuf offsetof (PktRealStub,_pktTxBuf) - #define FIRST_RX_BUF offsetof (PktRealStub,_pktRxBuf [0]) - #define LAST_RX_BUF offsetof (PktRealStub,_pktRxBuf [NUM_RX_BUF-1]) - -#else - extern WORD rxOutOfs; /* offsets into pktRxBuf FIFO queue */ - extern WORD rxInOfs; - extern DWORD pktDrop; /* # packets dropped in PktReceiver() */ - extern BYTE pktRxEnd; /* marks the end of r-mode code/data */ - - extern RX_ELEMENT pktRxBuf [NUM_RX_BUF]; /* PktDrvr Rx buffers */ - extern TX_ELEMENT pktTxBuf; /* PktDrvr Tx buffer */ - extern char pktTemp[20]; /* PktDrvr temp area */ - - #define FIRST_RX_BUF (WORD) &pktRxBuf [0] - #define LAST_RX_BUF (WORD) &pktRxBuf [NUM_RX_BUF-1] -#endif - - -#ifdef __BORLANDC__ /* Use Borland's inline functions */ - #define memcpy __memcpy__ - #define memcmp __memcmp__ - #define memset __memset__ -#endif - - -#if (DOSX & PHARLAP) - extern void PktReceiver (void); /* in pkt_rx0.asm */ - static int RealCopy (ULONG, ULONG, REALPTR*, FARPTR*, USHORT*); - - #undef FP_SEG - #undef FP_OFF - #define FP_OFF(x) ((WORD)(x)) - #define FP_SEG(x) ((WORD)(realBase >> 16)) - #define DOS_ADDR(s,o) (((DWORD)(s) << 16) + (WORD)(o)) - #define r_ax eax - #define r_bx ebx - #define r_dx edx - #define r_cx ecx - #define r_si esi - #define r_di edi - #define r_ds ds - #define r_es es - LOCAL FARPTR protBase; - LOCAL REALPTR realBase; - LOCAL WORD realSeg; /* DOS para-address of allocated area */ - LOCAL SWI_REGS reg; - - static WORD _far *rxOutOfsFp, *rxInOfsFp; - -#elif (DOSX & DJGPP) - static _go32_dpmi_seginfo rm_mem; - static __dpmi_regs reg; - static DWORD realBase; - static int para_skip = 0; - - #define DOS_ADDR(s,o) (((WORD)(s) << 4) + (o)) - #define r_ax x.ax - #define r_bx x.bx - #define r_dx x.dx - #define r_cx x.cx - #define r_si x.si - #define r_di x.di - #define r_ds x.ds - #define r_es x.es - -#elif (DOSX & DOS4GW) - LOCAL struct DPMI_regs reg; - LOCAL WORD rm_base_seg, rm_base_sel; - LOCAL DWORD realBase; - LOCAL int para_skip = 0; - - LOCAL DWORD dpmi_get_real_vector (int intr); - LOCAL WORD dpmi_real_malloc (int size, WORD *selector); - LOCAL void dpmi_real_free (WORD selector); - #define DOS_ADDR(s,o) (((DWORD)(s) << 4) + (WORD)(o)) - -#else /* real-mode Borland etc. */ - static struct { - WORD r_ax, r_bx, r_cx, r_dx, r_bp; - WORD r_si, r_di, r_ds, r_es, r_flags; - } reg; -#endif - -#ifdef __HIGHC__ - #pragma Alias (pktDrop, "_pktDrop") - #pragma Alias (pktRxBuf, "_pktRxBuf") - #pragma Alias (pktTxBuf, "_pktTxBuf") - #pragma Alias (pktTemp, "_pktTemp") - #pragma Alias (rxOutOfs, "_rxOutOfs") - #pragma Alias (rxInOfs, "_rxInOfs") - #pragma Alias (pktRxEnd, "_pktRxEnd") - #pragma Alias (PktReceiver,"_PktReceiver") -#endif - - -PUBLIC PKT_STAT pktStat; /* statistics for packets */ -PUBLIC PKT_INFO pktInfo; /* packet-driver information */ - -PUBLIC PKT_RX_MODE receiveMode = PDRX_DIRECT; -PUBLIC ETHER myAddress = { 0, 0, 0, 0, 0, 0 }; -PUBLIC ETHER ethBroadcast = { 255,255,255,255,255,255 }; - -LOCAL struct { /* internal statistics */ - DWORD tooSmall; /* size < ETH_MIN */ - DWORD tooLarge; /* size > ETH_MAX */ - DWORD badSync; /* count_1 != count_2 */ - DWORD wrongHandle; /* upcall to wrong handle */ - } intStat; - -/***************************************************************************/ - -PUBLIC const char *PktGetErrorStr (int errNum) -{ - static const char *errStr[] = { - "", - "Invalid handle number", - "No interfaces of specified class found", - "No interfaces of specified type found", - "No interfaces of specified number found", - "Bad packet type specified", - "Interface does not support multicast", - "Packet driver cannot terminate", - "Invalid receiver mode specified", - "Insufficient memory space", - "Type previously accessed, and not released", - "Command out of range, or not implemented", - "Cannot send packet (usually hardware error)", - "Cannot change hardware address ( > 1 handle open)", - "Hardware address has bad length or format", - "Cannot reset interface (more than 1 handle open)", - "Bad Check-sum", - "Bad size", - "Bad sync" , - "Source hit" - }; - - if (errNum < 0 || errNum >= DIM(errStr)) - return ("Unknown driver error."); - return (errStr [errNum]); -} - -/**************************************************************************/ - -PUBLIC const char *PktGetClassName (WORD class) -{ - switch (class) - { - case PD_ETHER: - return ("DIX-Ether"); - case PD_PRONET10: - return ("ProNET-10"); - case PD_IEEE8025: - return ("IEEE 802.5"); - case PD_OMNINET: - return ("OmniNet"); - case PD_APPLETALK: - return ("AppleTalk"); - case PD_SLIP: - return ("SLIP"); - case PD_STARTLAN: - return ("StartLAN"); - case PD_ARCNET: - return ("ArcNet"); - case PD_AX25: - return ("AX.25"); - case PD_KISS: - return ("KISS"); - case PD_IEEE8023_2: - return ("IEEE 802.3 w/802.2 hdr"); - case PD_FDDI8022: - return ("FDDI w/802.2 hdr"); - case PD_X25: - return ("X.25"); - case PD_LANstar: - return ("LANstar"); - case PD_PPP: - return ("PPP"); - default: - return ("unknown"); - } -} - -/**************************************************************************/ - -PUBLIC char const *PktRXmodeStr (PKT_RX_MODE mode) -{ - static const char *modeStr [] = { - "Receiver turned off", - "Receive only directly addressed packets", - "Receive direct & broadcast packets", - "Receive direct,broadcast and limited multicast packets", - "Receive direct,broadcast and all multicast packets", - "Receive all packets (promiscuouos mode)" - }; - - if (mode > DIM(modeStr)) - return ("??"); - return (modeStr [mode-1]); -} - -/**************************************************************************/ - -LOCAL __inline BOOL PktInterrupt (void) -{ - BOOL okay; - -#if (DOSX & PHARLAP) - _dx_real_int ((UINT)pktInfo.intr, ®); - okay = ((reg.flags & 1) == 0); /* OK if carry clear */ - -#elif (DOSX & DJGPP) - __dpmi_int ((int)pktInfo.intr, ®); - okay = ((reg.x.flags & 1) == 0); - -#elif (DOSX & DOS4GW) - union REGS r; - struct SREGS s; - - memset (&r, 0, sizeof(r)); - segread (&s); - r.w.ax = 0x300; - r.x.ebx = pktInfo.intr; - r.w.cx = 0; - s.es = FP_SEG (®); - r.x.edi = FP_OFF (®); - reg.r_flags = 0; - reg.r_ss = reg.r_sp = 0; /* DPMI host provides stack */ - - int386x (0x31, &r, &r, &s); - okay = (!r.w.cflag); - -#else - reg.r_flags = 0; - intr (pktInfo.intr, (struct REGPACK*)®); - okay = ((reg.r_flags & 1) == 0); -#endif - - if (okay) - pktInfo.error = NULL; - else pktInfo.error = PktGetErrorStr (reg.r_dx >> 8); - return (okay); -} - -/**************************************************************************/ - -/* - * Search for packet driver at interrupt 60h through 80h. If ASCIIZ - * string "PKT DRVR" found at offset 3 in the interrupt handler, return - * interrupt number, else return zero in pktInfo.intr - */ -PUBLIC BOOL PktSearchDriver (void) -{ - BYTE intr = 0x20; - BOOL found = FALSE; - - while (!found && intr < 0xFF) - { - static char str[12]; /* 3 + strlen("PKT DRVR") */ - static char pktStr[9] = "PKT DRVR"; /* ASCIIZ string at ofs 3 */ - DWORD rp; /* in interrupt routine */ - -#if (DOSX & PHARLAP) - _dx_rmiv_get (intr, &rp); - ReadRealMem (&str, (REALPTR)rp, sizeof(str)); - -#elif (DOSX & DJGPP) - __dpmi_raddr realAdr; - __dpmi_get_real_mode_interrupt_vector (intr, &realAdr); - rp = (realAdr.segment << 4) + realAdr.offset16; - dosmemget (rp, sizeof(str), &str); - -#elif (DOSX & DOS4GW) - rp = dpmi_get_real_vector (intr); - memcpy (&str, (void*)rp, sizeof(str)); - -#else - _fmemcpy (&str, getvect(intr), sizeof(str)); -#endif - - found = memcmp (&str[3],&pktStr,sizeof(pktStr)) == 0; - intr++; - } - pktInfo.intr = (found ? intr-1 : 0); - return (found); -} - - -/**************************************************************************/ - -static BOOL PktSetAccess (void) -{ - reg.r_ax = 0x0200 + pktInfo.class; - reg.r_bx = 0xFFFF; - reg.r_dx = 0; - reg.r_cx = 0; - -#if (DOSX & PHARLAP) - reg.ds = 0; - reg.esi = 0; - reg.es = RP_SEG (realBase); - reg.edi = (WORD) &PktReceiver; - -#elif (DOSX & DJGPP) - reg.x.ds = 0; - reg.x.si = 0; - reg.x.es = rm_mem.rm_segment; - reg.x.di = PktReceiver; - -#elif (DOSX & DOS4GW) - reg.r_ds = 0; - reg.r_si = 0; - reg.r_es = rm_base_seg; - reg.r_di = PktReceiver; - -#else - reg.r_ds = 0; - reg.r_si = 0; - reg.r_es = FP_SEG (&PktReceiver); - reg.r_di = FP_OFF (&PktReceiver); -#endif - - if (!PktInterrupt()) - return (FALSE); - - pktInfo.handle = reg.r_ax; - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktReleaseHandle (WORD handle) -{ - reg.r_ax = 0x0300; - reg.r_bx = handle; - return PktInterrupt(); -} - -/**************************************************************************/ - -PUBLIC BOOL PktTransmit (const void *eth, int len) -{ - if (len > ETH_MTU) - return (FALSE); - - reg.r_ax = 0x0400; /* Function 4, send pkt */ - reg.r_cx = len; /* total size of frame */ - -#if (DOSX & DJGPP) - dosmemput (eth, len, realBase+pktTxBuf); - reg.x.ds = rm_mem.rm_segment; /* DOS data segment and */ - reg.x.si = pktTxBuf; /* DOS offset to buffer */ - -#elif (DOSX & DOS4GW) - memcpy ((void*)(realBase+pktTxBuf), eth, len); - reg.r_ds = rm_base_seg; - reg.r_si = pktTxBuf; - -#elif (DOSX & PHARLAP) - memcpy (&pktTxBuf, eth, len); - reg.r_ds = FP_SEG (&pktTxBuf); - reg.r_si = FP_OFF (&pktTxBuf); - -#else - reg.r_ds = FP_SEG (eth); - reg.r_si = FP_OFF (eth); -#endif - - return PktInterrupt(); -} - -/**************************************************************************/ - -#if (DOSX & (DJGPP|DOS4GW)) -LOCAL __inline BOOL CheckElement (RX_ELEMENT *rx) -#else -LOCAL __inline BOOL CheckElement (RX_ELEMENT _far *rx) -#endif -{ - WORD count_1, count_2; - - /* - * We got an upcall to the same RMCB with wrong handle. - * This can happen if we failed to release handle at program exit - */ - if (rx->handle != pktInfo.handle) - { - pktInfo.error = "Wrong handle"; - intStat.wrongHandle++; - PktReleaseHandle (rx->handle); - return (FALSE); - } - count_1 = rx->firstCount; - count_2 = rx->secondCount; - - if (count_1 != count_2) - { - pktInfo.error = "Bad sync"; - intStat.badSync++; - return (FALSE); - } - if (count_1 > ETH_MAX) - { - pktInfo.error = "Large esize"; - intStat.tooLarge++; - return (FALSE); - } -#if 0 - if (count_1 < ETH_MIN) - { - pktInfo.error = "Small esize"; - intStat.tooSmall++; - return (FALSE); - } -#endif - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktTerminHandle (WORD handle) -{ - reg.r_ax = 0x0500; - reg.r_bx = handle; - return PktInterrupt(); -} - -/**************************************************************************/ - -PUBLIC BOOL PktResetInterface (WORD handle) -{ - reg.r_ax = 0x0700; - reg.r_bx = handle; - return PktInterrupt(); -} - -/**************************************************************************/ - -PUBLIC BOOL PktSetReceiverMode (PKT_RX_MODE mode) -{ - if (pktInfo.class == PD_SLIP || pktInfo.class == PD_PPP) - return (TRUE); - - reg.r_ax = 0x1400; - reg.r_bx = pktInfo.handle; - reg.r_cx = (WORD)mode; - - if (!PktInterrupt()) - return (FALSE); - - receiveMode = mode; - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktGetReceiverMode (PKT_RX_MODE *mode) -{ - reg.r_ax = 0x1500; - reg.r_bx = pktInfo.handle; - - if (!PktInterrupt()) - return (FALSE); - - *mode = reg.r_ax; - return (TRUE); -} - -/**************************************************************************/ - -static PKT_STAT initialStat; /* statistics at startup */ -static BOOL resetStat = FALSE; /* statistics reset ? */ - -PUBLIC BOOL PktGetStatistics (WORD handle) -{ - reg.r_ax = 0x1800; - reg.r_bx = handle; - - if (!PktInterrupt()) - return (FALSE); - -#if (DOSX & PHARLAP) - ReadRealMem (&pktStat, DOS_ADDR(reg.ds,reg.esi), sizeof(pktStat)); - -#elif (DOSX & DJGPP) - dosmemget (DOS_ADDR(reg.x.ds,reg.x.si), sizeof(pktStat), &pktStat); - -#elif (DOSX & DOS4GW) - memcpy (&pktStat, (void*)DOS_ADDR(reg.r_ds,reg.r_si), sizeof(pktStat)); - -#else - _fmemcpy (&pktStat, MK_FP(reg.r_ds,reg.r_si), sizeof(pktStat)); -#endif - - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktSessStatistics (WORD handle) -{ - if (!PktGetStatistics(pktInfo.handle)) - return (FALSE); - - if (resetStat) - { - pktStat.inPackets -= initialStat.inPackets; - pktStat.outPackets -= initialStat.outPackets; - pktStat.inBytes -= initialStat.inBytes; - pktStat.outBytes -= initialStat.outBytes; - pktStat.inErrors -= initialStat.inErrors; - pktStat.outErrors -= initialStat.outErrors; - pktStat.outErrors -= initialStat.outErrors; - pktStat.lost -= initialStat.lost; - } - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktResetStatistics (WORD handle) -{ - if (!PktGetStatistics(pktInfo.handle)) - return (FALSE); - - memcpy (&initialStat, &pktStat, sizeof(initialStat)); - resetStat = TRUE; - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktGetAddress (ETHER *addr) -{ - reg.r_ax = 0x0600; - reg.r_bx = pktInfo.handle; - reg.r_cx = sizeof (*addr); - -#if (DOSX & DJGPP) - reg.x.es = rm_mem.rm_segment; - reg.x.di = pktTemp; -#elif (DOSX & DOS4GW) - reg.r_es = rm_base_seg; - reg.r_di = pktTemp; -#else - reg.r_es = FP_SEG (&pktTemp); - reg.r_di = FP_OFF (&pktTemp); /* ES:DI = address for result */ -#endif - - if (!PktInterrupt()) - return (FALSE); - -#if (DOSX & PHARLAP) - ReadRealMem (addr, realBase + (WORD)&pktTemp, sizeof(*addr)); - -#elif (DOSX & DJGPP) - dosmemget (realBase+pktTemp, sizeof(*addr), addr); - -#elif (DOSX & DOS4GW) - memcpy (addr, (void*)(realBase+pktTemp), sizeof(*addr)); - -#else - memcpy ((void*)addr, &pktTemp, sizeof(*addr)); -#endif - - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktSetAddress (const ETHER *addr) -{ - /* copy addr to real-mode scrath area */ - -#if (DOSX & PHARLAP) - WriteRealMem (realBase + (WORD)&pktTemp, (void*)addr, sizeof(*addr)); - -#elif (DOSX & DJGPP) - dosmemput (addr, sizeof(*addr), realBase+pktTemp); - -#elif (DOSX & DOS4GW) - memcpy ((void*)(realBase+pktTemp), addr, sizeof(*addr)); - -#else - memcpy (&pktTemp, (void*)addr, sizeof(*addr)); -#endif - - reg.r_ax = 0x1900; - reg.r_cx = sizeof (*addr); /* address length */ - -#if (DOSX & DJGPP) - reg.x.es = rm_mem.rm_segment; /* DOS offset to param */ - reg.x.di = pktTemp; /* DOS segment to param */ -#elif (DOSX & DOS4GW) - reg.r_es = rm_base_seg; - reg.r_di = pktTemp; -#else - reg.r_es = FP_SEG (&pktTemp); - reg.r_di = FP_OFF (&pktTemp); -#endif - - return PktInterrupt(); -} - -/**************************************************************************/ - -PUBLIC BOOL PktGetDriverInfo (void) -{ - pktInfo.majVer = 0; - pktInfo.minVer = 0; - memset (&pktInfo.name, 0, sizeof(pktInfo.name)); - reg.r_ax = 0x01FF; - reg.r_bx = 0; - - if (!PktInterrupt()) - return (FALSE); - - pktInfo.number = reg.r_cx & 0xFF; - pktInfo.class = reg.r_cx >> 8; -#if 0 - pktInfo.minVer = reg.r_bx % 10; - pktInfo.majVer = reg.r_bx / 10; -#else - pktInfo.majVer = reg.r_bx; // !! -#endif - pktInfo.funcs = reg.r_ax & 0xFF; - pktInfo.type = reg.r_dx & 0xFF; - -#if (DOSX & PHARLAP) - ReadRealMem (&pktInfo.name, DOS_ADDR(reg.ds,reg.esi), sizeof(pktInfo.name)); - -#elif (DOSX & DJGPP) - dosmemget (DOS_ADDR(reg.x.ds,reg.x.si), sizeof(pktInfo.name), &pktInfo.name); - -#elif (DOSX & DOS4GW) - memcpy (&pktInfo.name, (void*)DOS_ADDR(reg.r_ds,reg.r_si), sizeof(pktInfo.name)); - -#else - _fmemcpy (&pktInfo.name, MK_FP(reg.r_ds,reg.r_si), sizeof(pktInfo.name)); -#endif - return (TRUE); -} - -/**************************************************************************/ - -PUBLIC BOOL PktGetDriverParam (void) -{ - reg.r_ax = 0x0A00; - - if (!PktInterrupt()) - return (FALSE); - -#if (DOSX & PHARLAP) - ReadRealMem (&pktInfo.majVer, DOS_ADDR(reg.es,reg.edi), PKT_PARAM_SIZE); - -#elif (DOSX & DJGPP) - dosmemget (DOS_ADDR(reg.x.es,reg.x.di), PKT_PARAM_SIZE, &pktInfo.majVer); - -#elif (DOSX & DOS4GW) - memcpy (&pktInfo.majVer, (void*)DOS_ADDR(reg.r_es,reg.r_di), PKT_PARAM_SIZE); - -#else - _fmemcpy (&pktInfo.majVer, MK_FP(reg.r_es,reg.r_di), PKT_PARAM_SIZE); -#endif - return (TRUE); -} - -/**************************************************************************/ - -#if (DOSX & PHARLAP) - PUBLIC int PktReceive (BYTE *buf, int max) - { - WORD inOfs = *rxInOfsFp; - WORD outOfs = *rxOutOfsFp; - - if (outOfs != inOfs) - { - RX_ELEMENT _far *head = (RX_ELEMENT _far*)(protBase+outOfs); - int size, len = max; - - if (CheckElement(head)) - { - size = min (head->firstCount, sizeof(RX_ELEMENT)); - len = min (size, max); - _fmemcpy (buf, &head->destin, len); - } - else - size = -1; - - outOfs += sizeof (RX_ELEMENT); - if (outOfs > LAST_RX_BUF) - outOfs = FIRST_RX_BUF; - *rxOutOfsFp = outOfs; - return (size); - } - return (0); - } - - PUBLIC void PktQueueBusy (BOOL busy) - { - *rxOutOfsFp = busy ? (*rxInOfsFp + sizeof(RX_ELEMENT)) : *rxInOfsFp; - if (*rxOutOfsFp > LAST_RX_BUF) - *rxOutOfsFp = FIRST_RX_BUF; - *(DWORD _far*)(protBase + (WORD)&pktDrop) = 0; - } - - PUBLIC WORD PktBuffersUsed (void) - { - WORD inOfs = *rxInOfsFp; - WORD outOfs = *rxOutOfsFp; - - if (inOfs >= outOfs) - return (inOfs - outOfs) / sizeof(RX_ELEMENT); - return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); - } - - PUBLIC DWORD PktRxDropped (void) - { - return (*(DWORD _far*)(protBase + (WORD)&pktDrop)); - } - -#elif (DOSX & DJGPP) - PUBLIC int PktReceive (BYTE *buf, int max) - { - WORD ofs = _farpeekw (_dos_ds, realBase+rxOutOfs); - - if (ofs != _farpeekw (_dos_ds, realBase+rxInOfs)) - { - RX_ELEMENT head; - int size, len = max; - - head.firstCount = _farpeekw (_dos_ds, realBase+ofs); - head.secondCount = _farpeekw (_dos_ds, realBase+ofs+2); - head.handle = _farpeekw (_dos_ds, realBase+ofs+4); - - if (CheckElement(&head)) - { - size = min (head.firstCount, sizeof(RX_ELEMENT)); - len = min (size, max); - dosmemget (realBase+ofs+6, len, buf); - } - else - size = -1; - - ofs += sizeof (RX_ELEMENT); - if (ofs > LAST_RX_BUF) - _farpokew (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); - else _farpokew (_dos_ds, realBase+rxOutOfs, ofs); - return (size); - } - return (0); - } - - PUBLIC void PktQueueBusy (BOOL busy) - { - WORD ofs; - - disable(); - ofs = _farpeekw (_dos_ds, realBase+rxInOfs); - if (busy) - ofs += sizeof (RX_ELEMENT); - - if (ofs > LAST_RX_BUF) - _farpokew (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); - else _farpokew (_dos_ds, realBase+rxOutOfs, ofs); - _farpokel (_dos_ds, realBase+pktDrop, 0UL); - enable(); - } - - PUBLIC WORD PktBuffersUsed (void) - { - WORD inOfs, outOfs; - - disable(); - inOfs = _farpeekw (_dos_ds, realBase+rxInOfs); - outOfs = _farpeekw (_dos_ds, realBase+rxOutOfs); - enable(); - if (inOfs >= outOfs) - return (inOfs - outOfs) / sizeof(RX_ELEMENT); - return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); - } - - PUBLIC DWORD PktRxDropped (void) - { - return _farpeekl (_dos_ds, realBase+pktDrop); - } - -#elif (DOSX & DOS4GW) - PUBLIC int PktReceive (BYTE *buf, int max) - { - WORD ofs = *(WORD*) (realBase+rxOutOfs); - - if (ofs != *(WORD*) (realBase+rxInOfs)) - { - RX_ELEMENT head; - int size, len = max; - - head.firstCount = *(WORD*) (realBase+ofs); - head.secondCount = *(WORD*) (realBase+ofs+2); - head.handle = *(WORD*) (realBase+ofs+4); - - if (CheckElement(&head)) - { - size = min (head.firstCount, sizeof(RX_ELEMENT)); - len = min (size, max); - memcpy (buf, (const void*)(realBase+ofs+6), len); - } - else - size = -1; - - ofs += sizeof (RX_ELEMENT); - if (ofs > LAST_RX_BUF) - *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; - else *(WORD*) (realBase+rxOutOfs) = ofs; - return (size); - } - return (0); - } - - PUBLIC void PktQueueBusy (BOOL busy) - { - WORD ofs; - - _disable(); - ofs = *(WORD*) (realBase+rxInOfs); - if (busy) - ofs += sizeof (RX_ELEMENT); - - if (ofs > LAST_RX_BUF) - *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; - else *(WORD*) (realBase+rxOutOfs) = ofs; - *(DWORD*) (realBase+pktDrop) = 0UL; - _enable(); - } - - PUBLIC WORD PktBuffersUsed (void) - { - WORD inOfs, outOfs; - - _disable(); - inOfs = *(WORD*) (realBase+rxInOfs); - outOfs = *(WORD*) (realBase+rxOutOfs); - _enable(); - if (inOfs >= outOfs) - return (inOfs - outOfs) / sizeof(RX_ELEMENT); - return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); - } - - PUBLIC DWORD PktRxDropped (void) - { - return *(DWORD*) (realBase+pktDrop); - } - -#else /* real-mode small/large model */ - - PUBLIC int PktReceive (BYTE *buf, int max) - { - if (rxOutOfs != rxInOfs) - { - RX_ELEMENT far *head = (RX_ELEMENT far*) MK_FP (_DS,rxOutOfs); - int size, len = max; - - if (CheckElement(head)) - { - size = min (head->firstCount, sizeof(RX_ELEMENT)); - len = min (size, max); - _fmemcpy (buf, &head->destin, len); - } - else - size = -1; - - rxOutOfs += sizeof (RX_ELEMENT); - if (rxOutOfs > LAST_RX_BUF) - rxOutOfs = FIRST_RX_BUF; - return (size); - } - return (0); - } - - PUBLIC void PktQueueBusy (BOOL busy) - { - rxOutOfs = busy ? (rxInOfs + sizeof(RX_ELEMENT)) : rxInOfs; - if (rxOutOfs > LAST_RX_BUF) - rxOutOfs = FIRST_RX_BUF; - pktDrop = 0L; - } - - PUBLIC WORD PktBuffersUsed (void) - { - WORD inOfs = rxInOfs; - WORD outOfs = rxOutOfs; - - if (inOfs >= outOfs) - return ((inOfs - outOfs) / sizeof(RX_ELEMENT)); - return (NUM_RX_BUF - (outOfs - inOfs) / sizeof(RX_ELEMENT)); - } - - PUBLIC DWORD PktRxDropped (void) - { - return (pktDrop); - } -#endif - -/**************************************************************************/ - -LOCAL __inline void PktFreeMem (void) -{ -#if (DOSX & PHARLAP) - if (realSeg) - { - _dx_real_free (realSeg); - realSeg = 0; - } -#elif (DOSX & DJGPP) - if (rm_mem.rm_segment) - { - unsigned ofs; /* clear the DOS-mem to prevent further upcalls */ - - for (ofs = 0; ofs < 16 * rm_mem.size / 4; ofs += 4) - _farpokel (_dos_ds, realBase + ofs, 0); - _go32_dpmi_free_dos_memory (&rm_mem); - rm_mem.rm_segment = 0; - } -#elif (DOSX & DOS4GW) - if (rm_base_sel) - { - dpmi_real_free (rm_base_sel); - rm_base_sel = 0; - } -#endif -} - -/**************************************************************************/ - -PUBLIC BOOL PktExitDriver (void) -{ - if (pktInfo.handle) - { - if (!PktSetReceiverMode(PDRX_BROADCAST)) - PUTS ("Error restoring receiver mode."); - - if (!PktReleaseHandle(pktInfo.handle)) - PUTS ("Error releasing PKT-DRVR handle."); - - PktFreeMem(); - pktInfo.handle = 0; - } - - if (pcap_pkt_debug >= 1) - printf ("Internal stats: too-small %lu, too-large %lu, bad-sync %lu, " - "wrong-handle %lu\n", - intStat.tooSmall, intStat.tooLarge, - intStat.badSync, intStat.wrongHandle); - return (TRUE); -} - -#if (DOSX & (DJGPP|DOS4GW)) -static void dump_pkt_stub (void) -{ - int i; - - fprintf (stderr, "PktReceiver %lu, pkt_stub[PktReceiver] =\n", - PktReceiver); - for (i = 0; i < 15; i++) - fprintf (stderr, "%02X, ", real_stub_array[i+PktReceiver]); - fputs ("\n", stderr); -} -#endif - -/* - * Front end initialization routine - */ -PUBLIC BOOL PktInitDriver (PKT_RX_MODE mode) -{ - PKT_RX_MODE rxMode; - BOOL writeInfo = (pcap_pkt_debug >= 3); - - pktInfo.quiet = (pcap_pkt_debug < 3); - -#if (DOSX & PHARLAP) && defined(__HIGHC__) - if (_mwenv != 2) - { - fprintf (stderr, "Only Pharlap DOS extender supported.\n"); - return (FALSE); - } -#endif - -#if (DOSX & PHARLAP) && defined(__WATCOMC__) - if (_Extender != 1) - { - fprintf (stderr, "Only DOS4GW style extenders supported.\n"); - return (FALSE); - } -#endif - - if (!PktSearchDriver()) - { - PUTS ("Packet driver not found."); - PktFreeMem(); - return (FALSE); - } - - if (!PktGetDriverInfo()) - { - PUTS ("Error getting pkt-drvr information."); - PktFreeMem(); - return (FALSE); - } - -#if (DOSX & PHARLAP) - if (RealCopy((ULONG)&rxOutOfs, (ULONG)&pktRxEnd, - &realBase, &protBase, (USHORT*)&realSeg)) - { - rxOutOfsFp = (WORD _far *) (protBase + (WORD) &rxOutOfs); - rxInOfsFp = (WORD _far *) (protBase + (WORD) &rxInOfs); - *rxOutOfsFp = FIRST_RX_BUF; - *rxInOfsFp = FIRST_RX_BUF; - } - else - { - PUTS ("Cannot allocate real-mode stub."); - return (FALSE); - } - -#elif (DOSX & (DJGPP|DOS4GW)) - if (sizeof(real_stub_array) > 0xFFFF) - { - fprintf (stderr, "`real_stub_array[]' too big.\n"); - return (FALSE); - } -#if (DOSX & DJGPP) - rm_mem.size = (sizeof(real_stub_array) + 15) / 16; - - if (_go32_dpmi_allocate_dos_memory(&rm_mem) || rm_mem.rm_offset != 0) - { - PUTS ("real-mode init failed."); - return (FALSE); - } - realBase = (rm_mem.rm_segment << 4); - dosmemput (&real_stub_array, sizeof(real_stub_array), realBase); - _farpokel (_dos_ds, realBase+rxOutOfs, FIRST_RX_BUF); - _farpokel (_dos_ds, realBase+rxInOfs, FIRST_RX_BUF); - -#elif (DOSX & DOS4GW) - rm_base_seg = dpmi_real_malloc (sizeof(real_stub_array), &rm_base_sel); - if (!rm_base_seg) - { - PUTS ("real-mode init failed."); - return (FALSE); - } - realBase = (rm_base_seg << 4); - memcpy ((void*)realBase, &real_stub_array, sizeof(real_stub_array)); - *(WORD*) (realBase+rxOutOfs) = FIRST_RX_BUF; - *(WORD*) (realBase+rxInOfs) = FIRST_RX_BUF; - -#endif - { - int pushf = PktReceiver; - - while (real_stub_array[pushf++] != 0x9C && /* pushf */ - real_stub_array[pushf] != 0xFA) /* cli */ - { - if (++para_skip > 16) - { - fprintf (stderr, "Something wrong with `pkt_stub.inc'.\n"); - para_skip = 0; - dump_pkt_stub(); - return (FALSE); - } - } - if (*(WORD*)(real_stub_array + offsetof(PktRealStub,_dummy)) != 0xB800) - { - fprintf (stderr, "`real_stub_array[]' is misaligned.\n"); - return (FALSE); - } - } - - if (pcap_pkt_debug > 2) - dump_pkt_stub(); - -#else - rxOutOfs = FIRST_RX_BUF; - rxInOfs = FIRST_RX_BUF; -#endif - - if (!PktSetAccess()) - { - PUTS ("Error setting pkt-drvr access."); - PktFreeMem(); - return (FALSE); - } - - if (!PktGetAddress(&myAddress)) - { - PUTS ("Error fetching adapter address."); - PktFreeMem(); - return (FALSE); - } - - if (!PktSetReceiverMode(mode)) - { - PUTS ("Error setting receiver mode."); - PktFreeMem(); - return (FALSE); - } - - if (!PktGetReceiverMode(&rxMode)) - { - PUTS ("Error getting receiver mode."); - PktFreeMem(); - return (FALSE); - } - - if (writeInfo) - printf ("Pkt-driver information:\n" - " Version : %d.%d\n" - " Name : %.15s\n" - " Class : %u (%s)\n" - " Type : %u\n" - " Number : %u\n" - " Funcs : %u\n" - " Intr : %Xh\n" - " Handle : %u\n" - " Extended : %s\n" - " Hi-perf : %s\n" - " RX mode : %s\n" - " Eth-addr : %02X:%02X:%02X:%02X:%02X:%02X\n", - - pktInfo.majVer, pktInfo.minVer, pktInfo.name, - pktInfo.class, PktGetClassName(pktInfo.class), - pktInfo.type, pktInfo.number, - pktInfo.funcs, pktInfo.intr, pktInfo.handle, - pktInfo.funcs == 2 || pktInfo.funcs == 6 ? "Yes" : "No", - pktInfo.funcs == 5 || pktInfo.funcs == 6 ? "Yes" : "No", - PktRXmodeStr(rxMode), - myAddress[0], myAddress[1], myAddress[2], - myAddress[3], myAddress[4], myAddress[5]); - -#if defined(DEBUG) && (DOSX & PHARLAP) - if (writeInfo) - { - DWORD rAdr = realBase + (WORD)&PktReceiver; - unsigned sel, ofs; - - printf ("\nReceiver at %04X:%04X\n", RP_SEG(rAdr), RP_OFF(rAdr)); - printf ("Realbase = %04X:%04X\n", RP_SEG(realBase),RP_OFF(realBase)); - - sel = _FP_SEG (protBase); - ofs = _FP_OFF (protBase); - printf ("Protbase = %04X:%08X\n", sel,ofs); - printf ("RealSeg = %04X\n", realSeg); - - sel = _FP_SEG (rxOutOfsFp); - ofs = _FP_OFF (rxOutOfsFp); - printf ("rxOutOfsFp = %04X:%08X\n", sel,ofs); - - sel = _FP_SEG (rxInOfsFp); - ofs = _FP_OFF (rxInOfsFp); - printf ("rxInOfsFp = %04X:%08X\n", sel,ofs); - - printf ("Ready: *rxOutOfsFp = %04X *rxInOfsFp = %04X\n", - *rxOutOfsFp, *rxInOfsFp); - - PktQueueBusy (TRUE); - printf ("Busy: *rxOutOfsFp = %04X *rxInOfsFp = %04X\n", - *rxOutOfsFp, *rxInOfsFp); - } -#endif - - memset (&pktStat, 0, sizeof(pktStat)); /* clear statistics */ - PktQueueBusy (TRUE); - return (TRUE); -} - - -/* - * DPMI functions only for Watcom + DOS4GW extenders - */ -#if (DOSX & DOS4GW) -LOCAL DWORD dpmi_get_real_vector (int intr) -{ - union REGS r; - - r.x.eax = 0x200; - r.x.ebx = (DWORD) intr; - int386 (0x31, &r, &r); - return ((r.w.cx << 4) + r.w.dx); -} - -LOCAL WORD dpmi_real_malloc (int size, WORD *selector) -{ - union REGS r; - - r.x.eax = 0x0100; /* DPMI allocate DOS memory */ - r.x.ebx = (size + 15) / 16; /* Number of paragraphs requested */ - int386 (0x31, &r, &r); - if (r.w.cflag & 1) - return (0); - - *selector = r.w.dx; - return (r.w.ax); /* Return segment address */ -} - -LOCAL void dpmi_real_free (WORD selector) -{ - union REGS r; - - r.x.eax = 0x101; /* DPMI free DOS memory */ - r.x.ebx = selector; /* Selector to free */ - int386 (0x31, &r, &r); -} -#endif - - -#if defined(DOSX) && (DOSX & PHARLAP) -/* - * Description: - * This routine allocates conventional memory for the specified block - * of code (which must be within the first 64K of the protected mode - * program segment) and copies the code to it. - * - * The caller should free up the conventional memory block when it - * is done with the conventional memory. - * - * NOTE THIS ROUTINE REQUIRES 386|DOS-EXTENDER 3.0 OR LATER. - * - * Calling arguments: - * start_offs start of real mode code in program segment - * end_offs 1 byte past end of real mode code in program segment - * real_basep returned; real mode ptr to use as a base for the - * real mode code (eg, to get the real mode FAR - * addr of a function foo(), take - * real_basep + (ULONG) foo). - * This pointer is constructed such that - * offsets within the real mode segment are - * the same as the link-time offsets in the - * protected mode program segment - * prot_basep returned; prot mode ptr to use as a base for getting - * to the conventional memory, also constructed - * so that adding the prot mode offset of a - * function or variable to the base gets you a - * ptr to the function or variable in the - * conventional memory block. - * rmem_adrp returned; real mode para addr of allocated - * conventional memory block, to be used to free - * up the conventional memory when done. DO NOT - * USE THIS TO CONSTRUCT A REAL MODE PTR, USE - * REAL_BASEP INSTEAD SO THAT OFFSETS WORK OUT - * CORRECTLY. - * - * Returned values: - * 0 if error - * 1 if success - */ -int RealCopy (ULONG start_offs, - ULONG end_offs, - REALPTR *real_basep, - FARPTR *prot_basep, - USHORT *rmem_adrp) -{ - ULONG rm_base; /* base real mode para addr for accessing */ - /* allocated conventional memory */ - UCHAR *source; /* source pointer for copy */ - FARPTR destin; /* destination pointer for copy */ - ULONG len; /* number of bytes to copy */ - ULONG temp; - USHORT stemp; - - /* First check for valid inputs - */ - if (start_offs >= end_offs || end_offs > 0x10000) - return (FALSE); - - /* Round start_offs down to a paragraph (16-byte) boundary so we can set up - * the real mode pointer easily. Round up end_offs to make sure we allocate - * enough paragraphs - */ - start_offs &= ~15; - end_offs = (15 + (end_offs << 4)) >> 4; - - /* Allocate the conventional memory for our real mode code. Remember to - * round byte count UP to 16-byte paragraph size. We alloc it - * above the DOS data buffer so both the DOS data buffer and the appl - * conventional mem block can still be resized. - * - * First just try to alloc it; if we can't get it, shrink the appl mem - * block down to the minimum, try to alloc the memory again, then grow the - * appl mem block back to the maximum. (Don't try to shrink the DOS data - * buffer to free conventional memory; it wouldn't be good for this routine - * to have the possible side effect of making file I/O run slower.) - */ - len = ((end_offs - start_offs) + 15) >> 4; - if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE) - { - if (_dx_cmem_usage(0, 0, &temp, &temp) != _DOSE_NONE) - return (FALSE); - - if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE) - *rmem_adrp = 0; - - if (_dx_cmem_usage(0, 1, &temp, &temp) != _DOSE_NONE) - { - if (*rmem_adrp != 0) - _dx_real_free (*rmem_adrp); - return (FALSE); - } - - if (*rmem_adrp == 0) - return (FALSE); - } - - /* Construct real mode & protected mode pointers to access the allocated - * memory. Note we know start_offs is aligned on a paragraph (16-byte) - * boundary, because we rounded it down. - * - * We make the offsets come out rights by backing off the real mode selector - * by start_offs. - */ - rm_base = ((ULONG) *rmem_adrp) - (start_offs >> 4); - RP_SET (*real_basep, 0, rm_base); - FP_SET (*prot_basep, rm_base << 4, SS_DOSMEM); - - /* Copy the real mode code/data to the allocated memory - */ - source = (UCHAR *) start_offs; - destin = *prot_basep; - FP_SET (destin, FP_OFF(*prot_basep) + start_offs, FP_SEL(*prot_basep)); - len = end_offs - start_offs; - WriteFarMem (destin, source, len); - - return (TRUE); -} -#endif /* DOSX && (DOSX & PHARLAP) */ diff --git a/contrib/libpcap/msdos/pktdrvr.h b/contrib/libpcap/msdos/pktdrvr.h deleted file mode 100644 index 50b7b4b..0000000 --- a/contrib/libpcap/msdos/pktdrvr.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef __PKTDRVR_H -#define __PKTDRVR_H - -#define PUBLIC -#define LOCAL static - -#define RX_BUF_SIZE ETH_MTU /* buffer size variables. NB !! */ -#define TX_BUF_SIZE ETH_MTU /* must be same as in pkt_rx*.* */ - -#ifdef __HIGHC__ -#pragma Off(Align_members) -#else -#pragma pack(1) -#endif - -typedef enum { /* Packet-driver classes */ - PD_ETHER = 1, - PD_PRONET10 = 2, - PD_IEEE8025 = 3, - PD_OMNINET = 4, - PD_APPLETALK = 5, - PD_SLIP = 6, - PD_STARTLAN = 7, - PD_ARCNET = 8, - PD_AX25 = 9, - PD_KISS = 10, - PD_IEEE8023_2 = 11, - PD_FDDI8022 = 12, - PD_X25 = 13, - PD_LANstar = 14, - PD_PPP = 18 - } PKT_CLASS; - -typedef enum { /* Packet-driver receive modes */ - PDRX_OFF = 1, /* turn off receiver */ - PDRX_DIRECT, /* receive only to this interface */ - PDRX_BROADCAST, /* DIRECT + broadcast packets */ - PDRX_MULTICAST1, /* BROADCAST + limited multicast */ - PDRX_MULTICAST2, /* BROADCAST + all multicast */ - PDRX_ALL_PACKETS, /* receive all packets on network */ - } PKT_RX_MODE; - -typedef struct { - char type[8]; - char len; - } PKT_FRAME; - - -typedef struct { - BYTE class; /* = 1 for DEC/Interl/Xerox Ethernet */ - BYTE number; /* = 0 for single LAN adapter */ - WORD type; /* = 13 for 3C523 */ - BYTE funcs; /* Basic/Extended/HiPerf functions */ - WORD intr; /* user interrupt vector number */ - WORD handle; /* Handle associated with session */ - BYTE name [15]; /* Name of adapter interface,ie.3C523*/ - BOOL quiet; /* (don't) print errors to stdout */ - const char *error; /* address of error string */ - BYTE majVer; /* Major driver implementation ver. */ - BYTE minVer; /* Minor driver implementation ver. */ - BYTE dummyLen; /* length of following data */ - WORD MAClength; /* HiPerformance data, N/A */ - WORD MTU; /* HiPerformance data, N/A */ - WORD multicast; /* HiPerformance data, N/A */ - WORD rcvrBuffers; /* valid for */ - WORD UMTbufs; /* High Performance drivers only */ - WORD postEOIintr; /* Usage ?? */ - } PKT_INFO; - -#define PKT_PARAM_SIZE 14 /* members majVer - postEOIintr */ - - -typedef struct { - DWORD inPackets; /* # of packets received */ - DWORD outPackets; /* # of packets transmitted */ - DWORD inBytes; /* # of bytes received */ - DWORD outBytes; /* # of bytes transmitted */ - DWORD inErrors; /* # of reception errors */ - DWORD outErrors; /* # of transmission errors */ - DWORD lost; /* # of packets lost (RX) */ - } PKT_STAT; - - -typedef struct { - ETHER destin; - ETHER source; - WORD proto; - BYTE data [TX_BUF_SIZE]; - } TX_ELEMENT; - -typedef struct { - WORD firstCount; /* # of bytes on 1st */ - WORD secondCount; /* and 2nd upcall */ - WORD handle; /* instance that upcalled */ - ETHER destin; /* E-net destination address */ - ETHER source; /* E-net source address */ - WORD proto; /* protocol number */ - BYTE data [RX_BUF_SIZE]; - } RX_ELEMENT; - - -#ifdef __HIGHC__ -#pragma pop(Align_members) -#else -#pragma pack() -#endif - - -/* - * Prototypes for publics - */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern PKT_STAT pktStat; /* statistics for packets */ -extern PKT_INFO pktInfo; /* packet-driver information */ - -extern PKT_RX_MODE receiveMode; -extern ETHER myAddress, ethBroadcast; - -extern BOOL PktInitDriver (PKT_RX_MODE mode); -extern BOOL PktExitDriver (void); - -extern const char *PktGetErrorStr (int errNum); -extern const char *PktGetClassName (WORD class); -extern const char *PktRXmodeStr (PKT_RX_MODE mode); -extern BOOL PktSearchDriver (void); -extern int PktReceive (BYTE *buf, int max); -extern BOOL PktTransmit (const void *eth, int len); -extern DWORD PktRxDropped (void); -extern BOOL PktReleaseHandle (WORD handle); -extern BOOL PktTerminHandle (WORD handle); -extern BOOL PktResetInterface (WORD handle); -extern BOOL PktSetReceiverMode(PKT_RX_MODE mode); -extern BOOL PktGetReceiverMode(PKT_RX_MODE *mode); -extern BOOL PktGetStatistics (WORD handle); -extern BOOL PktSessStatistics (WORD handle); -extern BOOL PktResetStatistics(WORD handle); -extern BOOL PktGetAddress (ETHER *addr); -extern BOOL PktSetAddress (const ETHER *addr); -extern BOOL PktGetDriverInfo (void); -extern BOOL PktGetDriverParam (void); -extern void PktQueueBusy (BOOL busy); -extern WORD PktBuffersUsed (void); - -#ifdef __cplusplus -} -#endif - -#endif /* __PKTDRVR_H */ - diff --git a/contrib/libpcap/msdos/readme.dos b/contrib/libpcap/msdos/readme.dos deleted file mode 100644 index 02ef1f7..0000000 --- a/contrib/libpcap/msdos/readme.dos +++ /dev/null @@ -1,162 +0,0 @@ -@(#) $Header: /tcpdump/master/libpcap/msdos/readme.dos,v 1.3 2004-12-19 19:47:01 guy Exp $ (LBL) - -libpcap for DOS ---------------- - -This file contains some notes on building and using libpcap for MS-DOS. -Look in `README' and `pcap.man' for usage and details. These targets are -supported: - - - Borland C 4.0+ small or large model. - - Metaware HighC 3.1+ with PharLap DOS-extender - - GNU C 2.7+ with djgpp 2.01+ DOS extender - - Watcom C 11.x with DOS4GW extender - -Note: the files in the libpcap.zip contains short trucated filenames. - So for djgpp to work with these, disable the use of long file names by - setting "LFN=n" in the environment. - -Files specific to DOS are pcap-dos.[ch] and the assembly and C files in -the MSDOS sub-directory. Remember to built lipcap libraries from the top -install directory. And not from the MSDOS sub-directory. - -Note for djgpp users: - If you got the libpcap from the official site www.tcpdump, then that - distribution does NOT contain any sources for building 32-bit drivers. - Instead get the full version at - http://www.bgnett.no/~giva/pcap/libpcap.zip - - and set "USE_32BIT_DRIVERS = 1" in msdos\common.dj. - - - -Requirements ------------- - -DOS-libpcap currently only works reliably with a real-mode Ethernet packet- -driver. This driver must be installed prior to using any program (e.g. -tcpdump) compiled with libpcap. Work is underway to implement protected- -mode drivers for 32-bit targets (djgpp only). The 3Com 3c509 driver is -working almost perfectly. Due to lack of LAN-cards, I've not had the -opportunity to test other drivers. These 32-bit drivers are modified -Linux drivers. - - -Required packages ------------------ - -The following packages and tools must be present for all targets. - -1. Watt-32 tcp/ip library. This library is *not* used to send or - receive network data. It's mostly used to access the 'hosts' - file and other features. Get 'watt32s*.zip' at: - - http://www.bgnett.no/~giva/ - -2. Exception handler and disassember library (libexc.a) is needed if - "USE_EXCEPT = 1" in common.dj. Available at: - - http://www.bgnett.no/~giva/misc/exc_dx07.zip - -3. Flex & Bison is used to generate parser for the filter handler - pcap_compile: - - ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/flx254b.zip - ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsn128b.zip - -4. NASM assembler v 0.98 or later is required when building djgpp and - Watcom targets: - - ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/nasm098p.zip - -5. sed (Stream Editor) is required for doing `make depend'. - It's available at - ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed*.zip - - A touch tool to update the time-stamp of a file. E.g. - ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/grep*.zip - -6. For djgpp rm.exe and cp.exe are required. These should already be - part of your djgpp installation. Also required (experimental at the - time) for djgpp is DLX 2.91 or later. This tool is for the generation - of dynamically loadable modules. - - -Compiling libpcap ------------------ - -Follow these steps in building libpcap: - -1. Make sure you've installed Watt-32 properly (see it's `INSTALL' file). - During that installation a environment variable `WATT_ROOT' is set. - This variable is used for building libpcap also (`WATT_INC' is - deducted from `WATT_ROOT'). djgpp users should also define environment - variables `C_INCLUDE_PATH' and `LIBRARY_PATH' to point to the include - directory and library directory respectively. E.g. put this in your - AUTOEXEC.BAT: - set C_INCLUDE_PATH=c:/net/watt/inc - set LIBRARY_PATH=c:/net/watt/lib - -2. Revise the msdos/common.dj file for your djgpp/gcc installation; - - change the value of `GCCLIB' to match location of libgcc.a. - - set `USE_32BIT_DRIVERS = 1' to build 32-bit driver objects. - - -3. Build pcap by using appropriate makefile. For djgpp, use: - `make -f msdos/makefile.dj' (i.e. GNU `make') - - For a Watcom target say: - `wmake -f msdos\makefile.wc' - - For a Borland target say: - `maker -f msdos\Makefile pcap_bc.lib' (Borland's `maker.exe') - - And for a HighC/Pharlap target say: - `maker -f msdos\Makefile pcap_hc.lib' (Borland's `maker.exe') - - You might like to change some `CFLAGS' -- only `DEBUG' define currently - have any effect. It shows a rotating "fan" in upper right corner of - screen. Remove `DEBUG' if you don't like it. You could add - `-fomit-frame-pointer' to `CFLAGS' to speed up the generated code. - But note, this makes debugging and crash-traceback difficult. Only - add it if you're fully confident your application is 100% stable. - - Note: Code in `USE_NDIS2' does not work at the moment. - -4. The resulting libraries are put in current directory. There's no - test-program for `libpcap'. Linking the library with `tcpdump' is - the ultimate test anyway. - - - -Extensions to libpcap ---------------------- - -I've included some extra functions to DOS-libpcap: - - `pcap_config_hook (const char *name, const char *value)' - - Allows an application to set values of internal libpcap variables. - `name' is typically a left-side keyword with an associated `value' - that is called from application's configure process (see tcpdump's - config.c file). libpcap keeps a set of tables that are searched for - a name/value match. Currently only used to set debug-levels and - parameters for the 32-bit network drivers. - - `pcap_set_wait (pcap_t *, void (*)(void), int)' : - - Only effective when reading offline traffic from dump-files. - Function `pcap_offline_read()' will wait (and optionally yield) - before printing next packet. This will simulate the pace the packets - where actually recorded. - - - -Happy sniffing ! - - -Gisle Vanem - - -October 1999, 2004 - diff --git a/contrib/libpcap/org.tcpdump.chmod_bpf.plist b/contrib/libpcap/org.tcpdump.chmod_bpf.plist deleted file mode 100644 index 8ad6852..0000000 --- a/contrib/libpcap/org.tcpdump.chmod_bpf.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Label - org.tcpdump.chmod_bpf - RunAtLoad - - Program - /usr/local/bin/chmod_bpf - ProgramArguments - - /usr/local/bin/chmod_bpf - - - -- cgit v1.1