-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 17 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 9 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 2 |
4 files changed, 14 insertions, 15 deletions
@@ -1,283 +1,284 @@ | |||
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 | 8 | ||
9 | Fixed Bugs | 9 | Fixed Bugs |
10 | ---------- | 10 | ---------- |
11 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) | 11 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) |
12 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) | 12 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) |
13 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) | 13 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) |
14 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) | 14 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) |
15 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) | 15 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) |
16 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) | 16 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) |
17 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) | 17 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) |
18 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) | 18 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) |
19 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) | 19 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) |
20 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) | 20 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) |
21 | 21 | ||
22 | Internal | 22 | Internal |
23 | -------- | 23 | -------- |
24 | * Make BluezApplet use OTaskbarApplet (mickeyl) | 24 | * Make BluezApplet use OTaskbarApplet (mickeyl) |
25 | * Rewrite OFileNotification to use the upcoming inotify interface instead of the deprecated dnotify (mickeyl) | 25 | * Rewrite OFileNotification to use the upcoming inotify interface instead of the deprecated dnotify (mickeyl) |
26 | * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) | ||
26 | 27 | ||
27 | 2005-03-25Opie 1.2.0 | 28 | 2005-03-25Opie 1.2.0 |
28 | 29 | ||
29 | Fixed Bugs | 30 | Fixed Bugs |
30 | ---------- | 31 | ---------- |
31 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) | 32 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) |
32 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) | 33 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) |
33 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) | 34 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) |
34 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) | 35 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) |
35 | * n.a.- make qpeglobal.h include qglobal.h (zecke) | 36 | * n.a.- make qpeglobal.h include qglobal.h (zecke) |
36 | 37 | ||
37 | 2005-03-20Opie 1.2.0-rc1 | 38 | 2005-03-20Opie 1.2.0-rc1 |
38 | 39 | ||
39 | 40 | ||
40 | New Features | 41 | New Features |
41 | ------------ | 42 | ------------ |
42 | * Launcher: Support a static background pixmap (mickeyl) | 43 | * Launcher: Support a static background pixmap (mickeyl) |
43 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) | 44 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) |
44 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) | 45 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) |
45 | * Added hi-res inline images for large resolution devices (drw) | 46 | * Added hi-res inline images for large resolution devices (drw) |
46 | * Improved launcher icons for consistency (ar) | 47 | * Improved launcher icons for consistency (ar) |
47 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) | 48 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) |
48 | 49 | ||
49 | Fixed Bugs | 50 | Fixed Bugs |
50 | ---------- | 51 | ---------- |
51 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) | 52 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) |
52 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) | 53 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) |
53 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) | 54 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) |
54 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) | 55 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) |
55 | * #1482 - Fix double '/' in paths (zecke) | 56 | * #1482 - Fix double '/' in paths (zecke) |
56 | * #1536 - Autosave of custom locations in opie backup (ar) | 57 | * #1536 - Autosave of custom locations in opie backup (ar) |
57 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) | 58 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) |
58 | * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) | 59 | * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) |
59 | * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) | 60 | * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) |
60 | * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) | 61 | * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) |
61 | * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) | 62 | * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) |
62 | * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) | 63 | * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) |
63 | * #1558 - Fixed opie-login breaking opie startup (mickeyl) | 64 | * #1558 - Fixed opie-login breaking opie startup (mickeyl) |
64 | * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) | 65 | * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) |
65 | * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) | 66 | * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) |
66 | * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) | 67 | * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) |
67 | * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) | 68 | * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) |
68 | * #1604 - Checkbook crashed on startup (drw) | 69 | * #1604 - Checkbook crashed on startup (drw) |
69 | * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) | 70 | * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) |
70 | * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) | 71 | * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) |
71 | * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) | 72 | * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) |
72 | * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) | 73 | * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) |
73 | * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) | 74 | * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) |
74 | * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) | 75 | * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) |
75 | * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw) | 76 | * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw) |
76 | * n.a. - AddressBook - fixed sorting by 'File As' name (drw) | 77 | * n.a. - AddressBook - fixed sorting by 'File As' name (drw) |
77 | * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers) | 78 | * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers) |
78 | * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw) | 79 | * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw) |
79 | 80 | ||
80 | Internal | 81 | Internal |
81 | -------- | 82 | -------- |
82 | * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) | 83 | * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) |
83 | * Killed the need for weak symbols in QtE (zecke) | 84 | * Killed the need for weak symbols in QtE (zecke) |
84 | * Added optional building libqpe without inline images (mickeyl) | 85 | * Added optional building libqpe without inline images (mickeyl) |
85 | * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw) | 86 | * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw) |
86 | 87 | ||
87 | 2005-02-03Opie 1.1.9 | 88 | 2005-02-03Opie 1.1.9 |
88 | 89 | ||
89 | New Features | 90 | New Features |
90 | ------------ | 91 | ------------ |
91 | * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) | 92 | * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) |
92 | * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) | 93 | * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) |
93 | * Usability enhancements in OpieIRC (skyhusker) | 94 | * Usability enhancements in OpieIRC (skyhusker) |
94 | 95 | ||
95 | Fixed Bugs | 96 | Fixed Bugs |
96 | ---------- | 97 | ---------- |
97 | * #1501 - Fixed bug in todo sql backend (eilers) | 98 | * #1501 - Fixed bug in todo sql backend (eilers) |
98 | * #1505 - Added more Swap sizes in memoryapplet (mickeyl) | 99 | * #1505 - Added more Swap sizes in memoryapplet (mickeyl) |
99 | * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke) | 100 | * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke) |
100 | * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke) | 101 | * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke) |
101 | * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl) | 102 | * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl) |
102 | * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl) | 103 | * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl) |
103 | * n.a. - Fixed numerous buglets in OpieIRC (skyhusker) | 104 | * n.a. - Fixed numerous buglets in OpieIRC (skyhusker) |
104 | 105 | ||
105 | Internal | 106 | Internal |
106 | -------- | 107 | -------- |
107 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) | 108 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) |
108 | * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl) | 109 | * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl) |
109 | * Made Opie compilable with Qt/Embedded 2.3.10 (ar) | 110 | * Made Opie compilable with Qt/Embedded 2.3.10 (ar) |
110 | * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl) | 111 | * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl) |
111 | * Build tree cleanups (mickeyl) | 112 | * Build tree cleanups (mickeyl) |
112 | 113 | ||
113 | 2004-11-26Opie 1.1.8 | 114 | 2004-11-26Opie 1.1.8 |
114 | 115 | ||
115 | New Features | 116 | New Features |
116 | ------------ | 117 | ------------ |
117 | * PackageManager supports installation of local ipkg files (drw) | 118 | * PackageManager supports installation of local ipkg files (drw) |
118 | * PackageManager supports linking of applications to root (drw) | 119 | * PackageManager supports linking of applications to root (drw) |
119 | * PackageManager supports src/gz feeds (drw,wimpie) | 120 | * PackageManager supports src/gz feeds (drw,wimpie) |
120 | * Added a syslog information tab to sysinfo (mickeyl) | 121 | * Added a syslog information tab to sysinfo (mickeyl) |
121 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) | 122 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) |
122 | 123 | ||
123 | Fixed Bugs | 124 | Fixed Bugs |
124 | ---------- | 125 | ---------- |
125 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) | 126 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) |
126 | * #1269 - VCards were imported into personal area if it was activated (eilers) | 127 | * #1269 - VCards were imported into personal area if it was activated (eilers) |
127 | * #1464 - Packagemanager dont set active filter after install a package (drw) | 128 | * #1464 - Packagemanager dont set active filter after install a package (drw) |
128 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) | 129 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) |
129 | * #1493 - Fixed one column layout bug of the launcher (hrw) | 130 | * #1493 - Fixed one column layout bug of the launcher (hrw) |
130 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) | 131 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) |
131 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) | 132 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) |
132 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) | 133 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) |
133 | 134 | ||
134 | Internal | 135 | Internal |
135 | -------- | 136 | -------- |
136 | * Moved libopie1 to unsupported (mickeyl) | 137 | * Moved libopie1 to unsupported (mickeyl) |
137 | * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) | 138 | * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) |
138 | * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) | 139 | * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) |
139 | 140 | ||
140 | 2004-11-14Opie 1.1.7 | 141 | 2004-11-14Opie 1.1.7 |
141 | 142 | ||
142 | New Features | 143 | New Features |
143 | ------------ | 144 | ------------ |
144 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) | 145 | * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) |
145 | * Backup now uses the busy indicator when backing up and restore (ar) | 146 | * Backup now uses the busy indicator when backing up and restore (ar) |
146 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) | 147 | * OpiePlayer2 gained adding of Directories to the playlist (zecke) |
147 | * OpiePlayer2 better error handling (zecke) | 148 | * OpiePlayer2 better error handling (zecke) |
148 | * OpiePlayer2 progress indication while streaming (zecke) | 149 | * OpiePlayer2 progress indication while streaming (zecke) |
149 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) | 150 | * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) |
150 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) | 151 | * Ported brightnessapplet from Qtopia 1.7 (mickeyl) |
151 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) | 152 | * Opie-Eye got a Digital Camera File Backend (alwin,zecke) |
152 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) | 153 | * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) |
153 | * Opie-Console use Custom Font and Size in a Profile (harlekin) | 154 | * Opie-Console use Custom Font and Size in a Profile (harlekin) |
154 | * Opie-Console transparently log the Output and Input to a file (harlekin) | 155 | * Opie-Console transparently log the Output and Input to a file (harlekin) |
155 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) | 156 | * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) |
156 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) | 157 | * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) |
157 | * Opie-Security gained a 'test authentication' button (clem) | 158 | * Opie-Security gained a 'test authentication' button (clem) |
158 | * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults | 159 | * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults |
159 | * Opie-Mail improve the handling of POP mail boxes (alwin) | 160 | * Opie-Mail improve the handling of POP mail boxes (alwin) |
160 | * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) | 161 | * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) |
161 | * Opie IRC - backports of the 'NeIRC fork' (zecke) | 162 | * Opie IRC - backports of the 'NeIRC fork' (zecke) |
162 | 163 | ||
163 | Fixed Bugs | 164 | Fixed Bugs |
164 | ---------- | 165 | ---------- |
165 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) | 166 | * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) |
166 | * #608 - Make Opie usable for left handed users (zecke) | 167 | * #608 - Make Opie usable for left handed users (zecke) |
167 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) | 168 | * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) |
168 | * #1245 - Opie-Go 'paused' (zecke) | 169 | * #1245 - Opie-Go 'paused' (zecke) |
169 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) | 170 | * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) |
170 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) | 171 | * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) |
171 | * #1395 - Build VNC Backend with gcc3.4 | 172 | * #1395 - Build VNC Backend with gcc3.4 |
172 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) | 173 | * #1440 - The icon of opie-mobilemsg is missing (CoreDump) |
173 | * #1426 - Add missing opie-bartender Icon (CoreDump) | 174 | * #1426 - Add missing opie-bartender Icon (CoreDump) |
174 | * #1445 - Opie-Sheet Has No Icon (CoreDump) | 175 | * #1445 - Opie-Sheet Has No Icon (CoreDump) |
175 | * #1448 - Brightness Applet added (mickeyl) | 176 | * #1448 - Brightness Applet added (mickeyl) |
176 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) | 177 | * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) |
177 | * #1482 - Fix OFileSelector to be able to sort by size (zecke) | 178 | * #1482 - Fix OFileSelector to be able to sort by size (zecke) |
178 | * n.a. - Opie-mail: fixed some crasher, some layout-problems | 179 | * n.a. - Opie-mail: fixed some crasher, some layout-problems |
179 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) | 180 | * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) |
180 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) | 181 | * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) |
181 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) | 182 | * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) |
182 | * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) | 183 | * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) |
183 | * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) | 184 | * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) |
184 | 185 | ||
185 | Internal | 186 | Internal |
186 | -------- | 187 | -------- |
187 | * Opie-Qashmoney has been moved to unsupported (mickeyl) | 188 | * Opie-Qashmoney has been moved to unsupported (mickeyl) |
188 | * Opie-Ubrowser has been moved to unsupported (mickeyl) | 189 | * Opie-Ubrowser has been moved to unsupported (mickeyl) |
189 | 190 | ||
190 | 2004-09-17Opie 1.1.6 | 191 | 2004-09-17Opie 1.1.6 |
191 | 192 | ||
192 | New Features | 193 | New Features |
193 | ------------ | 194 | ------------ |
194 | * Fifteen gained configurable number of items (zecke) | 195 | * Fifteen gained configurable number of items (zecke) |
195 | * Fifteen can have custom background images (zecke) | 196 | * Fifteen can have custom background images (zecke) |
196 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) | 197 | * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) |
197 | * Integrated the new security framework into libopie2 (zecke,clem) | 198 | * Integrated the new security framework into libopie2 (zecke,clem) |
198 | * Converted the launcher to use the new security framework (zecke) | 199 | * Converted the launcher to use the new security framework (zecke) |
199 | * Backup can now handle custom locations for backup and restore (ar) | 200 | * Backup can now handle custom locations for backup and restore (ar) |
200 | * Implemented right-on-hold feedback (wimpie,zecke) | 201 | * Implemented right-on-hold feedback (wimpie,zecke) |
201 | * Lots of new features in opie-reader (tim,pohly) | 202 | * Lots of new features in opie-reader (tim,pohly) |
202 | * Build system cleanups (schurig) | 203 | * Build system cleanups (schurig) |
203 | 204 | ||
204 | Fixed Bugs | 205 | Fixed Bugs |
205 | -------- | 206 | -------- |
206 | * #1005 - Fixed backup to CompactFlash (ar) | 207 | * #1005 - Fixed backup to CompactFlash (ar) |
207 | * #1167 - Fixed Opie write crashing on more text than one page (ar) | 208 | * #1167 - Fixed Opie write crashing on more text than one page (ar) |
208 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) | 209 | * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) |
209 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) | 210 | * #1359 - Fixed bookmarks in Gutenbrowser (ljp) |
210 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) | 211 | * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) |
211 | * #1370 - Pimconverter now reacts on cancel key (eilers) | 212 | * #1370 - Pimconverter now reacts on cancel key (eilers) |
212 | * #1376 - Bring back the capslock/numlock display (zecke) | 213 | * #1376 - Bring back the capslock/numlock display (zecke) |
213 | * #1383 - Language settings now warns about losing open apps (Markus Litz) | 214 | * #1383 - Language settings now warns about losing open apps (Markus Litz) |
214 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) | 215 | * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) |
215 | * #1394 - Fixed oversized headline in opie-login (coredump) | 216 | * #1394 - Fixed oversized headline in opie-login (coredump) |
216 | * #1396 - Opie-console captures the escape key and vim is working (zecke) | 217 | * #1396 - Opie-console captures the escape key and vim is working (zecke) |
217 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) | 218 | * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) |
218 | 219 | ||
219 | 2004-07-06Opie 1.1.4 | 220 | 2004-07-06Opie 1.1.4 |
220 | 221 | ||
221 | New Features | 222 | New Features |
222 | ------------ | 223 | ------------ |
223 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) | 224 | * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) |
224 | * Added Conversion tool for pim-data (eilers) | 225 | * Added Conversion tool for pim-data (eilers) |
225 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) | 226 | * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) |
226 | * Modified the PIM API for providing generic use of OPimRecords (eilers) | 227 | * Modified the PIM API for providing generic use of OPimRecords (eilers) |
227 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) | 228 | * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) |
228 | 229 | ||
229 | Fixed Bugs | 230 | Fixed Bugs |
230 | -------- | 231 | -------- |
231 | * #1068 - Country Drop Down Box Off Screen | 232 | * #1068 - Country Drop Down Box Off Screen |
232 | * #1291 - Opie tinykate does not open .desktop files (ar) | 233 | * #1291 - Opie tinykate does not open .desktop files (ar) |
233 | * #1291 - Opie sheet not saving correctly (ar) | 234 | * #1291 - Opie sheet not saving correctly (ar) |
234 | * #1294 - Opie does not know about British Summer Time | 235 | * #1294 - Opie does not know about British Summer Time |
235 | * #1314 - Drawpad initialization (mickeyl) | 236 | * #1314 - Drawpad initialization (mickeyl) |
236 | * #1317 - Packagemanager crashes on hold-down or install (chicken) | 237 | * #1317 - Packagemanager crashes on hold-down or install (chicken) |
237 | * #1321 - Batteryapplet graphic glitch (harlekin) | 238 | * #1321 - Batteryapplet graphic glitch (harlekin) |
238 | * #1324 - ZSafe not starting up (mickeyl) | 239 | * #1324 - ZSafe not starting up (mickeyl) |
239 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) | 240 | * #1328 - Personal Home Address fields is trimmed to 1char (eilers) |
240 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) | 241 | * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) |
241 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) | 242 | * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) |
242 | * #1348 - Datebook dependency on libopiedb2 (chicken) | 243 | * #1348 - Datebook dependency on libopiedb2 (chicken) |
243 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) | 244 | * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) |
244 | 245 | ||
245 | 2004-04-25Opie 1.1.3 | 246 | 2004-04-25Opie 1.1.3 |
246 | 247 | ||
247 | * Introduced first implementation of SQL-Support using SQLite (eilers) | 248 | * Introduced first implementation of SQL-Support using SQLite (eilers) |
248 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) | 249 | * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) |
249 | * Added a real system graffiti character set (brad) | 250 | * Added a real system graffiti character set (brad) |
250 | * Added Generic Keyconfig Widget (zecke) | 251 | * Added Generic Keyconfig Widget (zecke) |
251 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) | 252 | * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) |
252 | * Added new Bible reader app - opie-dagger (drw) | 253 | * Added new Bible reader app - opie-dagger (drw) |
253 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) | 254 | * Added a new Image Viewer. Work is ongoing (zecke,alwin) |
254 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) | 255 | * Added namespace usage in libopie2 and everywhere (zecke,alwin) |
255 | * Enabled the possibility to pass command line arguments to applications (mickeyl) | 256 | * Enabled the possibility to pass command line arguments to applications (mickeyl) |
256 | * Added an about applet showing some credits and information about Opie (mickeyl) | 257 | * Added an about applet showing some credits and information about Opie (mickeyl) |
257 | * Added benchmarking functionality to sysinfo (mickeyl) | 258 | * Added benchmarking functionality to sysinfo (mickeyl) |
258 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) | 259 | * Added applet and configuration application for switching hardware keyboard layouts (alwin) |
259 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) | 260 | * Ported applications from libopie1 to libopie2* (drw,ar,alwin) |
260 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) | 261 | * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) |
261 | * Clean-up of package information in control files (drw) | 262 | * Clean-up of package information in control files (drw) |
262 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) | 263 | * Repaired mediummount which was broken since integrating the quicklauncher (alwin) |
263 | * Improved big-screen support (zecke,ar) | 264 | * Improved big-screen support (zecke,ar) |
264 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) | 265 | * Improved multikeyboard support, added keyboard layout switching applet (mouse) |
265 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) | 266 | * Added a new mail client based on libetpan (harlekin,alwin,jgf) |
266 | * Added new package manager - opie-packagemanager (drw) | 267 | * Added new package manager - opie-packagemanager (drw) |
267 | * Improved light-n-power for C7x0 (mickeyl) | 268 | * Improved light-n-power for C7x0 (mickeyl) |
268 | * Added automatic rotation support for C7x0 (treke) | 269 | * Added automatic rotation support for C7x0 (treke) |
269 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) | 270 | * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) |
270 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) | 271 | * Added scanning the wireless network neighbourhood to networksettings (mickeyl) |
271 | 272 | ||
272 | 2003-11-29Opie 1.0.3 | 273 | 2003-11-29Opie 1.0.3 |
273 | 274 | ||
274 | * Released as Version 1.0.3 | 275 | * Released as Version 1.0.3 |
275 | * Improved i18n (various contributors) | 276 | * Improved i18n (various contributors) |
276 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) | 277 | * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) |
277 | * Made the Documents Tab optional (mickeyl) | 278 | * Made the Documents Tab optional (mickeyl) |
278 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) | 279 | * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) |
279 | 280 | ||
280 | 2003-08-04Opie 1.0.0 | 281 | 2003-08-04Opie 1.0.0 |
281 | 282 | ||
282 | * Released as Version 1.0.0 | 283 | * Released as Version 1.0.0 |
283 | * Including a PPP module for easy dial up (tille,harlekin,zecke) | 284 | * Including a PPP module for easy dial up (tille,harlekin,zecke) |
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 123aee8..3af3d4c 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -1,143 +1,134 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "omanufacturerdb.h" | 29 | #include "omanufacturerdb.h" |
30 | 30 | ||
31 | #define OPIE_IMPROVE_GUI_LATENCY 1 | ||
32 | |||
33 | /* OPIE */ | 31 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
35 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
36 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 34 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
37 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
38 | #endif | 36 | #endif |
39 | 37 | ||
40 | 38 | ||
41 | 39 | ||
42 | /* QT */ | 40 | /* QT */ |
43 | #include <qapplication.h> | 41 | #include <qapplication.h> |
44 | #include <qfile.h> | 42 | #include <qfile.h> |
45 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
46 | 44 | ||
47 | using namespace Opie::Core; | 45 | using namespace Opie::Core; |
48 | namespace Opie { | 46 | namespace Opie { |
49 | namespace Net { | 47 | namespace Net { |
50 | 48 | ||
51 | OManufacturerDB* OManufacturerDB::_instance = 0; | 49 | OManufacturerDB* OManufacturerDB::_instance = 0; |
52 | 50 | ||
53 | OManufacturerDB* OManufacturerDB::instance() | 51 | OManufacturerDB* OManufacturerDB::instance() |
54 | { | 52 | { |
55 | if ( !OManufacturerDB::_instance ) | 53 | if ( !OManufacturerDB::_instance ) |
56 | { | 54 | { |
57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 55 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
58 | _instance = new OManufacturerDB(); | 56 | _instance = new OManufacturerDB(); |
59 | } | 57 | } |
60 | return _instance; | 58 | return _instance; |
61 | } | 59 | } |
62 | 60 | ||
63 | 61 | ||
64 | OManufacturerDB::OManufacturerDB() | 62 | OManufacturerDB::OManufacturerDB() |
65 | { | 63 | { |
66 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 64 | if ( qApp ) Global::statusMessage( "Reading Manufacturers..." ); |
67 | Global::statusMessage( "Reading Manufacturers..." ); | ||
68 | #endif | ||
69 | QString filename( "/etc/manufacturers" ); | 65 | QString filename( "/etc/manufacturers" ); |
70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 66 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
71 | if ( !QFile::exists( filename ) ) | 67 | if ( !QFile::exists( filename ) ) |
72 | { | 68 | { |
73 | filename = QPEApplication::qpeDir()+"etc/manufacturers"; | 69 | filename = QPEApplication::qpeDir()+"etc/manufacturers"; |
74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
75 | if ( !QFile::exists( filename ) ) | 71 | if ( !QFile::exists( filename ) ) |
76 | { | 72 | { |
77 | filename = "/usr/share/wellenreiter/manufacturers"; | 73 | filename = "/usr/share/wellenreiter/manufacturers"; |
78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
79 | } | 75 | } |
80 | } | 76 | } |
81 | 77 | ||
82 | QFile file( filename ); | 78 | QFile file( filename ); |
83 | bool hasFile = file.open( IO_ReadOnly ); | 79 | bool hasFile = file.open( IO_ReadOnly ); |
84 | if (!hasFile) | 80 | if (!hasFile) |
85 | { | 81 | { |
86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 82 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
87 | } | 83 | } |
88 | else | 84 | else |
89 | { | 85 | { |
90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 86 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
91 | QTextStream s( &file ); | 87 | QTextStream s( &file ); |
92 | QString addr; | 88 | QString addr; |
93 | QString manu; | 89 | QString manu; |
94 | QString extManu; | 90 | QString extManu; |
95 | #ifdef OPIE_IMPROVE_GUI_LATENCY | ||
96 | int counter = 0; | 91 | int counter = 0; |
97 | #endif | 92 | |
98 | while (!s.atEnd()) | 93 | while (!s.atEnd()) |
99 | { | 94 | { |
100 | s >> addr; | 95 | s >> addr; |
101 | s >> manu; | 96 | s >> manu; |
102 | s >> extManu; | 97 | s >> extManu; |
103 | 98 | ||
104 | manufacturers.insert( addr, manu ); | 99 | manufacturers.insert( addr, manu ); |
105 | manufacturersExt.insert( addr, extManu ); | 100 | manufacturersExt.insert( addr, extManu ); |
106 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; | 101 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; |
107 | #ifdef OPIE_IMPROVE_GUI_LATENCY | ||
108 | counter++; | 102 | counter++; |
109 | if ( counter == 50 ) | 103 | if ( counter == 50 ) |
110 | { | 104 | { |
111 | qApp->processEvents(); | 105 | if ( qApp ) qApp->processEvents(); |
112 | counter = 0; | 106 | counter = 0; |
113 | } | 107 | } |
114 | #endif | ||
115 | } | 108 | } |
116 | odebug << "OManufacturerDB: manufacturer list completed." << oendl; | 109 | odebug << "OManufacturerDB: manufacturer list completed." << oendl; |
117 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 110 | if ( qApp ) Global::statusMessage( "Manufacturers Complete..." ); |
118 | Global::statusMessage( "Manufacturers Complete..." ); | ||
119 | #endif | ||
120 | } | 111 | } |
121 | } | 112 | } |
122 | 113 | ||
123 | 114 | ||
124 | OManufacturerDB::~OManufacturerDB() | 115 | OManufacturerDB::~OManufacturerDB() |
125 | { | 116 | { |
126 | } | 117 | } |
127 | 118 | ||
128 | 119 | ||
129 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 120 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
130 | { | 121 | { |
131 | return manufacturers[macaddr.upper().left(8)]; | 122 | return manufacturers[macaddr.upper().left(8)]; |
132 | } | 123 | } |
133 | 124 | ||
134 | 125 | ||
135 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 126 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
136 | { | 127 | { |
137 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 128 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
138 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 129 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
139 | } | 130 | } |
140 | 131 | ||
141 | } | 132 | } |
142 | } | 133 | } |
143 | 134 | ||
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 0a74019..f4bdbe0 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,1380 +1,1387 @@ | |||
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 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
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 | 32 | ||
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/ostation.h> | 34 | #include <opie2/ostation.h> |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | 42 | ||
43 | /* UNIX */ | 43 | /* UNIX */ |
44 | 44 | ||
45 | #include <assert.h> | 45 | #include <assert.h> |
46 | #include <arpa/inet.h> | 46 | #include <arpa/inet.h> |
47 | #include <errno.h> | 47 | #include <errno.h> |
48 | #include <string.h> | 48 | #include <string.h> |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <sys/ioctl.h> | 51 | #include <sys/ioctl.h> |
52 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
53 | #include <sys/types.h> | 53 | #include <sys/types.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #include <linux/sockios.h> | 55 | #include <linux/sockios.h> |
56 | #include <net/if_arp.h> | 56 | #include <net/if_arp.h> |
57 | #include <net/ethernet.h> | 57 | #include <net/ethernet.h> |
58 | #include <stdarg.h> | 58 | #include <stdarg.h> |
59 | 59 | ||
60 | #ifndef NODEBUG | 60 | #ifndef NODEBUG |
61 | #include <opie2/odebugmapper.h> | 61 | #include <opie2/odebugmapper.h> |
62 | 62 | ||
63 | using namespace Opie::Core; | 63 | using namespace Opie::Core; |
64 | using namespace Opie::Net::Internal; | 64 | using namespace Opie::Net::Internal; |
65 | DebugMapper* debugmapper = new DebugMapper(); | 65 | DebugMapper* debugmapper = new DebugMapper(); |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /*====================================================================================== | 68 | /*====================================================================================== |
69 | * ONetwork | 69 | * ONetwork |
70 | *======================================================================================*/ | 70 | *======================================================================================*/ |
71 | 71 | ||
72 | namespace Opie { | 72 | namespace Opie { |
73 | namespace Net { | 73 | namespace Net { |
74 | ONetwork* ONetwork::_instance = 0; | 74 | ONetwork* ONetwork::_instance = 0; |
75 | 75 | ||
76 | ONetwork::ONetwork() | 76 | ONetwork::ONetwork() |
77 | { | 77 | { |
78 | odebug << "ONetwork::ONetwork()" << oendl; | 78 | odebug << "ONetwork::ONetwork()" << oendl; |
79 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 79 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
80 | synchronize(); | 80 | synchronize(); |
81 | } | 81 | } |
82 | 82 | ||
83 | void ONetwork::synchronize() | 83 | void ONetwork::synchronize() |
84 | { | 84 | { |
85 | // gather available interfaces by inspecting /proc/net/dev | 85 | // 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 | 86 | //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 | 87 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
88 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | 88 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev |
89 | 89 | ||
90 | _interfaces.clear(); | 90 | _interfaces.clear(); |
91 | QString str; | 91 | QString str; |
92 | QFile f( "/proc/net/dev" ); | 92 | QFile f( "/proc/net/dev" ); |
93 | bool hasFile = f.open( IO_ReadOnly ); | 93 | bool hasFile = f.open( IO_ReadOnly ); |
94 | if ( !hasFile ) | 94 | if ( !hasFile ) |
95 | { | 95 | { |
96 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; | 96 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | QTextStream s( &f ); | 99 | QTextStream s( &f ); |
100 | s.readLine(); | 100 | s.readLine(); |
101 | s.readLine(); | 101 | s.readLine(); |
102 | while ( !s.atEnd() ) | 102 | while ( !s.atEnd() ) |
103 | { | 103 | { |
104 | s >> str; | 104 | s >> str; |
105 | str.truncate( str.find( ':' ) ); | 105 | str.truncate( str.find( ':' ) ); |
106 | odebug << "ONetwork: found interface '" << str << "'" << oendl; | 106 | odebug << "ONetwork: found interface '" << str << "'" << oendl; |
107 | if ( str.startsWith( "wifi" ) ) | ||
108 | { | ||
109 | odebug << "ONetwork: ignoring hostap control interface" << oendl; | ||
110 | s.readLine(); | ||
111 | continue; | ||
112 | } | ||
107 | ONetworkInterface* iface = 0; | 113 | ONetworkInterface* iface = 0; |
108 | if ( isWirelessInterface( str ) ) | 114 | if ( isWirelessInterface( str ) ) |
109 | { | 115 | { |
110 | iface = new OWirelessNetworkInterface( this, (const char*) str ); | 116 | iface = new OWirelessNetworkInterface( this, (const char*) str ); |
111 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; | 117 | odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl; |
112 | } | 118 | } |
113 | else | 119 | else |
114 | { | 120 | { |
115 | iface = new ONetworkInterface( this, (const char*) str ); | 121 | iface = new ONetworkInterface( this, (const char*) str ); |
116 | } | 122 | } |
117 | _interfaces.insert( str, iface ); | 123 | _interfaces.insert( str, iface ); |
118 | s.readLine(); | 124 | s.readLine(); |
119 | } | 125 | } |
120 | } | 126 | } |
121 | 127 | ||
122 | 128 | ||
123 | short ONetwork::wirelessExtensionCompileVersion() | 129 | short ONetwork::wirelessExtensionCompileVersion() |
124 | { | 130 | { |
125 | return WIRELESS_EXT; | 131 | return WIRELESS_EXT; |
126 | } | 132 | } |
127 | 133 | ||
128 | 134 | ||
129 | int ONetwork::count() const | 135 | int ONetwork::count() const |
130 | { | 136 | { |
131 | return _interfaces.count(); | 137 | return _interfaces.count(); |
132 | } | 138 | } |
133 | 139 | ||
134 | 140 | ||
135 | ONetworkInterface* ONetwork::interface( const QString& iface ) const | 141 | ONetworkInterface* ONetwork::interface( const QString& iface ) const |
136 | { | 142 | { |
137 | return _interfaces[iface]; | 143 | return _interfaces[iface]; |
138 | } | 144 | } |
139 | 145 | ||
140 | 146 | ||
141 | ONetwork* ONetwork::instance() | 147 | ONetwork* ONetwork::instance() |
142 | { | 148 | { |
143 | if ( !_instance ) _instance = new ONetwork(); | 149 | if ( !_instance ) _instance = new ONetwork(); |
144 | return _instance; | 150 | return _instance; |
145 | } | 151 | } |
146 | 152 | ||
147 | 153 | ||
148 | ONetwork::InterfaceIterator ONetwork::iterator() const | 154 | ONetwork::InterfaceIterator ONetwork::iterator() const |
149 | { | 155 | { |
150 | return ONetwork::InterfaceIterator( _interfaces ); | 156 | return ONetwork::InterfaceIterator( _interfaces ); |
151 | } | 157 | } |
152 | 158 | ||
153 | 159 | ||
154 | bool ONetwork::isPresent( const char* name ) const | 160 | bool ONetwork::isPresent( const char* name ) const |
155 | { | 161 | { |
156 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 162 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
157 | struct ifreq ifr; | 163 | struct ifreq ifr; |
158 | memset( &ifr, 0, sizeof( struct ifreq ) ); | 164 | memset( &ifr, 0, sizeof( struct ifreq ) ); |
159 | strcpy( (char*) &ifr.ifr_name, name ); | 165 | strcpy( (char*) &ifr.ifr_name, name ); |
160 | int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr ); | 166 | int result = ::ioctl( sfd, SIOCGIFFLAGS, &ifr ); |
161 | return result != -1; | 167 | return result != -1; |
162 | } | 168 | } |
163 | 169 | ||
164 | 170 | ||
165 | bool ONetwork::isWirelessInterface( const char* name ) const | 171 | bool ONetwork::isWirelessInterface( const char* name ) const |
166 | { | 172 | { |
167 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); | 173 | int sfd = socket( AF_INET, SOCK_STREAM, 0 ); |
168 | struct iwreq iwr; | 174 | struct iwreq iwr; |
169 | memset( &iwr, 0, sizeof( struct iwreq ) ); | 175 | memset( &iwr, 0, sizeof( struct iwreq ) ); |
170 | strcpy( (char*) &iwr.ifr_name, name ); | 176 | strcpy( (char*) &iwr.ifr_name, name ); |
171 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); | 177 | int result = ::ioctl( sfd, SIOCGIWNAME, &iwr ); |
172 | return result != -1; | 178 | return result != -1; |
173 | } | 179 | } |
174 | 180 | ||
175 | /*====================================================================================== | 181 | /*====================================================================================== |
176 | * ONetworkInterface | 182 | * ONetworkInterface |
177 | *======================================================================================*/ | 183 | *======================================================================================*/ |
178 | 184 | ||
179 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) | 185 | ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) |
180 | :QObject( parent, name ), | 186 | :QObject( parent, name ), |
181 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) | 187 | _sfd( socket( AF_INET, SOCK_DGRAM, 0 ) ), _mon( 0 ) |
182 | { | 188 | { |
183 | odebug << "ONetworkInterface::ONetworkInterface()" << oendl; | 189 | odebug << "ONetworkInterface::ONetworkInterface()" << oendl; |
184 | init(); | 190 | init(); |
185 | } | 191 | } |
186 | 192 | ||
187 | 193 | ||
188 | struct ifreq& ONetworkInterface::ifr() const | 194 | struct ifreq& ONetworkInterface::ifr() const |
189 | { | 195 | { |
190 | return _ifr; | 196 | return _ifr; |
191 | } | 197 | } |
192 | 198 | ||
193 | 199 | ||
194 | void ONetworkInterface::init() | 200 | void ONetworkInterface::init() |
195 | { | 201 | { |
196 | odebug << "ONetworkInterface::init()" << oendl; | 202 | odebug << "ONetworkInterface::init()" << oendl; |
197 | 203 | ||
198 | memset( &_ifr, 0, sizeof( struct ifreq ) ); | 204 | memset( &_ifr, 0, sizeof( struct ifreq ) ); |
199 | 205 | ||
200 | if ( _sfd == -1 ) | 206 | if ( _sfd == -1 ) |
201 | { | 207 | { |
202 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; | 208 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; |
203 | return; | 209 | return; |
204 | } | 210 | } |
205 | } | 211 | } |
206 | 212 | ||
207 | 213 | ||
208 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const | 214 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const |
209 | { | 215 | { |
210 | #ifndef NODEBUG | 216 | #ifndef NODEBUG |
211 | int result = ::ioctl( _sfd, call, &ifreq ); | 217 | int result = ::ioctl( _sfd, call, &ifreq ); |
212 | if ( result == -1 ) | 218 | if ( result == -1 ) |
213 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) | 219 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) |
214 | << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; | 220 | << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; |
215 | else | 221 | else |
216 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) | 222 | odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call ) |
217 | << "' - Status: Ok." << oendl; | 223 | << "' - Status: Ok." << oendl; |
218 | return ( result != -1 ); | 224 | return ( result != -1 ); |
219 | #else | 225 | #else |
220 | return ::ioctl( _sfd, call, &ifreq ) != -1; | 226 | return ::ioctl( _sfd, call, &ifreq ) != -1; |
221 | #endif | 227 | #endif |
222 | } | 228 | } |
223 | 229 | ||
224 | 230 | ||
225 | bool ONetworkInterface::ioctl( int call ) const | 231 | bool ONetworkInterface::ioctl( int call ) const |
226 | { | 232 | { |
227 | strcpy( _ifr.ifr_name, name() ); | 233 | strcpy( _ifr.ifr_name, name() ); |
228 | return ioctl( call, _ifr ); | 234 | return ioctl( call, _ifr ); |
229 | } | 235 | } |
230 | 236 | ||
231 | 237 | ||
232 | bool ONetworkInterface::isLoopback() const | 238 | bool ONetworkInterface::isLoopback() const |
233 | { | 239 | { |
234 | ioctl( SIOCGIFFLAGS ); | 240 | ioctl( SIOCGIFFLAGS ); |
235 | return _ifr.ifr_flags & IFF_LOOPBACK; | 241 | return _ifr.ifr_flags & IFF_LOOPBACK; |
236 | } | 242 | } |
237 | 243 | ||
238 | 244 | ||
239 | bool ONetworkInterface::setUp( bool b ) | 245 | bool ONetworkInterface::setUp( bool b ) |
240 | { | 246 | { |
241 | ioctl( SIOCGIFFLAGS ); | 247 | ioctl( SIOCGIFFLAGS ); |
242 | if ( b ) _ifr.ifr_flags |= IFF_UP; | 248 | if ( b ) _ifr.ifr_flags |= IFF_UP; |
243 | else _ifr.ifr_flags &= (~IFF_UP); | 249 | else _ifr.ifr_flags &= (~IFF_UP); |
244 | return ioctl( SIOCSIFFLAGS ); | 250 | return ioctl( SIOCSIFFLAGS ); |
245 | } | 251 | } |
246 | 252 | ||
247 | 253 | ||
248 | bool ONetworkInterface::isUp() const | 254 | bool ONetworkInterface::isUp() const |
249 | { | 255 | { |
250 | ioctl( SIOCGIFFLAGS ); | 256 | ioctl( SIOCGIFFLAGS ); |
251 | return _ifr.ifr_flags & IFF_UP; | 257 | return _ifr.ifr_flags & IFF_UP; |
252 | } | 258 | } |
253 | 259 | ||
254 | 260 | ||
255 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) | 261 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) |
256 | { | 262 | { |
257 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 263 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
258 | sa->sin_family = AF_INET; | 264 | sa->sin_family = AF_INET; |
259 | sa->sin_port = 0; | 265 | sa->sin_port = 0; |
260 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 266 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
261 | ioctl( SIOCSIFADDR ); | 267 | ioctl( SIOCSIFADDR ); |
262 | } | 268 | } |
263 | 269 | ||
264 | 270 | ||
265 | QString ONetworkInterface::ipV4Address() const | 271 | QString ONetworkInterface::ipV4Address() const |
266 | { | 272 | { |
267 | if ( ioctl( SIOCGIFADDR ) ) | 273 | if ( ioctl( SIOCGIFADDR ) ) |
268 | { | 274 | { |
269 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 275 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
270 | //FIXME: Use QHostAddress here | 276 | //FIXME: Use QHostAddress here |
271 | return QString( inet_ntoa( sa->sin_addr ) ); | 277 | return QString( inet_ntoa( sa->sin_addr ) ); |
272 | } | 278 | } |
273 | else | 279 | else |
274 | return "<unknown>"; | 280 | return "<unknown>"; |
275 | 281 | ||
276 | } | 282 | } |
277 | 283 | ||
278 | 284 | ||
279 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) | 285 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) |
280 | { | 286 | { |
281 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; | 287 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; |
282 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); | 288 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); |
283 | ioctl( SIOCSIFHWADDR ); | 289 | ioctl( SIOCSIFHWADDR ); |
284 | } | 290 | } |
285 | 291 | ||
286 | 292 | ||
287 | OMacAddress ONetworkInterface::macAddress() const | 293 | OMacAddress ONetworkInterface::macAddress() const |
288 | { | 294 | { |
289 | if ( ioctl( SIOCGIFHWADDR ) ) | 295 | if ( ioctl( SIOCGIFHWADDR ) ) |
290 | { | 296 | { |
291 | return OMacAddress( _ifr ); | 297 | return OMacAddress( _ifr ); |
292 | } | 298 | } |
293 | else | 299 | else |
294 | { | 300 | { |
295 | return OMacAddress::unknown; | 301 | return OMacAddress::unknown; |
296 | } | 302 | } |
297 | } | 303 | } |
298 | 304 | ||
299 | 305 | ||
300 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) | 306 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) |
301 | { | 307 | { |
302 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 308 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
303 | sa->sin_family = AF_INET; | 309 | sa->sin_family = AF_INET; |
304 | sa->sin_port = 0; | 310 | sa->sin_port = 0; |
305 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 311 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
306 | ioctl( SIOCSIFNETMASK ); | 312 | ioctl( SIOCSIFNETMASK ); |
307 | } | 313 | } |
308 | 314 | ||
309 | 315 | ||
310 | QString ONetworkInterface::ipV4Netmask() const | 316 | QString ONetworkInterface::ipV4Netmask() const |
311 | { | 317 | { |
312 | if ( ioctl( SIOCGIFNETMASK ) ) | 318 | if ( ioctl( SIOCGIFNETMASK ) ) |
313 | { | 319 | { |
314 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 320 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
315 | //FIXME: Use QHostAddress here | 321 | //FIXME: Use QHostAddress here |
316 | return QString( inet_ntoa( sa->sin_addr ) ); | 322 | return QString( inet_ntoa( sa->sin_addr ) ); |
317 | } | 323 | } |
318 | else | 324 | else |
319 | return "<unknown>"; | 325 | return "<unknown>"; |
320 | } | 326 | } |
321 | 327 | ||
322 | 328 | ||
323 | int ONetworkInterface::dataLinkType() const | 329 | int ONetworkInterface::dataLinkType() const |
324 | { | 330 | { |
325 | if ( ioctl( SIOCGIFHWADDR ) ) | 331 | if ( ioctl( SIOCGIFHWADDR ) ) |
326 | { | 332 | { |
327 | return _ifr.ifr_hwaddr.sa_family; | 333 | return _ifr.ifr_hwaddr.sa_family; |
328 | } | 334 | } |
329 | else | 335 | else |
330 | { | 336 | { |
331 | return -1; | 337 | return -1; |
332 | } | 338 | } |
333 | } | 339 | } |
334 | 340 | ||
335 | 341 | ||
336 | void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) | 342 | void ONetworkInterface::setMonitoring( OMonitoringInterface* m ) |
337 | { | 343 | { |
338 | _mon = m; | 344 | _mon = m; |
339 | odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; | 345 | odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl; |
340 | } | 346 | } |
341 | 347 | ||
342 | 348 | ||
343 | OMonitoringInterface* ONetworkInterface::monitoring() const | 349 | OMonitoringInterface* ONetworkInterface::monitoring() const |
344 | { | 350 | { |
345 | return _mon; | 351 | return _mon; |
346 | } | 352 | } |
347 | 353 | ||
348 | 354 | ||
349 | ONetworkInterface::~ONetworkInterface() | 355 | ONetworkInterface::~ONetworkInterface() |
350 | { | 356 | { |
351 | odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; | 357 | odebug << "ONetworkInterface::~ONetworkInterface()" << oendl; |
352 | if ( _sfd != -1 ) ::close( _sfd ); | 358 | if ( _sfd != -1 ) ::close( _sfd ); |
353 | } | 359 | } |
354 | 360 | ||
355 | 361 | ||
356 | bool ONetworkInterface::setPromiscuousMode( bool b ) | 362 | bool ONetworkInterface::setPromiscuousMode( bool b ) |
357 | { | 363 | { |
358 | ioctl( SIOCGIFFLAGS ); | 364 | ioctl( SIOCGIFFLAGS ); |
359 | if ( b ) _ifr.ifr_flags |= IFF_PROMISC; | 365 | if ( b ) _ifr.ifr_flags |= IFF_PROMISC; |
360 | else _ifr.ifr_flags &= (~IFF_PROMISC); | 366 | else _ifr.ifr_flags &= (~IFF_PROMISC); |
361 | return ioctl( SIOCSIFFLAGS ); | 367 | return ioctl( SIOCSIFFLAGS ); |
362 | } | 368 | } |
363 | 369 | ||
364 | 370 | ||
365 | bool ONetworkInterface::promiscuousMode() const | 371 | bool ONetworkInterface::promiscuousMode() const |
366 | { | 372 | { |
367 | ioctl( SIOCGIFFLAGS ); | 373 | ioctl( SIOCGIFFLAGS ); |
368 | return _ifr.ifr_flags & IFF_PROMISC; | 374 | return _ifr.ifr_flags & IFF_PROMISC; |
369 | } | 375 | } |
370 | 376 | ||
371 | 377 | ||
372 | bool ONetworkInterface::isWireless() const | 378 | bool ONetworkInterface::isWireless() const |
373 | { | 379 | { |
374 | return ioctl( SIOCGIWNAME ); | 380 | return ioctl( SIOCGIWNAME ); |
375 | } | 381 | } |
376 | 382 | ||
377 | 383 | ||
378 | /*====================================================================================== | 384 | /*====================================================================================== |
379 | * OChannelHopper | 385 | * OChannelHopper |
380 | *======================================================================================*/ | 386 | *======================================================================================*/ |
381 | 387 | ||
382 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) | 388 | OChannelHopper::OChannelHopper( OWirelessNetworkInterface* iface ) |
383 | :QObject( 0, "Mickey's funky hopper" ), | 389 | :QObject( 0, "Mickey's funky hopper" ), |
384 | _iface( iface ), _interval( 0 ), _tid( 0 ) | 390 | _iface( iface ), _interval( 0 ), _tid( 0 ) |
385 | { | 391 | { |
386 | int _maxChannel = iface->channels(); | 392 | int _maxChannel = iface->channels(); |
387 | // generate fancy hopping sequence honoring the device capabilities | 393 | // generate fancy hopping sequence honoring the device capabilities |
388 | if ( _maxChannel >= 1 ) _channels.append( 1 ); | 394 | if ( _maxChannel >= 1 ) _channels.append( 1 ); |
389 | if ( _maxChannel >= 7 ) _channels.append( 7 ); | 395 | if ( _maxChannel >= 7 ) _channels.append( 7 ); |
390 | if ( _maxChannel >= 13 ) _channels.append( 13 ); | 396 | if ( _maxChannel >= 13 ) _channels.append( 13 ); |
391 | if ( _maxChannel >= 2 ) _channels.append( 2 ); | 397 | if ( _maxChannel >= 2 ) _channels.append( 2 ); |
392 | if ( _maxChannel >= 8 ) _channels.append( 8 ); | 398 | if ( _maxChannel >= 8 ) _channels.append( 8 ); |
393 | if ( _maxChannel >= 3 ) _channels.append( 3 ); | 399 | if ( _maxChannel >= 3 ) _channels.append( 3 ); |
394 | if ( _maxChannel >= 14 ) _channels.append( 14 ); | 400 | if ( _maxChannel >= 14 ) _channels.append( 14 ); |
395 | if ( _maxChannel >= 9 ) _channels.append( 9 ); | 401 | if ( _maxChannel >= 9 ) _channels.append( 9 ); |
396 | if ( _maxChannel >= 4 ) _channels.append( 4 ); | 402 | if ( _maxChannel >= 4 ) _channels.append( 4 ); |
397 | if ( _maxChannel >= 10 ) _channels.append( 10 ); | 403 | if ( _maxChannel >= 10 ) _channels.append( 10 ); |
398 | if ( _maxChannel >= 5 ) _channels.append( 5 ); | 404 | if ( _maxChannel >= 5 ) _channels.append( 5 ); |
399 | if ( _maxChannel >= 11 ) _channels.append( 11 ); | 405 | if ( _maxChannel >= 11 ) _channels.append( 11 ); |
400 | if ( _maxChannel >= 6 ) _channels.append( 6 ); | 406 | if ( _maxChannel >= 6 ) _channels.append( 6 ); |
401 | if ( _maxChannel >= 12 ) _channels.append( 12 ); | 407 | if ( _maxChannel >= 12 ) _channels.append( 12 ); |
402 | _channel = _channels.begin(); | 408 | _channel = _channels.begin(); |
403 | } | 409 | } |
404 | 410 | ||
405 | 411 | ||
406 | OChannelHopper::~OChannelHopper() | 412 | OChannelHopper::~OChannelHopper() |
407 | { | 413 | { |
408 | } | 414 | } |
409 | 415 | ||
410 | 416 | ||
411 | bool OChannelHopper::isActive() const | 417 | bool OChannelHopper::isActive() const |
412 | { | 418 | { |
413 | return _tid; | 419 | return _tid; |
414 | } | 420 | } |
415 | 421 | ||
416 | 422 | ||
417 | int OChannelHopper::channel() const | 423 | int OChannelHopper::channel() const |
418 | { | 424 | { |
419 | return *_channel; | 425 | return *_channel; |
420 | } | 426 | } |
421 | 427 | ||
422 | 428 | ||
423 | void OChannelHopper::timerEvent( QTimerEvent* ) | 429 | void OChannelHopper::timerEvent( QTimerEvent* ) |
424 | { | 430 | { |
425 | _iface->setChannel( *_channel ); | 431 | _iface->setChannel( *_channel ); |
426 | emit( hopped( *_channel ) ); | 432 | emit( hopped( *_channel ) ); |
427 | odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl; | 433 | odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl; |
428 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); | 434 | if ( ++_channel == _channels.end() ) _channel = _channels.begin(); |
429 | } | 435 | } |
430 | 436 | ||
431 | 437 | ||
432 | void OChannelHopper::setInterval( int interval ) | 438 | void OChannelHopper::setInterval( int interval ) |
433 | { | 439 | { |
434 | if ( interval == _interval ) | 440 | if ( interval == _interval ) |
435 | return; | 441 | return; |
436 | 442 | ||
437 | if ( _interval ) | 443 | if ( _interval ) |
438 | killTimer( _tid ); | 444 | killTimer( _tid ); |
439 | 445 | ||
440 | _tid = 0; | 446 | _tid = 0; |
441 | _interval = interval; | 447 | _interval = interval; |
442 | 448 | ||
443 | if ( _interval ) | 449 | if ( _interval ) |
444 | { | 450 | { |
445 | _tid = startTimer( interval ); | 451 | _tid = startTimer( interval ); |
446 | } | 452 | } |
447 | } | 453 | } |
448 | 454 | ||
449 | 455 | ||
450 | int OChannelHopper::interval() const | 456 | int OChannelHopper::interval() const |
451 | { | 457 | { |
452 | return _interval; | 458 | return _interval; |
453 | } | 459 | } |
454 | 460 | ||
455 | 461 | ||
456 | /*====================================================================================== | 462 | /*====================================================================================== |
457 | * OWirelessNetworkInterface | 463 | * OWirelessNetworkInterface |
458 | *======================================================================================*/ | 464 | *======================================================================================*/ |
459 | 465 | ||
460 | OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) | 466 | OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const char* name ) |
461 | :ONetworkInterface( parent, name ), _hopper( 0 ) | 467 | :ONetworkInterface( parent, name ), _hopper( 0 ) |
462 | { | 468 | { |
463 | odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl; | 469 | odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl; |
464 | init(); | 470 | init(); |
465 | } | 471 | } |
466 | 472 | ||
467 | 473 | ||
468 | OWirelessNetworkInterface::~OWirelessNetworkInterface() | 474 | OWirelessNetworkInterface::~OWirelessNetworkInterface() |
469 | { | 475 | { |
470 | } | 476 | } |
471 | 477 | ||
472 | 478 | ||
473 | struct iwreq& OWirelessNetworkInterface::iwr() const | 479 | struct iwreq& OWirelessNetworkInterface::iwr() const |
474 | { | 480 | { |
475 | return _iwr; | 481 | return _iwr; |
476 | } | 482 | } |
477 | 483 | ||
478 | 484 | ||
479 | void OWirelessNetworkInterface::init() | 485 | void OWirelessNetworkInterface::init() |
480 | { | 486 | { |
481 | odebug << "OWirelessNetworkInterface::init()" << oendl; | 487 | odebug << "OWirelessNetworkInterface::init()" << oendl; |
482 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 488 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
483 | buildInformation(); | 489 | buildInformation(); |
484 | buildPrivateList(); | 490 | buildPrivateList(); |
485 | dumpInformation(); | 491 | dumpInformation(); |
486 | } | 492 | } |
487 | 493 | ||
488 | 494 | ||
489 | bool OWirelessNetworkInterface::isAssociated() const | 495 | bool OWirelessNetworkInterface::isAssociated() const |
490 | { | 496 | { |
491 | //FIXME: handle different modes | 497 | //FIXME: handle different modes |
492 | return !(associatedAP() == OMacAddress::unknown); | 498 | return !(associatedAP() == OMacAddress::unknown); |
493 | } | 499 | } |
494 | 500 | ||
495 | 501 | ||
496 | void OWirelessNetworkInterface::setAssociatedAP( const OMacAddress& mac ) const | 502 | void OWirelessNetworkInterface::setAssociatedAP( const OMacAddress& mac ) const |
497 | { | 503 | { |
498 | _iwr.u.ap_addr.sa_family = ARPHRD_ETHER; | 504 | _iwr.u.ap_addr.sa_family = ARPHRD_ETHER; |
499 | ::memcpy(_iwr.u.ap_addr.sa_data, mac.native(), ETH_ALEN); | 505 | ::memcpy(_iwr.u.ap_addr.sa_data, mac.native(), ETH_ALEN); |
500 | wioctl( SIOCSIWAP ); | 506 | wioctl( SIOCSIWAP ); |
501 | } | 507 | } |
502 | 508 | ||
503 | 509 | ||
504 | OMacAddress OWirelessNetworkInterface::associatedAP() const | 510 | OMacAddress OWirelessNetworkInterface::associatedAP() const |
505 | { | 511 | { |
506 | if ( ioctl( SIOCGIWAP ) ) | 512 | if ( ioctl( SIOCGIWAP ) ) |
507 | return (const unsigned char*) &_ifr.ifr_hwaddr.sa_data[0]; | 513 | return (const unsigned char*) &_ifr.ifr_hwaddr.sa_data[0]; |
508 | else | 514 | else |
509 | return OMacAddress::unknown; | 515 | return OMacAddress::unknown; |
510 | } | 516 | } |
511 | 517 | ||
512 | 518 | ||
513 | void OWirelessNetworkInterface::buildInformation() | 519 | void OWirelessNetworkInterface::buildInformation() |
514 | { | 520 | { |
515 | //ML: If you listen carefully enough, you can hear lots of WLAN drivers suck | 521 | //ML: If you listen carefully enough, you can hear lots of WLAN drivers suck |
516 | //ML: The HostAP drivers need more than sizeof struct_iw range to complete | 522 | //ML: The HostAP drivers need more than sizeof struct_iw range to complete |
517 | //ML: SIOCGIWRANGE otherwise they fail with "Invalid Argument Length". | 523 | //ML: SIOCGIWRANGE otherwise they fail with "Invalid Argument Length". |
518 | //ML: The Wlan-NG drivers on the otherside fail (segfault!) if you allocate | 524 | //ML: The Wlan-NG drivers on the otherside fail (segfault!) if you allocate |
519 | //ML: _too much_ space. This is damn shitty crap *sigh* | 525 | //ML: _too much_ space. This is damn shitty crap *sigh* |
520 | //ML: We allocate a large memory region in RAM and check whether the | 526 | //ML: We allocate a large memory region in RAM and check whether the |
521 | //ML: driver pollutes this extra space. The complaint will be made on stdout, | 527 | //ML: driver pollutes this extra space. The complaint will be made on stdout, |
522 | //ML: so please forward this... | 528 | //ML: so please forward this... |
523 | 529 | ||
524 | struct iwreq wrq; | 530 | struct iwreq wrq; |
525 | int len = sizeof( struct iw_range )*2; | 531 | int len = sizeof( struct iw_range )*2; |
526 | char *buffer = (char*) malloc( len ); | 532 | char *buffer = (char*) malloc( len ); |
527 | //FIXME: Validate if we actually got the memory block | 533 | //FIXME: Validate if we actually got the memory block |
528 | memset( buffer, 0, len ); | 534 | memset( buffer, 0, len ); |
529 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); | 535 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); |
530 | wrq.u.data.pointer = (caddr_t) buffer; | 536 | wrq.u.data.pointer = (caddr_t) buffer; |
531 | wrq.u.data.length = sizeof( struct iw_range ); | 537 | wrq.u.data.length = sizeof( struct iw_range ); |
532 | wrq.u.data.flags = 0; | 538 | wrq.u.data.flags = 0; |
533 | 539 | ||
534 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) | 540 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) |
535 | { | 541 | { |
536 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get channel information - using default values." << oendl; | 542 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get channel information - using default values." << oendl; |
537 | _channels.insert( 2412, 1 ); // 2.412 GHz | 543 | _channels.insert( 2412, 1 ); // 2.412 GHz |
538 | _channels.insert( 2417, 2 ); // 2.417 GHz | 544 | _channels.insert( 2417, 2 ); // 2.417 GHz |
539 | _channels.insert( 2422, 3 ); // 2.422 GHz | 545 | _channels.insert( 2422, 3 ); // 2.422 GHz |
540 | _channels.insert( 2427, 4 ); // 2.427 GHz | 546 | _channels.insert( 2427, 4 ); // 2.427 GHz |
541 | _channels.insert( 2432, 5 ); // 2.432 GHz | 547 | _channels.insert( 2432, 5 ); // 2.432 GHz |
542 | _channels.insert( 2437, 6 ); // 2.437 GHz | 548 | _channels.insert( 2437, 6 ); // 2.437 GHz |
543 | _channels.insert( 2442, 7 ); // 2.442 GHz | 549 | _channels.insert( 2442, 7 ); // 2.442 GHz |
544 | _channels.insert( 2447, 8 ); // 2.447 GHz | 550 | _channels.insert( 2447, 8 ); // 2.447 GHz |
545 | _channels.insert( 2452, 9 ); // 2.452 GHz | 551 | _channels.insert( 2452, 9 ); // 2.452 GHz |
546 | _channels.insert( 2457, 10 ); // 2.457 GHz | 552 | _channels.insert( 2457, 10 ); // 2.457 GHz |
547 | _channels.insert( 2462, 11 ); // 2.462 GHz | 553 | _channels.insert( 2462, 11 ); // 2.462 GHz |
548 | 554 | ||
549 | memset( &_range, 0, sizeof( struct iw_range ) ); | 555 | memset( &_range, 0, sizeof( struct iw_range ) ); |
550 | } | 556 | } |
551 | else | 557 | else |
552 | { | 558 | { |
553 | // <check if the driver overwrites stuff> | 559 | // <check if the driver overwrites stuff> |
554 | int max = 0; | 560 | int max = 0; |
555 | for ( int r = sizeof( struct iw_range ); r < len; r++ ) | 561 | for ( int r = sizeof( struct iw_range ); r < len; r++ ) |
556 | if (buffer[r] != 0) | 562 | if (buffer[r] != 0) |
557 | max = r; | 563 | max = r; |
558 | if (max > 0) | 564 | if (max > 0) |
559 | { | 565 | { |
560 | owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name() | 566 | owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name() |
561 | << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl; | 567 | << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl; |
562 | } | 568 | } |
563 | // </check if the driver overwrites stuff> | 569 | // </check if the driver overwrites stuff> |
564 | 570 | ||
565 | struct iw_range range; | 571 | struct iw_range range; |
566 | memcpy( &range, buffer, sizeof range ); | 572 | memcpy( &range, buffer, sizeof range ); |
567 | 573 | ||
568 | odebug << "OWirelessNetworkInterface::buildInformation(): Interface reported to have " << (int) range.num_frequency << " channels." << oendl; | 574 | odebug << "OWirelessNetworkInterface::buildInformation(): Interface reported to have " << (int) range.num_frequency << " channels." << oendl; |
569 | for ( int i = 0; i < range.num_frequency; ++i ) | 575 | for ( int i = 0; i < range.num_frequency; ++i ) |
570 | { | 576 | { |
571 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); | 577 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); |
572 | odebug << "OWirelessNetworkInterface::buildInformation: Adding frequency " << freq << " as channel " << i+1 << oendl; | 578 | odebug << "OWirelessNetworkInterface::buildInformation: Adding frequency " << freq << " as channel " << i+1 << oendl; |
573 | _channels.insert( freq, i+1 ); | 579 | _channels.insert( freq, i+1 ); |
574 | } | 580 | } |
575 | } | 581 | } |
576 | 582 | ||
577 | memcpy( &_range, buffer, sizeof( struct iw_range ) ); | 583 | memcpy( &_range, buffer, sizeof( struct iw_range ) ); |
578 | odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl; | 584 | odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl; |
579 | free(buffer); | 585 | free(buffer); |
580 | } | 586 | } |
581 | 587 | ||
582 | 588 | ||
583 | short OWirelessNetworkInterface::wirelessExtensionDriverVersion() const | 589 | short OWirelessNetworkInterface::wirelessExtensionDriverVersion() const |
584 | { | 590 | { |
585 | return _range.we_version_compiled; | 591 | return _range.we_version_compiled; |
586 | } | 592 | } |
587 | 593 | ||
588 | 594 | ||
589 | void OWirelessNetworkInterface::buildPrivateList() | 595 | void OWirelessNetworkInterface::buildPrivateList() |
590 | { | 596 | { |
591 | odebug << "OWirelessNetworkInterface::buildPrivateList()" << oendl; | 597 | odebug << "OWirelessNetworkInterface::buildPrivateList()" << oendl; |
592 | 598 | ||
593 | struct iw_priv_args priv[IW_MAX_PRIV_DEF]; | 599 | struct iw_priv_args priv[IW_MAX_PRIV_DEF]; |
594 | 600 | ||
595 | _iwr.u.data.pointer = (char*) &priv; | 601 | _iwr.u.data.pointer = (char*) &priv; |
596 | _iwr.u.data.length = IW_MAX_PRIV_DEF; // length in terms of number of (sizeof iw_priv_args), not (sizeof iw_priv_args) itself | 602 | _iwr.u.data.length = IW_MAX_PRIV_DEF; // length in terms of number of (sizeof iw_priv_args), not (sizeof iw_priv_args) itself |
597 | _iwr.u.data.flags = 0; | 603 | _iwr.u.data.flags = 0; |
598 | 604 | ||
599 | if ( !wioctl( SIOCGIWPRIV ) ) | 605 | if ( !wioctl( SIOCGIWPRIV ) ) |
600 | { | 606 | { |
601 | owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information." << oendl; | 607 | owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information." << oendl; |
602 | return; | 608 | return; |
603 | } | 609 | } |
604 | 610 | ||
605 | for ( int i = 0; i < _iwr.u.data.length; ++i ) | 611 | for ( int i = 0; i < _iwr.u.data.length; ++i ) |
606 | { | 612 | { |
607 | new OPrivateIOCTL( this, priv[i].name, priv[i].cmd, priv[i].get_args, priv[i].set_args ); | 613 | new OPrivateIOCTL( this, priv[i].name, priv[i].cmd, priv[i].get_args, priv[i].set_args ); |
608 | } | 614 | } |
609 | odebug << "OWirelessNetworkInterface::buildPrivateList(): Private ioctl list constructed." << oendl; | 615 | odebug << "OWirelessNetworkInterface::buildPrivateList(): Private ioctl list constructed." << oendl; |
610 | } | 616 | } |
611 | 617 | ||
612 | 618 | ||
613 | void OWirelessNetworkInterface::dumpInformation() const | 619 | void OWirelessNetworkInterface::dumpInformation() const |
614 | { | 620 | { |
615 | odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl; | 621 | odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl; |
616 | 622 | ||
617 | odebug << " - driver's idea of maximum throughput is " << _range.throughput | 623 | odebug << " - driver's idea of maximum throughput is " << _range.throughput |
618 | << " bps = " << ( _range.throughput / 8 ) << " byte/s = " << ( _range.throughput / 8 / 1024 ) | 624 | << " bps = " << ( _range.throughput / 8 ) << " byte/s = " << ( _range.throughput / 8 / 1024 ) |
619 | << " Kb/s = " << QString().sprintf("%f.2", float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 ) | 625 | << " Kb/s = " << QString().sprintf("%f.2", float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 ) |
620 | << " Mb/s" << oendl; | 626 | << " Mb/s" << oendl; |
621 | 627 | ||
622 | odebug << " - driver for '" << name() << "' (V" << _range.we_version_source | 628 | odebug << " - driver for '" << name() << "' (V" << _range.we_version_source |
623 | << ") has been compiled against WE V" << _range.we_version_compiled << oendl; | 629 | << ") has been compiled against WE V" << _range.we_version_compiled << oendl; |
624 | 630 | ||
625 | if ( _range.we_version_compiled != WIRELESS_EXT ) | 631 | if ( _range.we_version_compiled != WIRELESS_EXT ) |
626 | { | 632 | { |
627 | owarn << "Version mismatch! WE_DRIVER = " << _range.we_version_compiled << " and WE_OPIENET = " << WIRELESS_EXT << oendl; | 633 | owarn << "Version mismatch! WE_DRIVER = " << _range.we_version_compiled << " and WE_OPIENET = " << WIRELESS_EXT << oendl; |
628 | } | 634 | } |
629 | 635 | ||
630 | odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl; | 636 | odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl; |
631 | } | 637 | } |
632 | 638 | ||
633 | 639 | ||
634 | int OWirelessNetworkInterface::channel() const | 640 | int OWirelessNetworkInterface::channel() const |
635 | { | 641 | { |
636 | //FIXME: When monitoring enabled, then use it | 642 | //FIXME: When monitoring enabled, then use it |
637 | //FIXME: to gather the current RF channel | 643 | //FIXME: to gather the current RF channel |
638 | //FIXME: Until then, get active channel from hopper. | 644 | //FIXME: Until then, get active channel from hopper. |
639 | if ( _hopper && _hopper->isActive() ) | 645 | if ( _hopper && _hopper->isActive() ) |
640 | return _hopper->channel(); | 646 | return _hopper->channel(); |
641 | 647 | ||
642 | if ( !wioctl( SIOCGIWFREQ ) ) | 648 | if ( !wioctl( SIOCGIWFREQ ) ) |
643 | { | 649 | { |
644 | return -1; | 650 | return -1; |
645 | } | 651 | } |
646 | else | 652 | else |
647 | { | 653 | { |
648 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; | 654 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; |
649 | } | 655 | } |
650 | } | 656 | } |
651 | 657 | ||
652 | 658 | ||
653 | void OWirelessNetworkInterface::setChannel( int c ) const | 659 | void OWirelessNetworkInterface::setChannel( int c ) const |
654 | { | 660 | { |
655 | if ( !c ) | 661 | if ( !c ) |
656 | { | 662 | { |
657 | oerr << "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" << oendl; | 663 | oerr << "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" << oendl; |
658 | return; | 664 | return; |
659 | } | 665 | } |
660 | 666 | ||
661 | if ( !_mon ) | 667 | if ( !_mon ) |
662 | { | 668 | { |
663 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 669 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
664 | _iwr.u.freq.m = c; | 670 | _iwr.u.freq.m = c; |
665 | _iwr.u.freq.e = 0; | 671 | _iwr.u.freq.e = 0; |
666 | wioctl( SIOCSIWFREQ ); | 672 | wioctl( SIOCSIWFREQ ); |
667 | } | 673 | } |
668 | else | 674 | else |
669 | { | 675 | { |
670 | _mon->setChannel( c ); | 676 | _mon->setChannel( c ); |
671 | } | 677 | } |
672 | } | 678 | } |
673 | 679 | ||
674 | 680 | ||
675 | double OWirelessNetworkInterface::frequency() const | 681 | double OWirelessNetworkInterface::frequency() const |
676 | { | 682 | { |
677 | if ( !wioctl( SIOCGIWFREQ ) ) | 683 | if ( !wioctl( SIOCGIWFREQ ) ) |
678 | { | 684 | { |
679 | return -1.0; | 685 | return -1.0; |
680 | } | 686 | } |
681 | else | 687 | else |
682 | { | 688 | { |
683 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; | 689 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; |
684 | } | 690 | } |
685 | } | 691 | } |
686 | 692 | ||
687 | 693 | ||
688 | int OWirelessNetworkInterface::channels() const | 694 | int OWirelessNetworkInterface::channels() const |
689 | { | 695 | { |
690 | return _channels.count(); | 696 | return _channels.count(); |
691 | } | 697 | } |
692 | 698 | ||
693 | 699 | ||
694 | void OWirelessNetworkInterface::setChannelHopping( int interval ) | 700 | void OWirelessNetworkInterface::setChannelHopping( int interval ) |
695 | { | 701 | { |
696 | if ( !_hopper ) _hopper = new OChannelHopper( this ); | 702 | if ( !_hopper ) _hopper = new OChannelHopper( this ); |
697 | _hopper->setInterval( interval ); | 703 | _hopper->setInterval( interval ); |
698 | //FIXME: When and by whom will the channel hopper be deleted? | 704 | //FIXME: When and by whom will the channel hopper be deleted? |
699 | //TODO: rely on QObject hierarchy | 705 | //TODO: rely on QObject hierarchy |
700 | } | 706 | } |
701 | 707 | ||
702 | 708 | ||
703 | int OWirelessNetworkInterface::channelHopping() const | 709 | int OWirelessNetworkInterface::channelHopping() const |
704 | { | 710 | { |
705 | return _hopper->interval(); | 711 | return _hopper->interval(); |
706 | } | 712 | } |
707 | 713 | ||
708 | 714 | ||
709 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const | 715 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const |
710 | { | 716 | { |
711 | return _hopper; | 717 | return _hopper; |
712 | } | 718 | } |
713 | 719 | ||
714 | 720 | ||
715 | void OWirelessNetworkInterface::commit() const | 721 | void OWirelessNetworkInterface::commit() const |
716 | { | 722 | { |
717 | wioctl( SIOCSIWCOMMIT ); | 723 | wioctl( SIOCSIWCOMMIT ); |
718 | } | 724 | } |
719 | 725 | ||
720 | 726 | ||
721 | void OWirelessNetworkInterface::setMode( const QString& newMode ) | 727 | void OWirelessNetworkInterface::setMode( const QString& newMode ) |
722 | { | 728 | { |
723 | #ifdef FINALIZE | 729 | #ifdef FINALIZE |
724 | QString currentMode = mode(); | 730 | QString currentMode = mode(); |
725 | if ( currentMode == newMode ) return; | 731 | if ( currentMode == newMode ) return; |
726 | #endif | 732 | #endif |
727 | 733 | ||
728 | odebug << "OWirelessNetworkInterface::setMode(): trying to set mode " << newMode << oendl; | 734 | odebug << "OWirelessNetworkInterface::setMode(): trying to set mode " << newMode << oendl; |
729 | 735 | ||
730 | _iwr.u.mode = stringToMode( newMode ); | 736 | _iwr.u.mode = stringToMode( newMode ); |
731 | 737 | ||
732 | if ( _iwr.u.mode != IW_MODE_MONITOR ) | 738 | if ( _iwr.u.mode != IW_MODE_MONITOR ) |
733 | { | 739 | { |
734 | // IWR.U.MODE WIRD DURCH ABFRAGE DES MODE HIER PLATTGEMACHT!!!!!!!!!!!!!!!!!!!!! DEPP! | 740 | // IWR.U.MODE WIRD DURCH ABFRAGE DES MODE HIER PLATTGEMACHT!!!!!!!!!!!!!!!!!!!!! DEPP! |
735 | _iwr.u.mode = stringToMode( newMode ); | 741 | _iwr.u.mode = stringToMode( newMode ); |
736 | wioctl( SIOCSIWMODE ); | 742 | wioctl( SIOCSIWMODE ); |
737 | 743 | ||
738 | // special iwpriv fallback for monitor mode (check if we're really out of monitor mode now) | 744 | // special iwpriv fallback for monitor mode (check if we're really out of monitor mode now) |
739 | 745 | ||
740 | if ( mode() == "monitor" ) | 746 | if ( mode() == "monitor" ) |
741 | { | 747 | { |
742 | odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." << oendl; | 748 | odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." << oendl; |
743 | if ( _mon ) | 749 | if ( _mon ) |
744 | _mon->setEnabled( false ); | 750 | _mon->setEnabled( false ); |
745 | else | 751 | else |
746 | odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl; | 752 | odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl; |
747 | } | 753 | } |
748 | 754 | ||
749 | } | 755 | } |
750 | else // special iwpriv fallback for monitor mode | 756 | else // special iwpriv fallback for monitor mode |
751 | { | 757 | { |
752 | if ( wioctl( SIOCSIWMODE ) ) | 758 | if ( wioctl( SIOCSIWMODE ) ) |
753 | { | 759 | { |
754 | odebug << "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" << oendl; | 760 | odebug << "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" << oendl; |
755 | } | 761 | } |
756 | else | 762 | else |
757 | { | 763 | { |
758 | odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." << oendl; | 764 | odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." << oendl; |
759 | 765 | ||
760 | if ( _mon ) | 766 | if ( _mon ) |
761 | _mon->setEnabled( true ); | 767 | _mon->setEnabled( true ); |
762 | else | 768 | else |
763 | odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl; | 769 | odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl; |
764 | } | 770 | } |
765 | } | 771 | } |
766 | } | 772 | } |
767 | 773 | ||
768 | 774 | ||
769 | QString OWirelessNetworkInterface::mode() const | 775 | QString OWirelessNetworkInterface::mode() const |
770 | { | 776 | { |
771 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 777 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
772 | 778 | ||
773 | if ( !wioctl( SIOCGIWMODE ) ) | 779 | if ( !wioctl( SIOCGIWMODE ) ) |
774 | { | 780 | { |
775 | return "<unknown>"; | 781 | return "<unknown>"; |
776 | } | 782 | } |
777 | 783 | ||
778 | odebug << "OWirelessNetworkInterface::setMode(): WE's idea of current mode seems to be " << modeToString( _iwr.u.mode ) << oendl; | 784 | odebug << "OWirelessNetworkInterface::setMode(): WE's idea of current mode seems to be " << modeToString( _iwr.u.mode ) << oendl; |
779 | 785 | ||
780 | // legacy compatible monitor mode check | 786 | // legacy compatible monitor mode check |
781 | 787 | ||
782 | if ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 ) | 788 | if ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 ) |
783 | { | 789 | { |
784 | return "monitor"; | 790 | return "monitor"; |
785 | } | 791 | } |
786 | else | 792 | else |
787 | { | 793 | { |
788 | return modeToString( _iwr.u.mode ); | 794 | return modeToString( _iwr.u.mode ); |
789 | } | 795 | } |
790 | } | 796 | } |
791 | 797 | ||
792 | void OWirelessNetworkInterface::setNickName( const QString& nickname ) | 798 | void OWirelessNetworkInterface::setNickName( const QString& nickname ) |
793 | { | 799 | { |
794 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname ); | 800 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname ); |
795 | _iwr.u.essid.length = nickname.length(); | 801 | _iwr.u.essid.length = nickname.length(); |
796 | wioctl( SIOCSIWNICKN ); | 802 | wioctl( SIOCSIWNICKN ); |
797 | } | 803 | } |
798 | 804 | ||
799 | 805 | ||
800 | QString OWirelessNetworkInterface::nickName() const | 806 | QString OWirelessNetworkInterface::nickName() const |
801 | { | 807 | { |
802 | char str[IW_ESSID_MAX_SIZE]; | 808 | char str[IW_ESSID_MAX_SIZE]; |
803 | _iwr.u.data.pointer = &str[0]; | 809 | _iwr.u.data.pointer = &str[0]; |
804 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; | 810 | _iwr.u.data.length = IW_ESSID_MAX_SIZE; |
805 | if ( !wioctl( SIOCGIWNICKN ) ) | 811 | if ( !wioctl( SIOCGIWNICKN ) ) |
806 | { | 812 | { |
807 | return "<unknown>"; | 813 | return "<unknown>"; |
808 | } | 814 | } |
809 | else | 815 | else |
810 | { | 816 | { |
811 | str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string | 817 | str[_iwr.u.data.length] = '\0'; // some drivers don't zero-terminate the string |
812 | return str; | 818 | return str; |
813 | } | 819 | } |
814 | } | 820 | } |
815 | 821 | ||
816 | 822 | ||
817 | void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) | 823 | void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) |
818 | { | 824 | { |
819 | OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); | 825 | OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); |
820 | if ( !priv ) | 826 | if ( !priv ) |
821 | { | 827 | { |
822 | owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name() | 828 | owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name() |
823 | << "' does not support private ioctl '" << call << "'" << oendl; | 829 | << "' does not support private ioctl '" << call << "'" << oendl; |
824 | return; | 830 | return; |
825 | } | 831 | } |
826 | if ( priv->numberSetArgs() != numargs ) | 832 | if ( priv->numberSetArgs() != numargs ) |
827 | { | 833 | { |
828 | owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '" | 834 | owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '" |
829 | << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl; | 835 | << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl; |
830 | return; | 836 | return; |
831 | } | 837 | } |
832 | 838 | ||
833 | odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl; | 839 | odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl; |
834 | memset( &_iwr, 0, sizeof _iwr ); | 840 | memset( &_iwr, 0, sizeof _iwr ); |
835 | va_list argp; | 841 | va_list argp; |
836 | va_start( argp, numargs ); | 842 | va_start( argp, numargs ); |
837 | for ( int i = 0; i < numargs; ++i ) | 843 | for ( int i = 0; i < numargs; ++i ) |
838 | { | 844 | { |
839 | priv->setParameter( i, va_arg( argp, int ) ); | 845 | priv->setParameter( i, va_arg( argp, int ) ); |
840 | } | 846 | } |
841 | va_end( argp ); | 847 | va_end( argp ); |
842 | priv->invoke(); | 848 | priv->invoke(); |
843 | } | 849 | } |
844 | 850 | ||
845 | 851 | ||
846 | void OWirelessNetworkInterface::getPrivate( const QString& ) | 852 | void OWirelessNetworkInterface::getPrivate( const QString& ) |
847 | { | 853 | { |
848 | oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl; | 854 | oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl; |
849 | } | 855 | } |
850 | 856 | ||
851 | 857 | ||
852 | bool OWirelessNetworkInterface::hasPrivate( const QString& call ) | 858 | bool OWirelessNetworkInterface::hasPrivate( const QString& call ) |
853 | { | 859 | { |
854 | return child( call.local8Bit() ); | 860 | return child( call.local8Bit() ); |
855 | } | 861 | } |
856 | 862 | ||
857 | 863 | ||
858 | QString OWirelessNetworkInterface::SSID() const | 864 | QString OWirelessNetworkInterface::SSID() const |
859 | { | 865 | { |
860 | char str[IW_ESSID_MAX_SIZE]; | 866 | char str[IW_ESSID_MAX_SIZE]; |
861 | _iwr.u.essid.pointer = &str[0]; | 867 | _iwr.u.essid.pointer = &str[0]; |
862 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 868 | _iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
863 | if ( !wioctl( SIOCGIWESSID ) ) | 869 | if ( !wioctl( SIOCGIWESSID ) ) |
864 | { | 870 | { |
865 | return "<unknown>"; | 871 | return "<unknown>"; |
866 | } | 872 | } |
867 | else | 873 | else |
868 | { | 874 | { |
875 | str[_iwr.u.essid.length] = '\0'; // some drivers don't zero-terminate the string | ||
869 | return str; | 876 | return str; |
870 | } | 877 | } |
871 | } | 878 | } |
872 | 879 | ||
873 | 880 | ||
874 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) | 881 | void OWirelessNetworkInterface::setSSID( const QString& ssid ) |
875 | { | 882 | { |
876 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); | 883 | _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); |
877 | _iwr.u.essid.length = ssid.length()+1; // zero byte | 884 | _iwr.u.essid.length = ssid.length()+1; // zero byte |
878 | wioctl( SIOCSIWESSID ); | 885 | wioctl( SIOCSIWESSID ); |
879 | } | 886 | } |
880 | 887 | ||
881 | 888 | ||
882 | OStationList* OWirelessNetworkInterface::scanNetwork() | 889 | OStationList* OWirelessNetworkInterface::scanNetwork() |
883 | { | 890 | { |
884 | _iwr.u.param.flags = IW_SCAN_DEFAULT; | 891 | _iwr.u.param.flags = IW_SCAN_DEFAULT; |
885 | _iwr.u.param.value = 0; | 892 | _iwr.u.param.value = 0; |
886 | if ( !wioctl( SIOCSIWSCAN ) ) | 893 | if ( !wioctl( SIOCSIWSCAN ) ) |
887 | { | 894 | { |
888 | return 0; | 895 | return 0; |
889 | } | 896 | } |
890 | 897 | ||
891 | OStationList* stations = new OStationList(); | 898 | OStationList* stations = new OStationList(); |
892 | 899 | ||
893 | int timeout = 10000000; | 900 | int timeout = 10000000; |
894 | 901 | ||
895 | odebug << "ONetworkInterface::scanNetwork() - scan started." << oendl; | 902 | odebug << "ONetworkInterface::scanNetwork() - scan started." << oendl; |
896 | 903 | ||
897 | bool results = false; | 904 | bool results = false; |
898 | struct timeval tv; | 905 | struct timeval tv; |
899 | tv.tv_sec = 0; | 906 | tv.tv_sec = 0; |
900 | tv.tv_usec = 250000; // initial timeout ~ 250ms | 907 | tv.tv_usec = 250000; // initial timeout ~ 250ms |
901 | char buffer[IW_SCAN_MAX_DATA]; | 908 | char buffer[IW_SCAN_MAX_DATA]; |
902 | 909 | ||
903 | while ( !results && timeout > 0 ) | 910 | while ( !results && timeout > 0 ) |
904 | { | 911 | { |
905 | timeout -= tv.tv_usec; | 912 | timeout -= tv.tv_usec; |
906 | select( 0, 0, 0, 0, &tv ); | 913 | select( 0, 0, 0, 0, &tv ); |
907 | 914 | ||
908 | _iwr.u.data.pointer = &buffer[0]; | 915 | _iwr.u.data.pointer = &buffer[0]; |
909 | _iwr.u.data.flags = 0; | 916 | _iwr.u.data.flags = 0; |
910 | _iwr.u.data.length = sizeof buffer; | 917 | _iwr.u.data.length = sizeof buffer; |
911 | if ( wioctl( SIOCGIWSCAN ) ) | 918 | if ( wioctl( SIOCGIWSCAN ) ) |
912 | { | 919 | { |
913 | results = true; | 920 | results = true; |
914 | continue; | 921 | continue; |
915 | } | 922 | } |
916 | else if ( errno == EAGAIN) | 923 | else if ( errno == EAGAIN) |
917 | { | 924 | { |
918 | odebug << "ONetworkInterface::scanNetwork() - scan in progress..." << oendl; | 925 | odebug << "ONetworkInterface::scanNetwork() - scan in progress..." << oendl; |
919 | if ( qApp ) | 926 | if ( qApp ) |
920 | { | 927 | { |
921 | qApp->processEvents( 100 ); | 928 | qApp->processEvents( 100 ); |
922 | continue; | 929 | continue; |
923 | } | 930 | } |
924 | tv.tv_sec = 0; | 931 | tv.tv_sec = 0; |
925 | tv.tv_usec = 100000; | 932 | tv.tv_usec = 100000; |
926 | continue; | 933 | continue; |
927 | } | 934 | } |
928 | } | 935 | } |
929 | 936 | ||
930 | odebug << "ONetworkInterface::scanNetwork() - scan finished." << oendl; | 937 | odebug << "ONetworkInterface::scanNetwork() - scan finished." << oendl; |
931 | 938 | ||
932 | if ( results ) | 939 | if ( results ) |
933 | { | 940 | { |
934 | odebug << " - result length = " << _iwr.u.data.length << oendl; | 941 | odebug << " - result length = " << _iwr.u.data.length << oendl; |
935 | if ( !_iwr.u.data.length ) | 942 | if ( !_iwr.u.data.length ) |
936 | { | 943 | { |
937 | odebug << " - no results (empty neighbourhood)" << oendl; | 944 | odebug << " - no results (empty neighbourhood)" << oendl; |
938 | return stations; | 945 | return stations; |
939 | } | 946 | } |
940 | 947 | ||
941 | odebug << " - results are in!" << oendl; | 948 | odebug << " - results are in!" << oendl; |
942 | dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); | 949 | dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); |
943 | 950 | ||
944 | // parse results | 951 | // parse results |
945 | struct iw_event iwe; | 952 | struct iw_event iwe; |
946 | struct iw_stream_descr stream; | 953 | struct iw_stream_descr stream; |
947 | unsigned int cmd_index, event_type, event_len; | 954 | unsigned int cmd_index, event_type, event_len; |
948 | char *pointer; | 955 | char *pointer; |
949 | 956 | ||
950 | const char standard_ioctl_hdr[] = { | 957 | const char standard_ioctl_hdr[] = { |
951 | IW_HEADER_TYPE_NULL, /* SIOCSIWCOMMIT */ | 958 | IW_HEADER_TYPE_NULL, /* SIOCSIWCOMMIT */ |
952 | IW_HEADER_TYPE_CHAR, /* SIOCGIWNAME */ | 959 | IW_HEADER_TYPE_CHAR, /* SIOCGIWNAME */ |
953 | IW_HEADER_TYPE_PARAM, /* SIOCSIWNWID */ | 960 | IW_HEADER_TYPE_PARAM, /* SIOCSIWNWID */ |
954 | IW_HEADER_TYPE_PARAM, /* SIOCGIWNWID */ | 961 | IW_HEADER_TYPE_PARAM, /* SIOCGIWNWID */ |
955 | IW_HEADER_TYPE_FREQ, /* SIOCSIWFREQ */ | 962 | IW_HEADER_TYPE_FREQ, /* SIOCSIWFREQ */ |
956 | IW_HEADER_TYPE_FREQ, /* SIOCGIWFREQ */ | 963 | IW_HEADER_TYPE_FREQ, /* SIOCGIWFREQ */ |
957 | IW_HEADER_TYPE_UINT, /* SIOCSIWMODE */ | 964 | IW_HEADER_TYPE_UINT, /* SIOCSIWMODE */ |
958 | IW_HEADER_TYPE_UINT, /* SIOCGIWMODE */ | 965 | IW_HEADER_TYPE_UINT, /* SIOCGIWMODE */ |
959 | IW_HEADER_TYPE_PARAM, /* SIOCSIWSENS */ | 966 | IW_HEADER_TYPE_PARAM, /* SIOCSIWSENS */ |
960 | IW_HEADER_TYPE_PARAM, /* SIOCGIWSENS */ | 967 | IW_HEADER_TYPE_PARAM, /* SIOCGIWSENS */ |
961 | IW_HEADER_TYPE_NULL, /* SIOCSIWRANGE */ | 968 | IW_HEADER_TYPE_NULL, /* SIOCSIWRANGE */ |
962 | IW_HEADER_TYPE_POINT, /* SIOCGIWRANGE */ | 969 | IW_HEADER_TYPE_POINT, /* SIOCGIWRANGE */ |
963 | IW_HEADER_TYPE_NULL, /* SIOCSIWPRIV */ | 970 | IW_HEADER_TYPE_NULL, /* SIOCSIWPRIV */ |
964 | IW_HEADER_TYPE_POINT, /* SIOCGIWPRIV */ | 971 | IW_HEADER_TYPE_POINT, /* SIOCGIWPRIV */ |
965 | IW_HEADER_TYPE_NULL, /* SIOCSIWSTATS */ | 972 | IW_HEADER_TYPE_NULL, /* SIOCSIWSTATS */ |
966 | IW_HEADER_TYPE_POINT, /* SIOCGIWSTATS */ | 973 | IW_HEADER_TYPE_POINT, /* SIOCGIWSTATS */ |
967 | IW_HEADER_TYPE_POINT, /* SIOCSIWSPY */ | 974 | IW_HEADER_TYPE_POINT, /* SIOCSIWSPY */ |
968 | IW_HEADER_TYPE_POINT, /* SIOCGIWSPY */ | 975 | IW_HEADER_TYPE_POINT, /* SIOCGIWSPY */ |
969 | IW_HEADER_TYPE_POINT, /* SIOCSIWTHRSPY */ | 976 | IW_HEADER_TYPE_POINT, /* SIOCSIWTHRSPY */ |
970 | IW_HEADER_TYPE_POINT, /* SIOCGIWTHRSPY */ | 977 | IW_HEADER_TYPE_POINT, /* SIOCGIWTHRSPY */ |
971 | IW_HEADER_TYPE_ADDR, /* SIOCSIWAP */ | 978 | IW_HEADER_TYPE_ADDR, /* SIOCSIWAP */ |
972 | IW_HEADER_TYPE_ADDR, /* SIOCGIWAP */ | 979 | IW_HEADER_TYPE_ADDR, /* SIOCGIWAP */ |
973 | IW_HEADER_TYPE_NULL, /* -- hole -- */ | 980 | IW_HEADER_TYPE_NULL, /* -- hole -- */ |
974 | IW_HEADER_TYPE_POINT, /* SIOCGIWAPLIST */ | 981 | IW_HEADER_TYPE_POINT, /* SIOCGIWAPLIST */ |
975 | IW_HEADER_TYPE_PARAM, /* SIOCSIWSCAN */ | 982 | IW_HEADER_TYPE_PARAM, /* SIOCSIWSCAN */ |
976 | IW_HEADER_TYPE_POINT, /* SIOCGIWSCAN */ | 983 | IW_HEADER_TYPE_POINT, /* SIOCGIWSCAN */ |
977 | IW_HEADER_TYPE_POINT, /* SIOCSIWESSID */ | 984 | IW_HEADER_TYPE_POINT, /* SIOCSIWESSID */ |
978 | IW_HEADER_TYPE_POINT, /* SIOCGIWESSID */ | 985 | IW_HEADER_TYPE_POINT, /* SIOCGIWESSID */ |
979 | IW_HEADER_TYPE_POINT, /* SIOCSIWNICKN */ | 986 | IW_HEADER_TYPE_POINT, /* SIOCSIWNICKN */ |
980 | IW_HEADER_TYPE_POINT, /* SIOCGIWNICKN */ | 987 | IW_HEADER_TYPE_POINT, /* SIOCGIWNICKN */ |
981 | IW_HEADER_TYPE_NULL, /* -- hole -- */ | 988 | IW_HEADER_TYPE_NULL, /* -- hole -- */ |
982 | IW_HEADER_TYPE_NULL, /* -- hole -- */ | 989 | IW_HEADER_TYPE_NULL, /* -- hole -- */ |
983 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRATE */ | 990 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRATE */ |
984 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRATE */ | 991 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRATE */ |
985 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRTS */ | 992 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRTS */ |
986 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRTS */ | 993 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRTS */ |
987 | IW_HEADER_TYPE_PARAM, /* SIOCSIWFRAG */ | 994 | IW_HEADER_TYPE_PARAM, /* SIOCSIWFRAG */ |
988 | IW_HEADER_TYPE_PARAM, /* SIOCGIWFRAG */ | 995 | IW_HEADER_TYPE_PARAM, /* SIOCGIWFRAG */ |
989 | IW_HEADER_TYPE_PARAM, /* SIOCSIWTXPOW */ | 996 | IW_HEADER_TYPE_PARAM, /* SIOCSIWTXPOW */ |
990 | IW_HEADER_TYPE_PARAM, /* SIOCGIWTXPOW */ | 997 | IW_HEADER_TYPE_PARAM, /* SIOCGIWTXPOW */ |
991 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRETRY */ | 998 | IW_HEADER_TYPE_PARAM, /* SIOCSIWRETRY */ |
992 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRETRY */ | 999 | IW_HEADER_TYPE_PARAM, /* SIOCGIWRETRY */ |
993 | IW_HEADER_TYPE_POINT, /* SIOCSIWENCODE */ | 1000 | IW_HEADER_TYPE_POINT, /* SIOCSIWENCODE */ |
994 | IW_HEADER_TYPE_POINT, /* SIOCGIWENCODE */ | 1001 | IW_HEADER_TYPE_POINT, /* SIOCGIWENCODE */ |
995 | IW_HEADER_TYPE_PARAM, /* SIOCSIWPOWER */ | 1002 | IW_HEADER_TYPE_PARAM, /* SIOCSIWPOWER */ |
996 | IW_HEADER_TYPE_PARAM, /* SIOCGIWPOWER */ | 1003 | IW_HEADER_TYPE_PARAM, /* SIOCGIWPOWER */ |
997 | }; | 1004 | }; |
998 | 1005 | ||
999 | const char standard_event_hdr[] = { | 1006 | const char standard_event_hdr[] = { |
1000 | IW_HEADER_TYPE_ADDR, /* IWEVTXDROP */ | 1007 | IW_HEADER_TYPE_ADDR, /* IWEVTXDROP */ |
1001 | IW_HEADER_TYPE_QUAL, /* IWEVQUAL */ | 1008 | IW_HEADER_TYPE_QUAL, /* IWEVQUAL */ |
1002 | IW_HEADER_TYPE_POINT, /* IWEVCUSTOM */ | 1009 | IW_HEADER_TYPE_POINT, /* IWEVCUSTOM */ |
1003 | IW_HEADER_TYPE_ADDR, /* IWEVREGISTERED */ | 1010 | IW_HEADER_TYPE_ADDR, /* IWEVREGISTERED */ |
1004 | IW_HEADER_TYPE_ADDR, /* IWEVEXPIRED */ | 1011 | IW_HEADER_TYPE_ADDR, /* IWEVEXPIRED */ |
1005 | IW_HEADER_TYPE_POINT, /* IWEVGENIE */ | 1012 | IW_HEADER_TYPE_POINT, /* IWEVGENIE */ |
1006 | IW_HEADER_TYPE_POINT, /* IWEVMICHAELMICFAILURE */ | 1013 | IW_HEADER_TYPE_POINT, /* IWEVMICHAELMICFAILURE */ |
1007 | IW_HEADER_TYPE_POINT, /* IWEVASSOCREQIE */ | 1014 | IW_HEADER_TYPE_POINT, /* IWEVASSOCREQIE */ |
1008 | IW_HEADER_TYPE_POINT, /* IWEVASSOCRESPIE */ | 1015 | IW_HEADER_TYPE_POINT, /* IWEVASSOCRESPIE */ |
1009 | IW_HEADER_TYPE_POINT, /* IWEVPMKIDCAND */ | 1016 | IW_HEADER_TYPE_POINT, /* IWEVPMKIDCAND */ |
1010 | }; | 1017 | }; |
1011 | 1018 | ||
1012 | 1019 | ||
1013 | const int event_type_size[] = { | 1020 | const int event_type_size[] = { |
1014 | IW_EV_LCP_LEN, /* IW_HEADER_TYPE_NULL */ | 1021 | IW_EV_LCP_LEN, /* IW_HEADER_TYPE_NULL */ |
1015 | 0, | 1022 | 0, |
1016 | IW_EV_CHAR_LEN, /* IW_HEADER_TYPE_CHAR */ | 1023 | IW_EV_CHAR_LEN, /* IW_HEADER_TYPE_CHAR */ |
1017 | 0, | 1024 | 0, |
1018 | IW_EV_UINT_LEN, /* IW_HEADER_TYPE_UINT */ | 1025 | IW_EV_UINT_LEN, /* IW_HEADER_TYPE_UINT */ |
1019 | IW_EV_FREQ_LEN, /* IW_HEADER_TYPE_FREQ */ | 1026 | IW_EV_FREQ_LEN, /* IW_HEADER_TYPE_FREQ */ |
1020 | IW_EV_ADDR_LEN, /* IW_HEADER_TYPE_ADDR */ | 1027 | IW_EV_ADDR_LEN, /* IW_HEADER_TYPE_ADDR */ |
1021 | 0, | 1028 | 0, |
1022 | IW_EV_POINT_LEN, /* Without variable payload */ | 1029 | IW_EV_POINT_LEN, /* Without variable payload */ |
1023 | IW_EV_PARAM_LEN, /* IW_HEADER_TYPE_PARAM */ | 1030 | IW_EV_PARAM_LEN, /* IW_HEADER_TYPE_PARAM */ |
1024 | IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ | 1031 | IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ |
1025 | }; | 1032 | }; |
1026 | 1033 | ||
1027 | 1034 | ||
1028 | //Initialize the stream | 1035 | //Initialize the stream |
1029 | memset( &stream, 0, sizeof(struct iw_stream_descr) ); | 1036 | memset( &stream, 0, sizeof(struct iw_stream_descr) ); |
1030 | stream.current = buffer; | 1037 | stream.current = buffer; |
1031 | stream.end = buffer + _iwr.u.data.length; | 1038 | stream.end = buffer + _iwr.u.data.length; |
1032 | 1039 | ||
1033 | do | 1040 | do |
1034 | { | 1041 | { |
1035 | if ((stream.current + IW_EV_LCP_LEN) > stream.end) | 1042 | if ((stream.current + IW_EV_LCP_LEN) > stream.end) |
1036 | break; | 1043 | break; |
1037 | memcpy((char *) &iwe, stream.current, IW_EV_LCP_LEN); | 1044 | memcpy((char *) &iwe, stream.current, IW_EV_LCP_LEN); |
1038 | 1045 | ||
1039 | if (iwe.len <= IW_EV_LCP_LEN) //If yes, it is an invalid event | 1046 | if (iwe.len <= IW_EV_LCP_LEN) //If yes, it is an invalid event |
1040 | break; | 1047 | break; |
1041 | if (iwe.cmd <= SIOCIWLAST) { | 1048 | if (iwe.cmd <= SIOCIWLAST) { |
1042 | cmd_index = iwe.cmd - SIOCIWFIRST; | 1049 | cmd_index = iwe.cmd - SIOCIWFIRST; |
1043 | 1050 | ||
1044 | if(cmd_index < sizeof(standard_ioctl_hdr)) | 1051 | if(cmd_index < sizeof(standard_ioctl_hdr)) |
1045 | event_type = standard_ioctl_hdr[cmd_index]; | 1052 | event_type = standard_ioctl_hdr[cmd_index]; |
1046 | } | 1053 | } |
1047 | else { | 1054 | else { |
1048 | cmd_index = iwe.cmd - IWEVFIRST; | 1055 | cmd_index = iwe.cmd - IWEVFIRST; |
1049 | 1056 | ||
1050 | if(cmd_index < sizeof(standard_event_hdr)) | 1057 | if(cmd_index < sizeof(standard_event_hdr)) |
1051 | event_type = standard_event_hdr[cmd_index]; | 1058 | event_type = standard_event_hdr[cmd_index]; |
1052 | } | 1059 | } |
1053 | 1060 | ||
1054 | /* Unknown events -> event_type=0 => IW_EV_LCP_LEN */ | 1061 | /* Unknown events -> event_type=0 => IW_EV_LCP_LEN */ |
1055 | event_len = event_type_size[event_type]; | 1062 | event_len = event_type_size[event_type]; |
1056 | 1063 | ||
1057 | /* Fixup for later version of WE */ | 1064 | /* Fixup for later version of WE */ |
1058 | if((_range.we_version_compiled > 18) && (event_type == IW_HEADER_TYPE_POINT)) | 1065 | if((_range.we_version_compiled > 18) && (event_type == IW_HEADER_TYPE_POINT)) |
1059 | event_len -= IW_EV_POINT_OFF; | 1066 | event_len -= IW_EV_POINT_OFF; |
1060 | 1067 | ||
1061 | /* Check if we know about this event */ | 1068 | /* Check if we know about this event */ |
1062 | if(event_len <= IW_EV_LCP_LEN) { | 1069 | if(event_len <= IW_EV_LCP_LEN) { |
1063 | /* Skip to next event */ | 1070 | /* Skip to next event */ |
1064 | stream.current += iwe.len; | 1071 | stream.current += iwe.len; |
1065 | continue; | 1072 | continue; |
1066 | } | 1073 | } |
1067 | 1074 | ||
1068 | event_len -= IW_EV_LCP_LEN; | 1075 | event_len -= IW_EV_LCP_LEN; |
1069 | 1076 | ||
1070 | /* Set pointer on data */ | 1077 | /* Set pointer on data */ |
1071 | if(stream.value != NULL) | 1078 | if(stream.value != NULL) |
1072 | pointer = stream.value; /* Next value in event */ | 1079 | pointer = stream.value; /* Next value in event */ |
1073 | else | 1080 | else |
1074 | pointer = stream.current + IW_EV_LCP_LEN; /* First value in event */ | 1081 | pointer = stream.current + IW_EV_LCP_LEN; /* First value in event */ |
1075 | 1082 | ||
1076 | if((pointer + event_len) > stream.end) { | 1083 | if((pointer + event_len) > stream.end) { |
1077 | /* Go to next event */ | 1084 | /* Go to next event */ |
1078 | stream.current += iwe.len; | 1085 | stream.current += iwe.len; |
1079 | break; | 1086 | break; |
1080 | } | 1087 | } |
1081 | 1088 | ||
1082 | /* Fixup for later version of WE */ | 1089 | /* Fixup for later version of WE */ |
1083 | if((_range.we_version_compiled > 18) && (event_type == IW_HEADER_TYPE_POINT)) | 1090 | if((_range.we_version_compiled > 18) && (event_type == IW_HEADER_TYPE_POINT)) |
1084 | memcpy((char *) &iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len); | 1091 | memcpy((char *) &iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len); |
1085 | else | 1092 | else |
1086 | memcpy((char *) &iwe + IW_EV_LCP_LEN, pointer, event_len); | 1093 | memcpy((char *) &iwe + IW_EV_LCP_LEN, pointer, event_len); |
1087 | 1094 | ||
1088 | /* Skip event in the stream */ | 1095 | /* Skip event in the stream */ |
1089 | pointer += event_len; | 1096 | pointer += event_len; |
1090 | 1097 | ||
1091 | /* Special processing for iw_point events */ | 1098 | /* Special processing for iw_point events */ |
1092 | if(event_type == IW_HEADER_TYPE_POINT) { | 1099 | if(event_type == IW_HEADER_TYPE_POINT) { |
1093 | /* Check the length of the payload */ | 1100 | /* Check the length of the payload */ |
1094 | 1101 | ||
1095 | if((iwe.len - (event_len + IW_EV_LCP_LEN)) > 0) | 1102 | if((iwe.len - (event_len + IW_EV_LCP_LEN)) > 0) |
1096 | /* Set pointer on variable part (warning : non aligned) */ | 1103 | /* Set pointer on variable part (warning : non aligned) */ |
1097 | iwe.u.data.pointer = pointer; | 1104 | iwe.u.data.pointer = pointer; |
1098 | else | 1105 | else |
1099 | /* No data */ | 1106 | /* No data */ |
1100 | iwe.u.data.pointer = NULL; | 1107 | iwe.u.data.pointer = NULL; |
1101 | /* Go to next event */ | 1108 | /* Go to next event */ |
1102 | stream.current += iwe.len; | 1109 | stream.current += iwe.len; |
1103 | } | 1110 | } |
1104 | 1111 | ||
1105 | else { | 1112 | else { |
1106 | /* Is there more value in the event ? */ | 1113 | /* Is there more value in the event ? */ |
1107 | if((pointer + event_len) <= (stream.current + iwe.len)) | 1114 | if((pointer + event_len) <= (stream.current + iwe.len)) |
1108 | /* Go to next value */ | 1115 | /* Go to next value */ |
1109 | stream.value = pointer; | 1116 | stream.value = pointer; |
1110 | else { | 1117 | else { |
1111 | /* Go to next event */ | 1118 | /* Go to next event */ |
1112 | stream.value = NULL; | 1119 | stream.value = NULL; |
1113 | stream.current += iwe.len; | 1120 | stream.current += iwe.len; |
1114 | } | 1121 | } |
1115 | } | 1122 | } |
1116 | 1123 | ||
1117 | struct iw_event *we = &iwe; | 1124 | struct iw_event *we = &iwe; |
1118 | //------ | 1125 | //------ |
1119 | odebug << " - reading next event... cmd=" << we->cmd << ", len=" << we->len << oendl; | 1126 | odebug << " - reading next event... cmd=" << we->cmd << ", len=" << we->len << oendl; |
1120 | switch (we->cmd) | 1127 | switch (we->cmd) |
1121 | { | 1128 | { |
1122 | case SIOCGIWAP: | 1129 | case SIOCGIWAP: |
1123 | { | 1130 | { |
1124 | odebug << "SIOCGIWAP" << oendl; | 1131 | odebug << "SIOCGIWAP" << oendl; |
1125 | stations->append( new OStation() ); | 1132 | stations->append( new OStation() ); |
1126 | stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; | 1133 | stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; |
1127 | break; | 1134 | break; |
1128 | } | 1135 | } |
1129 | case SIOCGIWMODE: | 1136 | case SIOCGIWMODE: |
1130 | { | 1137 | { |
1131 | odebug << "SIOCGIWMODE" << oendl; | 1138 | odebug << "SIOCGIWMODE" << oendl; |
1132 | stations->last()->type = modeToString( we->u.mode ); | 1139 | stations->last()->type = modeToString( we->u.mode ); |
1133 | break; | 1140 | break; |
1134 | } | 1141 | } |
1135 | case SIOCGIWFREQ: | 1142 | case SIOCGIWFREQ: |
1136 | { | 1143 | { |
1137 | odebug << "SIOCGIWFREQ" << oendl; | 1144 | odebug << "SIOCGIWFREQ" << oendl; |
1138 | if ( we->u.freq.m > 1000 ) | 1145 | if ( we->u.freq.m > 1000 ) |
1139 | stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; | 1146 | stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; |
1140 | else | 1147 | else |
1141 | stations->last()->channel = static_cast<int>(((double) we->u.freq.m) * pow( 10.0, we->u.freq.e )); | 1148 | stations->last()->channel = static_cast<int>(((double) we->u.freq.m) * pow( 10.0, we->u.freq.e )); |
1142 | break; | 1149 | break; |
1143 | } | 1150 | } |
1144 | case SIOCGIWESSID: | 1151 | case SIOCGIWESSID: |
1145 | { | 1152 | { |
1146 | odebug << "SIOCGIWESSID" << oendl; | 1153 | odebug << "SIOCGIWESSID" << oendl; |
1147 | we->u.essid.length = '\0'; // make sure it is zero terminated | 1154 | we->u.essid.length = '\0'; // make sure it is zero terminated |
1148 | stations->last()->ssid = static_cast<const char*> (we->u.essid.pointer); | 1155 | stations->last()->ssid = static_cast<const char*> (we->u.essid.pointer); |
1149 | odebug << "ESSID: " << stations->last()->ssid << oendl; | 1156 | odebug << "ESSID: " << stations->last()->ssid << oendl; |
1150 | break; | 1157 | break; |
1151 | } | 1158 | } |
1152 | case IWEVQUAL: | 1159 | case IWEVQUAL: |
1153 | { | 1160 | { |
1154 | odebug << "IWEVQUAL" << oendl; | 1161 | odebug << "IWEVQUAL" << oendl; |
1155 | stations->last()->level = static_cast<int>(we->u.qual.level); | 1162 | stations->last()->level = static_cast<int>(we->u.qual.level); |
1156 | break; /* Quality part of statistics (scan) */ | 1163 | break; /* Quality part of statistics (scan) */ |
1157 | } | 1164 | } |
1158 | case SIOCGIWENCODE: | 1165 | case SIOCGIWENCODE: |
1159 | { | 1166 | { |
1160 | odebug << "SIOCGIWENCODE" << oendl; | 1167 | odebug << "SIOCGIWENCODE" << oendl; |
1161 | stations->last()->encrypted = !(we->u.data.flags & IW_ENCODE_DISABLED); | 1168 | stations->last()->encrypted = !(we->u.data.flags & IW_ENCODE_DISABLED); |
1162 | break; | 1169 | break; |
1163 | } | 1170 | } |
1164 | 1171 | ||
1165 | case SIOCGIWRATE: | 1172 | case SIOCGIWRATE: |
1166 | { | 1173 | { |
1167 | odebug << "SIOCGIWRATE" << oendl; | 1174 | odebug << "SIOCGIWRATE" << oendl; |
1168 | stations->last()->rates.append(we->u.bitrate.value); | 1175 | stations->last()->rates.append(we->u.bitrate.value); |
1169 | break; | 1176 | break; |
1170 | } | 1177 | } |
1171 | case SIOCGIWSENS: odebug << "SIOCGIWSENS" << oendl; break; | 1178 | case SIOCGIWSENS: odebug << "SIOCGIWSENS" << oendl; break; |
1172 | case IWEVTXDROP: odebug << "IWEVTXDROP" << oendl; break; /* Packet dropped to excessive retry */ | 1179 | case IWEVTXDROP: odebug << "IWEVTXDROP" << oendl; break; /* Packet dropped to excessive retry */ |
1173 | case IWEVCUSTOM: odebug << "IWEVCUSTOM" << oendl; break; /* Driver specific ascii string */ | 1180 | case IWEVCUSTOM: odebug << "IWEVCUSTOM" << oendl; break; /* Driver specific ascii string */ |
1174 | case IWEVREGISTERED: odebug << "IWEVREGISTERED" << oendl; break; /* Discovered a new node (AP mode) */ | 1181 | case IWEVREGISTERED: odebug << "IWEVREGISTERED" << oendl; break; /* Discovered a new node (AP mode) */ |
1175 | case IWEVEXPIRED: odebug << "IWEVEXPIRED" << oendl; break; /* Expired a node (AP mode) */ | 1182 | case IWEVEXPIRED: odebug << "IWEVEXPIRED" << oendl; break; /* Expired a node (AP mode) */ |
1176 | default: odebug << "unhandled event" << oendl; | 1183 | default: odebug << "unhandled event" << oendl; |
1177 | } | 1184 | } |
1178 | 1185 | ||
1179 | } while (true); | 1186 | } while (true); |
1180 | } | 1187 | } |
1181 | else | 1188 | else |
1182 | { | 1189 | { |
1183 | odebug << " - no results (timeout) :(" << oendl; | 1190 | odebug << " - no results (timeout) :(" << oendl; |
1184 | } | 1191 | } |
1185 | return stations; | 1192 | return stations; |
1186 | } | 1193 | } |
1187 | 1194 | ||
1188 | 1195 | ||
1189 | int OWirelessNetworkInterface::signalStrength() const | 1196 | int OWirelessNetworkInterface::signalStrength() const |
1190 | { | 1197 | { |
1191 | iw_statistics stat; | 1198 | iw_statistics stat; |
1192 | ::memset( &stat, 0, sizeof stat ); | 1199 | ::memset( &stat, 0, sizeof stat ); |
1193 | _iwr.u.data.pointer = (char*) &stat; | 1200 | _iwr.u.data.pointer = (char*) &stat; |
1194 | _iwr.u.data.flags = 0; | 1201 | _iwr.u.data.flags = 0; |
1195 | _iwr.u.data.length = sizeof stat; | 1202 | _iwr.u.data.length = sizeof stat; |
1196 | 1203 | ||
1197 | if ( !wioctl( SIOCGIWSTATS ) ) | 1204 | if ( !wioctl( SIOCGIWSTATS ) ) |
1198 | { | 1205 | { |
1199 | return -1; | 1206 | return -1; |
1200 | } | 1207 | } |
1201 | 1208 | ||
1202 | int max = _range.max_qual.qual; | 1209 | int max = _range.max_qual.qual; |
1203 | int cur = stat.qual.qual; | 1210 | int cur = stat.qual.qual; |
1204 | // int lev = stat.qual.level; //FIXME: Do something with them? | 1211 | // int lev = stat.qual.level; //FIXME: Do something with them? |
1205 | // int noi = stat.qual.noise; //FIXME: Do something with them? | 1212 | // int noi = stat.qual.noise; //FIXME: Do something with them? |
1206 | 1213 | ||
1207 | 1214 | ||
1208 | return max != 0 ? cur*100/max: -1; | 1215 | return max != 0 ? cur*100/max: -1; |
1209 | } | 1216 | } |
1210 | 1217 | ||
1211 | 1218 | ||
1212 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const | 1219 | bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const |
1213 | { | 1220 | { |
1214 | #ifndef NODEBUG | 1221 | #ifndef NODEBUG |
1215 | int result = ::ioctl( _sfd, call, &iwreq ); | 1222 | int result = ::ioctl( _sfd, call, &iwreq ); |
1216 | 1223 | ||
1217 | if ( result == -1 ) | 1224 | if ( result == -1 ) |
1218 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 1225 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
1219 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; | 1226 | << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl; |
1220 | else | 1227 | else |
1221 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" | 1228 | odebug << "ONetworkInterface::wioctl (" << name() << ") call '" |
1222 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; | 1229 | << debugmapper->map( call ) << "' - Status: Ok." << oendl; |
1223 | 1230 | ||
1224 | return ( result != -1 ); | 1231 | return ( result != -1 ); |
1225 | #else | 1232 | #else |
1226 | return ::ioctl( _sfd, call, &iwreq ) != -1; | 1233 | return ::ioctl( _sfd, call, &iwreq ) != -1; |
1227 | #endif | 1234 | #endif |
1228 | } | 1235 | } |
1229 | 1236 | ||
1230 | 1237 | ||
1231 | bool OWirelessNetworkInterface::wioctl( int call ) const | 1238 | bool OWirelessNetworkInterface::wioctl( int call ) const |
1232 | { | 1239 | { |
1233 | strcpy( _iwr.ifr_name, name() ); | 1240 | strcpy( _iwr.ifr_name, name() ); |
1234 | return wioctl( call, _iwr ); | 1241 | return wioctl( call, _iwr ); |
1235 | } | 1242 | } |
1236 | 1243 | ||
1237 | 1244 | ||
1238 | /*====================================================================================== | 1245 | /*====================================================================================== |
1239 | * OMonitoringInterface | 1246 | * OMonitoringInterface |
1240 | *======================================================================================*/ | 1247 | *======================================================================================*/ |
1241 | 1248 | ||
1242 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1249 | OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1243 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) | 1250 | :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) |
1244 | { | 1251 | { |
1245 | } | 1252 | } |
1246 | 1253 | ||
1247 | 1254 | ||
1248 | OMonitoringInterface::~OMonitoringInterface() | 1255 | OMonitoringInterface::~OMonitoringInterface() |
1249 | { | 1256 | { |
1250 | } | 1257 | } |
1251 | 1258 | ||
1252 | 1259 | ||
1253 | void OMonitoringInterface::setChannel( int c ) | 1260 | void OMonitoringInterface::setChannel( int c ) |
1254 | { | 1261 | { |
1255 | // use standard WE channel switching protocol | 1262 | // use standard WE channel switching protocol |
1256 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); | 1263 | memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); |
1257 | _if->_iwr.u.freq.m = c; | 1264 | _if->_iwr.u.freq.m = c; |
1258 | _if->_iwr.u.freq.e = 0; | 1265 | _if->_iwr.u.freq.e = 0; |
1259 | _if->wioctl( SIOCSIWFREQ ); | 1266 | _if->wioctl( SIOCSIWFREQ ); |
1260 | } | 1267 | } |
1261 | 1268 | ||
1262 | 1269 | ||
1263 | void OMonitoringInterface::setEnabled( bool ) | 1270 | void OMonitoringInterface::setEnabled( bool ) |
1264 | { | 1271 | { |
1265 | } | 1272 | } |
1266 | 1273 | ||
1267 | 1274 | ||
1268 | /*====================================================================================== | 1275 | /*====================================================================================== |
1269 | * OCiscoMonitoringInterface | 1276 | * OCiscoMonitoringInterface |
1270 | *======================================================================================*/ | 1277 | *======================================================================================*/ |
1271 | 1278 | ||
1272 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1279 | OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1273 | :OMonitoringInterface( iface, prismHeader ) | 1280 | :OMonitoringInterface( iface, prismHeader ) |
1274 | { | 1281 | { |
1275 | iface->setMonitoring( this ); | 1282 | iface->setMonitoring( this ); |
1276 | } | 1283 | } |
1277 | 1284 | ||
1278 | 1285 | ||
1279 | OCiscoMonitoringInterface::~OCiscoMonitoringInterface() | 1286 | OCiscoMonitoringInterface::~OCiscoMonitoringInterface() |
1280 | { | 1287 | { |
1281 | } | 1288 | } |
1282 | 1289 | ||
1283 | 1290 | ||
1284 | void OCiscoMonitoringInterface::setEnabled( bool /*b*/ ) | 1291 | void OCiscoMonitoringInterface::setEnabled( bool /*b*/ ) |
1285 | { | 1292 | { |
1286 | QString fname; | 1293 | QString fname; |
1287 | fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); | 1294 | fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); |
1288 | QFile f( fname ); | 1295 | QFile f( fname ); |
1289 | if ( !f.exists() ) return; | 1296 | if ( !f.exists() ) return; |
1290 | 1297 | ||
1291 | if ( f.open( IO_WriteOnly ) ) | 1298 | if ( f.open( IO_WriteOnly ) ) |
1292 | { | 1299 | { |
1293 | QTextStream s( &f ); | 1300 | QTextStream s( &f ); |
1294 | s << "Mode: r"; | 1301 | s << "Mode: r"; |
1295 | s << "Mode: y"; | 1302 | s << "Mode: y"; |
1296 | s << "XmitPower: 1"; | 1303 | s << "XmitPower: 1"; |
1297 | } | 1304 | } |
1298 | 1305 | ||
1299 | // flushing and closing will be done automatically when f goes out of scope | 1306 | // flushing and closing will be done automatically when f goes out of scope |
1300 | } | 1307 | } |
1301 | 1308 | ||
1302 | 1309 | ||
1303 | QString OCiscoMonitoringInterface::name() const | 1310 | QString OCiscoMonitoringInterface::name() const |
1304 | { | 1311 | { |
1305 | return "cisco"; | 1312 | return "cisco"; |
1306 | } | 1313 | } |
1307 | 1314 | ||
1308 | 1315 | ||
1309 | void OCiscoMonitoringInterface::setChannel( int ) | 1316 | void OCiscoMonitoringInterface::setChannel( int ) |
1310 | { | 1317 | { |
1311 | // cisco devices automatically switch channels when in monitor mode | 1318 | // cisco devices automatically switch channels when in monitor mode |
1312 | } | 1319 | } |
1313 | 1320 | ||
1314 | 1321 | ||
1315 | /*====================================================================================== | 1322 | /*====================================================================================== |
1316 | * OWlanNGMonitoringInterface | 1323 | * OWlanNGMonitoringInterface |
1317 | *======================================================================================*/ | 1324 | *======================================================================================*/ |
1318 | 1325 | ||
1319 | 1326 | ||
1320 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1327 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1321 | :OMonitoringInterface( iface, prismHeader ) | 1328 | :OMonitoringInterface( iface, prismHeader ) |
1322 | { | 1329 | { |
1323 | iface->setMonitoring( this ); | 1330 | iface->setMonitoring( this ); |
1324 | } | 1331 | } |
1325 | 1332 | ||
1326 | 1333 | ||
1327 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() | 1334 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() |
1328 | { | 1335 | { |
1329 | } | 1336 | } |
1330 | 1337 | ||
1331 | 1338 | ||
1332 | void OWlanNGMonitoringInterface::setEnabled( bool b ) | 1339 | void OWlanNGMonitoringInterface::setEnabled( bool b ) |
1333 | { | 1340 | { |
1334 | //FIXME: do nothing if its already in the same mode | 1341 | //FIXME: do nothing if its already in the same mode |
1335 | 1342 | ||
1336 | QString enable = b ? "true" : "false"; | 1343 | QString enable = b ? "true" : "false"; |
1337 | QString prism = _prismHeader ? "true" : "false"; | 1344 | QString prism = _prismHeader ? "true" : "false"; |
1338 | QString cmd; | 1345 | QString cmd; |
1339 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 1346 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
1340 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); | 1347 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); |
1341 | system( cmd ); | 1348 | system( cmd ); |
1342 | } | 1349 | } |
1343 | 1350 | ||
1344 | 1351 | ||
1345 | QString OWlanNGMonitoringInterface::name() const | 1352 | QString OWlanNGMonitoringInterface::name() const |
1346 | { | 1353 | { |
1347 | return "wlan-ng"; | 1354 | return "wlan-ng"; |
1348 | } | 1355 | } |
1349 | 1356 | ||
1350 | 1357 | ||
1351 | void OWlanNGMonitoringInterface::setChannel( int c ) | 1358 | void OWlanNGMonitoringInterface::setChannel( int c ) |
1352 | { | 1359 | { |
1353 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. | 1360 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. |
1354 | 1361 | ||
1355 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; | 1362 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; |
1356 | QString prism = _prismHeader ? "true" : "false"; | 1363 | QString prism = _prismHeader ? "true" : "false"; |
1357 | QString cmd; | 1364 | QString cmd; |
1358 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 1365 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
1359 | (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); | 1366 | (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); |
1360 | system( cmd ); | 1367 | system( cmd ); |
1361 | } | 1368 | } |
1362 | 1369 | ||
1363 | 1370 | ||
1364 | /*====================================================================================== | 1371 | /*====================================================================================== |
1365 | * OHostAPMonitoringInterface | 1372 | * OHostAPMonitoringInterface |
1366 | *======================================================================================*/ | 1373 | *======================================================================================*/ |
1367 | 1374 | ||
1368 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1375 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
1369 | :OMonitoringInterface( iface, prismHeader ) | 1376 | :OMonitoringInterface( iface, prismHeader ) |
1370 | { | 1377 | { |
1371 | iface->setMonitoring( this ); | 1378 | iface->setMonitoring( this ); |
1372 | } | 1379 | } |
1373 | 1380 | ||
1374 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() | 1381 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() |
1375 | { | 1382 | { |
1376 | } | 1383 | } |
1377 | 1384 | ||
1378 | void OHostAPMonitoringInterface::setEnabled( bool b ) | 1385 | void OHostAPMonitoringInterface::setEnabled( bool b ) |
1379 | { | 1386 | { |
1380 | int monitorCode = _prismHeader ? 1 : 2; | 1387 | int monitorCode = _prismHeader ? 1 : 2; |
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro index a10a949..460de0a 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.5 | 21 | VERSION = 1.8.6 |
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 | } |