summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-22 22:11:28 (UTC)
committer mickeyl <mickeyl>2003-04-22 22:11:28 (UTC)
commita0ffe9079338a8b870de5267a22ddbb01cb1cc27 (patch) (side-by-side diff)
treefe240ab38bd11cd32d51674e4f79a465092476e5
parentbb8965d31b06ec122a0916d8c5bc4c4b68873a14 (diff)
downloadopie-a0ffe9079338a8b870de5267a22ddbb01cb1cc27.zip
opie-a0ffe9079338a8b870de5267a22ddbb01cb1cc27.tar.gz
opie-a0ffe9079338a8b870de5267a22ddbb01cb1cc27.tar.bz2
add prism header parsing capability!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/802_11_user.h14
-rw-r--r--libopie2/opienet/onetwork.cpp5
-rw-r--r--libopie2/opienet/opcap.cpp31
-rw-r--r--libopie2/opienet/opcap.h19
4 files changed, 67 insertions, 2 deletions
diff --git a/libopie2/opienet/802_11_user.h b/libopie2/opienet/802_11_user.h
index f596bd8..cd98503 100644
--- a/libopie2/opienet/802_11_user.h
+++ b/libopie2/opienet/802_11_user.h
@@ -371,2 +371,16 @@ struct ieee_802_11_mgmt_body {
+/* a 802.11 value */
+struct val_80211 {
+ unsigned int did;
+ unsigned short status, len;
+ unsigned int data;
+};
+
+/* header attached during prism monitor mode */
+struct prism_hdr {
+ unsigned int msgcode, msglen;
+ char devname[16];
+ struct val_80211 hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+};
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index be2736a..95e7043 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -653,3 +653,4 @@ bool OWirelessNetworkInterface::monitorMode() const
qDebug( "dataLinkType = %d", dataLinkType() );
- return dataLinkType() == ARPHRD_IEEE80211;
+ return ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 );
+ // 802 is the header type for PRISM - Linux support for this is pending...
}
@@ -935,3 +936,3 @@ void OOrinocoMonitoringInterface::setChannel( int c )
{
- _if->setPrivate( "monitor", 2, 2, c );
+ _if->setPrivate( "monitor", 2, 1, c );
}
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index e362883..675818e 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -67,2 +67,7 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
+ case DLT_PRISM_HEADER:
+ qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" );
+ new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this );
+ break;
+
default:
@@ -318,2 +323,28 @@ OTCPPacket::~OTCPPacket()
/*======================================================================================
+ * OPrismHeaderPacket
+ *======================================================================================*/
+
+
+OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent )
+ :QObject( parent, "Prism" ), _header( data )
+
+{
+ qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." );
+
+ qDebug( "Signal Strength = %d", data->signal.data );
+
+ new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this );
+}
+
+OPrismHeaderPacket::~OPrismHeaderPacket()
+{
+}
+
+
+unsigned int OPrismHeaderPacket::signalStrength() const
+{
+ return _header->signal.data;
+}
+
+/*======================================================================================
* OWaveLanPacket
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index fe88e68..83f7115 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -157,2 +157,21 @@ class OEthernetPacket : public QObject
/*======================================================================================
+ * OPrismHeaderPacket - DLT_PRISM_HEADER frame
+ *======================================================================================*/
+
+class OPrismHeaderPacket : public QObject
+{
+ Q_OBJECT
+
+ public:
+ OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 );
+ virtual ~OPrismHeaderPacket();
+
+ unsigned int signalStrength() const;
+
+ private:
+ const struct prism_hdr* _header;
+};
+
+
+/*======================================================================================
* OWaveLanPacket - DLT_IEEE802_11 frame