author | mickeyl <mickeyl> | 2005-05-16 17:48:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-16 17:48:03 (UTC) |
commit | d2426de3452342ab4af8e95214b9ff408f30744e (patch) (side-by-side diff) | |
tree | 41eb23ab226a83778112aaf6d14ab3e8fc5dc896 /libopie2/opienet/onetwork.cpp | |
parent | a0276f0957bd503491e8d435b7ad1a6479ce24eb (diff) | |
download | opie-d2426de3452342ab4af8e95214b9ff408f30744e.zip opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.gz opie-d2426de3452342ab4af8e95214b9ff408f30744e.tar.bz2 |
- add ONetworkInterfaceDriverInfo block extracting info using ethtool ioctls
- adjust example
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 05513f8..1deb051 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -26,44 +26,46 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* OPIE */ - #include <opie2/onetwork.h> #include <opie2/ostation.h> #include <opie2/odebug.h> +using namespace Opie::Core; /* QT */ - #include <qfile.h> #include <qtextstream.h> #include <qapplication.h> -/* UNIX */ - +/* STD */ #include <assert.h> #include <arpa/inet.h> #include <errno.h> +#include <stdarg.h> #include <string.h> #include <stdlib.h> #include <math.h> +#include <unistd.h> +#include <net/if_arp.h> +#include <net/ethernet.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> -#include <unistd.h> +#include <linux/types.h> #include <linux/sockios.h> -#include <net/if_arp.h> -#include <net/ethernet.h> -#include <stdarg.h> +#define u64 __u64 +#define u32 __u32 +#define u16 __u16 +#define u8 __u8 +#include <linux/ethtool.h> #ifndef NODEBUG #include <opie2/odebugmapper.h> - -using namespace Opie::Core; using namespace Opie::Net::Internal; DebugMapper* debugmapper = new DebugMapper(); #endif /*====================================================================================== * ONetwork @@ -378,12 +380,20 @@ bool ONetworkInterface::promiscuousMode() const bool ONetworkInterface::isWireless() const { return ioctl( SIOCGIWNAME ); } +ONetworkInterfaceDriverInfo ONetworkInterface::driverInfo() const +{ + struct ethtool_drvinfo info; + info.cmd = ETHTOOL_GDRVINFO; + _ifr.ifr_data = (caddr_t) &info; + return ioctl( SIOCETHTOOL ) ? ONetworkInterfaceDriverInfo( info.driver, info.version, info.fw_version, info.bus_info) : ONetworkInterfaceDriverInfo(); +} + /*====================================================================================== * OChannelHopper *======================================================================================*/ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) :QObject( 0, "Mickey's funky hopper" ), @@ -402,12 +412,13 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) if ( _maxChannel >= 4 ) _channels.append( 4 ); if ( _maxChannel >= 10 ) _channels.append( 10 ); if ( _maxChannel >= 5 ) _channels.append( 5 ); if ( _maxChannel >= 11 ) _channels.append( 11 ); if ( _maxChannel >= 6 ) _channels.append( 6 ); if ( _maxChannel >= 12 ) _channels.append( 12 ); + //FIXME: Add 802.11a/g channels _channel = _channels.begin(); } OChannelHopper::~OChannelHopper() { |