-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 | |||
@@ -27,48 +27,53 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* OPIE */ | 29 | /* OPIE */ |
30 | #include <opie2/onetwork.h> | 30 | #include <opie2/onetwork.h> |
31 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
32 | #include <opie2/omanufacturerdb.h> | 32 | #include <opie2/omanufacturerdb.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | /* STD */ | 35 | /* STD */ |
36 | #include <unistd.h> | 36 | #include <unistd.h> |
37 | 37 | ||
38 | using namespace Opie::Net; | 38 | using namespace Opie::Net; |
39 | 39 | ||
40 | int main( int argc, char** argv ) | 40 | int main( int argc, char** argv ) |
41 | { | 41 | { |
42 | odebug << "OPIE Network Demo" << oendl; | 42 | odebug << "OPIE Network Demo" << oendl; |
43 | 43 | ||
44 | ONetwork* net = ONetwork::instance(); | 44 | ONetwork* net = ONetwork::instance(); |
45 | 45 | ||
46 | ONetwork::InterfaceIterator it = net->iterator(); | 46 | ONetwork::InterfaceIterator it = net->iterator(); |
47 | 47 | ||
48 | while ( it.current() ) | 48 | while ( it.current() ) |
49 | { | 49 | { |
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; |
52 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl; | 57 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl; |
53 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl; | 58 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl; |
54 | odebug << "DEMO: MAC Manufacturer seems to be '" << it.current()->macAddress().manufacturer() << "'" << oendl; | 59 | odebug << "DEMO: MAC Manufacturer seems to be '" << it.current()->macAddress().manufacturer() << "'" << oendl; |
55 | odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl; | 60 | odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl; |
56 | odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl; | 61 | odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl; |
57 | odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address() << "'" << oendl; | 62 | odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address() << "'" << oendl; |
58 | if ( it.current()->isWireless() ) | 63 | if ( it.current()->isWireless() ) |
59 | { | 64 | { |
60 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | 65 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); |
61 | odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl; | 66 | odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl; |
62 | odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl; | 67 | odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl; |
63 | odebug << "DEMO: Antenna is tuned to '" << iface->frequency() << "', that is channel " << iface->channel() << "" << oendl; | 68 | odebug << "DEMO: Antenna is tuned to '" << iface->frequency() << "', that is channel " << iface->channel() << "" << oendl; |
64 | 69 | ||
65 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | 70 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) |
66 | //{ | 71 | //{ |
67 | //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl; | 72 | //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl; |
68 | //} | 73 | //} |
69 | 74 | ||
70 | /* | 75 | /* |
71 | 76 | ||
72 | // nickname | 77 | // nickname |
73 | odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl; | 78 | odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl; |
74 | iface->setNickName( "MyNickName" ); | 79 | iface->setNickName( "MyNickName" ); |
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 | |||
@@ -79,48 +79,74 @@ class OMacAddress | |||
79 | Private *d; | 79 | Private *d; |
80 | 80 | ||
81 | }; | 81 | }; |
82 | 82 | ||
83 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 83 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
84 | 84 | ||
85 | 85 | ||
86 | /*====================================================================================== | 86 | /*====================================================================================== |
87 | * OHostAddress | 87 | * OHostAddress |
88 | *======================================================================================*/ | 88 | *======================================================================================*/ |
89 | 89 | ||
90 | class OHostAddress : public QHostAddress | 90 | class OHostAddress : public QHostAddress |
91 | { | 91 | { |
92 | /*public: | 92 | /*public: |
93 | OHostAddress(); | 93 | OHostAddress(); |
94 | ~OHostAddress(); | 94 | ~OHostAddress(); |
95 | */ | 95 | */ |
96 | private: | 96 | private: |
97 | class Private; | 97 | class Private; |
98 | Private *d; | 98 | Private *d; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
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 |
104 | *======================================================================================*/ | 130 | *======================================================================================*/ |
105 | 131 | ||
106 | class OPrivateIOCTL : public QObject | 132 | class OPrivateIOCTL : public QObject |
107 | { | 133 | { |
108 | public: | 134 | public: |
109 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); | 135 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); |
110 | ~OPrivateIOCTL(); | 136 | ~OPrivateIOCTL(); |
111 | 137 | ||
112 | int numberGetArgs() const; | 138 | int numberGetArgs() const; |
113 | int typeGetArgs() const; | 139 | int typeGetArgs() const; |
114 | int numberSetArgs() const; | 140 | int numberSetArgs() const; |
115 | int typeSetArgs() const; | 141 | int typeSetArgs() const; |
116 | 142 | ||
117 | // FIXME return int? as ::ioctl does? -zecke | 143 | // FIXME return int? as ::ioctl does? -zecke |
118 | void invoke() const; | 144 | void invoke() const; |
119 | void setParameter( int, u_int32_t ); | 145 | void setParameter( int, u_int32_t ); |
120 | 146 | ||
121 | private: | 147 | private: |
122 | u_int32_t _ioctl; | 148 | u_int32_t _ioctl; |
123 | u_int16_t _getargs; | 149 | u_int16_t _getargs; |
124 | u_int16_t _setargs; | 150 | u_int16_t _setargs; |
125 | 151 | ||
126 | class Private; | 152 | class Private; |
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 | |||
@@ -8,80 +8,82 @@ | |||
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
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> |
35 | using 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 | |||
63 | using namespace Opie::Core; | ||
64 | using namespace Opie::Net::Internal; | 66 | using namespace Opie::Net::Internal; |
65 | DebugMapper* debugmapper = new DebugMapper(); | 67 | DebugMapper* debugmapper = new DebugMapper(); |
66 | #endif | 68 | #endif |
67 | 69 | ||
68 | /*====================================================================================== | 70 | /*====================================================================================== |
69 | * ONetwork | 71 | * ONetwork |
70 | *======================================================================================*/ | 72 | *======================================================================================*/ |
71 | 73 | ||
72 | namespace Opie { | 74 | namespace Opie { |
73 | namespace Net { | 75 | namespace Net { |
74 | ONetwork* ONetwork::_instance = 0; | 76 | ONetwork* ONetwork::_instance = 0; |
75 | 77 | ||
76 | ONetwork::ONetwork() | 78 | ONetwork::ONetwork() |
77 | { | 79 | { |
78 | odebug << "ONetwork::ONetwork()" << oendl; | 80 | odebug << "ONetwork::ONetwork()" << oendl; |
79 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 81 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
80 | synchronize(); | 82 | synchronize(); |
81 | } | 83 | } |
82 | 84 | ||
83 | void ONetwork::synchronize() | 85 | void ONetwork::synchronize() |
84 | { | 86 | { |
85 | // gather available interfaces by inspecting /proc/net/dev | 87 | // gather available interfaces by inspecting /proc/net/dev |
86 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 88 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
87 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 89 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
@@ -360,72 +362,81 @@ ONetworkInterface::~ONetworkInterface() | |||
360 | 362 | ||
361 | 363 | ||
362 | bool ONetworkInterface::setPromiscuousMode( bool b ) | 364 | bool ONetworkInterface::setPromiscuousMode( bool b ) |
363 | { | 365 | { |
364 | ioctl( SIOCGIFFLAGS ); | 366 | ioctl( SIOCGIFFLAGS ); |
365 | if ( b ) _ifr.ifr_flags |= IFF_PROMISC; | 367 | if ( b ) _ifr.ifr_flags |= IFF_PROMISC; |
366 | else _ifr.ifr_flags &= (~IFF_PROMISC); | 368 | else _ifr.ifr_flags &= (~IFF_PROMISC); |
367 | return ioctl( SIOCSIFFLAGS ); | 369 | return ioctl( SIOCSIFFLAGS ); |
368 | } | 370 | } |
369 | 371 | ||
370 | 372 | ||
371 | bool ONetworkInterface::promiscuousMode() const | 373 | bool ONetworkInterface::promiscuousMode() const |
372 | { | 374 | { |
373 | ioctl( SIOCGIFFLAGS ); | 375 | ioctl( SIOCGIFFLAGS ); |
374 | return _ifr.ifr_flags & IFF_PROMISC; | 376 | return _ifr.ifr_flags & IFF_PROMISC; |
375 | } | 377 | } |
376 | 378 | ||
377 | 379 | ||
378 | bool ONetworkInterface::isWireless() const | 380 | bool ONetworkInterface::isWireless() const |
379 | { | 381 | { |
380 | return ioctl( SIOCGIWNAME ); | 382 | return ioctl( SIOCGIWNAME ); |
381 | } | 383 | } |
382 | 384 | ||
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 | /*====================================================================================== |
385 | * OChannelHopper | 395 | * OChannelHopper |
386 | *======================================================================================*/ | 396 | *======================================================================================*/ |
387 | 397 | ||
388 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | 398 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) |
389 | :QObject( 0, "Mickey's funky hopper" ), | 399 | :QObject( 0, "Mickey's funky hopper" ), |
390 | _iface( iface ), _interval( 0 ), _tid( 0 ) | 400 | _iface( iface ), _interval( 0 ), _tid( 0 ) |
391 | { | 401 | { |
392 | int _maxChannel = iface->channels(); | 402 | int _maxChannel = iface->channels(); |
393 | // generate fancy hopping sequence honoring the device capabilities | 403 | // generate fancy hopping sequence honoring the device capabilities |
394 | if ( _maxChannel >= 1 ) _channels.append( 1 ); | 404 | if ( _maxChannel >= 1 ) _channels.append( 1 ); |
395 | if ( _maxChannel >= 7 ) _channels.append( 7 ); | 405 | if ( _maxChannel >= 7 ) _channels.append( 7 ); |
396 | if ( _maxChannel >= 13 ) _channels.append( 13 ); | 406 | if ( _maxChannel >= 13 ) _channels.append( 13 ); |
397 | if ( _maxChannel >= 2 ) _channels.append( 2 ); | 407 | if ( _maxChannel >= 2 ) _channels.append( 2 ); |
398 | if ( _maxChannel >= 8 ) _channels.append( 8 ); | 408 | if ( _maxChannel >= 8 ) _channels.append( 8 ); |
399 | if ( _maxChannel >= 3 ) _channels.append( 3 ); | 409 | if ( _maxChannel >= 3 ) _channels.append( 3 ); |
400 | if ( _maxChannel >= 14 ) _channels.append( 14 ); | 410 | if ( _maxChannel >= 14 ) _channels.append( 14 ); |
401 | if ( _maxChannel >= 9 ) _channels.append( 9 ); | 411 | if ( _maxChannel >= 9 ) _channels.append( 9 ); |
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 | ||
412 | OChannelHopper::~OChannelHopper() | 423 | OChannelHopper::~OChannelHopper() |
413 | { | 424 | { |
414 | } | 425 | } |
415 | 426 | ||
416 | 427 | ||
417 | bool OChannelHopper::isActive() const | 428 | bool OChannelHopper::isActive() const |
418 | { | 429 | { |
419 | return _tid; | 430 | return _tid; |
420 | } | 431 | } |
421 | 432 | ||
422 | 433 | ||
423 | int OChannelHopper::channel() const | 434 | int OChannelHopper::channel() const |
424 | { | 435 | { |
425 | return *_channel; | 436 | return *_channel; |
426 | } | 437 | } |
427 | 438 | ||
428 | 439 | ||
429 | void OChannelHopper::timerEvent( QTimerEvent* ) | 440 | void OChannelHopper::timerEvent( QTimerEvent* ) |
430 | { | 441 | { |
431 | _iface->setChannel( *_channel ); | 442 | _iface->setChannel( *_channel ); |
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 | |||
@@ -181,68 +181,75 @@ class ONetworkInterface : public QObject | |||
181 | bool setUp( bool ); | 181 | bool setUp( bool ); |
182 | /** | 182 | /** |
183 | * @returns true if the interface is up. | 183 | * @returns true if the interface is up. |
184 | */ | 184 | */ |
185 | bool isUp() const; | 185 | bool isUp() const; |
186 | /** | 186 | /** |
187 | * @returns true if the interface is a loopback interface. | 187 | * @returns true if the interface is a loopback interface. |
188 | */ | 188 | */ |
189 | bool isLoopback() const; | 189 | bool isLoopback() const; |
190 | /** | 190 | /** |
191 | * @returns true if the interface is featuring supports the wireless extension protocol. | 191 | * @returns true if the interface is featuring supports the wireless extension protocol. |
192 | */ | 192 | */ |
193 | bool isWireless() const; | 193 | bool isWireless() const; |
194 | /** | 194 | /** |
195 | * Associate the IP address @ addr with the interface. | 195 | * Associate the IP address @ addr with the interface. |
196 | */ | 196 | */ |
197 | void setIPV4Address( const QHostAddress& addr ); | 197 | void setIPV4Address( const QHostAddress& addr ); |
198 | /** | 198 | /** |
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 | */ |
211 | OMacAddress macAddress() const; | 212 | OMacAddress macAddress() const; |
212 | /** | 213 | /** |
213 | * Associate the IPv4 @a netmask with the interface. | 214 | * Associate the IPv4 @a netmask with the interface. |
214 | */ | 215 | */ |
215 | void setIPV4Netmask( const QHostAddress& netmask ); | 216 | void setIPV4Netmask( const QHostAddress& netmask ); |
216 | /** | 217 | /** |
217 | * @returns the IPv4 netmask associated with the interface. | 218 | * @returns the IPv4 netmask associated with the interface. |
218 | */ | 219 | */ |
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 | ||
231 | protected: | 238 | protected: |
232 | struct ifreq& ifr() const; | 239 | struct ifreq& ifr() const; |
233 | virtual void init(); | 240 | virtual void init(); |
234 | bool ioctl( int call ) const; | 241 | bool ioctl( int call ) const; |
235 | bool ioctl( int call, struct ifreq& ) const; | 242 | bool ioctl( int call, struct ifreq& ) const; |
236 | private: | 243 | private: |
237 | class Private; | 244 | class Private; |
238 | Private *d; | 245 | Private *d; |
239 | }; | 246 | }; |
240 | 247 | ||
241 | /*====================================================================================== | 248 | /*====================================================================================== |
242 | * OChannelHopper | 249 | * OChannelHopper |
243 | *======================================================================================*/ | 250 | *======================================================================================*/ |
244 | 251 | ||
245 | /** | 252 | /** |
246 | * @brief A radio frequency channel hopper. | 253 | * @brief A radio frequency channel hopper. |
247 | * | 254 | * |
248 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 255 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
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 | |||
@@ -1,40 +1,40 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = 802_11_user.h \ | 4 | HEADERS = 802_11_user.h \ |
5 | dhcp.h \ | 5 | dhcp.h \ |
6 | udp_ports.h \ | 6 | udp_ports.h \ |
7 | odebugmapper.h \ | 7 | odebugmapper.h \ |
8 | omanufacturerdb.h \ | 8 | omanufacturerdb.h \ |
9 | onetutils.h \ | 9 | onetutils.h \ |
10 | onetwork.h \ | 10 | onetwork.h \ |
11 | opcap.h \ | 11 | opcap.h \ |
12 | ostation.h | 12 | ostation.h |
13 | SOURCES = odebugmapper.cpp \ | 13 | SOURCES = odebugmapper.cpp \ |
14 | omanufacturerdb.cpp \ | 14 | omanufacturerdb.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 |
19 | INTERFACES = | 19 | 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 |
23 | DEPENDPATH += $(OPIEDIR)/include | 23 | DEPENDPATH += $(OPIEDIR)/include |
24 | LIBS += -lpcap | 24 | LIBS += -lpcap |
25 | 25 | ||
26 | 26 | ||
27 | !contains( platform, x11 ) { | 27 | !contains( platform, x11 ) { |
28 | include( $(OPIEDIR)/include.pro ) | 28 | include( $(OPIEDIR)/include.pro ) |
29 | } | 29 | } |
30 | 30 | ||
31 | contains( platform, x11 ) { | 31 | contains( platform, x11 ) { |
32 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 32 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
33 | } | 33 | } |
34 | 34 | ||
35 | !isEmpty( LIBPCAP_INC_DIR ) { | 35 | !isEmpty( LIBPCAP_INC_DIR ) { |
36 | INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH | 36 | INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH |
37 | } | 37 | } |
38 | !isEmpty( LIBPCAP_LIB_DIR ) { | 38 | !isEmpty( LIBPCAP_LIB_DIR ) { |
39 | LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS | 39 | LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS |
40 | } | 40 | } |