author | mickeyl <mickeyl> | 2003-04-07 18:07:38 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-07 18:07:38 (UTC) |
commit | cac6a08e456a057a19cc1fc56824fc98ff4f0bc1 (patch) (unidiff) | |
tree | b17fa559629bcb9f49d685d3ec8b8dddc6a20f46 | |
parent | 75f029f87d4c84b37ccfe1c81ef205a6cd5fca79 (diff) | |
download | opie-cac6a08e456a057a19cc1fc56824fc98ff4f0bc1.zip opie-cac6a08e456a057a19cc1fc56824fc98ff4f0bc1.tar.gz opie-cac6a08e456a057a19cc1fc56824fc98ff4f0bc1.tar.bz2 |
- add OManufacturerDB
- API extensions for OMacAddress
- add data packet recognition for miniwellenreiter
-rw-r--r-- | libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 63 | ||||
-rw-r--r-- | libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | 1 | ||||
-rw-r--r-- | libopie2/libopie2.control | 6 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 96 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 37 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 21 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 3 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 12 |
9 files changed, 205 insertions, 42 deletions
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index 7581888..f800336 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -78,39 +78,16 @@ public: | |||
78 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); | 78 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); |
79 | exit( -1 ); | 79 | exit( -1 ); |
80 | } | 80 | } |
81 | 81 | ||
82 | // downcast should be safe now | 82 | // downcast should be safe now |
83 | wiface = (OWirelessNetworkInterface*) iface; | 83 | wiface = (OWirelessNetworkInterface*) iface; |
84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); | 84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); |
85 | 85 | ||
86 | /* | ||
87 | |||
88 | // ifconfig down the interface - this enable more crash-proof | ||
89 | // scanning with drivers like spectrum_cs... | ||
90 | if ( wiface->isUp() ) | ||
91 | { | ||
92 | printf( "Interface status is up... switching to down... " ); | ||
93 | wiface->setUp( false ); | ||
94 | if ( wiface->isUp() ) | ||
95 | { | ||
96 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | ||
97 | exit( -1 ); | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | printf( "ok.\n" ); | ||
102 | } | ||
103 | } | ||
104 | else | ||
105 | printf( "Interface status is already down - good.\n" ); | ||
106 | |||
107 | */ | ||
108 | |||
109 | // ifconfig +promisc the interface to receive all packets | 86 | // ifconfig +promisc the interface to receive all packets |
110 | if ( !wiface->promiscuousMode() ) | 87 | if ( !wiface->promiscuousMode() ) |
111 | { | 88 | { |
112 | printf( "Interface status is not promisc... switching to promisc... " ); | 89 | printf( "Interface status is not promisc... switching to promisc... " ); |
113 | wiface->setPromiscuousMode( true ); | 90 | wiface->setPromiscuousMode( true ); |
114 | if ( !wiface->promiscuousMode() ) | 91 | if ( !wiface->promiscuousMode() ) |
115 | { | 92 | { |
116 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | 93 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); |
@@ -164,30 +141,68 @@ public slots: | |||
164 | { | 141 | { |
165 | if (!p) | 142 | if (!p) |
166 | { | 143 | { |
167 | printf( "(empty packet received)\n" ); | 144 | printf( "(empty packet received)\n" ); |
168 | return; | 145 | return; |
169 | } | 146 | } |
170 | 147 | ||
171 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); | 148 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); |
172 | |||
173 | if ( beacon ) | 149 | if ( beacon ) |
174 | { | 150 | { |
175 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 151 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
176 | QString essid = ssid ? ssid->ID() : "<unknown>"; | 152 | QString essid = ssid ? ssid->ID() : "<unknown>"; |
177 | 153 | ||
178 | if ( stations.find( essid ) ) | 154 | if ( stations.find( essid ) ) |
179 | stations[essid]->beacons++; | 155 | stations[essid]->beacons++; |
180 | else | 156 | else |
181 | { | 157 | { |
182 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); | 158 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); |
183 | stations.insert( essid, new Station( "unknown", wiface->channel(), | 159 | stations.insert( essid, new Station( "unknown", wiface->channel(), |
184 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); | 160 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); |
185 | } | 161 | } |
162 | return; | ||
163 | } | ||
164 | |||
165 | OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" ); | ||
166 | if ( data ) | ||
167 | { | ||
168 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | ||
169 | if ( wlan->fromDS() && !wlan->toDS() ) | ||
170 | { | ||
171 | printf( "FromDS: '%s' -> '%s' via '%s'\n", | ||
172 | (const char*) wlan->macAddress3().toString(true), | ||
173 | (const char*) wlan->macAddress1().toString(true), | ||
174 | (const char*) wlan->macAddress2().toString(true) ); | ||
175 | } | ||
176 | else | ||
177 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
178 | { | ||
179 | printf( "ToDS: '%s' -> '%s' via '%s'\n", | ||
180 | (const char*) wlan->macAddress2().toString(true), | ||
181 | (const char*) wlan->macAddress3().toString(true), | ||
182 | (const char*) wlan->macAddress1().toString(true) ); | ||
183 | } | ||
184 | else | ||
185 | if ( wlan->fromDS() && wlan->toDS() ) | ||
186 | { | ||
187 | printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n", | ||
188 | (const char*) wlan->macAddress4().toString(true), | ||
189 | (const char*) wlan->macAddress3().toString(true), | ||
190 | (const char*) wlan->macAddress1().toString(true), | ||
191 | (const char*) wlan->macAddress2().toString(true) ); | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n", | ||
196 | (const char*) wlan->macAddress2().toString(true), | ||
197 | (const char*) wlan->macAddress1().toString(true), | ||
198 | (const char*) wlan->macAddress3().toString(true) ); | ||
199 | } | ||
200 | return; | ||
186 | } | 201 | } |
187 | } | 202 | } |
188 | private: | 203 | private: |
189 | OPacketCapturer* cap; | 204 | OPacketCapturer* cap; |
190 | OWirelessNetworkInterface* wiface; | 205 | OWirelessNetworkInterface* wiface; |
191 | }; | 206 | }; |
192 | 207 | ||
193 | 208 | ||
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 020fc23..f801b15 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -7,16 +7,17 @@ int main( int argc, char** argv ) | |||
7 | ONetwork* net = ONetwork::instance(); | 7 | ONetwork* net = ONetwork::instance(); |
8 | 8 | ||
9 | ONetwork::InterfaceIterator it = net->iterator(); | 9 | ONetwork::InterfaceIterator it = net->iterator(); |
10 | 10 | ||
11 | while ( it.current() ) | 11 | while ( it.current() ) |
12 | { | 12 | { |
13 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | 13 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); |
14 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | 14 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); |
15 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); | ||
15 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); | 16 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); |
16 | if ( it.current()->isWireless() ) | 17 | if ( it.current()->isWireless() ) |
17 | { | 18 | { |
18 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | 19 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); |
19 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); | 20 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); |
20 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); | 21 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); |
21 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | 22 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); |
22 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); | 23 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); |
diff --git a/libopie2/libopie2.control b/libopie2/libopie2.control index 24a7c37..866d106 100644 --- a/libopie2/libopie2.control +++ b/libopie2/libopie2.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Files: $OPIEDIR/lib/libopiecore2.so.1.8.1 $OPIEDIR/lib/libopiecore2.so.1.8 $OPIEDIR/lib/libopiecore2.so.1 $OPIEDIR/lib/libopienet2.so.1.8.1 $OPIEDIR/lib/libopienet2.so.1.8 $OPIEDIR/lib/libopienet2.so.1 $OPIEDIR/lib/libopieui2.so.1.8.1 $OPIEDIR/lib/libopieui2.so.1.8 $OPIEDIR/lib/libopieui2.so.1 | 1 | Files: $OPIEDIR/lib/libopiecore2.so.1.8.1 $OPIEDIR/lib/libopiecore2.so.1.8 $OPIEDIR/lib/libopiecore2.so.1 $OPIEDIR/lib/libopienet2.so.1.8.1 $OPIEDIR/lib/libopienet2.so.1.8 $OPIEDIR/lib/libopienet2.so.1 $OPIEDIR/lib/libopieui2.so.1.8.1 $OPIEDIR/lib/libopieui2.so.1.8 $OPIEDIR/lib/libopieui2.so.1 $OPIEDIR/etc/manufacturers |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/system | 3 | Section: opie/system |
4 | Maintainer: Opie Team <opie@handhelds.org> | 4 | Maintainer: Opie Team <opie@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 1.8.1-$SUB_VERSION.1 | 6 | Version: 1.8.1-$SUB_VERSION.2 |
7 | Depends: libqpe1 | 7 | Depends: libqpe1 |
8 | Provides: libopie2 | 8 | Provides: libopie2 |
9 | Replaces: libopie2 | ||
10 | Description: Opie library 2.0 | 9 | Description: Opie library 2.0 |
10 | |||
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp new file mode 100644 index 0000000..ea15125 --- a/dev/null +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -0,0 +1,96 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "omanufacturerdb.h" | ||
17 | |||
18 | // Qt | ||
19 | #include <qstring.h> | ||
20 | #include <qfile.h> | ||
21 | #include <qtextstream.h> | ||
22 | |||
23 | OManufacturerDB* OManufacturerDB::_instance = 0; | ||
24 | |||
25 | OManufacturerDB* OManufacturerDB::instance() | ||
26 | { | ||
27 | if ( !OManufacturerDB::_instance ) | ||
28 | { | ||
29 | qDebug( "OManufacturerDB::instance(): creating OManufacturerDB..." ); | ||
30 | _instance = new OManufacturerDB(); | ||
31 | } | ||
32 | return _instance; | ||
33 | } | ||
34 | |||
35 | |||
36 | OManufacturerDB::OManufacturerDB() | ||
37 | { | ||
38 | QString filename( "/etc/manufacturers" ); | ||
39 | qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); | ||
40 | if ( !QFile::exists( filename ) ) | ||
41 | { | ||
42 | filename = "/opt/QtPalmtop/etc/manufacturers"; | ||
43 | qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); | ||
44 | if ( !QFile::exists( filename ) ) | ||
45 | { | ||
46 | filename = "/usr/share/wellenreiter/manufacturers"; | ||
47 | qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | QFile file( filename ); | ||
52 | bool hasFile = file.open( IO_ReadOnly ); | ||
53 | if (!hasFile) | ||
54 | { | ||
55 | qWarning( "OManufacturerDB: no valid manufacturer list found.", (const char*) filename ); | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | qDebug( "OManufacturerDB: found manufacturer list in '%s'...", (const char*) filename ); | ||
60 | QTextStream s( &file ); | ||
61 | QString addr; | ||
62 | QString manu; | ||
63 | while (!s.atEnd()) | ||
64 | { | ||
65 | s >> addr; | ||
66 | if ( !addr ) // read nothing!? | ||
67 | { | ||
68 | continue; | ||
69 | } | ||
70 | else | ||
71 | if ( addr[0] == '#' ) | ||
72 | { | ||
73 | s.readLine(); | ||
74 | continue; | ||
75 | } | ||
76 | s.skipWhiteSpace(); | ||
77 | s >> manu; | ||
78 | s.readLine(); | ||
79 | //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); | ||
80 | manufacturers.insert( addr, manu ); | ||
81 | |||
82 | } | ||
83 | } | ||
84 | |||
85 | } | ||
86 | |||
87 | |||
88 | OManufacturerDB::~OManufacturerDB() | ||
89 | { | ||
90 | } | ||
91 | |||
92 | |||
93 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | ||
94 | { | ||
95 | return manufacturers[macaddr.upper().left(8)]; | ||
96 | } | ||
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h new file mode 100644 index 0000000..5e66c37 --- a/dev/null +++ b/libopie2/opienet/omanufacturerdb.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef OMANUFACTURERDB_H | ||
17 | #define OMANUFACTURERDB_H | ||
18 | |||
19 | #include <qmap.h> | ||
20 | |||
21 | class OManufacturerDB | ||
22 | { | ||
23 | public: | ||
24 | static OManufacturerDB* instance(); | ||
25 | const QString& lookup( const QString& macaddr ) const; | ||
26 | |||
27 | protected: | ||
28 | OManufacturerDB(); | ||
29 | virtual ~OManufacturerDB(); | ||
30 | |||
31 | private: | ||
32 | QMap<QString, QString> manufacturers; | ||
33 | static OManufacturerDB* _instance; | ||
34 | }; | ||
35 | |||
36 | #endif | ||
37 | |||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 2485f30..236f108 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -26,16 +26,17 @@ | |||
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/onetutils.h> | 32 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/omanufacturerdb.h> | ||
34 | 35 | ||
35 | #include <net/if.h> | 36 | #include <net/if.h> |
36 | 37 | ||
37 | #include <cstdio> | 38 | #include <cstdio> |
38 | using namespace std; | 39 | using namespace std; |
39 | 40 | ||
40 | #define IW_PRIV_TYPE_MASK 0x7000 | 41 | #define IW_PRIV_TYPE_MASK 0x7000 |
41 | #define IW_PRIV_TYPE_NONE 0x0000 | 42 | #define IW_PRIV_TYPE_NONE 0x0000 |
@@ -104,26 +105,34 @@ OMacAddress OMacAddress::fromString( const QString& str ) | |||
104 | if ( !ok ) return OMacAddress::unknown; | 105 | if ( !ok ) return OMacAddress::unknown; |
105 | addr.truncate( index ); | 106 | addr.truncate( index ); |
106 | index -= 3; | 107 | index -= 3; |
107 | } | 108 | } |
108 | return (const unsigned char*) &buf; | 109 | return (const unsigned char*) &buf; |
109 | } | 110 | } |
110 | 111 | ||
111 | 112 | ||
112 | QString OMacAddress::toString() const | 113 | QString OMacAddress::toString( bool substitute ) const |
113 | { | 114 | { |
114 | QString s; | 115 | QString manu; |
115 | s.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", | 116 | manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff ); |
116 | _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff, | 117 | QString serial; |
117 | _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); | 118 | serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); |
118 | return s; | 119 | if ( !substitute ) return manu+serial; |
120 | // fallback - if no vendor is found, just use the number | ||
121 | QString textmanu = OManufacturerDB::instance()->lookup( manu ); | ||
122 | return textmanu.isNull() ? manu+serial : textmanu + serial; | ||
119 | } | 123 | } |
120 | 124 | ||
121 | 125 | ||
126 | QString OMacAddress::manufacturer() const | ||
127 | { | ||
128 | return OManufacturerDB::instance()->lookup( toString() ); | ||
129 | } | ||
130 | |||
122 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | 131 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) |
123 | { | 132 | { |
124 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; | 133 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; |
125 | } | 134 | } |
126 | 135 | ||
127 | 136 | ||
128 | /*====================================================================================== | 137 | /*====================================================================================== |
129 | * OHostAddress | 138 | * OHostAddress |
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 73d52cc..bedea63 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -50,17 +50,18 @@ class OWirelessNetworkInterface; | |||
50 | class OMacAddress | 50 | class OMacAddress |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | OMacAddress( unsigned char* ); | 53 | OMacAddress( unsigned char* ); |
54 | OMacAddress( const unsigned char* ); | 54 | OMacAddress( const unsigned char* ); |
55 | OMacAddress( struct ifreq& ); | 55 | OMacAddress( struct ifreq& ); |
56 | ~OMacAddress(); | 56 | ~OMacAddress(); |
57 | 57 | ||
58 | QString toString() const; | 58 | QString manufacturer() const; |
59 | QString toString( bool substitute = false ) const; | ||
59 | const unsigned char* native() const; | 60 | const unsigned char* native() const; |
60 | 61 | ||
61 | static OMacAddress fromString( const QString& ); | 62 | static OMacAddress fromString( const QString& ); |
62 | 63 | ||
63 | public: | 64 | public: |
64 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 65 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
65 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 66 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
66 | 67 | ||
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 6ddd457..40aac2c 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -634,38 +634,38 @@ OWaveLanManagementChallenge::~OWaveLanManagementChallenge() | |||
634 | 634 | ||
635 | /*====================================================================================== | 635 | /*====================================================================================== |
636 | * OWaveLanDataPacket | 636 | * OWaveLanDataPacket |
637 | *======================================================================================*/ | 637 | *======================================================================================*/ |
638 | 638 | ||
639 | OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent ) | 639 | OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent ) |
640 | :QObject( parent, "802.11 Data" ), _header( data ) | 640 | :QObject( parent, "802.11 Data" ), _header( data ) |
641 | { | 641 | { |
642 | //qDebug( "size of header = %d", sizeof( struct ieee_802_11_data_header ) ); | 642 | qDebug( "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." ); |
643 | //qDebug( "header: %0x", data ); | 643 | |
644 | const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header ); | 644 | const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header ); |
645 | //qDebug( "payload: %0x", payload ); | ||
646 | 645 | ||
646 | #warning The next line works for most cases, but can not be correct generally! | ||
647 | if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address | 647 | if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address |
648 | 648 | ||
649 | new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this ); | 649 | new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this ); |
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | OWaveLanDataPacket::~OWaveLanDataPacket() | 653 | OWaveLanDataPacket::~OWaveLanDataPacket() |
654 | { | 654 | { |
655 | } | 655 | } |
656 | 656 | ||
657 | 657 | ||
658 | /*====================================================================================== | 658 | /*====================================================================================== |
659 | * OLLCPacket | 659 | * OLLCPacket |
660 | *======================================================================================*/ | 660 | *======================================================================================*/ |
661 | 661 | ||
662 | OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent ) | 662 | OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent ) |
663 | :QObject( parent, "802.11 802_2" ), _header( data ) | 663 | :QObject( parent, "802.11 LLC" ), _header( data ) |
664 | { | 664 | { |
665 | qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." ); | 665 | qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." ); |
666 | 666 | ||
667 | if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) ) | 667 | if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) ) |
668 | { | 668 | { |
669 | qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) ); | 669 | qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) ); |
670 | 670 | ||
671 | switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h | 671 | switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h |
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro index e73afbf..3f9166a 100644 --- a/libopie2/opienet/opienet.pro +++ b/libopie2/opienet/opienet.pro | |||
@@ -1,18 +1,22 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = onetutils.cpp onetwork.h opcap.h | 4 | HEADERS = omanufacturerdb.cpp \ |
5 | 5 | onetutils.cpp \ | |
6 | SOURCES = onetutils.cpp onetwork.cpp opcap.cpp | 6 | onetwork.h \ |
7 | opcap.h | ||
8 | SOURCES = omanufacturerdb.cpp \ | ||
9 | onetutils.cpp \ | ||
10 | onetwork.cpp \ | ||
11 | opcap.cpp | ||
7 | INTERFACES = | 12 | INTERFACES = |
8 | TARGET = opienet2 | 13 | TARGET = opienet2 |
9 | VERSION = 1.8.1 | 14 | VERSION = 1.8.1 |
10 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
11 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
12 | LIBS += -lpcap | 17 | LIBS += -lpcap |
13 | |||
14 | MOC_DIR = moc | 18 | MOC_DIR = moc |
15 | OBJECTS_DIR = obj | 19 | OBJECTS_DIR = obj |
16 | 20 | ||
17 | include ( $(OPIEDIR)/include.pro ) | 21 | include ( $(OPIEDIR)/include.pro ) |
18 | 22 | ||