-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 2 | ||||
-rw-r--r-- | examples/opienet/onetworkdemo/onetworkdemo.cpp | 2 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 19 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 43 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 7 | ||||
-rw-r--r-- | noncore/applets/networkapplet/networkapplet.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opiestumbler/opiestumbler.cpp | 2 |
9 files changed, 47 insertions, 44 deletions
@@ -1,61 +1,63 @@ | |||
1 | 2005-??-??Opie 1.2.1 | 1 | 2005-??-??Opie 1.2.1 |
2 | 2 | ||
3 | 3 | ||
4 | New Features | 4 | New Features |
5 | ------------ | 5 | ------------ |
6 | * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) | 6 | * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) |
7 | * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) | 7 | * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) |
8 | * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) | 8 | * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) |
9 | * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) | 9 | * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) |
10 | 10 | ||
11 | Fixed Bugs | 11 | Fixed Bugs |
12 | ---------- | 12 | ---------- |
13 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) | 13 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) |
14 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) | 14 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) |
15 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) | 15 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) |
16 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) | 16 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) |
17 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) | 17 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) |
18 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) | 18 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) |
19 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) | 19 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) |
20 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) | 20 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) |
21 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) | 21 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) |
22 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) | 22 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) |
23 | * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) | 23 | * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) |
24 | 24 | ||
25 | Internal | 25 | Internal |
26 | -------- | 26 | -------- |
27 | * Make BluezApplet use OTaskbarApplet (mickeyl) | 27 | * Make BluezApplet use OTaskbarApplet (mickeyl) |
28 | * Rewrite OFileNotification to use the upcoming inotify interface instead of the deprecated dnotify (mickeyl) | 28 | * Rewrite OFileNotification to use the upcoming inotify interface instead of the deprecated dnotify (mickeyl) |
29 | * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) | 29 | * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) |
30 | * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) | ||
31 | * libopienet: Miscellaneous API cleanups (mickeyl) | ||
30 | 32 | ||
31 | 2005-03-25Opie 1.2.0 | 33 | 2005-03-25Opie 1.2.0 |
32 | 34 | ||
33 | Fixed Bugs | 35 | Fixed Bugs |
34 | ---------- | 36 | ---------- |
35 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) | 37 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) |
36 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) | 38 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) |
37 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) | 39 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) |
38 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) | 40 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) |
39 | * n.a.- make qpeglobal.h include qglobal.h (zecke) | 41 | * n.a.- make qpeglobal.h include qglobal.h (zecke) |
40 | 42 | ||
41 | 2005-03-20Opie 1.2.0-rc1 | 43 | 2005-03-20Opie 1.2.0-rc1 |
42 | 44 | ||
43 | 45 | ||
44 | New Features | 46 | New Features |
45 | ------------ | 47 | ------------ |
46 | * Launcher: Support a static background pixmap (mickeyl) | 48 | * Launcher: Support a static background pixmap (mickeyl) |
47 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) | 49 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) |
48 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) | 50 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) |
49 | * Added hi-res inline images for large resolution devices (drw) | 51 | * Added hi-res inline images for large resolution devices (drw) |
50 | * Improved launcher icons for consistency (ar) | 52 | * Improved launcher icons for consistency (ar) |
51 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) | 53 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) |
52 | 54 | ||
53 | Fixed Bugs | 55 | Fixed Bugs |
54 | ---------- | 56 | ---------- |
55 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) | 57 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) |
56 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) | 58 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) |
57 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) | 59 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) |
58 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) | 60 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) |
59 | * #1482 - Fix double '/' in paths (zecke) | 61 | * #1482 - Fix double '/' in paths (zecke) |
60 | * #1536 - Autosave of custom locations in opie backup (ar) | 62 | * #1536 - Autosave of custom locations in opie backup (ar) |
61 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) | 63 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) |
diff --git a/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index ebd3b5f..ba9d2ca 100644 --- a/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -22,65 +22,65 @@ class Station | |||
22 | QString type; | 22 | QString type; |
23 | int channel; | 23 | int channel; |
24 | bool wep; | 24 | bool wep; |
25 | int beacons; | 25 | int beacons; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | QDict<Station> stations; | 28 | QDict<Station> stations; |
29 | 29 | ||
30 | //======================== Application class =============================== | 30 | //======================== Application class =============================== |
31 | 31 | ||
32 | class Wellenreiter : public QApplication | 32 | class Wellenreiter : public QApplication |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 ) | 36 | Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 ) |
37 | { | 37 | { |
38 | 38 | ||
39 | ONetwork* net = ONetwork::instance(); | 39 | ONetwork* net = ONetwork::instance(); |
40 | 40 | ||
41 | if ( argc < 3 ) | 41 | if ( argc < 3 ) |
42 | { | 42 | { |
43 | printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); | 43 | printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); |
44 | printf( "\n" ); | 44 | printf( "\n" ); |
45 | printf( "Valid wireless interfaces (detected) are:\n" ); | 45 | printf( "Valid wireless interfaces (detected) are:\n" ); |
46 | 46 | ||
47 | ONetwork::InterfaceIterator it = net->iterator(); | 47 | ONetwork::InterfaceIterator it = net->iterator(); |
48 | while ( it.current() ) | 48 | while ( it.current() ) |
49 | { | 49 | { |
50 | if ( it.current()->isWireless() ) | 50 | if ( it.current()->isWireless() ) |
51 | { | 51 | { |
52 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), | 52 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), |
53 | (const char*) it.current()->macAddress().toString(), | 53 | (const char*) it.current()->macAddress().toString(), |
54 | (const char*) it.current()->ipV4Address() ); | 54 | (const char*) it.current()->ipV4Address().toString() ); |
55 | } | 55 | } |
56 | ++it; | 56 | ++it; |
57 | } | 57 | } |
58 | exit( -1 ); | 58 | exit( -1 ); |
59 | } | 59 | } |
60 | 60 | ||
61 | printf( "*******************************************************************\n" ); | 61 | printf( "*******************************************************************\n" ); |
62 | printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" ); | 62 | printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" ); |
63 | printf( "*******************************************************************\n" ); | 63 | printf( "*******************************************************************\n" ); |
64 | printf( "\n\n" ); | 64 | printf( "\n\n" ); |
65 | 65 | ||
66 | QString interface( argv[1] ); | 66 | QString interface( argv[1] ); |
67 | QString driver( argv[2] ); | 67 | QString driver( argv[2] ); |
68 | 68 | ||
69 | printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); | 69 | printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); |
70 | 70 | ||
71 | // sanity checks before downcasting | 71 | // sanity checks before downcasting |
72 | ONetworkInterface* iface = net->interface( interface ); | 72 | ONetworkInterface* iface = net->interface( interface ); |
73 | if ( !iface ) | 73 | if ( !iface ) |
74 | { | 74 | { |
75 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); | 75 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); |
76 | exit( -1 ); | 76 | exit( -1 ); |
77 | } | 77 | } |
78 | if ( !iface->isWireless() ) | 78 | if ( !iface->isWireless() ) |
79 | { | 79 | { |
80 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); | 80 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); |
81 | exit( -1 ); | 81 | exit( -1 ); |
82 | } | 82 | } |
83 | 83 | ||
84 | // downcast should be safe now | 84 | // downcast should be safe now |
85 | wiface = (OWirelessNetworkInterface*) iface; | 85 | wiface = (OWirelessNetworkInterface*) iface; |
86 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); | 86 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); |
diff --git a/examples/opienet/onetworkdemo/onetworkdemo.cpp b/examples/opienet/onetworkdemo/onetworkdemo.cpp index b3a1115..e8958dc 100644 --- a/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -30,65 +30,65 @@ | |||
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(); | 51 | ONetworkInterfaceDriverInfo info = it.current()->driverInfo(); |
52 | odebug << "DEMO: DriverName reported as '" << info.name() << "'" << oendl; | 52 | odebug << "DEMO: DriverName reported as '" << info.name() << "'" << oendl; |
53 | odebug << "DEMO: DriverVersion reported as '" << info.version() << "'" << oendl; | 53 | odebug << "DEMO: DriverVersion reported as '" << info.version() << "'" << oendl; |
54 | odebug << "DEMO: DriverFirmware reported as '" << info.firmware() << "'" << oendl; | 54 | odebug << "DEMO: DriverFirmware reported as '" << info.firmware() << "'" << oendl; |
55 | odebug << "DEMO: DriverBus reported as '" << info.bus() << "'" << oendl; | 55 | odebug << "DEMO: DriverBus reported as '" << info.bus() << "'" << oendl; |
56 | odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl; | 56 | odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl; |
57 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl; | 57 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl; |
58 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl; | 58 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl; |
59 | 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; |
60 | odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl; | 60 | odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl; |
61 | odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl; | 61 | odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl; |
62 | odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address() << "'" << oendl; | 62 | odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address().toString() << "'" << oendl; |
63 | if ( it.current()->isWireless() ) | 63 | if ( it.current()->isWireless() ) |
64 | { | 64 | { |
65 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | 65 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); |
66 | odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl; | 66 | odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl; |
67 | odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl; | 67 | odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl; |
68 | 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; |
69 | 69 | ||
70 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | 70 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) |
71 | //{ | 71 | //{ |
72 | //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl; | 72 | //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl; |
73 | //} | 73 | //} |
74 | 74 | ||
75 | /* | 75 | /* |
76 | 76 | ||
77 | // nickname | 77 | // nickname |
78 | odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl; | 78 | odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl; |
79 | iface->setNickName( "MyNickName" ); | 79 | iface->setNickName( "MyNickName" ); |
80 | if ( iface->nickName() != "MyNickName" ) | 80 | if ( iface->nickName() != "MyNickName" ) |
81 | odebug << "DEMO: Warning! Can't change nickname" << oendl; | 81 | odebug << "DEMO: Warning! Can't change nickname" << oendl; |
82 | else | 82 | else |
83 | odebug << "DEMO: Nickname change successful." << oendl; | 83 | odebug << "DEMO: Nickname change successful." << oendl; |
84 | 84 | ||
85 | /* | 85 | /* |
86 | 86 | ||
87 | // operation mode | 87 | // operation mode |
88 | odebug << "DEMO: Current OperationMode is '" << iface->mode() << "'" << oendl; | 88 | odebug << "DEMO: Current OperationMode is '" << iface->mode() << "'" << oendl; |
89 | iface->setMode( "adhoc" ); | 89 | iface->setMode( "adhoc" ); |
90 | if ( iface->mode() != "adhoc" ) | 90 | if ( iface->mode() != "adhoc" ) |
91 | odebug << "DEMO: Warning! Can't change operation mode" << oendl; | 91 | odebug << "DEMO: Warning! Can't change operation mode" << oendl; |
92 | else | 92 | else |
93 | odebug << "DEMO: Operation Mode change successful." << oendl; | 93 | odebug << "DEMO: Operation Mode change successful." << oendl; |
94 | 94 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index c8c494a..9c3e650 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -1,37 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | =. (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
5 | =. | ||
6 | .=l. | 4 | .=l. |
7 | .>+-= | 5 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | ._= =} : | 11 | ._= =} : |
14 | .%`+i> _;_. | 12 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 20 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
29 | 27 | ||
30 | */ | 28 | */ |
31 | 29 | ||
32 | #include <opie2/onetutils.h> | 30 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | 31 | #include <opie2/onetwork.h> |
34 | #include <opie2/omanufacturerdb.h> | 32 | #include <opie2/omanufacturerdb.h> |
35 | 33 | ||
36 | #include <net/if.h> | 34 | #include <net/if.h> |
37 | #include <assert.h> | 35 | #include <assert.h> |
@@ -107,64 +105,79 @@ OMacAddress OMacAddress::fromString( const QString& str ) | |||
107 | } | 105 | } |
108 | 106 | ||
109 | 107 | ||
110 | QString OMacAddress::toString( bool substitute ) const | 108 | QString OMacAddress::toString( bool substitute ) const |
111 | { | 109 | { |
112 | QString manu; | 110 | QString manu; |
113 | manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff ); | 111 | manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff ); |
114 | QString serial; | 112 | QString serial; |
115 | serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); | 113 | serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); |
116 | if ( !substitute ) return manu+serial; | 114 | if ( !substitute ) return manu+serial; |
117 | // fallback - if no vendor is found, just use the number | 115 | // fallback - if no vendor is found, just use the number |
118 | QString textmanu = OManufacturerDB::instance()->lookup( manu ); | 116 | QString textmanu = OManufacturerDB::instance()->lookup( manu ); |
119 | return textmanu.isNull() ? manu+serial : textmanu+serial; | 117 | return textmanu.isNull() ? manu+serial : textmanu+serial; |
120 | } | 118 | } |
121 | 119 | ||
122 | 120 | ||
123 | QString OMacAddress::manufacturer() const | 121 | QString OMacAddress::manufacturer() const |
124 | { | 122 | { |
125 | return OManufacturerDB::instance()->lookupExt( toString() ); | 123 | return OManufacturerDB::instance()->lookupExt( toString() ); |
126 | } | 124 | } |
127 | 125 | ||
128 | 126 | ||
129 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | 127 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) |
130 | { | 128 | { |
131 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; | 129 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; |
132 | } | 130 | } |
133 | 131 | ||
134 | 132 | ||
135 | /*====================================================================================== | 133 | /*====================================================================================== |
136 | * OHostAddress | 134 | * OHostAddress |
137 | *======================================================================================*/ | 135 | *======================================================================================*/ |
138 | 136 | ||
137 | OHostAddress::OHostAddress() | ||
138 | :QHostAddress() | ||
139 | { | ||
140 | } | ||
141 | |||
142 | |||
143 | OHostAddress::OHostAddress( Q_UINT32 ip4Addr ) | ||
144 | :QHostAddress( ip4Addr ) | ||
145 | { | ||
146 | } | ||
147 | |||
148 | |||
149 | OHostAddress::~OHostAddress() | ||
150 | { | ||
151 | } | ||
139 | 152 | ||
140 | /*====================================================================================== | 153 | /*====================================================================================== |
141 | * OPrivateIOCTL | 154 | * OPrivateIOCTL |
142 | *======================================================================================*/ | 155 | *======================================================================================*/ |
143 | 156 | ||
144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 157 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 158 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
146 | { | 159 | { |
147 | } | 160 | } |
148 | 161 | ||
149 | 162 | ||
150 | OPrivateIOCTL::~OPrivateIOCTL() | 163 | OPrivateIOCTL::~OPrivateIOCTL() |
151 | { | 164 | { |
152 | } | 165 | } |
153 | 166 | ||
154 | 167 | ||
155 | int OPrivateIOCTL::numberGetArgs() const | 168 | int OPrivateIOCTL::numberGetArgs() const |
156 | { | 169 | { |
157 | return _getargs & IW_PRIV_SIZE_MASK; | 170 | return _getargs & IW_PRIV_SIZE_MASK; |
158 | } | 171 | } |
159 | 172 | ||
160 | 173 | ||
161 | int OPrivateIOCTL::typeGetArgs() const | 174 | int OPrivateIOCTL::typeGetArgs() const |
162 | { | 175 | { |
163 | return _getargs & IW_PRIV_TYPE_MASK >> 12; | 176 | return _getargs & IW_PRIV_TYPE_MASK >> 12; |
164 | } | 177 | } |
165 | 178 | ||
166 | 179 | ||
167 | int OPrivateIOCTL::numberSetArgs() const | 180 | int OPrivateIOCTL::numberSetArgs() const |
168 | { | 181 | { |
169 | return _setargs & IW_PRIV_SIZE_MASK; | 182 | return _setargs & IW_PRIV_SIZE_MASK; |
170 | } | 183 | } |
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 25c9238..f08738c 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -1,36 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 20 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | 27 | ||
29 | */ | 28 | */ |
30 | 29 | ||
31 | #ifndef ONETUTILS_H | 30 | #ifndef ONETUTILS_H |
32 | #define ONETUTILS_H | 31 | #define ONETUTILS_H |
33 | 32 | ||
34 | #include <qdict.h> | 33 | #include <qdict.h> |
35 | #include <qmap.h> | 34 | #include <qmap.h> |
36 | #include <qstring.h> | 35 | #include <qstring.h> |
@@ -60,68 +59,69 @@ class OMacAddress | |||
60 | OMacAddress( struct ifreq& ); | 59 | OMacAddress( struct ifreq& ); |
61 | ~OMacAddress(); | 60 | ~OMacAddress(); |
62 | 61 | ||
63 | QString manufacturer() const; | 62 | QString manufacturer() const; |
64 | QString toString( bool substitute = false ) const; | 63 | QString toString( bool substitute = false ) const; |
65 | const unsigned char* native() const; | 64 | const unsigned char* native() const; |
66 | 65 | ||
67 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? | 66 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? |
68 | static OMacAddress fromString( const QString& ); | 67 | static OMacAddress fromString( const QString& ); |
69 | 68 | ||
70 | public: | 69 | public: |
71 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 70 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
72 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 71 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
73 | 72 | ||
74 | private: | 73 | private: |
75 | unsigned char _bytes[6]; | 74 | unsigned char _bytes[6]; |
76 | 75 | ||
77 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 76 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
78 | class Private; | 77 | class Private; |
79 | Private *d; | 78 | Private *d; |
80 | 79 | ||
81 | }; | 80 | }; |
82 | 81 | ||
83 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 82 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
84 | 83 | ||
85 | 84 | ||
86 | /*====================================================================================== | 85 | /*====================================================================================== |
87 | * OHostAddress | 86 | * OHostAddress |
88 | *======================================================================================*/ | 87 | *======================================================================================*/ |
89 | 88 | ||
90 | class OHostAddress : public QHostAddress | 89 | class OHostAddress : public QHostAddress |
91 | { | 90 | { |
92 | /*public: | 91 | public: |
93 | OHostAddress(); | 92 | OHostAddress(); |
93 | OHostAddress( Q_UINT32 ip4Addr ); | ||
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 | 103 | * ONetworkInterfaceDriverInfo |
104 | *======================================================================================*/ | 104 | *======================================================================================*/ |
105 | 105 | ||
106 | class ONetworkInterfaceDriverInfo | 106 | class ONetworkInterfaceDriverInfo |
107 | { | 107 | { |
108 | public: | 108 | public: |
109 | ONetworkInterfaceDriverInfo( const QString& name = "<unknown>", | 109 | ONetworkInterfaceDriverInfo( const QString& name = "<unknown>", |
110 | const QString& version = "<unknown>", | 110 | const QString& version = "<unknown>", |
111 | const QString& firmware = "<unknown>", | 111 | const QString& firmware = "<unknown>", |
112 | const QString& bus = "<unknown>" ) : | 112 | const QString& bus = "<unknown>" ) : |
113 | _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { }; | 113 | _name( name ), _version( version ), _firmware( firmware ), _bus( bus ) { }; |
114 | ~ONetworkInterfaceDriverInfo() { }; | 114 | ~ONetworkInterfaceDriverInfo() { }; |
115 | 115 | ||
116 | QString name() const { return _name; }; | 116 | QString name() const { return _name; }; |
117 | QString version() const { return _version; }; | 117 | QString version() const { return _version; }; |
118 | QString firmware() const { return _firmware; }; | 118 | QString firmware() const { return _firmware; }; |
119 | QString bus() const { return _bus; }; | 119 | QString bus() const { return _bus; }; |
120 | 120 | ||
121 | private: | 121 | private: |
122 | const QString _name; | 122 | const QString _name; |
123 | const QString _version; | 123 | const QString _version; |
124 | const QString _firmware; | 124 | const QString _firmware; |
125 | const QString _bus; | 125 | const QString _bus; |
126 | }; | 126 | }; |
127 | 127 | ||
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 1deb051..0649ca2 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,36 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 20 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | 27 | ||
29 | */ | 28 | */ |
30 | 29 | ||
31 | /* OPIE */ | 30 | /* OPIE */ |
32 | #include <opie2/onetwork.h> | 31 | #include <opie2/onetwork.h> |
33 | #include <opie2/ostation.h> | 32 | #include <opie2/ostation.h> |
34 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
35 | using namespace Opie::Core; | 34 | using namespace Opie::Core; |
36 | 35 | ||
@@ -56,68 +55,64 @@ using namespace Opie::Core; | |||
56 | #include <linux/types.h> | 55 | #include <linux/types.h> |
57 | #include <linux/sockios.h> | 56 | #include <linux/sockios.h> |
58 | #define u64 __u64 | 57 | #define u64 __u64 |
59 | #define u32 __u32 | 58 | #define u32 __u32 |
60 | #define u16 __u16 | 59 | #define u16 __u16 |
61 | #define u8 __u8 | 60 | #define u8 __u8 |
62 | #include <linux/ethtool.h> | 61 | #include <linux/ethtool.h> |
63 | 62 | ||
64 | #ifndef NODEBUG | 63 | #ifndef NODEBUG |
65 | #include <opie2/odebugmapper.h> | 64 | #include <opie2/odebugmapper.h> |
66 | using namespace Opie::Net::Internal; | 65 | using namespace Opie::Net::Internal; |
67 | DebugMapper* debugmapper = new DebugMapper(); | 66 | DebugMapper* debugmapper = new DebugMapper(); |
68 | #endif | 67 | #endif |
69 | 68 | ||
70 | /*====================================================================================== | 69 | /*====================================================================================== |
71 | * ONetwork | 70 | * ONetwork |
72 | *======================================================================================*/ | 71 | *======================================================================================*/ |
73 | 72 | ||
74 | namespace Opie { | 73 | namespace Opie { |
75 | namespace Net { | 74 | namespace Net { |
76 | ONetwork* ONetwork::_instance = 0; | 75 | ONetwork* ONetwork::_instance = 0; |
77 | 76 | ||
78 | ONetwork::ONetwork() | 77 | ONetwork::ONetwork() |
79 | { | 78 | { |
80 | odebug << "ONetwork::ONetwork()" << oendl; | 79 | odebug << "ONetwork::ONetwork()" << oendl; |
81 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 80 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
82 | synchronize(); | 81 | synchronize(); |
83 | } | 82 | } |
84 | 83 | ||
85 | void ONetwork::synchronize() | 84 | void ONetwork::synchronize() |
86 | { | 85 | { |
87 | // gather available interfaces by inspecting /proc/net/dev | 86 | // gather available interfaces by inspecting /proc/net/dev |
88 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | ||
89 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | ||
90 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | ||
91 | |||
92 | _interfaces.clear(); | 87 | _interfaces.clear(); |
93 | QString str; | 88 | QString str; |
94 | QFile f( "/proc/net/dev" ); | 89 | QFile f( "/proc/net/dev" ); |
95 | bool hasFile = f.open( IO_ReadOnly ); | 90 | bool hasFile = f.open( IO_ReadOnly ); |
96 | if ( !hasFile ) | 91 | if ( !hasFile ) |
97 | { | 92 | { |
98 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; | 93 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; |
99 | return; | 94 | return; |
100 | } | 95 | } |
101 | QTextStream s( &f ); | 96 | QTextStream s( &f ); |
102 | s.readLine(); | 97 | s.readLine(); |
103 | s.readLine(); | 98 | s.readLine(); |
104 | while ( !s.atEnd() ) | 99 | while ( !s.atEnd() ) |
105 | { | 100 | { |
106 | s >> str; | 101 | s >> str; |
107 | str.truncate( str.find( ':' ) ); | 102 | str.truncate( str.find( ':' ) ); |
108 | odebug << "ONetwork: found interface '" << str << "'" << oendl; | 103 | odebug << "ONetwork: found interface '" << str << "'" << oendl; |
109 | if ( str.startsWith( "wifi" ) ) | 104 | if ( str.startsWith( "wifi" ) ) |
110 | { | 105 | { |
111 | odebug << "ONetwork: ignoring hostap control interface" << oendl; | 106 | odebug << "ONetwork: ignoring hostap control interface" << oendl; |
112 | s.readLine(); | 107 | s.readLine(); |
113 | continue; | 108 | continue; |
114 | } | 109 | } |
115 | ONetworkInterface* iface = 0; | 110 | ONetworkInterface* iface = 0; |
116 | if ( isWirelessInterface( str ) ) | 111 | if ( isWirelessInterface( str ) ) |
117 | { | 112 | { |
118 | iface = new OWirelessNetworkInterface( this, (const char*) str ); | 113 | iface = new OWirelessNetworkInterface( this, (const char*) str ); |
119 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; | 114 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; |
120 | } | 115 | } |
121 | else | 116 | else |
122 | { | 117 | { |
123 | iface = new ONetworkInterface( this, (const char*) str ); | 118 | iface = new ONetworkInterface( this, (const char*) str ); |
@@ -173,65 +168,64 @@ bool ONetwork::isPresent( const char* name ) const | |||
173 | bool ONetwork::isWirelessInterface( const char* name ) const | 168 | bool ONetwork::isWirelessInterface( const char* name ) const |
174 | { | 169 | { |
175 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 170 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
176 | struct iwreq iwr; | 171 | struct iwreq iwr; |
177 | memset( &iwr, 0, sizeof( struct iwreq ) ); | 172 | memset( &iwr, 0, sizeof( struct iwreq ) ); |
178 | strcpy( (char*) &iwr.ifr_name, name ); | 173 | strcpy( (char*) &iwr.ifr_name, name ); |
179 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); | 174 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); |
180 | return result != -1; | 175 | return result != -1; |
181 | } | 176 | } |
182 | 177 | ||
183 | /*====================================================================================== | 178 | /*====================================================================================== |
184 | * ONetworkInterface | 179 | * ONetworkInterface |
185 | *======================================================================================*/ | 180 | *======================================================================================*/ |
186 | 181 | ||
187 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) | 182 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) |
188 | :QObject( parent, name ), | 183 | :QObject( parent, name ), |
189 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) | 184 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) |
190 | { | 185 | { |
191 | odebug << "ONetworkInterface::ONetworkInterface()" << oendl; | 186 | odebug << "ONetworkInterface::ONetworkInterface()" << oendl; |
192 | init(); | 187 | init(); |
193 | } | 188 | } |
194 | 189 | ||
195 | 190 | ||
196 | struct ifreq& ONetworkInterface::ifr() const | 191 | struct ifreq& ONetworkInterface::ifr() const |
197 | { | 192 | { |
198 | return _ifr; | 193 | return _ifr; |
199 | } | 194 | } |
200 | 195 | ||
201 | 196 | ||
202 | void ONetworkInterface::init() | 197 | void ONetworkInterface::init() |
203 | { | 198 | { |
204 | odebug << "ONetworkInterface::init()" << oendl; | 199 | odebug << "ONetworkInterface::init()" << oendl; |
205 | |||
206 | memset( &_ifr, 0, sizeof( struct ifreq ) ); | 200 | memset( &_ifr, 0, sizeof( struct ifreq ) ); |
207 | 201 | ||
208 | if ( _sfd == -1 ) | 202 | if ( _sfd == -1 ) |
209 | { | 203 | { |
210 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; | 204 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; |
211 | return; | 205 | return; |
212 | } | 206 | } |
213 | } | 207 | } |
214 | 208 | ||
215 | 209 | ||
216 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const | 210 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const |
217 | { | 211 | { |
218 | #ifndef NODEBUG | 212 | #ifndef NODEBUG |
219 | int result = ::ioctl( _sfd, call, &ifreq ); | 213 | int result = ::ioctl( _sfd, call, &ifreq ); |
220 | if ( result == -1 ) | 214 | if ( result == -1 ) |
221 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) | 215 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) |
222 | << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; | 216 | << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; |
223 | else | 217 | else |
224 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) | 218 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) |
225 | << "' - Status: Ok." << oendl; | 219 | << "' - Status: Ok." << oendl; |
226 | return ( result != -1 ); | 220 | return ( result != -1 ); |
227 | #else | 221 | #else |
228 | return ::ioctl( _sfd, call, &ifreq ) != -1; | 222 | return ::ioctl( _sfd, call, &ifreq ) != -1; |
229 | #endif | 223 | #endif |
230 | } | 224 | } |
231 | 225 | ||
232 | 226 | ||
233 | bool ONetworkInterface::ioctl( int call ) const | 227 | bool ONetworkInterface::ioctl( int call ) const |
234 | { | 228 | { |
235 | strcpy( _ifr.ifr_name, name() ); | 229 | strcpy( _ifr.ifr_name, name() ); |
236 | return ioctl( call, _ifr ); | 230 | return ioctl( call, _ifr ); |
237 | } | 231 | } |
@@ -241,119 +235,106 @@ bool ONetworkInterface::isLoopback() const | |||
241 | { | 235 | { |
242 | ioctl( SIOCGIFFLAGS ); | 236 | ioctl( SIOCGIFFLAGS ); |
243 | return _ifr.ifr_flags & IFF_LOOPBACK; | 237 | return _ifr.ifr_flags & IFF_LOOPBACK; |
244 | } | 238 | } |
245 | 239 | ||
246 | 240 | ||
247 | bool ONetworkInterface::setUp( bool b ) | 241 | bool ONetworkInterface::setUp( bool b ) |
248 | { | 242 | { |
249 | ioctl( SIOCGIFFLAGS ); | 243 | ioctl( SIOCGIFFLAGS ); |
250 | if ( b ) _ifr.ifr_flags |= IFF_UP; | 244 | if ( b ) _ifr.ifr_flags |= IFF_UP; |
251 | else _ifr.ifr_flags &= (~IFF_UP); | 245 | else _ifr.ifr_flags &= (~IFF_UP); |
252 | return ioctl( SIOCSIFFLAGS ); | 246 | return ioctl( SIOCSIFFLAGS ); |
253 | } | 247 | } |
254 | 248 | ||
255 | 249 | ||
256 | bool ONetworkInterface::isUp() const | 250 | bool ONetworkInterface::isUp() const |
257 | { | 251 | { |
258 | ioctl( SIOCGIFFLAGS ); | 252 | ioctl( SIOCGIFFLAGS ); |
259 | return _ifr.ifr_flags & IFF_UP; | 253 | return _ifr.ifr_flags & IFF_UP; |
260 | } | 254 | } |
261 | 255 | ||
262 | 256 | ||
263 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) | 257 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) |
264 | { | 258 | { |
265 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 259 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
266 | sa->sin_family = AF_INET; | 260 | sa->sin_family = AF_INET; |
267 | sa->sin_port = 0; | 261 | sa->sin_port = 0; |
268 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 262 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
269 | ioctl( SIOCSIFADDR ); | 263 | ioctl( SIOCSIFADDR ); |
270 | } | 264 | } |
271 | 265 | ||
272 | 266 | ||
273 | QString ONetworkInterface::ipV4Address() const | 267 | OHostAddress ONetworkInterface::ipV4Address() const |
274 | { | 268 | { |
275 | if ( ioctl( SIOCGIFADDR ) ) | 269 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
276 | { | 270 | return ioctl( SIOCGIFADDR ) ? OHostAddress( ntohl( sa->sin_addr.s_addr ) ) : OHostAddress(); |
277 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | ||
278 | //FIXME: Use QHostAddress here | ||
279 | return QString( inet_ntoa( sa->sin_addr ) ); | ||
280 | } | ||
281 | else | ||
282 | return "<unknown>"; | ||
283 | |||
284 | } | 271 | } |
285 | 272 | ||
286 | 273 | ||
287 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) | 274 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) |
288 | { | 275 | { |
289 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; | 276 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; |
290 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); | 277 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); |
291 | ioctl( SIOCSIFHWADDR ); | 278 | ioctl( SIOCSIFHWADDR ); |
292 | } | 279 | } |
293 | 280 | ||
294 | 281 | ||
295 | OMacAddress ONetworkInterface::macAddress() const | 282 | OMacAddress ONetworkInterface::macAddress() const |
296 | { | 283 | { |
297 | if ( ioctl( SIOCGIFHWADDR ) ) | 284 | if ( ioctl( SIOCGIFHWADDR ) ) |
298 | { | 285 | { |
299 | return OMacAddress( _ifr ); | 286 | return OMacAddress( _ifr ); |
300 | } | 287 | } |
301 | else | 288 | else |
302 | { | 289 | { |
303 | return OMacAddress::unknown; | 290 | return OMacAddress::unknown; |
304 | } | 291 | } |
305 | } | 292 | } |
306 | 293 | ||
307 | 294 | ||
308 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) | 295 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) |
309 | { | 296 | { |
310 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 297 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
311 | sa->sin_family = AF_INET; | 298 | sa->sin_family = AF_INET; |
312 | sa->sin_port = 0; | 299 | sa->sin_port = 0; |
313 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 300 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
314 | ioctl( SIOCSIFNETMASK ); | 301 | ioctl( SIOCSIFNETMASK ); |
315 | } | 302 | } |
316 | 303 | ||
317 | 304 | ||
318 | QString ONetworkInterface::ipV4Netmask() const | 305 | OHostAddress ONetworkInterface::ipV4Netmask() const |
319 | { | 306 | { |
320 | if ( ioctl( SIOCGIFNETMASK ) ) | 307 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
321 | { | 308 | return ioctl( SIOCGIFNETMASK ) ? OHostAddress( ntohl( sa->sin_addr.s_addr ) ) : OHostAddress(); |
322 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | ||
323 | //FIXME: Use QHostAddress here | ||
324 | return QString( inet_ntoa( sa->sin_addr ) ); | ||
325 | } | ||
326 | else | ||
327 | return "<unknown>"; | ||
328 | } | 309 | } |
329 | 310 | ||
330 | 311 | ||
331 | int ONetworkInterface::dataLinkType() const | 312 | int ONetworkInterface::dataLinkType() const |
332 | { | 313 | { |
333 | if ( ioctl( SIOCGIFHWADDR ) ) | 314 | if ( ioctl( SIOCGIFHWADDR ) ) |
334 | { | 315 | { |
335 | return _ifr.ifr_hwaddr.sa_family; | 316 | return _ifr.ifr_hwaddr.sa_family; |
336 | } | 317 | } |
337 | else | 318 | else |
338 | { | 319 | { |
339 | return -1; | 320 | return -1; |
340 | } | 321 | } |
341 | } | 322 | } |
342 | 323 | ||
343 | 324 | ||
344 | void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) | 325 | void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) |
345 | { | 326 | { |
346 | _mon = m; | 327 | _mon = m; |
347 | odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; | 328 | odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; |
348 | } | 329 | } |
349 | 330 | ||
350 | 331 | ||
351 | OMonitoringInterface* ONetworkInterface::monitoring() const | 332 | OMonitoringInterface* ONetworkInterface::monitoring() const |
352 | { | 333 | { |
353 | return _mon; | 334 | return _mon; |
354 | } | 335 | } |
355 | 336 | ||
356 | 337 | ||
357 | ONetworkInterface::~ONetworkInterface() | 338 | ONetworkInterface::~ONetworkInterface() |
358 | { | 339 | { |
359 | odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; | 340 | odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; |
@@ -518,65 +499,73 @@ void OWirelessNetworkInterface::setAssociatedAP( const OMacAddress& mac ) const | |||
518 | } | 499 | } |
519 | 500 | ||
520 | 501 | ||
521 | OMacAddress OWirelessNetworkInterface::associatedAP() const | 502 | OMacAddress OWirelessNetworkInterface::associatedAP() const |
522 | { | 503 | { |
523 | if ( ioctl( SIOCGIWAP ) ) | 504 | if ( ioctl( SIOCGIWAP ) ) |
524 | return (const unsigned char*) &_ifr.ifr_hwaddr.sa_data[0]; | 505 | return (const unsigned char*) &_ifr.ifr_hwaddr.sa_data[0]; |
525 | else | 506 | else |
526 | return OMacAddress::unknown; | 507 | return OMacAddress::unknown; |
527 | } | 508 | } |
528 | 509 | ||
529 | 510 | ||
530 | void OWirelessNetworkInterface::buildInformation() | 511 | void OWirelessNetworkInterface::buildInformation() |
531 | { | 512 | { |
532 | //ML: If you listen carefully enough, you can hear lots of WLAN drivers suck | 513 | //ML: If you listen carefully enough, you can hear lots of WLAN drivers suck |
533 | //ML: The HostAP drivers need more than sizeof struct_iw range to complete | 514 | //ML: The HostAP drivers need more than sizeof struct_iw range to complete |
534 | //ML: SIOCGIWRANGE otherwise they fail with "Invalid Argument Length". | 515 | //ML: SIOCGIWRANGE otherwise they fail with "Invalid Argument Length". |
535 | //ML: The Wlan-NG drivers on the otherside fail (segfault!) if you allocate | 516 | //ML: The Wlan-NG drivers on the otherside fail (segfault!) if you allocate |
536 | //ML: _too much_ space. This is damn shitty crap *sigh* | 517 | //ML: _too much_ space. This is damn shitty crap *sigh* |
537 | //ML: We allocate a large memory region in RAM and check whether the | 518 | //ML: We allocate a large memory region in RAM and check whether the |
538 | //ML: driver pollutes this extra space. The complaint will be made on stdout, | 519 | //ML: driver pollutes this extra space. The complaint will be made on stdout, |
539 | //ML: so please forward this... | 520 | //ML: so please forward this... |
540 | 521 | ||
541 | struct iwreq wrq; | 522 | struct iwreq wrq; |
542 | int len = sizeof( struct iw_range )*2; | 523 | int len = sizeof( struct iw_range )*2; |
543 | char buffer[len]; | 524 | char buffer[len]; |
544 | memset( buffer, 0, len ); | 525 | memset( buffer, 0, len ); |
545 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); | 526 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); |
546 | wrq.u.data.pointer = (caddr_t) buffer; | 527 | wrq.u.data.pointer = (caddr_t) buffer; |
547 | wrq.u.data.length = sizeof buffer; | 528 | wrq.u.data.length = sizeof buffer; |
548 | wrq.u.data.flags = 0; | 529 | wrq.u.data.flags = 0; |
549 | 530 | ||
550 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) | 531 | int result = ::ioctl( _sfd, SIOCGIWRANGE, &wrq ); |
532 | if ( result == -1 ) | ||
533 | { | ||
534 | owarn << "OWirelessNetworkInterface::buildInformation(): SIOCGIWRANGE failed (" << strerror( errno ) << ") - retrying with smaller buffer..." << oendl; | ||
535 | wrq.u.data.length = sizeof( struct iw_range ); | ||
536 | result = ::ioctl( _sfd, SIOCGIWRANGE, &wrq ); | ||
537 | } | ||
538 | |||
539 | if ( result == -1 ) | ||
551 | { | 540 | { |
552 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get driver information (" << strerror( errno ) << ") - using default values." << oendl; | 541 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get driver information (" << strerror( errno ) << ") - using default values." << oendl; |
553 | _channels.insert( 2412, 1 ); // 2.412 GHz | 542 | _channels.insert( 2412, 1 ); // 2.412 GHz |
554 | _channels.insert( 2417, 2 ); // 2.417 GHz | 543 | _channels.insert( 2417, 2 ); // 2.417 GHz |
555 | _channels.insert( 2422, 3 ); // 2.422 GHz | 544 | _channels.insert( 2422, 3 ); // 2.422 GHz |
556 | _channels.insert( 2427, 4 ); // 2.427 GHz | 545 | _channels.insert( 2427, 4 ); // 2.427 GHz |
557 | _channels.insert( 2432, 5 ); // 2.432 GHz | 546 | _channels.insert( 2432, 5 ); // 2.432 GHz |
558 | _channels.insert( 2437, 6 ); // 2.437 GHz | 547 | _channels.insert( 2437, 6 ); // 2.437 GHz |
559 | _channels.insert( 2442, 7 ); // 2.442 GHz | 548 | _channels.insert( 2442, 7 ); // 2.442 GHz |
560 | _channels.insert( 2447, 8 ); // 2.447 GHz | 549 | _channels.insert( 2447, 8 ); // 2.447 GHz |
561 | _channels.insert( 2452, 9 ); // 2.452 GHz | 550 | _channels.insert( 2452, 9 ); // 2.452 GHz |
562 | _channels.insert( 2457, 10 ); // 2.457 GHz | 551 | _channels.insert( 2457, 10 ); // 2.457 GHz |
563 | _channels.insert( 2462, 11 ); // 2.462 GHz | 552 | _channels.insert( 2462, 11 ); // 2.462 GHz |
564 | 553 | ||
565 | memset( &_range, 0, sizeof( struct iw_range ) ); | 554 | memset( &_range, 0, sizeof( struct iw_range ) ); |
566 | } | 555 | } |
567 | else | 556 | else |
568 | { | 557 | { |
569 | // <check if the driver overwrites stuff> | 558 | // <check if the driver overwrites stuff> |
570 | int max = 0; | 559 | int max = 0; |
571 | for ( int r = sizeof( struct iw_range ); r < len; r++ ) | 560 | for ( int r = sizeof( struct iw_range ); r < len; r++ ) |
572 | if (buffer[r] != 0) | 561 | if (buffer[r] != 0) |
573 | max = r; | 562 | max = r; |
574 | if (max > 0) | 563 | if (max > 0) |
575 | { | 564 | { |
576 | owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name() | 565 | owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name() |
577 | << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl; | 566 | << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl; |
578 | } | 567 | } |
579 | // </check if the driver overwrites stuff> | 568 | // </check if the driver overwrites stuff> |
580 | 569 | ||
581 | struct iw_range range; | 570 | struct iw_range range; |
582 | memcpy( &range, buffer, sizeof range ); | 571 | memcpy( &range, buffer, sizeof range ); |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index f0c4450..b13c7a3 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,36 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 20 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | 27 | ||
29 | */ | 28 | */ |
30 | 29 | ||
31 | #ifndef ONETWORK_H | 30 | #ifndef ONETWORK_H |
32 | #define ONETWORK_H | 31 | #define ONETWORK_H |
33 | 32 | ||
34 | /* OPIE */ | 33 | /* OPIE */ |
35 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
36 | #include <opie2/ostation.h> | 35 | #include <opie2/ostation.h> |
@@ -169,84 +168,84 @@ class ONetworkInterface : public QObject | |||
169 | /** | 168 | /** |
170 | * Setting an interface to promiscuous mode enables the device to receive | 169 | * Setting an interface to promiscuous mode enables the device to receive |
171 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. | 170 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. |
172 | */ | 171 | */ |
173 | bool setPromiscuousMode( bool ); | 172 | bool setPromiscuousMode( bool ); |
174 | /** | 173 | /** |
175 | * @returns true if the interface is set to promiscuous mode. | 174 | * @returns true if the interface is set to promiscuous mode. |
176 | */ | 175 | */ |
177 | bool promiscuousMode() const; | 176 | bool promiscuousMode() const; |
178 | /** | 177 | /** |
179 | * Setting an interface to up enables it to receive packets. | 178 | * Setting an interface to up enables it to receive packets. |
180 | */ | 179 | */ |
181 | bool setUp( bool ); | 180 | bool setUp( bool ); |
182 | /** | 181 | /** |
183 | * @returns true if the interface is up. | 182 | * @returns true if the interface is up. |
184 | */ | 183 | */ |
185 | bool isUp() const; | 184 | bool isUp() const; |
186 | /** | 185 | /** |
187 | * @returns true if the interface is a loopback interface. | 186 | * @returns true if the interface is a loopback interface. |
188 | */ | 187 | */ |
189 | bool isLoopback() const; | 188 | bool isLoopback() const; |
190 | /** | 189 | /** |
191 | * @returns true if the interface is featuring supports the wireless extension protocol. | 190 | * @returns true if the interface is featuring supports the wireless extension protocol. |
192 | */ | 191 | */ |
193 | bool isWireless() const; | 192 | bool isWireless() const; |
194 | /** | 193 | /** |
195 | * Associate the IP address @ addr with the interface. | 194 | * Associate the IP address @ addr with the interface. |
196 | */ | 195 | */ |
197 | void setIPV4Address( const QHostAddress& addr ); | 196 | void setIPV4Address( const QHostAddress& addr ); |
198 | /** | 197 | /** |
199 | * @returns the IPv4 address associated with the interface. | 198 | * @returns the IPv4 address associated with the interface. |
200 | */ | 199 | */ |
201 | QString ipV4Address() const; //TODO: make this return an OHostAddress | 200 | OHostAddress ipV4Address() const; |
202 | /** | 201 | /** |
203 | * Associate the MAC address @a addr with the interface. | 202 | * 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. | 203 | * @note It can be necessary to shut down the interface prior to calling this method. |
205 | * @note This operation needs root privileges | 204 | * @note This operation needs root privileges |
206 | * @warning This is not supported by all drivers. | 205 | * @warning This is not supported by all drivers. |
207 | */ | 206 | */ |
208 | void setMacAddress( const OMacAddress& addr ); | 207 | void setMacAddress( const OMacAddress& addr ); |
209 | /** | 208 | /** |
210 | * @returns the MAC address associated with the interface. | 209 | * @returns the MAC address associated with the interface. |
211 | */ | 210 | */ |
212 | OMacAddress macAddress() const; | 211 | OMacAddress macAddress() const; |
213 | /** | 212 | /** |
214 | * Associate the IPv4 @a netmask with the interface. | 213 | * Associate the IPv4 @a netmask with the interface. |
215 | */ | 214 | */ |
216 | void setIPV4Netmask( const QHostAddress& netmask ); | 215 | void setIPV4Netmask( const QHostAddress& netmask ); |
217 | /** | 216 | /** |
218 | * @returns the IPv4 netmask associated with the interface. | 217 | * @returns the IPv4 netmask associated with the interface. |
219 | */ | 218 | */ |
220 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress | 219 | OHostAddress ipV4Netmask() const; |
221 | /** | 220 | /** |
222 | * @returns the data link type currently associated with the interface. | 221 | * @returns the data link type currently associated with the interface. |
223 | * @see #include <net/if_arp.h> for possible values. | 222 | * @see #include <net/if_arp.h> for possible values. |
224 | */ | 223 | */ |
225 | int dataLinkType() const; | 224 | int dataLinkType() const; |
226 | /** | 225 | /** |
227 | * @returns a ONetworkInterfaceDriverInfo driver information block | 226 | * @returns a ONetworkInterfaceDriverInfo driver information block |
228 | * @note This operation needs root privileges | 227 | * @note This operation needs root privileges |
229 | * @warning This is not supported by all drivers | 228 | * @warning This is not supported by all drivers |
230 | */ | 229 | */ |
231 | ONetworkInterfaceDriverInfo driverInfo() const; | 230 | ONetworkInterfaceDriverInfo driverInfo() const; |
232 | 231 | ||
233 | protected: | 232 | protected: |
234 | const int _sfd; | 233 | const int _sfd; |
235 | mutable ifreq _ifr; | 234 | mutable ifreq _ifr; |
236 | OMonitoringInterface* _mon; | 235 | OMonitoringInterface* _mon; |
237 | 236 | ||
238 | protected: | 237 | protected: |
239 | struct ifreq& ifr() const; | 238 | struct ifreq& ifr() const; |
240 | virtual void init(); | 239 | virtual void init(); |
241 | bool ioctl( int call ) const; | 240 | bool ioctl( int call ) const; |
242 | bool ioctl( int call, struct ifreq& ) const; | 241 | bool ioctl( int call, struct ifreq& ) const; |
243 | private: | 242 | private: |
244 | class Private; | 243 | class Private; |
245 | Private *d; | 244 | Private *d; |
246 | }; | 245 | }; |
247 | 246 | ||
248 | /*====================================================================================== | 247 | /*====================================================================================== |
249 | * OChannelHopper | 248 | * OChannelHopper |
250 | *======================================================================================*/ | 249 | *======================================================================================*/ |
251 | 250 | ||
252 | /** | 251 | /** |
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index 534a8d0..bd6ca66 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp | |||
@@ -54,83 +54,83 @@ IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) | |||
54 | { | 54 | { |
55 | _iface = ONetwork::instance()->interface( name ); | 55 | _iface = ONetwork::instance()->interface( name ); |
56 | assert( _iface ); | 56 | assert( _iface ); |
57 | setToggleButton( true ); | 57 | setToggleButton( true ); |
58 | //setAutoRaise( true ); | 58 | //setAutoRaise( true ); |
59 | setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); | 59 | setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); |
60 | setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); | 60 | setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); |
61 | setOn( _iface->isUp() ); | 61 | setOn( _iface->isUp() ); |
62 | //setFixedWidth( 16 ); | 62 | //setFixedWidth( 16 ); |
63 | connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); | 63 | connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | IfaceUpDownButton::~IfaceUpDownButton() | 67 | IfaceUpDownButton::~IfaceUpDownButton() |
68 | { | 68 | { |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | void IfaceUpDownButton::clicked() | 72 | void IfaceUpDownButton::clicked() |
73 | { | 73 | { |
74 | _iface->setUp( isOn() ); | 74 | _iface->setUp( isOn() ); |
75 | setOn( _iface->isUp() ); // it might not have worked... | 75 | setOn( _iface->isUp() ); // it might not have worked... |
76 | repaint(); | 76 | repaint(); |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name ) | 80 | IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name ) |
81 | :QLineEdit( parent, name ) | 81 | :QLineEdit( parent, name ) |
82 | { | 82 | { |
83 | setFont( QFont( "fixed" ) ); | 83 | setFont( QFont( "fixed" ) ); |
84 | _iface = ONetwork::instance()->interface( name ); | 84 | _iface = ONetwork::instance()->interface( name ); |
85 | setFixedWidth( 105 ); | 85 | setFixedWidth( 105 ); |
86 | setText( _iface->ipV4Address() ); | 86 | setText( _iface->ipV4Address().toString() ); |
87 | connect( this, SIGNAL( returnPressed() ), this, SLOT( returnPressed() ) ); | 87 | connect( this, SIGNAL( returnPressed() ), this, SLOT( returnPressed() ) ); |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | IfaceIPAddress::~IfaceIPAddress() | 91 | IfaceIPAddress::~IfaceIPAddress() |
92 | { | 92 | { |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | void IfaceIPAddress::returnPressed() | 96 | void IfaceIPAddress::returnPressed() |
97 | { | 97 | { |
98 | QHostAddress a; | 98 | QHostAddress a; |
99 | a.setAddress( text() ); | 99 | a.setAddress( text() ); |
100 | QHostAddress mask; | 100 | QHostAddress mask; |
101 | mask.setAddress( _iface->ipV4Netmask() ); // setIPV4Address destroys the netmask... | 101 | mask.setAddress( _iface->ipV4Netmask().toString() ); // setIPV4Address destroys the netmask... |
102 | _iface->setIPV4Address( a ); | 102 | _iface->setIPV4Address( a ); |
103 | _iface->setIPV4Netmask( mask ); // recover the old netmask | 103 | _iface->setIPV4Netmask( mask ); // recover the old netmask |
104 | setText( _iface->ipV4Address() ); | 104 | setText( _iface->ipV4Address().toString() ); |
105 | repaint(); | 105 | repaint(); |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | NetworkAppletControl::NetworkAppletControl( OTaskbarApplet* parent, const char* name ) | 109 | NetworkAppletControl::NetworkAppletControl( OTaskbarApplet* parent, const char* name ) |
110 | :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), l(0) | 110 | :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), l(0) |
111 | { | 111 | { |
112 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 112 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
113 | l = new QVBoxLayout( this, 4, 2 ); | 113 | l = new QVBoxLayout( this, 4, 2 ); |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void NetworkAppletControl::build() | 117 | void NetworkAppletControl::build() |
118 | { | 118 | { |
119 | ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); | 119 | ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); |
120 | while ( it.current() ) | 120 | while ( it.current() ) |
121 | { | 121 | { |
122 | QHBoxLayout* h = new QHBoxLayout( l ); | 122 | QHBoxLayout* h = new QHBoxLayout( l ); |
123 | QLabel* symbol = new QLabel( this ); | 123 | QLabel* symbol = new QLabel( this ); |
124 | symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); | 124 | symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); |
125 | h->addWidget( symbol ); | 125 | h->addWidget( symbol ); |
126 | symbol->show(); | 126 | symbol->show(); |
127 | 127 | ||
128 | QLabel* name = new QLabel( it.current()->name(), this ); | 128 | QLabel* name = new QLabel( it.current()->name(), this ); |
129 | name->setFixedWidth( 35 ); | 129 | name->setFixedWidth( 35 ); |
130 | h->addWidget( name ); | 130 | h->addWidget( name ); |
131 | name->show(); | 131 | name->show(); |
132 | 132 | ||
133 | IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); | 133 | IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); |
134 | h->addWidget( ip ); | 134 | h->addWidget( ip ); |
135 | ip->show(); | 135 | ip->show(); |
136 | 136 | ||
diff --git a/noncore/net/opiestumbler/opiestumbler.cpp b/noncore/net/opiestumbler/opiestumbler.cpp index 8dedd67..f231fca 100644 --- a/noncore/net/opiestumbler/opiestumbler.cpp +++ b/noncore/net/opiestumbler/opiestumbler.cpp | |||
@@ -307,42 +307,42 @@ void OpieStumbler::slotAssociated() | |||
307 | 307 | ||
308 | if (!wiface->isAssociated()) { | 308 | if (!wiface->isAssociated()) { |
309 | Global::statusMessage(tr("Could not Join")); | 309 | Global::statusMessage(tr("Could not Join")); |
310 | return; | 310 | return; |
311 | } | 311 | } |
312 | 312 | ||
313 | Global::statusMessage(tr("Joined")); | 313 | Global::statusMessage(tr("Joined")); |
314 | 314 | ||
315 | if(m_proc) { | 315 | if(m_proc) { |
316 | m_proc->kill(); | 316 | m_proc->kill(); |
317 | delete m_proc; | 317 | delete m_proc; |
318 | } | 318 | } |
319 | 319 | ||
320 | m_proc = new Opie::Core::OProcess(this); | 320 | m_proc = new Opie::Core::OProcess(this); |
321 | 321 | ||
322 | *m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface; | 322 | *m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface; |
323 | m_proc->start(Opie::Core::OProcess::DontCare); | 323 | m_proc->start(Opie::Core::OProcess::DontCare); |
324 | QTimer::singleShot(5000, this, SLOT(slotCheckDHCP())); | 324 | QTimer::singleShot(5000, this, SLOT(slotCheckDHCP())); |
325 | } | 325 | } |
326 | 326 | ||
327 | void OpieStumbler::slotCheckDHCP() | 327 | void OpieStumbler::slotCheckDHCP() |
328 | { | 328 | { |
329 | if(!m_proc->isRunning()) { | 329 | if(!m_proc->isRunning()) { |
330 | Global::statusMessage(tr("Could not Obtain an Address")); | 330 | Global::statusMessage(tr("Could not Obtain an Address")); |
331 | delete m_proc; | 331 | delete m_proc; |
332 | m_proc = NULL; | 332 | m_proc = NULL; |
333 | return; | 333 | return; |
334 | } | 334 | } |
335 | m_listCurrent->show(); | 335 | m_listCurrent->show(); |
336 | 336 | ||
337 | 337 | ||
338 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); | 338 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); |
339 | Global::statusMessage(tr("Obtained IP ") + wiface->ipV4Address()); | 339 | Global::statusMessage(tr("Obtained IP ") + wiface->ipV4Address().toString()); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | 343 | ||
344 | 344 | ||
345 | 345 | ||
346 | 346 | ||
347 | 347 | ||
348 | 348 | ||