summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp13
-rwxr-xr-xlibopie2/tools/regen.py198
-rw-r--r--noncore/net/wellenreiter/ChangeLog9
3 files changed, 205 insertions, 15 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
index 595633d..f61270b 100644
--- a/libopie2/opienet/omanufacturerdb.cpp
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -82,6 +82,9 @@ OManufacturerDB::OManufacturerDB()
82 QString addr; 82 QString addr;
83 QString manu; 83 QString manu;
84 QString extManu; 84 QString extManu;
85 #ifdef OPIE_IMPROVE_GUI_LATENCY
86 int counter = 0;
87 #endif
85 while (!s.atEnd()) 88 while (!s.atEnd())
86 { 89 {
87 s >> addr; 90 s >> addr;
@@ -90,11 +93,17 @@ OManufacturerDB::OManufacturerDB()
90 93
91 manufacturers.insert( addr, manu ); 94 manufacturers.insert( addr, manu );
92 manufacturersExt.insert( addr, extManu ); 95 manufacturersExt.insert( addr, extManu );
93 odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; 96 // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl;
94 #ifdef OPIE_IMPROVE_GUI_LATENCY 97 #ifdef OPIE_IMPROVE_GUI_LATENCY
95 if ( qApp ) qApp->processEvents(); 98 counter++;
99 if ( counter == 50 )
100 {
101 qApp->processEvents();
102 counter = 0;
103 }
96 #endif 104 #endif
97 } 105 }
106 odebug << "OManufacturerDB: manufacturer list completed." << oendl;
98 } 107 }
99} 108}
100 109
diff --git a/libopie2/tools/regen.py b/libopie2/tools/regen.py
index 3779896..89385e1 100755
--- a/libopie2/tools/regen.py
+++ b/libopie2/tools/regen.py
@@ -1,26 +1,31 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3# 3"""Regenerate C++ mapping classes"""
4# regenerate ioctl_table.h 4
5# 5#---------------------------------------------------------------------------#
6# #
7#---------------------------------------------------------------------------#
8
9def regenDebugMapper( basename ):
10 """
11 Debug Mapper - maps ioctl numbers to names, e.g. 0x4x5a -> SIOCGIWNAME
12 """
6 13
7import sys
8import os
9result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines() 14result = os.popen( 'find /usr/include -name "*.h" |xargs grep -h SIOC|grep 0x' ).readlines()
10 15
11try: 16try:
12 tablehfile = file( sys.argv[1]+".h", "w" ) 17 tablehfile = file( basename+".h", "w" )
13except: 18except:
14 tablehfile = sys.stdout 19 tablehfile = sys.stdout
15 20
16try: 21try:
17 tablecfile = file( sys.argv[1]+".cpp", "w" ) 22 tablecfile = file( basename+".cpp", "w" )
18except: 23except:
19 tablecfile = sys.stdout 24 tablecfile = sys.stdout
20 25
21print >>tablehfile,""" 26print >>tablehfile,"""
22/* 27/*
23 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 28 * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
24 */ 29 */
25 30
26#ifndef DEBUGMAPPER_H 31#ifndef DEBUGMAPPER_H
@@ -43,11 +48,11 @@ class DebugMapper
43}; 48};
44 49
45#endif 50#endif
46""" 51""" % sys.argv[0]
47 52
48print >>tablecfile,""" 53print >>tablecfile,"""
49/* 54/*
50 * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> 55 * debug value mapper - generated by %s - (C) Michael 'Mickey' Lauer <mickey@vanille.de>
51 */ 56 */
52 57
53#include <opie2/odebug.h> 58#include <opie2/odebug.h>
@@ -58,7 +63,7 @@ DebugMapper::DebugMapper()
58{ 63{
59 odebug << "DebugMapper::DebugMapper()" << oendl; 64 odebug << "DebugMapper::DebugMapper()" << oendl;
60 65
61""" % (tablehfile.name) 66""" % ( sys.argv[0], tablehfile.name )
62 67
63for line in result: 68for line in result:
64 l = line.split() 69 l = line.split()
@@ -94,3 +99,174 @@ const QString& DebugMapper::map( int value ) const
94} 99}
95 100
96""" 101"""
102
103#---------------------------------------------------------------------------#
104# #
105#---------------------------------------------------------------------------#
106
107def regenManufacturerDB( basename ):
108
109 try:
110 h = file( basename+".h", "w" )
111 except:
112 h = sys.stdout
113
114 try:
115 cpp = file( basename+".cpp", "w" )
116 except:
117 cpp = sys.stdout
118
119 print >>h,"""
120#ifndef OMANUFACTURERDB_H
121#define OMANUFACTURERDB_H
122
123#include <qmap.h>
124
125/**
126 * @brief A Ethernet card vendor database.
127 *
128 * This class encapsulates the lookup of Ethernet vendor given a
129 * certain Mac Address. Only the first three bytes define the vendor.
130 */
131class OManufacturerDB
132{
133 public:
134 /**
135 * @returns the one-and-only @ref OManufacturerDB instance.
136 */
137 static OManufacturerDB* instance();
138 /**
139 * @returns the short manufacturer string given a @a macaddr.
140 */
141 const QString& lookup( const QString& macaddr ) const;
142 /**
143 * @returns the enhanced manufacturer string given a @a macaddr.
144 */
145 const QString& lookupExt( const QString& macaddr ) const;
146
147 protected:
148 OManufacturerDB();
149 virtual ~OManufacturerDB();
150
151 private:
152 QMap<QString, QString> manufacturers;
153 QMap<QString, QString> manufacturersExt;
154 static OManufacturerDB* _instance;
155};
156
157#endif
158"""
159
160 print >>cpp,"""
161#include "%s.h"
162
163/* OPIE CORE */
164#include <opie2/odebug.h>
165
166/* QT */
167#include <qapplication.h>
168#include <qstring.h>
169
170#define OPIE_IMPROVE_GUI_LATENCY 1
171
172OManufacturerDB* OManufacturerDB::_instance = 0;
173
174OManufacturerDB* OManufacturerDB::instance()
175{
176 if ( !OManufacturerDB::_instance )
177 {
178 odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl;
179 _instance = new OManufacturerDB();
180 }
181 return _instance;
182}
183
184
185OManufacturerDB::OManufacturerDB()
186{
187""" % basename
188
189 count = 0
190 for line in sys.stdin:
191 if line[0] == "#": # skip comments
192 continue
193 #print line.strip()
194 entries = line.strip().split()
195 #print "number of entries =", len( entries )
196 #print entries
197 if len( entries ) < 2:
198 continue
199 elif len( entries ) == 2:
200 count += 1
201 print "2-line detected."
202 print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] )
203 print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], entries[1] )
204 elif len( entries ) > 2:
205 count += 1
206 print "3-line detected."
207 print >>cpp, ' manufacturers.insert( "%s", "%s" );' % ( entries[0], entries[1] )
208 print >>cpp, ' manufacturersExt.insert( "%s", "%s" );' % ( entries[0], "_".join( entries[3:] ) )
209 else:
210 assert( false )
211 if not (count % 1000):
212 print >>cpp,"""
213#ifdef OPIE_IMPROVE_GUI_LATENCY
214 if (qApp) qApp->processEvents();
215#endif
216"""
217 print "successfully parsed", count, "manufacturer lines"
218 print >>cpp,"""
219}
220
221
222OManufacturerDB::~OManufacturerDB()
223{
224}
225
226
227const QString& OManufacturerDB::lookup( const QString& macaddr ) const
228{
229 return manufacturers[macaddr.upper().left(8)];
230}
231
232
233const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const
234{
235 QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) );
236 return it == manufacturersExt.end() ? lookup( macaddr ) : *it;
237}
238"""
239
240#---------------------------------------------------------------------------#
241# #
242#---------------------------------------------------------------------------#
243
244#---------------------------------------------------------------------------#
245# #
246#---------------------------------------------------------------------------#
247
248#---------------------------------------------------------------------------#
249# #
250#---------------------------------------------------------------------------#
251
252import sys
253import os
254import copy
255
256if __name__ == "__main__":
257 if len( sys.argv ) != 3:
258 print """
259Usage: %s <table> <basename>
260
261Available tables: %s
262""" % ( sys.argv[0], [ str(k)[5:] for k in copy.copy( locals() ) if k.startswith( "regen" ) ] )
263 sys.exit( -1 )
264
265 try:
266 func = locals()["regen%s" % sys.argv[1]]
267 except KeyError:
268 print "Table '%s' unknown." % sys.argv[1]
269 sys.exit( -1 )
270 else:
271 func( sys.argv[2] )
272 sys.exit( 0 ) \ No newline at end of file
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog
index 1ce25d5..55e13fc 100644
--- a/noncore/net/wellenreiter/ChangeLog
+++ b/noncore/net/wellenreiter/ChangeLog
@@ -1,10 +1,15 @@
1 2004-??-?? Michael Lauer <mickey@Vanille.de>
2
3 * Improved the speed reading the manufacturer list
4 * GPS coordinates are now presented in the DMS (as opposed to decimal) format
5
1 2003-12-18 Michael Lauer <mickey@Vanille.de> 6 2003-12-18 Michael Lauer <mickey@Vanille.de>
2 7
3 * Released as Version 1.0.2 (Development Snapshot) 8 * Released as Version 1.0.2 (Development Snapshot)
4 * Add automatic uploading of capture files to "The Capture Dump" site at 9 * Added automatic uploading of capture files to "The Capture Dump" site at
5 http://www.Vanille.de/projects/capturedump.spy 10 http://www.Vanille.de/projects/capturedump.spy
6 * Initial reading of the manufacturer database happens now in background 11 * Initial reading of the manufacturer database happens now in background
7 * Remove deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now. 12 * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now.
8 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that 13 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that
9 doesn't work, it falls back to using the proprietary iwpriv commands 14 doesn't work, it falls back to using the proprietary iwpriv commands
10 15