-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 6 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 6 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 2 |
3 files changed, 5 insertions, 9 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 209ec94..3003e12 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -1,92 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 20 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | |||
29 | */ | 27 | */ |
30 | 28 | ||
31 | #include "omanufacturerdb.h" | 29 | #include "omanufacturerdb.h" |
32 | 30 | ||
33 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 31 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
34 | 32 | ||
35 | /* OPIE */ | 33 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
37 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 35 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
38 | #include <qpe/global.h> | 36 | #include <qpe/global.h> |
39 | #endif | 37 | #endif |
40 | 38 | ||
41 | /* QT */ | 39 | /* QT */ |
42 | #include <qapplication.h> | 40 | #include <qapplication.h> |
43 | #include <qfile.h> | 41 | #include <qfile.h> |
44 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
45 | 43 | ||
46 | using namespace Opie::Core; | 44 | using namespace Opie::Core; |
47 | namespace Opie { | 45 | namespace Opie { |
48 | namespace Net { | 46 | namespace Net { |
49 | 47 | ||
50 | OManufacturerDB* OManufacturerDB::_instance = 0; | 48 | OManufacturerDB* OManufacturerDB::_instance = 0; |
51 | 49 | ||
52 | OManufacturerDB* OManufacturerDB::instance() | 50 | OManufacturerDB* OManufacturerDB::instance() |
53 | { | 51 | { |
54 | if ( !OManufacturerDB::_instance ) | 52 | if ( !OManufacturerDB::_instance ) |
55 | { | 53 | { |
56 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 54 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
57 | _instance = new OManufacturerDB(); | 55 | _instance = new OManufacturerDB(); |
58 | } | 56 | } |
59 | return _instance; | 57 | return _instance; |
60 | } | 58 | } |
61 | 59 | ||
62 | 60 | ||
63 | OManufacturerDB::OManufacturerDB() | 61 | OManufacturerDB::OManufacturerDB() |
64 | { | 62 | { |
65 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 63 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
66 | Global::statusMessage( "Reading Manufacturers..." ); | 64 | Global::statusMessage( "Reading Manufacturers..." ); |
67 | #endif | 65 | #endif |
68 | QString filename( "/etc/manufacturers" ); | 66 | QString filename( "/etc/manufacturers" ); |
69 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 67 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
70 | if ( !QFile::exists( filename ) ) | 68 | if ( !QFile::exists( filename ) ) |
71 | { | 69 | { |
72 | filename = "/opt/QtPalmtop/etc/manufacturers"; | 70 | filename = "/opt/QtPalmtop/etc/manufacturers"; |
73 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 71 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
74 | if ( !QFile::exists( filename ) ) | 72 | if ( !QFile::exists( filename ) ) |
75 | { | 73 | { |
76 | filename = "/usr/share/wellenreiter/manufacturers"; | 74 | filename = "/usr/share/wellenreiter/manufacturers"; |
77 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 75 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
78 | } | 76 | } |
79 | } | 77 | } |
80 | 78 | ||
81 | QFile file( filename ); | 79 | QFile file( filename ); |
82 | bool hasFile = file.open( IO_ReadOnly ); | 80 | bool hasFile = file.open( IO_ReadOnly ); |
83 | if (!hasFile) | 81 | if (!hasFile) |
84 | { | 82 | { |
85 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 83 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
86 | } | 84 | } |
87 | else | 85 | else |
88 | { | 86 | { |
89 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 87 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
90 | QTextStream s( &file ); | 88 | QTextStream s( &file ); |
91 | QString addr; | 89 | QString addr; |
92 | QString manu; | 90 | QString manu; |
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h index 5c1940e..c667e20 100644 --- a/libopie2/opienet/omanufacturerdb.h +++ b/libopie2/opienet/omanufacturerdb.h | |||
@@ -1,77 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 20 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | |||
29 | */ | 27 | */ |
30 | 28 | ||
31 | #ifndef OMANUFACTURERDB_H | 29 | #ifndef OMANUFACTURERDB_H |
32 | #define OMANUFACTURERDB_H | 30 | #define OMANUFACTURERDB_H |
33 | 31 | ||
34 | #include <qmap.h> | 32 | #include <qmap.h> |
35 | 33 | ||
36 | namespace Opie { | 34 | namespace Opie { |
37 | namespace Net { | 35 | namespace Net { |
38 | 36 | ||
39 | /** | 37 | /** |
40 | * @brief A Ethernet card vendor database. | 38 | * @brief A Ethernet card vendor database. |
41 | * | 39 | * |
42 | * This class encapsulates the lookup of Ethernet vendor given a | 40 | * This class encapsulates the lookup of Ethernet vendor given a |
43 | * certain Mac Address. Only the first three bytes define the vendor. | 41 | * certain Mac Address. Only the first three bytes define the vendor. |
44 | */ | 42 | */ |
45 | class OManufacturerDB | 43 | class OManufacturerDB |
46 | { | 44 | { |
47 | public: | 45 | public: |
48 | /** | 46 | /** |
49 | * @returns the one-and-only @ref OManufacturerDB instance. | 47 | * @returns the one-and-only @ref OManufacturerDB instance. |
50 | */ | 48 | */ |
51 | static OManufacturerDB* instance(); | 49 | static OManufacturerDB* instance(); |
52 | /** | 50 | /** |
53 | * @returns the short manufacturer string given a @a macaddr. | 51 | * @returns the short manufacturer string given a @a macaddr. |
54 | */ | 52 | */ |
55 | const QString& lookup( const QString& macaddr ) const; | 53 | const QString& lookup( const QString& macaddr ) const; |
56 | /** | 54 | /** |
57 | * @returns the enhanced manufacturer string given a @a macaddr. | 55 | * @returns the enhanced manufacturer string given a @a macaddr. |
58 | */ | 56 | */ |
59 | const QString& lookupExt( const QString& macaddr ) const; | 57 | const QString& lookupExt( const QString& macaddr ) const; |
60 | 58 | ||
61 | protected: | 59 | protected: |
62 | OManufacturerDB(); | 60 | OManufacturerDB(); |
63 | virtual ~OManufacturerDB(); | 61 | virtual ~OManufacturerDB(); |
64 | 62 | ||
65 | private: | 63 | private: |
66 | QMap<QString, QString> manufacturers; | 64 | QMap<QString, QString> manufacturers; |
67 | QMap<QString, QString> manufacturersExt; | 65 | QMap<QString, QString> manufacturersExt; |
68 | static OManufacturerDB* _instance; | 66 | static OManufacturerDB* _instance; |
69 | class Private; | 67 | class Private; |
70 | Private *d; | 68 | Private *d; |
71 | }; | 69 | }; |
72 | 70 | ||
73 | } | 71 | } |
74 | } | 72 | } |
75 | 73 | ||
76 | #endif | 74 | #endif |
77 | 75 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index c185805..047a704 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -136,106 +136,106 @@ bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | |||
136 | * OHostAddress | 136 | * OHostAddress |
137 | *======================================================================================*/ | 137 | *======================================================================================*/ |
138 | 138 | ||
139 | 139 | ||
140 | /*====================================================================================== | 140 | /*====================================================================================== |
141 | * OPrivateIOCTL | 141 | * OPrivateIOCTL |
142 | *======================================================================================*/ | 142 | *======================================================================================*/ |
143 | 143 | ||
144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
146 | { | 146 | { |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | OPrivateIOCTL::~OPrivateIOCTL() | 150 | OPrivateIOCTL::~OPrivateIOCTL() |
151 | { | 151 | { |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | int OPrivateIOCTL::numberGetArgs() const | 155 | int OPrivateIOCTL::numberGetArgs() const |
156 | { | 156 | { |
157 | return _getargs & IW_PRIV_SIZE_MASK; | 157 | return _getargs & IW_PRIV_SIZE_MASK; |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | int OPrivateIOCTL::typeGetArgs() const | 161 | int OPrivateIOCTL::typeGetArgs() const |
162 | { | 162 | { |
163 | return _getargs & IW_PRIV_TYPE_MASK >> 12; | 163 | return _getargs & IW_PRIV_TYPE_MASK >> 12; |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | int OPrivateIOCTL::numberSetArgs() const | 167 | int OPrivateIOCTL::numberSetArgs() const |
168 | { | 168 | { |
169 | return _setargs & IW_PRIV_SIZE_MASK; | 169 | return _setargs & IW_PRIV_SIZE_MASK; |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | int OPrivateIOCTL::typeSetArgs() const | 173 | int OPrivateIOCTL::typeSetArgs() const |
174 | { | 174 | { |
175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | void OPrivateIOCTL::invoke() const | 179 | void OPrivateIOCTL::invoke() const |
180 | { | 180 | { |
181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | 181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | 185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) |
186 | { | 186 | { |
187 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; | 187 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; |
188 | arglist[num] = value; | 188 | arglist[num] = value; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | 192 | ||
193 | namespace Internal { | 193 | namespace Internal { |
194 | /*====================================================================================== | 194 | /*====================================================================================== |
195 | * assorted functions | 195 | * assorted functions |
196 | *======================================================================================*/ | 196 | *======================================================================================*/ |
197 | 197 | ||
198 | void dumpBytes( const unsigned char* data, int num ) | 198 | void dumpBytes( const unsigned char* data, int num ) |
199 | { | 199 | { |
200 | printf( "Dumping %d bytes @ %0x", num, data ); | 200 | printf( "Dumping %d bytes @ 0x%p", num, data ); |
201 | printf( "-------------------------------------------\n" ); | 201 | printf( "-------------------------------------------\n" ); |
202 | 202 | ||
203 | for ( int i = 0; i < num; ++i ) | 203 | for ( int i = 0; i < num; ++i ) |
204 | { | 204 | { |
205 | printf( "%02x ", data[i] ); | 205 | printf( "%02x ", data[i] ); |
206 | if ( !((i+1) % 32) ) printf( "\n" ); | 206 | if ( !((i+1) % 32) ) printf( "\n" ); |
207 | } | 207 | } |
208 | printf( "\n\n" ); | 208 | printf( "\n\n" ); |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | int stringToMode( const QString& mode ) | 212 | int stringToMode( const QString& mode ) |
213 | { | 213 | { |
214 | if ( mode == "auto" ) return IW_MODE_AUTO; | 214 | if ( mode == "auto" ) return IW_MODE_AUTO; |
215 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; | 215 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; |
216 | else if ( mode == "managed" ) return IW_MODE_INFRA; | 216 | else if ( mode == "managed" ) return IW_MODE_INFRA; |
217 | else if ( mode == "master" ) return IW_MODE_MASTER; | 217 | else if ( mode == "master" ) return IW_MODE_MASTER; |
218 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; | 218 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; |
219 | else if ( mode == "secondary" ) return IW_MODE_SECOND; | 219 | else if ( mode == "secondary" ) return IW_MODE_SECOND; |
220 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; | 220 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; |
221 | else assert( 0 ); | 221 | else assert( 0 ); |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | QString modeToString( int mode ) | 225 | QString modeToString( int mode ) |
226 | { | 226 | { |
227 | switch ( mode ) | 227 | switch ( mode ) |
228 | { | 228 | { |
229 | case IW_MODE_AUTO: return "auto"; | 229 | case IW_MODE_AUTO: return "auto"; |
230 | case IW_MODE_ADHOC: return "adhoc"; | 230 | case IW_MODE_ADHOC: return "adhoc"; |
231 | case IW_MODE_INFRA: return "managed"; | 231 | case IW_MODE_INFRA: return "managed"; |
232 | case IW_MODE_MASTER: return "master"; | 232 | case IW_MODE_MASTER: return "master"; |
233 | case IW_MODE_REPEAT: return "repeater"; | 233 | case IW_MODE_REPEAT: return "repeater"; |
234 | case IW_MODE_SECOND: return "second"; | 234 | case IW_MODE_SECOND: return "second"; |
235 | case IW_MODE_MONITOR: return "monitor"; | 235 | case IW_MODE_MONITOR: return "monitor"; |
236 | default: assert( 0 ); | 236 | default: assert( 0 ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |