-rw-r--r-- | examples/opienet/onetworkdemo/onetworkdemo.cpp | 5 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 26 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 31 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 7 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 2 |
5 files changed, 60 insertions, 11 deletions
diff --git a/examples/opienet/onetworkdemo/onetworkdemo.cpp b/examples/opienet/onetworkdemo/onetworkdemo.cpp index e0c93a2..b3a1115 100644 --- a/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -50,2 +50,7 @@ int main( int argc, char** argv ) | |||
50 | odebug << "DEMO: ONetwork contains Interface '" << it.current()->name() << "'" << oendl; | 50 | odebug << "DEMO: ONetwork contains Interface '" << it.current()->name() << "'" << oendl; |
51 | ONetworkInterfaceDriverInfo info = it.current()->driverInfo(); | ||
52 | odebug << "DEMO: DriverName reported as '" << info.name() << "'" << oendl; | ||
53 | odebug << "DEMO: DriverVersion reported as '" << info.version() << "'" << oendl; | ||
54 | odebug << "DEMO: DriverFirmware reported as '" << info.firmware() << "'" << oendl; | ||
55 | odebug << "DEMO: DriverBus reported as '" << info.bus() << "'" << oendl; | ||
51 | odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl; | 56 | odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl; |
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 | |||
@@ -102,2 +102,28 @@ class OHostAddress : public QHostAddress | |||
102 | /*====================================================================================== | 102 | /*====================================================================================== |
103 | * ONetworkInterfaceDriverInfo | ||
104 | *======================================================================================*/ | ||
105 | |||
106 | class ONetworkInterfaceDriverInfo | ||
107 | { | ||
108 | public: | ||
109 | ONetworkInterfaceDriverInfo( const QString& name = "<unknown>", | ||
110 | const QString& version = "<unknown>", | ||
111 | const QString& firmware = "<unknown>", | ||
112 | const QString& bus = "<unknown>" ) : | ||
113 | _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { }; | ||
114 | ~ONetworkInterfaceDriverInfo() { }; | ||
115 | |||
116 | QString name() const { return _name; }; | ||
117 | QString version() const { return _version; }; | ||
118 | QString firmware() const { return _firmware; }; | ||
119 | QString bus() const { return _bus; }; | ||
120 | |||
121 | private: | ||
122 | const QString _name; | ||
123 | const QString _version; | ||
124 | const QString _firmware; | ||
125 | const QString _bus; | ||
126 | }; | ||
127 | |||
128 | /*====================================================================================== | ||
103 | * OPrivateIOCTL | 129 | * 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 | |||
@@ -31,3 +31,2 @@ | |||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | |||
33 | #include <opie2/onetwork.h> | 32 | #include <opie2/onetwork.h> |
@@ -35,5 +34,5 @@ | |||
35 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | using namespace Opie::Core; | ||
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | |||
39 | #include <qfile.h> | 38 | #include <qfile.h> |
@@ -42,4 +41,3 @@ | |||
42 | 41 | ||
43 | /* UNIX */ | 42 | /* STD */ |
44 | |||
45 | #include <assert.h> | 43 | #include <assert.h> |
@@ -47,2 +45,3 @@ | |||
47 | #include <errno.h> | 45 | #include <errno.h> |
46 | #include <stdarg.h> | ||
48 | #include <string.h> | 47 | #include <string.h> |
@@ -50,2 +49,5 @@ | |||
50 | #include <math.h> | 49 | #include <math.h> |
50 | #include <unistd.h> | ||
51 | #include <net/if_arp.h> | ||
52 | #include <net/ethernet.h> | ||
51 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
@@ -53,7 +55,9 @@ | |||
53 | #include <sys/types.h> | 55 | #include <sys/types.h> |
54 | #include <unistd.h> | 56 | #include <linux/types.h> |
55 | #include <linux/sockios.h> | 57 | #include <linux/sockios.h> |
56 | #include <net/if_arp.h> | 58 | #define u64 __u64 |
57 | #include <net/ethernet.h> | 59 | #define u32 __u32 |
58 | #include <stdarg.h> | 60 | #define u16 __u16 |
61 | #define u8 __u8 | ||
62 | #include <linux/ethtool.h> | ||
59 | 63 | ||
@@ -61,4 +65,2 @@ | |||
61 | #include <opie2/odebugmapper.h> | 65 | #include <opie2/odebugmapper.h> |
62 | |||
63 | using namespace Opie::Core; | ||
64 | using namespace Opie::Net::Internal; | 66 | using namespace Opie::Net::Internal; |
@@ -383,2 +385,10 @@ bool ONetworkInterface::isWireless() const | |||
383 | 385 | ||
386 | ONetworkInterfaceDriverInfo ONetworkInterface::driverInfo() const | ||
387 | { | ||
388 | struct ethtool_drvinfo info; | ||
389 | info.cmd = ETHTOOL_GDRVINFO; | ||
390 | _ifr.ifr_data = (caddr_t) &info; | ||
391 | return ioctl( SIOCETHTOOL ) ? ONetworkInterfaceDriverInfo( info.driver, info.version, info.fw_version, info.bus_info) : ONetworkInterfaceDriverInfo(); | ||
392 | } | ||
393 | |||
384 | /*====================================================================================== | 394 | /*====================================================================================== |
@@ -407,2 +417,3 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | |||
407 | if ( _maxChannel >= 12 ) _channels.append( 12 ); | 417 | if ( _maxChannel >= 12 ) _channels.append( 12 ); |
418 | //FIXME: Add 802.11a/g channels | ||
408 | _channel = _channels.begin(); | 419 | _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 | |||
@@ -204,2 +204,3 @@ class ONetworkInterface : public QObject | |||
204 | * @note It can be necessary to shut down the interface prior to calling this method. | 204 | * @note It can be necessary to shut down the interface prior to calling this method. |
205 | * @note This operation needs root privileges | ||
205 | * @warning This is not supported by all drivers. | 206 | * @warning This is not supported by all drivers. |
@@ -224,2 +225,8 @@ class ONetworkInterface : public QObject | |||
224 | int dataLinkType() const; | 225 | int dataLinkType() const; |
226 | /** | ||
227 | * @returns a ONetworkInterfaceDriverInfo driver information block | ||
228 | * @note This operation needs root privileges | ||
229 | * @warning This is not supported by all drivers | ||
230 | */ | ||
231 | ONetworkInterfaceDriverInfo driverInfo() const; | ||
225 | 232 | ||
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 | |||
@@ -20,3 +20,3 @@ INTERFACES = | |||
20 | TARGET = opienet2 | 20 | TARGET = opienet2 |
21 | VERSION = 1.8.6 | 21 | VERSION = 1.8.7 |
22 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |