author | mickeyl <mickeyl> | 2003-02-23 16:45:09 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-23 16:45:09 (UTC) |
commit | 2f897267b4d3ec5b1c7dafdc0700a8e91cbb3321 (patch) (unidiff) | |
tree | 9f32fb9e22a26188c6f1c1092c74b1bf47aa418c | |
parent | 3a3c703d9bdf57f50b3f47aa14c858ef1026e3d3 (diff) | |
download | opie-2f897267b4d3ec5b1c7dafdc0700a8e91cbb3321.zip opie-2f897267b4d3ec5b1c7dafdc0700a8e91cbb3321.tar.gz opie-2f897267b4d3ec5b1c7dafdc0700a8e91cbb3321.tar.bz2 |
simplification and fixes for the standalone X11 build
-rw-r--r-- | noncore/net/wellenreiter/README | 11 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/daemon.pro | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui-x11.pro | 15 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 27 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/resource.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 10 |
11 files changed, 68 insertions, 35 deletions
diff --git a/noncore/net/wellenreiter/README b/noncore/net/wellenreiter/README index ada9321..7de6a33 100644 --- a/noncore/net/wellenreiter/README +++ b/noncore/net/wellenreiter/README | |||
@@ -1,112 +1,111 @@ | |||
1 | /*************************************************************************/ | 1 | /*************************************************************************/ |
2 | /* W e l l e n r e i t e r I I */ | 2 | /* W e l l e n r e i t e r I I */ |
3 | /* =============================== */ | 3 | /* =============================== */ |
4 | /* */ | 4 | /* */ |
5 | /* Version: Opie-ALPHA-January */ | 5 | /* Version: Opie-ALPHA-January */ |
6 | /*************************************************************************/ | 6 | /*************************************************************************/ |
7 | 7 | ||
8 | -------------------------------------------------- | 8 | -------------------------------------------------- |
9 | Release Notes for Opie-ALPHA Version January 2002 | 9 | Release Notes for Opie-ALPHA Version January 2002 |
10 | -------------------------------------------------- | 10 | -------------------------------------------------- |
11 | 11 | ||
12 | ===================== | 12 | ===================== |
13 | = Supported Devices = | 13 | = Supported Devices = |
14 | ===================== | 14 | ===================== |
15 | 15 | ||
16 | * low-level orinoco_cs-based (including prism2 and spectrum_cs) | 16 | * low-level orinoco_cs-based (including prism2 and spectrum_cs) |
17 | 17 | ||
18 | ===================== | 18 | ===================== |
19 | = Build = | 19 | = Build = |
20 | ===================== | 20 | ===================== |
21 | 21 | ||
22 | (I) Opie Build Environment | 22 | (I) Opie Build Environment |
23 | 23 | ||
24 | To compile Wellenreiter within the Opie build environment, add the | 24 | To compile Wellenreiter within the Opie build environment, add the |
25 | following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' | 25 | following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' |
26 | 26 | ||
27 | noncore/net/wellenreiter/libwellenreiter \ | 27 | noncore/net/wellenreiter/libwellenreiter \ |
28 | noncore/net/wellenreiter/daemon \ | 28 | noncore/net/wellenreiter/daemon \ |
29 | noncore/net/wellenreiter/contrib/orinoco_hopper \ | 29 | noncore/net/wellenreiter/contrib/orinoco_hopper \ |
30 | noncore/net/wellenreiter/gui | 30 | noncore/net/wellenreiter/gui |
31 | 31 | ||
32 | ./configure and rebuild. Note that you need libpcap in your toolchain. | 32 | ./configure and rebuild. Note that you need libpcap in your toolchain. |
33 | 33 | ||
34 | (II) OpenZaurus Build Environment | 34 | (II) OpenZaurus Build Environment |
35 | 35 | ||
36 | To compile Wellenreiter within the OZ build environment, add the | 36 | To compile Wellenreiter within the OZ build environment, add the |
37 | following lines to $OPIEDIR/packages: | 37 | following lines to $OPIEDIR/packages: |
38 | CONFIG_WELLENREITER noncore/net/wellenreiter/libwellenreiter libwellenreiter.pro | 38 | CONFIG_WELLENREITER noncore/net/wellenreiter/libwellenreiter libwellenreiter.pro |
39 | CONFIG_WELLENREITER noncore/net/wellenreiter/daemon daemon.pro | 39 | CONFIG_WELLENREITER noncore/net/wellenreiter/daemon daemon.pro |
40 | CONFIG_WELLENREITER noncore/net/wellenreiter/gui gui.pro | 40 | CONFIG_WELLENREITER noncore/net/wellenreiter/gui gui.pro |
41 | CONFIG_WELLENREITER noncore/net/wellenreiter/contrib/orinoco_hopper orinoco_hopper.pro | 41 | CONFIG_WELLENREITER noncore/net/wellenreiter/contrib/orinoco_hopper orinoco_hopper.pro |
42 | 42 | ||
43 | make -f Makefile.test clean-configs | 43 | make -f Makefile.test clean-configs |
44 | cd <BUILDROOT> | 44 | cd <BUILDROOT> |
45 | make SUBDIRS=packages/opie package | 45 | make SUBDIRS=packages/opie package |
46 | 46 | ||
47 | (III) To compile a standalone Wellenreiter for X11, you need Qt3 and the development | 47 | (III) To compile a standalone Wellenreiter for X11, you need Qt3 and the development |
48 | packages for Qt3, e.g. libqt3-devel. Assuming, $OPIEDIR and $QTDIR is set to Opie resp. | 48 | packages for Qt3, e.g. libqt3-devel. Assuming, $QTDIR is set to your Qt-Director |
49 | Qt (e.g. /usr/lib/qt3), do the following: | 49 | (e.g. /usr/lib/qt3), set $OPIEDIR to your installation prefix, e.g. /usr/local, then |
50 | export QMAKESPEC=$OPIEDIR/mkspecs/linux-g++ | 50 | export QMAKESPEC=$QTDIR/mkspecs/linux-g++ |
51 | cd $OPIEDIR/noncore/net/wellenreiter | 51 | qmake "platform=x11" wellenreiter.pro |
52 | qmake -makefile wellenreiter.pro | ||
53 | make qmake | ||
54 | make | 52 | make |
53 | make install | ||
55 | 54 | ||
56 | ===================== | 55 | ===================== |
57 | = Install = | 56 | = Install = |
58 | ===================== | 57 | ===================== |
59 | 58 | ||
60 | Alternatively, you can use our precompiled ipk. Get it from | 59 | Alternatively, you can use our precompiled ipk. Get it from |
61 | http://opie.net.wox.org/wellenreiter/. This also includes a recent libpcap. | 60 | http://opie.net.wox.org/wellenreiter/. This also includes a recent libpcap. |
62 | 61 | ||
63 | ===================== | 62 | ===================== |
64 | = Run = | 63 | = Run = |
65 | ===================== | 64 | ===================== |
66 | 65 | ||
67 | There are two possible modes: <Manual> and <Automatic>. I suggest, you | 66 | There are two possible modes: <Manual> and <Automatic>. I suggest, you |
68 | start with the <Automatic> Mode. This works just using the "Start" | 67 | start with the <Automatic> Mode. This works just using the "Start" |
69 | and "Stop" Pushbuttons in the Wellenreiter GUI. If this doesn't work, | 68 | and "Stop" Pushbuttons in the Wellenreiter GUI. If this doesn't work, |
70 | then use the following strategy: | 69 | then use the following strategy: |
71 | 70 | ||
72 | 1. Place card in monitor mode. This is device dependent. | 71 | 1. Place card in monitor mode. This is device dependent. |
73 | 72 | ||
74 | Caution: Don't do this while you're logged in via ssh | 73 | Caution: Don't do this while you're logged in via ssh |
75 | or otherwise using the wireless interface - your connection | 74 | or otherwise using the wireless interface - your connection |
76 | will freeze: The card can't be used normally when sniffing! | 75 | will freeze: The card can't be used normally when sniffing! |
77 | 76 | ||
78 | For most orinoco-based cards this can be done using either | 77 | For most orinoco-based cards this can be done using either |
79 | 'iwpriv <interface> 2' or 'iwpriv <interface> 2 1'. | 78 | 'iwpriv <interface> 2' or 'iwpriv <interface> 2 1'. |
80 | 79 | ||
81 | You can check if this works, by calling 'ifconfig <interface>'. | 80 | You can check if this works, by calling 'ifconfig <interface>'. |
82 | If you see 'Protocol: UNSPEC' and an unusual long MAC-Address, | 81 | If you see 'Protocol: UNSPEC' and an unusual long MAC-Address, |
83 | then your card has been successfully set to the monitor mode. | 82 | then your card has been successfully set to the monitor mode. |
84 | 83 | ||
85 | 2. Start a channel hopper. A wireless card has several channels | 84 | 2. Start a channel hopper. A wireless card has several channels |
86 | (e.g. radio frequencies) here it can listen for beacons. | 85 | (e.g. radio frequencies) here it can listen for beacons. |
87 | Beacons are management data frames from other stations. | 86 | Beacons are management data frames from other stations. |
88 | Remember, this is radio transmission, so the card has to be | 87 | Remember, this is radio transmission, so the card has to be |
89 | "tuned" to a certain channel to be able to receive the beacons. | 88 | "tuned" to a certain channel to be able to receive the beacons. |
90 | 89 | ||
91 | In order to scan the complete frequency spectrum and thus be able | 90 | In order to scan the complete frequency spectrum and thus be able |
92 | to detect all available stations, you have to 'hop' through the | 91 | to detect all available stations, you have to 'hop' through the |
93 | channels frequently. You can do this manually (e.g. with 'iwconfig') | 92 | channels frequently. You can do this manually (e.g. with 'iwconfig') |
94 | [hahaha] or you can use a channel hopper. | 93 | [hahaha] or you can use a channel hopper. |
95 | 94 | ||
96 | For convenience, the current Wellenreiter Alpha comes with a | 95 | For convenience, the current Wellenreiter Alpha comes with a |
97 | channel hopper for Orinoco-based cards. Start this via | 96 | channel hopper for Orinoco-based cards. Start this via |
98 | orinoco_hopper <interface>. | 97 | orinoco_hopper <interface>. |
99 | 98 | ||
100 | 3. Start the Wellenreiter sniffing daemon: wellenreiterd. | 99 | 3. Start the Wellenreiter sniffing daemon: wellenreiterd. |
101 | 100 | ||
102 | 4. Start the Wellenreiter GUI and sniff like hell. Don't press the button | 101 | 4. Start the Wellenreiter GUI and sniff like hell. Don't press the button |
103 | "Start Scan" yet, because it enables the demo mode and will crash the | 102 | "Start Scan" yet, because it enables the demo mode and will crash the |
104 | wellenreiterd daemon if running. | 103 | wellenreiterd daemon if running. |
105 | 104 | ||
106 | ===================== | 105 | ===================== |
107 | = Credits = | 106 | = Credits = |
108 | ===================== | 107 | ===================== |
109 | 108 | ||
110 | Sniffer: Max Moser <max@remote-exploit.org> | 109 | Sniffer: Max Moser <max@remote-exploit.org> |
111 | Communication and Protocol: Martin J. Muench <mjm@remote-exploit.org> | 110 | Communication and Protocol: Martin J. Muench <mjm@remote-exploit.org> |
112 | GUI: Michael Lauer <mickeyl@handhelds.org> | 111 | GUI: Michael Lauer <mickeyl@handhelds.org> |
diff --git a/noncore/net/wellenreiter/daemon/daemon.pro b/noncore/net/wellenreiter/daemon/daemon.pro index 8943db7..33a6bb9 100644 --- a/noncore/net/wellenreiter/daemon/daemon.pro +++ b/noncore/net/wellenreiter/daemon/daemon.pro | |||
@@ -1,16 +1,16 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | CONFIG = warn_on debug | 3 | CONFIG = warn_on debug |
4 | #CONFIG = warn_on release | 4 | #CONFIG = warn_on release |
5 | HEADERS = source/config.hh source/daemon.hh | 5 | HEADERS = source/config.hh source/daemon.hh |
6 | SOURCES = source/daemon.cc | 6 | SOURCES = source/daemon.cc |
7 | INCLUDEPATH += ../ | 7 | INCLUDEPATH += ../ |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lpcap -lpthread -L$(OPIEDIR)/lib -lwellenreiter | 9 | LIBS += -lpcap -lpthread -L$(OPIEDIR)/lib -lwellenreiter |
10 | INTERFACES = | 10 | INTERFACES = |
11 | TARGET = wellenreiterd | 11 | TARGET = wellenreiterd |
12 | DEFINES += DEBUG | 12 | DEFINES += DEBUG |
13 | 13 | ||
14 | 14 | !contains( platform, x11 ) { | |
15 | 15 | include ( $(OPIEDIR)/include.pro ) | |
16 | include ( $(OPIEDIR)/include.pro ) | 16 | } |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 6ea6f02..f86b109 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -1,47 +1,56 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include <qmap.h> | 17 | #include <qmap.h> |
18 | #include <qcombobox.h> | 18 | #include <qcombobox.h> |
19 | #include <qpushbutton.h> | ||
19 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
21 | #include <qlayout.h> | ||
20 | 22 | ||
21 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 23 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
22 | :WellenreiterConfigBase( parent, name, true, f ) | 24 | :WellenreiterConfigBase( parent, name, true, f ) |
23 | { | 25 | { |
24 | _devicetype[ "cisco" ] = 1; | 26 | _devicetype[ "cisco" ] = 1; |
25 | _devicetype[ "wlan-ng" ] = 2; | 27 | _devicetype[ "wlan-ng" ] = 2; |
26 | _devicetype[ "hostap" ] = 3; | 28 | _devicetype[ "hostap" ] = 3; |
27 | _devicetype[ "orinoco" ] = 4; | 29 | _devicetype[ "orinoco" ] = 4; |
28 | _devicetype[ "<manual>" ] = 5; | 30 | _devicetype[ "<manual>" ] = 5; |
31 | |||
32 | #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here | ||
33 | QPushButton* okButton = new QPushButton( "ok", this ); | ||
34 | okButton->show(); | ||
35 | Layout5_2->addWidget( okButton ); //FIXME: rename this in configbase.ui | ||
36 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); | ||
37 | #endif | ||
29 | }; | 38 | }; |
30 | 39 | ||
31 | int WellenreiterConfigWindow::daemonDeviceType() | 40 | int WellenreiterConfigWindow::daemonDeviceType() |
32 | { | 41 | { |
33 | QString name = deviceType->currentText(); | 42 | QString name = deviceType->currentText(); |
34 | if ( _devicetype.contains( name ) ) | 43 | if ( _devicetype.contains( name ) ) |
35 | { | 44 | { |
36 | return _devicetype[name]; | 45 | return _devicetype[name]; |
37 | } | 46 | } |
38 | else | 47 | else |
39 | { | 48 | { |
40 | return 0; | 49 | return 0; |
41 | } | 50 | } |
42 | }; | 51 | }; |
43 | 52 | ||
44 | int WellenreiterConfigWindow::daemonHopInterval() | 53 | int WellenreiterConfigWindow::daemonHopInterval() |
45 | { | 54 | { |
46 | return hopInterval->cleanText().toInt(); | 55 | return hopInterval->cleanText().toInt(); |
47 | } | 56 | } |
diff --git a/noncore/net/wellenreiter/gui/gui-x11.pro b/noncore/net/wellenreiter/gui/gui-x11.pro deleted file mode 100644 index 25185fb..0000000 --- a/noncore/net/wellenreiter/gui/gui-x11.pro +++ b/dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | DESTDIR = . | ||
2 | TEMPLATE = app | ||
3 | CONFIG = qt warn_on debug | ||
4 | #CONFIG = qt warn_on release | ||
5 | HEADERS = mainwindow.h wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h configwindow.h resource.h wlan.h cardconfig.h manufacturers.h | ||
6 | SOURCES = main.cpp mainwindow.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp configwindow.cpp resource.cpp wlan.cpp cardconfig.cpp manufacturers.cpp | ||
7 | INCLUDEPATH += ../ | ||
8 | DEPENDPATH += ../ | ||
9 | LIBS += -L. -lwellenreiter | ||
10 | INTERFACES = configbase.ui | ||
11 | TARGET = wellenreiter | ||
12 | |||
13 | |||
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 95e9f22..822b0db 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,40 +1,49 @@ | |||
1 | MOC_DIR = ./tmp | 1 | MOC_DIR = ./tmp |
2 | OBJECTS_DIR = ./tmp | 2 | OBJECTS_DIR = ./tmp |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | TEMPLATE = app | 4 | TEMPLATE = app |
5 | CONFIG = qt warn_on debug | 5 | CONFIG = qt warn_on debug |
6 | 6 | ||
7 | HEADERS = wellenreiterbase.h \ | 7 | HEADERS = wellenreiterbase.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | wellenreiter.h \ | 9 | wellenreiter.h \ |
10 | scanlistitem.h \ | 10 | scanlistitem.h \ |
11 | scanlist.h \ | 11 | scanlist.h \ |
12 | logwindow.h \ | 12 | logwindow.h \ |
13 | hexwindow.h \ | 13 | hexwindow.h \ |
14 | configwindow.h \ | 14 | configwindow.h \ |
15 | wlan.h \ | 15 | wlan.h \ |
16 | cardconfig.h \ | 16 | cardconfig.h \ |
17 | manufacturers.h | 17 | manufacturers.h |
18 | 18 | ||
19 | SOURCES = main.cpp \ | 19 | SOURCES = main.cpp \ |
20 | mainwindow.cpp \ | 20 | mainwindow.cpp \ |
21 | wellenreiterbase.cpp \ | 21 | wellenreiterbase.cpp \ |
22 | wellenreiter.cpp \ | 22 | wellenreiter.cpp \ |
23 | scanlistitem.cpp \ | 23 | scanlistitem.cpp \ |
24 | scanlist.cpp \ | 24 | scanlist.cpp \ |
25 | logwindow.cpp \ | 25 | logwindow.cpp \ |
26 | hexwindow.cpp \ | 26 | hexwindow.cpp \ |
27 | configwindow.cpp \ | 27 | configwindow.cpp \ |
28 | wlan.cpp \ | 28 | wlan.cpp \ |
29 | cardconfig.cpp \ | 29 | cardconfig.cpp \ |
30 | manufacturers.cpp | 30 | manufacturers.cpp |
31 | 31 | ||
32 | INCLUDEPATH += $(OPIEDIR)/include ../ | 32 | INCLUDEPATH += $(OPIEDIR)/include ../ |
33 | DEPENDPATH += $(OPIEDIR)/include ../ | 33 | DEPENDPATH += $(OPIEDIR)/include ../ |
34 | LIBS += -lqpe -lopie -L. -lwellenreiter | 34 | LIBS += -L. -lwellenreiter |
35 | INTERFACES = configbase.ui | 35 | INTERFACES = configbase.ui |
36 | TARGET = wellenreiter | 36 | TARGET = wellenreiter |
37 | 37 | ||
38 | !contains( platform, x11 ) { | ||
39 | message( qws ) | ||
40 | include ( $(OPIEDIR)/include.pro ) | ||
41 | LIBS += -lqpe -lopie | ||
42 | } | ||
38 | 43 | ||
44 | contains( platform, x11 ) { | ||
45 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
46 | SOURCES += resource.cpp | ||
47 | HEADERS += resource.h | ||
48 | } | ||
39 | 49 | ||
40 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index b67376c..b2d3a71 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,140 +1,161 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
18 | #include "wellenreiter.h" | 18 | #include "wellenreiter.h" |
19 | 19 | ||
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qiconset.h> | 21 | #include <qiconset.h> |
22 | #include <qmenubar.h> | 22 | #include <qmenubar.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qstatusbar.h> | 24 | #include <qstatusbar.h> |
25 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | 26 | ||
27 | #ifdef QWS | 27 | #ifdef QWS |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #else | 29 | #else |
30 | #include "resource.h" | 30 | #include "resource.h" |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
34 | :QMainWindow( parent, name, f ) | 34 | :QMainWindow( parent, name, f ) |
35 | { | 35 | { |
36 | cw = new WellenreiterConfigWindow( this ); | 36 | cw = new WellenreiterConfigWindow( this ); |
37 | mw = new Wellenreiter( this ); | 37 | mw = new Wellenreiter( this ); |
38 | mw->setConfigWindow( cw ); | 38 | mw->setConfigWindow( cw ); |
39 | setCentralWidget( mw ); | 39 | setCentralWidget( mw ); |
40 | 40 | ||
41 | // setup icon sets | 41 | // setup icon sets |
42 | 42 | ||
43 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | ||
44 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 43 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
45 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 44 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
45 | #ifdef QWS | ||
46 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | ||
46 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 47 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
48 | #else | ||
49 | startStopIconSet = new QIconSet(); | ||
50 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); | ||
51 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); | ||
52 | #endif | ||
47 | 53 | ||
48 | // setup tool buttons | 54 | // setup tool buttons |
49 | 55 | ||
50 | startStopButton = new QToolButton( 0 ); | 56 | startStopButton = new QToolButton( 0 ); |
51 | startStopButton->setAutoRaise( true ); | 57 | startStopButton->setAutoRaise( true ); |
58 | #ifdef QWS | ||
52 | startStopButton->setOnIconSet( *cancelIconSet ); | 59 | startStopButton->setOnIconSet( *cancelIconSet ); |
53 | startStopButton->setOffIconSet( *searchIconSet ); | 60 | startStopButton->setOffIconSet( *searchIconSet ); |
61 | #else | ||
62 | startStopButton->setIconSet( *startStopIconSet ); | ||
63 | #endif | ||
54 | startStopButton->setToggleButton( true ); | 64 | startStopButton->setToggleButton( true ); |
55 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 65 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); |
56 | startStopButton->setEnabled( false ); | 66 | startStopButton->setEnabled( false ); |
57 | 67 | ||
58 | QToolButton* c = new QToolButton( 0 ); | 68 | QToolButton* c = new QToolButton( 0 ); |
59 | c->setAutoRaise( true ); | 69 | c->setAutoRaise( true ); |
60 | c->setIconSet( *infoIconSet ); | 70 | c->setIconSet( *infoIconSet ); |
61 | c->setEnabled( false ); | 71 | c->setEnabled( false ); |
62 | 72 | ||
63 | QToolButton* d = new QToolButton( 0 ); | 73 | QToolButton* d = new QToolButton( 0 ); |
64 | d->setAutoRaise( true ); | 74 | d->setAutoRaise( true ); |
65 | d->setIconSet( *settingsIconSet ); | 75 | d->setIconSet( *settingsIconSet ); |
66 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 76 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
67 | 77 | ||
68 | // setup menu bar | 78 | // setup menu bar |
69 | 79 | ||
70 | QMenuBar* mb = menuBar(); | 80 | QMenuBar* mb = menuBar(); |
71 | 81 | ||
72 | QPopupMenu* file = new QPopupMenu( mb ); | 82 | QPopupMenu* file = new QPopupMenu( mb ); |
73 | file->insertItem( "&Load" ); | 83 | file->insertItem( "&Load" ); |
74 | file->insertItem( "&Save" ); | 84 | file->insertItem( "&Save" ); |
75 | 85 | ||
76 | QPopupMenu* view = new QPopupMenu( mb ); | 86 | QPopupMenu* view = new QPopupMenu( mb ); |
77 | view->insertItem( "&Configure" ); | 87 | view->insertItem( "&Configure" ); |
78 | 88 | ||
79 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 89 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
80 | sniffer->insertItem( "&Configure" ); | 90 | sniffer->insertItem( "&Configure" ); |
81 | sniffer->insertSeparator(); | 91 | sniffer->insertSeparator(); |
82 | 92 | ||
83 | int id; | 93 | int id; |
84 | 94 | ||
85 | id = mb->insertItem( "&File", file ); | 95 | id = mb->insertItem( "&File", file ); |
86 | mb->setItemEnabled( id, false ); | 96 | mb->setItemEnabled( id, false ); |
87 | id = mb->insertItem( "&View", view ); | 97 | id = mb->insertItem( "&View", view ); |
88 | mb->setItemEnabled( id, false ); | 98 | mb->setItemEnabled( id, false ); |
89 | id = mb->insertItem( "&Sniffer", sniffer ); | 99 | id = mb->insertItem( "&Sniffer", sniffer ); |
90 | mb->setItemEnabled( id, false ); | 100 | mb->setItemEnabled( id, false ); |
91 | 101 | ||
102 | #ifdef QWS | ||
92 | mb->insertItem( startStopButton ); | 103 | mb->insertItem( startStopButton ); |
93 | mb->insertItem( c ); | 104 | mb->insertItem( c ); |
94 | mb->insertItem( d ); | 105 | mb->insertItem( d ); |
106 | #else // Qt3 changed the insertion order. It's now totally random :( | ||
107 | mb->insertItem( d ); | ||
108 | mb->insertItem( c ); | ||
109 | mb->insertItem( startStopButton ); | ||
110 | #endif | ||
95 | 111 | ||
96 | // setup status bar (for now only on X11) | 112 | // setup status bar (for now only on X11) |
97 | 113 | ||
98 | #ifndef QWS | 114 | #ifndef QWS |
99 | statusBar()->message( "Ready." ); | 115 | statusBar()->message( "Ready." ); |
100 | #endif | 116 | #endif |
101 | 117 | ||
102 | }; | 118 | }; |
103 | 119 | ||
104 | void WellenreiterMainWindow::showConfigure() | 120 | void WellenreiterMainWindow::showConfigure() |
105 | { | 121 | { |
106 | qDebug( "show configure..." ); | 122 | qDebug( "show configure..." ); |
107 | cw->setCaption( tr( "Configure" ) ); | 123 | cw->setCaption( tr( "Configure" ) ); |
124 | #ifdef QWS | ||
108 | cw->showMaximized(); | 125 | cw->showMaximized(); |
126 | #endif | ||
109 | int result = cw->exec(); | 127 | int result = cw->exec(); |
110 | 128 | ||
111 | if ( result ) | 129 | if ( result ) |
112 | { | 130 | { |
113 | // check configuration from config window | 131 | // check configuration from config window |
114 | 132 | ||
115 | const QString& interface = cw->interfaceName->currentText(); | 133 | const QString& interface = cw->interfaceName->currentText(); |
116 | const int cardtype = cw->daemonDeviceType(); | 134 | const int cardtype = cw->daemonDeviceType(); |
117 | const int interval = cw->daemonHopInterval(); | 135 | const int interval = cw->daemonHopInterval(); |
118 | 136 | ||
119 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 137 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
120 | startStopButton->setEnabled( true ); | 138 | startStopButton->setEnabled( true ); |
121 | //TODO ... | 139 | //TODO ... |
122 | else | 140 | else |
123 | startStopButton->setEnabled( false ); | 141 | startStopButton->setEnabled( false ); |
124 | //TODO ... | 142 | //TODO ... |
125 | } | 143 | } |
126 | } | 144 | } |
127 | 145 | ||
128 | WellenreiterMainWindow::~WellenreiterMainWindow() | 146 | WellenreiterMainWindow::~WellenreiterMainWindow() |
129 | { | 147 | { |
130 | 148 | ||
131 | delete searchIconSet; | ||
132 | delete infoIconSet; | 149 | delete infoIconSet; |
133 | delete settingsIconSet; | 150 | delete settingsIconSet; |
151 | #ifdef QWS | ||
152 | delete searchIconSet; | ||
134 | delete cancelIconSet; | 153 | delete cancelIconSet; |
135 | 154 | #else | |
155 | delete startStopIconSet; | ||
156 | #endif | ||
136 | 157 | ||
137 | }; | 158 | }; |
138 | 159 | ||
139 | 160 | ||
140 | 161 | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 7d772a8..c21841a 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -1,49 +1,50 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef MAINWINDOW_H | 16 | #ifndef MAINWINDOW_H |
17 | #define MAINWINDOW_H | 17 | #define MAINWINDOW_H |
18 | 18 | ||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | 20 | ||
21 | class Wellenreiter; | 21 | class Wellenreiter; |
22 | class WellenreiterConfigWindow; | 22 | class WellenreiterConfigWindow; |
23 | class QIconSet; | 23 | class QIconSet; |
24 | class QToolButton; | 24 | class QToolButton; |
25 | 25 | ||
26 | class WellenreiterMainWindow: public QMainWindow | 26 | class WellenreiterMainWindow: public QMainWindow |
27 | { | 27 | { |
28 | Q_OBJECT | 28 | Q_OBJECT |
29 | 29 | ||
30 | public: | 30 | public: |
31 | WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); | 31 | WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); |
32 | ~WellenreiterMainWindow(); | 32 | ~WellenreiterMainWindow(); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | Wellenreiter* mw; | 35 | Wellenreiter* mw; |
36 | WellenreiterConfigWindow* cw; | 36 | WellenreiterConfigWindow* cw; |
37 | 37 | ||
38 | QIconSet* startStopIconSet; | ||
38 | const QIconSet* searchIconSet; | 39 | const QIconSet* searchIconSet; |
39 | const QIconSet* infoIconSet; | 40 | const QIconSet* infoIconSet; |
40 | const QIconSet* settingsIconSet; | 41 | const QIconSet* settingsIconSet; |
41 | const QIconSet* cancelIconSet; | 42 | const QIconSet* cancelIconSet; |
42 | 43 | ||
43 | QToolButton* startStopButton; | 44 | QToolButton* startStopButton; |
44 | 45 | ||
45 | public slots: | 46 | public slots: |
46 | void showConfigure(); | 47 | void showConfigure(); |
47 | }; | 48 | }; |
48 | 49 | ||
49 | #endif | 50 | #endif |
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index fb0966a..7683329 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp | |||
@@ -1,35 +1,35 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "resource.h" | 16 | #include "resource.h" |
17 | 17 | ||
18 | #define PIXMAPPATH "/usr/share/wellenreiter/pics/" | 18 | #define PIXMAPPATH "/usr/local/share" |
19 | 19 | ||
20 | namespace Resource | 20 | namespace Resource |
21 | { | 21 | { |
22 | 22 | ||
23 | QPixmap loadPixmap( const QString& pix ) | 23 | QPixmap loadPixmap( const QString& pix ) |
24 | { | 24 | { |
25 | QString filename; | 25 | QString filename; |
26 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); | 26 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); |
27 | QPixmap pixmap( filename ); | 27 | QPixmap pixmap( filename ); |
28 | if ( pixmap.isNull() ) | 28 | if ( pixmap.isNull() ) |
29 | { | 29 | { |
30 | qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); | 30 | qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); |
31 | } | 31 | } |
32 | return pixmap; | 32 | return pixmap; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | }; | 35 | }; |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index db7063b..c599bb4 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,269 +1,269 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
19 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qspinbox.h> | 21 | #include <qspinbox.h> |
22 | #include <qsocketnotifier.h> | 22 | #include <qsocketnotifier.h> |
23 | 23 | ||
24 | // Qtopia | 24 | // Qtopia |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | // Opie | 31 | // Opie |
32 | 32 | ||
33 | #ifdef QWS | 33 | #ifdef QWS |
34 | #include <opie/odevice.h> | 34 | #include <opie/odevice.h> |
35 | using namespace Opie; | 35 | using namespace Opie; |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | // Standard | 38 | // Standard |
39 | 39 | ||
40 | #include <assert.h> | 40 | #include <assert.h> |
41 | #include <errno.h> | 41 | #include <errno.h> |
42 | #include <unistd.h> | 42 | #include <unistd.h> |
43 | #include <string.h> | 43 | #include <string.h> |
44 | #include <sys/types.h> | 44 | #include <sys/types.h> |
45 | #include <sys/socket.h> | 45 | #include <sys/socket.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | 48 | ||
49 | // Local | 49 | // Local |
50 | 50 | ||
51 | #include "wellenreiter.h" | 51 | #include "wellenreiter.h" |
52 | #include "scanlist.h" | 52 | #include "scanlist.h" |
53 | #include "logwindow.h" | 53 | #include "logwindow.h" |
54 | #include "hexwindow.h" | 54 | #include "hexwindow.h" |
55 | #include "configwindow.h" | 55 | #include "configwindow.h" |
56 | 56 | ||
57 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
58 | 58 | ||
59 | #include <daemon/source/config.hh> | 59 | #include <daemon/source/config.hh> |
60 | #include <libwellenreiter/source/wl_types.hh> | 60 | #include <libwellenreiter/source/wl_types.hh> |
61 | #include <libwellenreiter/source/wl_sock.hh> | 61 | #include <libwellenreiter/source/wl_sock.hh> |
62 | #include <libwellenreiter/source/wl_proto.hh> | 62 | #include <libwellenreiter/source/wl_proto.hh> |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent ) |
65 | : WellenreiterBase( parent, 0, 0 ), | 65 | : WellenreiterBase( parent, 0, 0 ), |
66 | daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) | 66 | daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) |
67 | { | 67 | { |
68 | 68 | ||
69 | // | 69 | // |
70 | // construct manufacturer database | 70 | // construct manufacturer database |
71 | // | 71 | // |
72 | 72 | ||
73 | QString manufile; | 73 | QString manufile; |
74 | #ifdef QWS | 74 | #ifdef QWS |
75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
76 | #else | 76 | #else |
77 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); | 77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); |
78 | #endif | 78 | #endif |
79 | manufacturerdb = new ManufacturerDB( manufile ); | 79 | manufacturerdb = new ManufacturerDB( manufile ); |
80 | 80 | ||
81 | logwindow->log( "(i) Wellenreiter has been started." ); | 81 | logwindow->log( "(i) Wellenreiter has been started." ); |
82 | 82 | ||
83 | // | 83 | // |
84 | // detect operating system | 84 | // detect operating system |
85 | // | 85 | // |
86 | 86 | ||
87 | #ifdef QWS | 87 | #ifdef QWS |
88 | QString sys; | 88 | QString sys; |
89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
90 | _system = ODevice::inst()->system(); | 90 | _system = ODevice::inst()->system(); |
91 | logwindow->log( sys ); | 91 | logwindow->log( sys ); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | // | 94 | // |
95 | // setup socket for daemon communication, register socket notifier | 95 | // setup socket for daemon communication, register socket notifier |
96 | // | 96 | // |
97 | 97 | ||
98 | // struct sockaddr_in sockaddr; | 98 | // struct sockaddr_in sockaddr; |
99 | daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); | 99 | daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); |
100 | if ( daemon_fd == -1 ) | 100 | if ( daemon_fd == -1 ) |
101 | { | 101 | { |
102 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); | 102 | logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); |
103 | } | 103 | } |
104 | else | 104 | else |
105 | { | 105 | { |
106 | int flags; | 106 | int flags; |
107 | flags = fcntl( daemon_fd, F_GETFL, 0 ); | 107 | flags = fcntl( daemon_fd, F_GETFL, 0 ); |
108 | fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); | 108 | fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); |
109 | QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); | 109 | QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); |
110 | connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); | 110 | connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); |
111 | } | 111 | } |
112 | 112 | ||
113 | // setup GUI | 113 | // setup GUI |
114 | netview->setColumnWidthMode( 1, QListView::Manual ); | 114 | netview->setColumnWidthMode( 1, QListView::Manual ); |
115 | 115 | ||
116 | if ( manufacturerdb ) | 116 | if ( manufacturerdb ) |
117 | netview->setManufacturerDB( manufacturerdb ); | 117 | netview->setManufacturerDB( manufacturerdb ); |
118 | 118 | ||
119 | } | 119 | } |
120 | 120 | ||
121 | Wellenreiter::~Wellenreiter() | 121 | Wellenreiter::~Wellenreiter() |
122 | { | 122 | { |
123 | // no need to delete child widgets, Qt does it all for us | 123 | // no need to delete child widgets, Qt does it all for us |
124 | 124 | ||
125 | delete manufacturerdb; | 125 | delete manufacturerdb; |
126 | } | 126 | } |
127 | 127 | ||
128 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 128 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
129 | { | 129 | { |
130 | configwindow = cw; | 130 | configwindow = cw; |
131 | } | 131 | } |
132 | 132 | ||
133 | void Wellenreiter::handleMessage() | 133 | void Wellenreiter::handleMessage() |
134 | { | 134 | { |
135 | // FIXME: receive message and handle it | 135 | // FIXME: receive message and handle it |
136 | 136 | ||
137 | qDebug( "received message from daemon." ); | 137 | qDebug( "received message from daemon." ); |
138 | 138 | ||
139 | /*char buffer[10000]; | 139 | /*char buffer[10000]; |
140 | memset( &buffer, 0, sizeof( buffer ) );*/ | 140 | memset( &buffer, 0, sizeof( buffer ) );*/ |
141 | 141 | ||
142 | char buffer[WL_SOCKBUF]; | 142 | char buffer[WL_SOCKBUF]; |
143 | 143 | ||
144 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | 144 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); |
145 | 145 | ||
146 | /* | 146 | /* |
147 | 147 | ||
148 | struct sockaddr from; | 148 | struct sockaddr from; |
149 | socklen_t len; | 149 | socklen_t len; |
150 | 150 | ||
151 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); | 151 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); |
152 | qDebug( "received %d from recv [%d bytes]", result, len ); | 152 | qDebug( "received %d from recv [%d bytes]", result, len ); |
153 | 153 | ||
154 | */ | 154 | */ |
155 | 155 | ||
156 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); | 156 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); |
157 | 157 | ||
158 | if ( result == -1 ) | 158 | if ( result == -1 ) |
159 | { | 159 | { |
160 | qDebug( "Warning: %s", strerror( errno ) ); | 160 | qDebug( "Warning: %s", strerror( errno ) ); |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | 163 | ||
164 | int command = buffer[1] - 48; | 164 | int command = buffer[1] - 48; |
165 | 165 | ||
166 | /* | 166 | /* |
167 | typedef struct { | 167 | typedef struct { |
168 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | 168 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc |
169 | int ssid_len; Length of SSID | 169 | int ssid_len; Length of SSID |
170 | int channel; Channel | 170 | int channel; Channel |
171 | int wep; 1 = WEP enabled ; 0 = disabled | 171 | int wep; 1 = WEP enabled ; 0 = disabled |
172 | char mac[64]; MAC address of Accesspoint | 172 | char mac[64]; MAC address of Accesspoint |
173 | char bssid[128]; BSSID of Accesspoint | 173 | char bssid[128]; BSSID of Accesspoint |
174 | } wl_network_t; | 174 | } wl_network_t; |
175 | */ | 175 | */ |
176 | 176 | ||
177 | qDebug( "Recv result: %d", ( result ) ); | 177 | qDebug( "Recv result: %d", ( result ) ); |
178 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); | 178 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); |
179 | hexwindow->log( (const char*) &buffer ); | 179 | hexwindow->log( (const char*) &buffer ); |
180 | 180 | ||
181 | if ( command == NETFOUND ) /* new network found */ | 181 | if ( command == NETFOUND ) /* new network found */ |
182 | { | 182 | { |
183 | qDebug( "Sniffer said: new network found." ); | 183 | qDebug( "Sniffer said: new network found." ); |
184 | wl_network_t n; | 184 | wl_network_t n; |
185 | get_network_found( &n, (char*) &buffer ); | 185 | get_network_found( &n, (char*) &buffer ); |
186 | 186 | ||
187 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); | 187 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); |
188 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); | 188 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); |
189 | 189 | ||
190 | //n.bssid[n.ssid_len] = "\0"; | 190 | //n.bssid[n.ssid_len] = "\0"; |
191 | 191 | ||
192 | QString type; | 192 | QString type; |
193 | 193 | ||
194 | if ( n.net_type == 1 ) | 194 | if ( n.net_type == 1 ) |
195 | type = "managed"; | 195 | type = "managed"; |
196 | else | 196 | else |
197 | type = "adhoc"; | 197 | type = "adhoc"; |
198 | 198 | ||
199 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); | 199 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); |
200 | 200 | ||
201 | } | 201 | } |
202 | 202 | ||
203 | else | 203 | else |
204 | 204 | ||
205 | { | 205 | { |
206 | qDebug( "unknown sniffer command." ); | 206 | qDebug( "unknown sniffer command." ); |
207 | } | 207 | } |
208 | 208 | ||
209 | } | 209 | } |
210 | 210 | ||
211 | void Wellenreiter::dataReceived() | 211 | void Wellenreiter::dataReceived() |
212 | { | 212 | { |
213 | logwindow->log( "(d) Received data from daemon" ); | 213 | logwindow->log( "(d) Received data from daemon" ); |
214 | handleMessage(); | 214 | handleMessage(); |
215 | } | 215 | } |
216 | 216 | ||
217 | void Wellenreiter::startStopClicked() | 217 | void Wellenreiter::startStopClicked() |
218 | { | 218 | { |
219 | if ( daemonRunning ) | 219 | if ( daemonRunning ) |
220 | { | 220 | { |
221 | daemonRunning = false; | 221 | daemonRunning = false; |
222 | 222 | ||
223 | logwindow->log( "(i) Daemon has been stopped." ); | 223 | logwindow->log( "(i) Daemon has been stopped." ); |
224 | setCaption( tr( "Wellenreiter/Opie" ) ); | 224 | setCaption( tr( "Wellenreiter/Opie" ) ); |
225 | 225 | ||
226 | // Stop daemon - ugly for now... later better | 226 | // Stop daemon - ugly for now... later better |
227 | 227 | ||
228 | system( "killall wellenreiterd" ); | 228 | system( "killall wellenreiterd" ); |
229 | 229 | ||
230 | // get configuration from config window | 230 | // get configuration from config window |
231 | 231 | ||
232 | const QString& interface = configwindow->interfaceName->currentText(); | 232 | const QString& interface = configwindow->interfaceName->currentText(); |
233 | 233 | ||
234 | // reset the interface trying to get it into a usable state again | 234 | // reset the interface trying to get it into a usable state again |
235 | 235 | ||
236 | QString cmdline; | 236 | QString cmdline; |
237 | cmdline.sprintf( "iwpriv %s monitor 0; ifdown %s; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); | 237 | cmdline.sprintf( "iwpriv %s monitor 0; ifdown %s; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); |
238 | system( cmdline ); | 238 | system( cmdline ); |
239 | 239 | ||
240 | // message the user | 240 | // message the user |
241 | 241 | ||
242 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); | 242 | QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); |
243 | } | 243 | } |
244 | 244 | ||
245 | else | 245 | else |
246 | { | 246 | { |
247 | 247 | ||
248 | // get configuration from config window | 248 | // get configuration from config window |
249 | 249 | ||
250 | const QString& interface = configwindow->interfaceName->currentText(); | 250 | const QString& interface = configwindow->interfaceName->currentText(); |
251 | const int cardtype = configwindow->daemonDeviceType(); | 251 | const int cardtype = configwindow->daemonDeviceType(); |
252 | const int interval = configwindow->daemonHopInterval(); | 252 | const int interval = configwindow->daemonHopInterval(); |
253 | 253 | ||
254 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) | 254 | if ( ( interface == "<select>" ) || ( cardtype == 0 ) ) |
255 | { | 255 | { |
256 | QMessageBox::information( this, "Wellenreiter/Opie", "Your device is not\nptoperly configured. Please reconfigure!" ); | 256 | QMessageBox::information( this, "Wellenreiter/Opie", "Your device is not\nptoperly configured. Please reconfigure!" ); |
257 | return; | 257 | return; |
258 | } | 258 | } |
259 | 259 | ||
260 | // start wellenreiterd | 260 | // start wellenreiterd |
261 | 261 | ||
262 | QString cmdline; | 262 | QString cmdline; |
263 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); | 263 | cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype ); |
264 | 264 | ||
265 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); | 265 | qDebug( "about to execute '%s' ...", (const char*) cmdline ); |
266 | system( cmdline ); | 266 | system( cmdline ); |
267 | qDebug( "done!" ); | 267 | qDebug( "done!" ); |
268 | 268 | ||
269 | logwindow->log( "(i) Daemon has been started." ); | 269 | logwindow->log( "(i) Daemon has been started." ); |
diff --git a/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro b/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro index 58da0c1..5930c60 100644 --- a/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro +++ b/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro | |||
@@ -1,15 +1,16 @@ | |||
1 | DESTDIR = $(OPIEDIR)/lib | ||
1 | TEMPLATE = lib | 2 | TEMPLATE = lib |
2 | CONFIG = warn_on debug | 3 | CONFIG = warn_on debug |
3 | VERSION = 0.2 | 4 | VERSION = 0.2 |
4 | HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh source/wl_types.hh | 5 | HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh source/wl_types.hh |
5 | SOURCES = source/cardmode.cc source/wl_log.cc source/wl_proto.cc source/sniff.cc source/wl_sock.cc | 6 | SOURCES = source/cardmode.cc source/wl_log.cc source/wl_proto.cc source/sniff.cc source/wl_sock.cc |
6 | 7 | ||
7 | LIBS = -lpcap | 8 | LIBS = -lpcap |
8 | TMAKE_CFLAGS += -D__UNIX__ | 9 | TMAKE_CFLAGS += -D__UNIX__ |
9 | DEFINES += DEBUG | 10 | DEFINES += DEBUG |
10 | DESTDIR = $(OPIEDIR)/lib | ||
11 | TARGET = wellenreiter | 11 | TARGET = wellenreiter |
12 | 12 | ||
13 | !contains( platform, x11 ) { | ||
14 | include ( $(OPIEDIR)/include.pro ) | ||
15 | } | ||
13 | 16 | ||
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index dd75c8c..17d0e31 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro | |||
@@ -1,6 +1,14 @@ | |||
1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
2 | unix:SUBDIRS = libwellenreiter daemon gui | 2 | unix:SUBDIRS = libwellenreiter daemon gui |
3 | 3 | ||
4 | 4 | ||
5 | !contains( platform, x11 ) { | ||
6 | message( Configuring Wellenreiter for build on Opie ) | ||
7 | include ( $(OPIEDIR)/include.pro ) | ||
8 | } | ||
9 | |||
10 | contains( platform, x11 ) { | ||
11 | message( Configuring Wellenreiter for build on Qt/X11 ) | ||
12 | system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics ) | ||
13 | } | ||
5 | 14 | ||
6 | include ( $(OPIEDIR)/include.pro ) | ||