summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-22 22:11:28 (UTC)
committer mickeyl <mickeyl>2003-04-22 22:11:28 (UTC)
commita0ffe9079338a8b870de5267a22ddbb01cb1cc27 (patch) (unidiff)
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
@@ -364,16 +364,30 @@ struct ieee_802_11_mgmt_body {
364 // struct ssid_tssid; 364 // struct ssid_tssid;
365 // struct rates_t rates; 365 // struct rates_t rates;
366 // struct ds_tds; 366 // struct ds_tds;
367 // struct cf_tcf; 367 // struct cf_tcf;
368 // struct fh_tfh; 368 // struct fh_tfh;
369 // struct tim_ttim; 369 // struct tim_ttim;
370}; 370};
371 371
372/* a 802.11 value */
373struct val_80211 {
374 unsigned int did;
375 unsigned short status, len;
376 unsigned int data;
377};
378
379/* header attached during prism monitor mode */
380struct prism_hdr {
381 unsigned int msgcode, msglen;
382 char devname[16];
383 struct val_80211 hosttime, mactime, channel, rssi, sq, signal,
384 noise, rate, istx, frmlen;
385};
372 386
373struct ieee_802_11_data_body { 387struct ieee_802_11_data_body {
374//FIXME 388//FIXME
375}; 389};
376 390
377struct ieee_802_11_control_body { 391struct ieee_802_11_control_body {
378//FIXME 392//FIXME
379}; 393};
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
@@ -646,17 +646,18 @@ void OWirelessNetworkInterface::setMonitorMode( bool b )
646 else 646 else
647 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); 647 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" );
648} 648}
649 649
650 650
651bool OWirelessNetworkInterface::monitorMode() const 651bool OWirelessNetworkInterface::monitorMode() const
652{ 652{
653 qDebug( "dataLinkType = %d", dataLinkType() ); 653 qDebug( "dataLinkType = %d", dataLinkType() );
654 return dataLinkType() == ARPHRD_IEEE80211; 654 return ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 );
655 // 802 is the header type for PRISM - Linux support for this is pending...
655} 656}
656 657
657 658
658QString OWirelessNetworkInterface::nickName() const 659QString OWirelessNetworkInterface::nickName() const
659{ 660{
660 char str[IW_ESSID_MAX_SIZE]; 661 char str[IW_ESSID_MAX_SIZE];
661 _iwr.u.data.pointer = &str[0]; 662 _iwr.u.data.pointer = &str[0];
662 _iwr.u.data.length = IW_ESSID_MAX_SIZE; 663 _iwr.u.data.length = IW_ESSID_MAX_SIZE;
@@ -928,17 +929,17 @@ OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* ifa
928 929
929OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() 930OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface()
930{ 931{
931} 932}
932 933
933 934
934void OOrinocoMonitoringInterface::setChannel( int c ) 935void OOrinocoMonitoringInterface::setChannel( int c )
935{ 936{
936 _if->setPrivate( "monitor", 2, 2, c ); 937 _if->setPrivate( "monitor", 2, 1, c );
937} 938}
938 939
939 940
940void OOrinocoMonitoringInterface::setEnabled( bool b ) 941void OOrinocoMonitoringInterface::setEnabled( bool b )
941{ 942{
942 if ( b ) 943 if ( b )
943 { 944 {
944 setChannel( 1 ); 945 setChannel( 1 );
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
@@ -60,16 +60,21 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
60 new OEthernetPacket( _end, (const struct ether_header*) data, this ); 60 new OEthernetPacket( _end, (const struct ether_header*) data, this );
61 break; 61 break;
62 62
63 case DLT_IEEE802_11: 63 case DLT_IEEE802_11:
64 qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" ); 64 qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" );
65 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); 65 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
66 break; 66 break;
67 67
68 case DLT_PRISM_HEADER:
69 qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" );
70 new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this );
71 break;
72
68 default: 73 default:
69 qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink '%s'!", datalink ); 74 qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink '%s'!", datalink );
70 } 75 }
71} 76}
72 77
73 78
74OPacket::~OPacket() 79OPacket::~OPacket()
75{ 80{
@@ -311,16 +316,42 @@ OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QOb
311} 316}
312 317
313OTCPPacket::~OTCPPacket() 318OTCPPacket::~OTCPPacket()
314{ 319{
315} 320}
316 321
317 322
318/*====================================================================================== 323/*======================================================================================
324 * OPrismHeaderPacket
325 *======================================================================================*/
326
327
328OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent )
329 :QObject( parent, "Prism" ), _header( data )
330
331{
332 qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." );
333
334 qDebug( "Signal Strength = %d", data->signal.data );
335
336 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this );
337}
338
339OPrismHeaderPacket::~OPrismHeaderPacket()
340{
341}
342
343
344unsigned int OPrismHeaderPacket::signalStrength() const
345{
346 return _header->signal.data;
347}
348
349/*======================================================================================
319 * OWaveLanPacket 350 * OWaveLanPacket
320 *======================================================================================*/ 351 *======================================================================================*/
321 352
322 353
323OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent ) 354OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent )
324 :QObject( parent, "802.11" ), _wlanhdr( data ) 355 :QObject( parent, "802.11" ), _wlanhdr( data )
325 356
326{ 357{
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
@@ -150,16 +150,35 @@ class OEthernetPacket : public QObject
150 int type() const; 150 int type() const;
151 151
152 private: 152 private:
153 const struct ether_header* _ether; 153 const struct ether_header* _ether;
154}; 154};
155 155
156 156
157/*====================================================================================== 157/*======================================================================================
158 * OPrismHeaderPacket - DLT_PRISM_HEADER frame
159 *======================================================================================*/
160
161class OPrismHeaderPacket : public QObject
162{
163 Q_OBJECT
164
165 public:
166 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 );
167 virtual ~OPrismHeaderPacket();
168
169 unsigned int signalStrength() const;
170
171 private:
172 const struct prism_hdr* _header;
173};
174
175
176/*======================================================================================
158 * OWaveLanPacket - DLT_IEEE802_11 frame 177 * OWaveLanPacket - DLT_IEEE802_11 frame
159 *======================================================================================*/ 178 *======================================================================================*/
160 179
161class OWaveLanPacket : public QObject 180class OWaveLanPacket : public QObject
162{ 181{
163 Q_OBJECT 182 Q_OBJECT
164 183
165 public: 184 public: