summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/onetutils.h26
-rw-r--r--libopie2/opienet/onetwork.cpp31
-rw-r--r--libopie2/opienet/onetwork.h7
-rw-r--r--libopie2/opienet/opienet.pro2
4 files changed, 55 insertions, 11 deletions
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
@@ -97,12 +97,38 @@ class OHostAddress : public QHostAddress
97 class Private; 97 class Private;
98 Private *d; 98 Private *d;
99}; 99};
100 100
101 101
102/*====================================================================================== 102/*======================================================================================
103 * ONetworkInterfaceDriverInfo
104 *======================================================================================*/
105
106class 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
104 *======================================================================================*/ 130 *======================================================================================*/
105 131
106class OPrivateIOCTL : public QObject 132class OPrivateIOCTL : public QObject
107{ 133{
108 public: 134 public:
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 @@
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32
33#include <opie2/onetwork.h> 32#include <opie2/onetwork.h>
34#include <opie2/ostation.h> 33#include <opie2/ostation.h>
35#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35using namespace Opie::Core;
36 36
37/* QT */ 37/* QT */
38
39#include <qfile.h> 38#include <qfile.h>
40#include <qtextstream.h> 39#include <qtextstream.h>
41#include <qapplication.h> 40#include <qapplication.h>
42 41
43/* UNIX */ 42/* STD */
44
45#include <assert.h> 43#include <assert.h>
46#include <arpa/inet.h> 44#include <arpa/inet.h>
47#include <errno.h> 45#include <errno.h>
46#include <stdarg.h>
48#include <string.h> 47#include <string.h>
49#include <stdlib.h> 48#include <stdlib.h>
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>
52#include <sys/socket.h> 54#include <sys/socket.h>
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
60#ifndef NODEBUG 64#ifndef NODEBUG
61#include <opie2/odebugmapper.h> 65#include <opie2/odebugmapper.h>
62
63using namespace Opie::Core;
64using namespace Opie::Net::Internal; 66using namespace Opie::Net::Internal;
65DebugMapper* debugmapper = new DebugMapper(); 67DebugMapper* debugmapper = new DebugMapper();
66#endif 68#endif
67 69
68/*====================================================================================== 70/*======================================================================================
69 * ONetwork 71 * ONetwork
@@ -378,12 +380,20 @@ bool ONetworkInterface::promiscuousMode() const
378bool ONetworkInterface::isWireless() const 380bool ONetworkInterface::isWireless() const
379{ 381{
380 return ioctl( SIOCGIWNAME ); 382 return ioctl( SIOCGIWNAME );
381} 383}
382 384
383 385
386ONetworkInterfaceDriverInfo 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/*======================================================================================
385 * OChannelHopper 395 * OChannelHopper
386 *======================================================================================*/ 396 *======================================================================================*/
387 397
388OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) 398OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface )
389 :QObject( 0, "Mickey's funky hopper" ), 399 :QObject( 0, "Mickey's funky hopper" ),
@@ -402,12 +412,13 @@ OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface )
402 if ( _maxChannel >= 4 ) _channels.append( 4 ); 412 if ( _maxChannel >= 4 ) _channels.append( 4 );
403 if ( _maxChannel >= 10 ) _channels.append( 10 ); 413 if ( _maxChannel >= 10 ) _channels.append( 10 );
404 if ( _maxChannel >= 5 ) _channels.append( 5 ); 414 if ( _maxChannel >= 5 ) _channels.append( 5 );
405 if ( _maxChannel >= 11 ) _channels.append( 11 ); 415 if ( _maxChannel >= 11 ) _channels.append( 11 );
406 if ( _maxChannel >= 6 ) _channels.append( 6 ); 416 if ( _maxChannel >= 6 ) _channels.append( 6 );
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();
409} 420}
410 421
411 422
412OChannelHopper::~OChannelHopper() 423OChannelHopper::~OChannelHopper()
413{ 424{
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
@@ -199,12 +199,13 @@ class ONetworkInterface : public QObject
199 * @returns the IPv4 address associated with the interface. 199 * @returns the IPv4 address associated with the interface.
200 */ 200 */
201 QString ipV4Address() const; //TODO: make this return an OHostAddress 201 QString ipV4Address() const; //TODO: make this return an OHostAddress
202 /** 202 /**
203 * Associate the MAC address @a addr with the interface. 203 * Associate the MAC address @a addr with the interface.
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.
206 */ 207 */
207 void setMacAddress( const OMacAddress& addr ); 208 void setMacAddress( const OMacAddress& addr );
208 /** 209 /**
209 * @returns the MAC address associated with the interface. 210 * @returns the MAC address associated with the interface.
210 */ 211 */
@@ -219,12 +220,18 @@ class ONetworkInterface : public QObject
219 QString ipV4Netmask() const; //TODO: make this return an OHostAddress 220 QString ipV4Netmask() const; //TODO: make this return an OHostAddress
220 /** 221 /**
221 * @returns the data link type currently associated with the interface. 222 * @returns the data link type currently associated with the interface.
222 * @see #include <net/if_arp.h> for possible values. 223 * @see #include <net/if_arp.h> for possible values.
223 */ 224 */
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
226 protected: 233 protected:
227 const int _sfd; 234 const int _sfd;
228 mutable ifreq _ifr; 235 mutable ifreq _ifr;
229 OMonitoringInterface* _mon; 236 OMonitoringInterface* _mon;
230 237
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
@@ -15,13 +15,13 @@ SOURCES = odebugmapper.cpp \
15 onetutils.cpp \ 15 onetutils.cpp \
16 onetwork.cpp \ 16 onetwork.cpp \
17 opcap.cpp \ 17 opcap.cpp \
18 ostation.cpp 18 ostation.cpp
19INTERFACES = 19INTERFACES =
20TARGET = opienet2 20TARGET = opienet2
21VERSION = 1.8.6 21VERSION = 1.8.7
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23DEPENDPATH += $(OPIEDIR)/include 23DEPENDPATH += $(OPIEDIR)/include
24LIBS += -lpcap 24LIBS += -lpcap
25 25
26 26
27!contains( platform, x11 ) { 27!contains( platform, x11 ) {