Diffstat (limited to 'libopie2/opienet/onetutils.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index ad0e89d..ce147c5 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -25,25 +25,25 @@ | |||
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/onetutils.h> | 32 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/omanufacturerdb.h> | 34 | #include <opie2/omanufacturerdb.h> |
35 | 35 | ||
36 | #include <net/if.h> | 36 | #include <net/if.h> |
37 | 37 | #include <cassert> | |
38 | #include <cstdio> | 38 | #include <cstdio> |
39 | using namespace std; | 39 | using namespace std; |
40 | 40 | ||
41 | #define IW_PRIV_TYPE_MASK 0x7000 | 41 | #define IW_PRIV_TYPE_MASK 0x7000 |
42 | #define IW_PRIV_TYPE_NONE 0x0000 | 42 | #define IW_PRIV_TYPE_NONE 0x0000 |
43 | #define IW_PRIV_TYPE_BYTE 0x1000 | 43 | #define IW_PRIV_TYPE_BYTE 0x1000 |
44 | #define IW_PRIV_TYPE_CHAR 0x2000 | 44 | #define IW_PRIV_TYPE_CHAR 0x2000 |
45 | #define IW_PRIV_TYPE_INT 0x4000 | 45 | #define IW_PRIV_TYPE_INT 0x4000 |
46 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 46 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
47 | #define IW_PRIV_TYPE_ADDR 0x6000 | 47 | #define IW_PRIV_TYPE_ADDR 0x6000 |
48 | #define IW_PRIV_SIZE_FIXED 0x0800 | 48 | #define IW_PRIV_SIZE_FIXED 0x0800 |
49 | #define IW_PRIV_SIZE_MASK 0x07FF | 49 | #define IW_PRIV_SIZE_MASK 0x07FF |
@@ -204,12 +204,40 @@ void dumpBytes( const unsigned char* data, int num ) | |||
204 | { | 204 | { |
205 | printf( "Dumping %d bytes @ %0x", num, data ); | 205 | printf( "Dumping %d bytes @ %0x", num, data ); |
206 | printf( "-------------------------------------------\n" ); | 206 | printf( "-------------------------------------------\n" ); |
207 | 207 | ||
208 | for ( int i = 0; i < num; ++i ) | 208 | for ( int i = 0; i < num; ++i ) |
209 | { | 209 | { |
210 | printf( "%02x ", data[i] ); | 210 | printf( "%02x ", data[i] ); |
211 | if ( !((i+1) % 32) ) printf( "\n" ); | 211 | if ( !((i+1) % 32) ) printf( "\n" ); |
212 | } | 212 | } |
213 | printf( "\n\n" ); | 213 | printf( "\n\n" ); |
214 | } | 214 | } |
215 | 215 | ||
216 | |||
217 | int stringToMode( const QString& mode ) | ||
218 | { | ||
219 | if ( mode == "auto" ) return IW_MODE_AUTO; | ||
220 | else if ( mode == "adhoc" ) return IW_MODE_ADHOC; | ||
221 | else if ( mode == "managed" ) return IW_MODE_INFRA; | ||
222 | else if ( mode == "master" ) return IW_MODE_MASTER; | ||
223 | else if ( mode == "repeater" ) return IW_MODE_REPEAT; | ||
224 | else if ( mode == "secondary" ) return IW_MODE_SECOND; | ||
225 | else if ( mode == "monitor" ) return IW_MODE_MONITOR; | ||
226 | else assert( 0 ); | ||
227 | } | ||
228 | |||
229 | |||
230 | QString modeToString( int mode ) | ||
231 | { | ||
232 | switch ( mode ) | ||
233 | { | ||
234 | case IW_MODE_AUTO: return "auto"; | ||
235 | case IW_MODE_ADHOC: return "adhoc"; | ||
236 | case IW_MODE_INFRA: return "managed"; | ||
237 | case IW_MODE_MASTER: return "master"; | ||
238 | case IW_MODE_REPEAT: return "repeater"; | ||
239 | case IW_MODE_SECOND: return "second"; | ||
240 | case IW_MODE_MONITOR: return "monitor"; | ||
241 | default: assert( 0 ); | ||
242 | } | ||
243 | } | ||