summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetwork.cpp
Unidiff
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp55
1 files changed, 23 insertions, 32 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 789e8ca..6a363d7 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -54,2 +54,3 @@
54#include <linux/sockios.h> 54#include <linux/sockios.h>
55#include <net/if_arp.h>
55#include <stdarg.h> 56#include <stdarg.h>
@@ -73,3 +74,4 @@ void ONetwork::synchronize()
73 // gather available interfaces by inspecting /proc/net/dev 74 // gather available interfaces by inspecting /proc/net/dev
74 // we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices 75 //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices
76 //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices
75 77
@@ -134,7 +136,3 @@ bool ONetwork::isWirelessInterface( const char* name ) const
134 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); 136 int result = ::ioctl( sfd, SIOCGIWNAME, &iwr );
135 if ( result == -1 ) 137 return result != -1;
136 qDebug( "ONetwork::ioctl(): SIOCGIWNAME failed: %d (%s)", result, strerror( errno ) );
137 else
138 qDebug( "ONetwork::ioctl(): SIOCGIWNAME ok." );
139 return ( result != -1 );
140} 138}
@@ -241,2 +239,15 @@ OMacAddress ONetworkInterface::macAddress() const
241 239
240int ONetworkInterface::dataLinkType() const
241{
242 if ( ioctl( SIOCGIFHWADDR ) )
243 {
244 return _ifr.ifr_hwaddr.sa_family;
245 }
246 else
247 {
248 return -1;
249 }
250}
251
252
242void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) 253void ONetworkInterface::setMonitoring( OMonitoringInterface* m )
@@ -587,3 +598,4 @@ bool OWirelessNetworkInterface::monitorMode() const
587{ 598{
588 return _mon ? _mon->enabled() : false; 599 qDebug( "dataLinkType = %d", dataLinkType() );
600 return dataLinkType() == ARPHRD_IEEE80211;
589} 601}
@@ -687,3 +699,3 @@ bool OWirelessNetworkInterface::wioctl( int call ) const
687OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface ) 699OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface )
688 :_enabled( false ), _if( static_cast<OWirelessNetworkInterface*>( iface ) ) 700 :_if( static_cast<OWirelessNetworkInterface*>( iface ) )
689{ 701{
@@ -709,23 +721,11 @@ bool OMonitoringInterface::enabled() const
709{ 721{
710 return _enabled; 722 return _if->monitorMode();
711} 723}
712 724
725
713void OMonitoringInterface::setEnabled( bool b ) 726void OMonitoringInterface::setEnabled( bool b )
714{ 727{
715 // open a packet capturer here or leave this to
716 // the client code?
717
718 /*
719
720 if ( b )
721 {
722 OPacketCapturer* opcap = new OPacketCapturer();
723 opcap->open( _if->name() );
724 }
725 */
726
727 _enabled = b;
728
729} 728}
730 729
730
731/*====================================================================================== 731/*======================================================================================
@@ -759,5 +759,2 @@ void OCiscoMonitoringInterface::setEnabled( bool b )
759 s << "XmitPower: 1"; 759 s << "XmitPower: 1";
760
761 OMonitoringInterface::setEnabled( b );
762
763 } 760 }
@@ -805,4 +802,2 @@ void OWlanNGMonitoringInterface::setEnabled( bool b )
805 system( cmd ); 802 system( cmd );
806
807 OMonitoringInterface::setEnabled( b );
808} 803}
@@ -865,4 +860,2 @@ void OHostAPMonitoringInterface::setEnabled( bool b )
865 } 860 }
866
867 OMonitoringInterface::setEnabled( b );
868} 861}
@@ -916,4 +909,2 @@ void OOrinocoMonitoringInterface::setEnabled( bool b )
916 } 909 }
917
918 OMonitoringInterface::setEnabled( b );
919} 910}