From d2426de3452342ab4af8e95214b9ff408f30744e Mon Sep 17 00:00:00 2001 From: mickeyl Date: Mon, 16 May 2005 17:48:03 +0000 Subject: - add ONetworkInterfaceDriverInfo block extracting info using ethtool ioctls - adjust example --- (limited to 'libopie2') diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 32f5355..25c9238 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h @@ -100,6 +100,32 @@ class OHostAddress : public QHostAddress /*====================================================================================== + * ONetworkInterfaceDriverInfo + *======================================================================================*/ + +class ONetworkInterfaceDriverInfo +{ + public: + ONetworkInterfaceDriverInfo( const QString& name = "", + const QString& version = "", + const QString& firmware = "", + const QString& bus = "" ) : + _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { }; + ~ONetworkInterfaceDriverInfo() { }; + + QString name() const { return _name; }; + QString version() const { return _version; }; + QString firmware() const { return _firmware; }; + QString bus() const { return _bus; }; + + private: + const QString _name; + const QString _version; + const QString _firmware; + const QString _bus; +}; + +/*====================================================================================== * OPrivateIOCTL *======================================================================================*/ 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 @@ -29,38 +29,40 @@ */ /* OPIE */ - #include #include #include +using namespace Opie::Core; /* QT */ - #include #include #include -/* UNIX */ - +/* STD */ #include #include #include +#include #include #include #include +#include +#include +#include #include #include #include -#include +#include #include -#include -#include -#include +#define u64 __u64 +#define u32 __u32 +#define u16 __u16 +#define u8 __u8 +#include #ifndef NODEBUG #include - -using namespace Opie::Core; using namespace Opie::Net::Internal; DebugMapper* debugmapper = new DebugMapper(); #endif @@ -381,6 +383,14 @@ bool ONetworkInterface::isWireless() const } +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 *======================================================================================*/ @@ -405,6 +415,7 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) 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(); } diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index fa9f39f..f0c4450 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -202,6 +202,7 @@ class ONetworkInterface : public QObject /** * Associate the MAC address @a addr with the interface. * @note It can be necessary to shut down the interface prior to calling this method. + * @note This operation needs root privileges * @warning This is not supported by all drivers. */ void setMacAddress( const OMacAddress& addr ); @@ -222,6 +223,12 @@ class ONetworkInterface : public QObject * @see #include for possible values. */ int dataLinkType() const; + /** + * @returns a ONetworkInterfaceDriverInfo driver information block + * @note This operation needs root privileges + * @warning This is not supported by all drivers + */ + ONetworkInterfaceDriverInfo driverInfo() const; protected: const int _sfd; diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro index 460de0a..854e5ff 100644 --- a/libopie2/opienet/opienet.pro +++ b/libopie2/opienet/opienet.pro @@ -18,7 +18,7 @@ SOURCES = odebugmapper.cpp \ ostation.cpp INTERFACES = TARGET = opienet2 -VERSION = 1.8.6 +VERSION = 1.8.7 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lpcap -- cgit v0.9.0.2