author | mickeyl <mickeyl> | 2003-05-08 17:35:05 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-08 17:35:05 (UTC) |
commit | 41ca770b8bea964ea9c5905b1df1209fe4720f89 (patch) (side-by-side diff) | |
tree | 585b10184e6afc283055ce3f7348ae19969b5174 /libopie2/opienet/omanufacturerdb.cpp | |
parent | 197cdbb5ca34517c077b69bb8517787ab1e52aeb (diff) | |
download | opie-41ca770b8bea964ea9c5905b1df1209fe4720f89.zip opie-41ca770b8bea964ea9c5905b1df1209fe4720f89.tar.gz opie-41ca770b8bea964ea9c5905b1df1209fe4720f89.tar.bz2 |
- sync manufacturer list with ethereal
- fix onetworkdemo example
- add API for short/extended manufacturer names
Diffstat (limited to 'libopie2/opienet/omanufacturerdb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index ea15125..c185fc5 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp @@ -55,33 +55,43 @@ OManufacturerDB::OManufacturerDB() qWarning( "OManufacturerDB: no valid manufacturer list found.", (const char*) filename ); } else { qDebug( "OManufacturerDB: found manufacturer list in '%s'...", (const char*) filename ); QTextStream s( &file ); QString addr; QString manu; + QString extManu; while (!s.atEnd()) { s >> addr; if ( !addr ) // read nothing!? { continue; } else if ( addr[0] == '#' ) { - s.readLine(); continue; } s.skipWhiteSpace(); s >> manu; - s.readLine(); - //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); + s.skipWhiteSpace(); + s >> extManu; + if ( extManu[0] == '#' ) // we have an extended manufacturer + { + s.skipWhiteSpace(); + extManu = s.readLine(); + qDebug( "OManufacturerDB: read '%s' as extended manufacturer string", (const char*) extManu ); + manufacturersExt.insert( addr, extManu ); + } + else + s.readLine(); + qDebug( "ManufacturerDB: read tuple %s, %s", (const char*) addr, (const char*) manu ); manufacturers.insert( addr, manu ); } } } @@ -89,8 +99,16 @@ OManufacturerDB::~OManufacturerDB() { } const QString& OManufacturerDB::lookup( const QString& macaddr ) const { return manufacturers[macaddr.upper().left(8)]; } + + +const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const +{ + QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); + return it == manufacturersExt.end() ? lookup( macaddr ) : *it; +} + |