summaryrefslogtreecommitdiff
path: root/libopie2/opienet
authormickeyl <mickeyl>2003-10-21 18:09:34 (UTC)
committer mickeyl <mickeyl>2003-10-21 18:09:34 (UTC)
commit3e9d8077999bd928b7103bd19f7b41f305c573d9 (patch) (side-by-side diff)
tree507ee7f3a1539d02af159fb0fed4153e08c5ece0 /libopie2/opienet
parent76ca3158518a851085b5a5ebe3724d0c0c3be857 (diff)
downloadopie-3e9d8077999bd928b7103bd19f7b41f305c573d9.zip
opie-3e9d8077999bd928b7103bd19f7b41f305c573d9.tar.gz
opie-3e9d8077999bd928b7103bd19f7b41f305c573d9.tar.bz2
- more work on scanning
- start OStation class representing a network node
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp45
-rw-r--r--libopie2/opienet/opienet.pro6
-rw-r--r--libopie2/opienet/ostation.cpp49
-rw-r--r--libopie2/opienet/ostation.h67
4 files changed, 164 insertions, 3 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 918ba07..a85a510 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -34,6 +34,7 @@
/* OPIE */
#include <opie2/onetwork.h>
+#include <opie2/ostation.h>
/* QT */
@@ -881,11 +882,53 @@ int OWirelessNetworkInterface::scanNetwork()
if ( results )
{
+ qDebug( " - result length = %d", _iwr.u.data.length );
+ if ( !_iwr.u.data.length )
+ {
+ qDebug( " - no results (empty neighbourhood)" );
+ return 0;
+ }
+
qDebug( " - results are in!" );
+ dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length );
+
+ int stations = 0;
+
+ // parse results
+
+ int offset = 0;
+ struct iw_event* we = (struct iw_event*) &buffer[0];
+
+ while ( offset < _iwr.u.data.length )
+ {
+ //const char* cmd = *(*_ioctlmap)[we->cmd];
+ //if ( !cmd ) cmd = "<unknown>";
+ qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len );
+ switch (we->cmd)
+ {
+ case SIOCGIWAP: qDebug( "SIOCGIWAP" ); stations++; break;
+ case SIOCGIWMODE: qDebug( "SIOCGIWMODE" ); break;
+ case SIOCGIWFREQ: qDebug( "SIOCGIWFREQ" ); break;
+ case SIOCGIWESSID: qDebug( "SIOCGIWESSID" ); break;
+ case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break;
+ case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break;
+ case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */
+ case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */
+ case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */
+ case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */
+ case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */
+ default: qDebug( "unhandled event" );
+ }
+
+ offset += we->len;
+ we = (struct iw_event*) &buffer[offset];
+ }
+
}
else
{
- qDebug( " - no results :(" );
+ qDebug( " - no results (timeout) :(" );
+ return 0;
}
}
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index 304d968..d966462 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -9,12 +9,14 @@ HEADERS = 802_11_user.h \
omanufacturerdb.h \
onetutils.h \
onetwork.h \
- opcap.h
+ opcap.h \
+ ostation.h
SOURCES = oioctlmap.cpp \
omanufacturerdb.cpp \
onetutils.cpp \
onetwork.cpp \
- opcap.cpp
+ opcap.cpp \
+ ostation.cpp
INTERFACES =
TARGET = opienet2
VERSION = 1.8.1
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp
new file mode 100644
index 0000000..3817b31
--- a/dev/null
+++ b/libopie2/opienet/ostation.cpp
@@ -0,0 +1,49 @@
+/*
+                 This file is part of the Opie Project
+
+              (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include <opie2/ostation.h>
+
+/*======================================================================================
+ * OStation
+ *======================================================================================*/
+
+OStation::OStation()
+{
+ qDebug( "OStation::OStation()" );
+}
+
+
+OStation::~OStation()
+{
+ qDebug( "OStation::~OStation()" );
+}
+
+
diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h
new file mode 100644
index 0000000..f61570b
--- a/dev/null
+++ b/libopie2/opienet/ostation.h
@@ -0,0 +1,67 @@
+/*
+                 This file is part of the Opie Project
+
+              (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef OSTATION_H
+#define OSTATION_H
+
+#include <opie2/onetutils.h>
+
+#include <qdict.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <qhostaddress.h>
+#include <qobject.h>
+
+#include <sys/types.h>
+
+class OStation;
+
+typedef QDict<OStation> OStationDict;
+
+/*======================================================================================
+ * OStation
+ *======================================================================================*/
+
+class OStation
+{
+ public:
+ OStation();
+ ~OStation();
+
+ private:
+ OMacAddress macAddress;
+ QHostAddress ipAddress;
+ QString ssid;
+ QString type;
+};
+
+#endif // OSTATION_H
+