b12588a35e60e12803950b06baf0de843f88cbec
[obnox/wireshark/wip.git] / test / config.sh
1 #!/bin/bash
2 #
3 # Configuration of the command line tests
4 #
5 # $Id$
6 #
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 2005 Ulf Lamping
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24 #
25
26 # Set WS_SYSTEM to our system type, e.g. Windows, Linux, Darwin
27 # http://support.microsoft.com/kb/100843
28 if [ -n "${OS#Windows}" ] ; then
29         WS_SYSTEM="Windows"
30 else
31         WS_SYSTEM=`uname -s`
32 fi
33
34
35 # Path to the Wireshark binaries, only used for the settings below
36 WS_BIN_PATH=..
37
38 # Are we allowed to open interfaces or capture on this system?
39 SKIP_CAPTURE=${SKIP_CAPTURE:-1}
40
41 # Override the last two items if we're running Windows
42 if [ "$WS_SYSTEM" = "Windows" ] ; then
43         WS_BIN_PATH=../wireshark-gtk2
44         SKIP_CAPTURE=0
45 fi
46
47 # Tweak the following to your liking.
48 WIRESHARK=$WS_BIN_PATH/wireshark
49 TSHARK=$WS_BIN_PATH/tshark
50 CAPINFOS=$WS_BIN_PATH/capinfos
51 DUMPCAP=$WS_BIN_PATH/dumpcap
52
53 # interface with at least a few packets/sec traffic on it
54 # (e.g. start a web radio to generate some traffic :-)
55 # an interfaces index (1 based) should do well for recent devbuilds
56 if [ "$WS_SYSTEM" = "Windows" -a -z "$TRAFFIC_CAPTURE_IFACE" ] ; then
57         # Try to fetch the first Ethernet interface.
58         TRAFFIC_CAPTURE_IFACE=`$TSHARK -D | \
59                 egrep 'Ethernet|Network Connection|VMware' | \
60                 head -1 | cut -c 1`
61 fi
62 TRAFFIC_CAPTURE_IFACE=${TRAFFIC_CAPTURE_IFACE:-1}
63
64 # time to capture some traffic (in seconds)
65 # (you may increase this if you get errors caused by very low traffic)
66 TRAFFIC_CAPTURE_DURATION=60
67
68 # the default is to not capture in promiscuous mode
69 # (this makes known trouble with some Windows WLAN adapters)
70 # if you need promiscuous mode, comment this line out
71 TRAFFIC_CAPTURE_PROMISC=-p
72
73 # only test capturing from a fifo if we're not on Windows
74 #  and we have a mkfifo. (Windows cygwin has a mkfifo but
75 #   Windows dumpcap & etc use Windows named pipes which
76 #   are different than the cygwin named pipes).
77 #
78 if [ "$WS_SYSTEM" != "Windows" ] && which mkfifo &>/dev/null ; then
79     TEST_FIFO=1
80 fi
81
82 # Display our environment
83
84 ##printf "\n ------- Info =-----------------\n"
85 ##printf "Syms :$WS_SYSTEM: :$TRAFFIC_CAPTURE_IFACE: :$SKIP_CAPTURE: :$TEST_FIFO:\n"
86 ##
87 ##ls -l $WIRESHARK $TSHARK $DUMPCAP
88 ##ls -l $(which wireshark) $(which tshark) $(which dumpcap)
89 ##printf " ----------------------------------\n\n"
90