-rw-r--r-- | libopie2/opienet/dhcp.h | 1 | ||||
-rw-r--r-- | libopie2/opienet/libopienet2.control | 4 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 67 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 43 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 2 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 6 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 5 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 5 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 5 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 2 | ||||
-rw-r--r-- | libopie2/opienet/ostation.cpp | 3 | ||||
-rw-r--r-- | libopie2/opienet/ostation.h | 3 | ||||
-rw-r--r-- | libopie2/opienet/udp_ports.h | 2 |
14 files changed, 87 insertions, 69 deletions
diff --git a/libopie2/opienet/dhcp.h b/libopie2/opienet/dhcp.h index 3f2f775..368e375 100644 --- a/libopie2/opienet/dhcp.h +++ b/libopie2/opienet/dhcp.h @@ -105,96 +105,97 @@ struct dhcp_packet { #define DHO_COOKIE_SERVERS 8 #define DHO_LPR_SERVERS 9 #define DHO_IMPRESS_SERVERS 10 #define DHO_RESOURCE_LOCATION_SERVERS 11 #define DHO_HOST_NAME 12 #define DHO_BOOT_SIZE 13 #define DHO_MERIT_DUMP 14 #define DHO_DOMAIN_NAME 15 #define DHO_SWAP_SERVER 16 #define DHO_ROOT_PATH 17 #define DHO_EXTENSIONS_PATH 18 #define DHO_IP_FORWARDING 19 #define DHO_NON_LOCAL_SOURCE_ROUTING 20 #define DHO_POLICY_FILTER 21 #define DHO_MAX_DGRAM_REASSEMBLY 22 #define DHO_DEFAULT_IP_TTL 23 #define DHO_PATH_MTU_AGING_TIMEOUT 24 #define DHO_PATH_MTU_PLATEAU_TABLE 25 #define DHO_INTERFACE_MTU 26 #define DHO_ALL_SUBNETS_LOCAL 27 #define DHO_BROADCAST_ADDRESS 28 #define DHO_PERFORM_MASK_DISCOVERY 29 #define DHO_MASK_SUPPLIER 30 #define DHO_ROUTER_DISCOVERY 31 #define DHO_ROUTER_SOLICITATION_ADDRESS 32 #define DHO_STATIC_ROUTES 33 #define DHO_TRAILER_ENCAPSULATION 34 #define DHO_ARP_CACHE_TIMEOUT 35 #define DHO_IEEE802_3_ENCAPSULATION 36 #define DHO_DEFAULT_TCP_TTL 37 #define DHO_TCP_KEEPALIVE_INTERVAL 38 #define DHO_TCP_KEEPALIVE_GARBAGE 39 #define DHO_NIS_DOMAIN 40 #define DHO_NIS_SERVERS 41 #define DHO_NTP_SERVERS 42 #define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 #define DHO_NETBIOS_NAME_SERVERS 44 #define DHO_NETBIOS_DD_SERVER 45 #define DHO_NETBIOS_NODE_TYPE 46 #define DHO_NETBIOS_SCOPE 47 #define DHO_FONT_SERVERS 48 #define DHO_X_DISPLAY_MANAGER 49 #define DHO_DHCP_REQUESTED_ADDRESS 50 #define DHO_DHCP_LEASE_TIME 51 #define DHO_DHCP_OPTION_OVERLOAD 52 #define DHO_DHCP_MESSAGE_TYPE 53 #define DHO_DHCP_SERVER_IDENTIFIER 54 #define DHO_DHCP_PARAMETER_REQUEST_LIST 55 #define DHO_DHCP_MESSAGE 56 #define DHO_DHCP_MAX_MESSAGE_SIZE 57 #define DHO_DHCP_RENEWAL_TIME 58 #define DHO_DHCP_REBINDING_TIME 59 #define DHO_VENDOR_CLASS_IDENTIFIER 60 #define DHO_DHCP_CLIENT_IDENTIFIER 61 #define DHO_NWIP_DOMAIN_NAME 62 #define DHO_NWIP_SUBOPTIONS 63 #define DHO_USER_CLASS 77 #define DHO_FQDN 81 #define DHO_DHCP_AGENT_OPTIONS 82 #define DHO_SUBNET_SELECTION 118 /* RFC3011! */ /* The DHO_AUTHENTICATE option is not a standard yet, so I've allocated an option out of the "local" option space for it on a temporary basis. Once an option code number is assigned, I will immediately and shamelessly break this, so don't count on it continuing to work. */ #define DHO_AUTHENTICATE 210 #define DHO_END 255 /* DHCP message types. */ #define DHCPDISCOVER 1 #define DHCPOFFER 2 #define DHCPREQUEST 3 #define DHCPDECLINE 4 #define DHCPACK 5 #define DHCPNAK 6 #define DHCPRELEASE 7 #define DHCPINFORM 8 /* Relay Agent Information option subtypes: */ #define RAI_CIRCUIT_ID 1 #define RAI_REMOTE_ID 2 #define RAI_AGENT_ID 3 /* FQDN suboptions: */ #define FQDN_NO_CLIENT_UPDATE 1 #define FQDN_SERVER_UPDATE 2 #define FQDN_ENCODED 3 #define FQDN_RCODE1 4 #define FQDN_RCODE2 5 #define FQDN_HOSTNAME 6 #define FQDN_DOMAINNAME 7 #define FQDN_FQDN 8 #define FQDN_SUBOPTION_COUNT 8 #endif
\ No newline at end of file + diff --git a/libopie2/opienet/libopienet2.control b/libopie2/opienet/libopienet2.control index 65d8464..8eb0704 100644 --- a/libopie2/opienet/libopienet2.control +++ b/libopie2/opienet/libopienet2.control @@ -1,11 +1,11 @@ Package: libopienet2 Files: $OPIEDIR/lib/libopienet2.so.* $OPIEDIR/etc/manufacturers Priority: optional Section: opie/system Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: 1.8.1-$SUB_VERSION.2 -Depends: libqpe1, libopiecore2 (1.8.1) +Version: 1.8.2-$SUB_VERSION.2 +Depends: libopiecore2 (1.8.2) Provides: libopienet2 Description: Opie library 2.0 NET diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp index d62b3ba..7e4ab2b 100644 --- a/libopie2/opienet/odebugmapper.cpp +++ b/libopie2/opienet/odebugmapper.cpp @@ -1,213 +1,215 @@ /* * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> */ +#include <opie2/odebug.h> + #include "odebugmapper.h" DebugMapper::DebugMapper() { - qDebug( "DebugMapper::DebugMapper()" ); + odebug << "DebugMapper::DebugMapper()" << oendl; _map.insert( 0x8902, new QString("SIOCSPGRP") ); _map.insert( 0x8904, new QString("SIOCGPGRP") ); _map.insert( 0x8905, new QString("SIOCATMARK") ); _map.insert( 0x8906, new QString("SIOCGSTAMP") ); _map.insert( 0x890B, new QString("SIOCADDRT") ); _map.insert( 0x890C, new QString("SIOCDELRT") ); _map.insert( 0x890D, new QString("SIOCRTMSG") ); _map.insert( 0x8910, new QString("SIOCGIFNAME") ); _map.insert( 0x8911, new QString("SIOCSIFLINK") ); _map.insert( 0x8912, new QString("SIOCGIFCONF") ); _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); _map.insert( 0x8915, new QString("SIOCGIFADDR") ); _map.insert( 0x8916, new QString("SIOCSIFADDR") ); _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); _map.insert( 0x891f, new QString("SIOCGIFMEM") ); _map.insert( 0x8920, new QString("SIOCSIFMEM") ); _map.insert( 0x8921, new QString("SIOCGIFMTU") ); _map.insert( 0x8922, new QString("SIOCSIFMTU") ); _map.insert( 0x8923, new QString("SIOCSIFNAME") ); _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); _map.insert( 0x8931, new QString("SIOCADDMULTI") ); _map.insert( 0x8932, new QString("SIOCDELMULTI") ); _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); _map.insert( 0x8936, new QString("SIOCDIFADDR") ); _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); _map.insert( 0x8940, new QString("SIOCGIFBR") ); _map.insert( 0x8941, new QString("SIOCSIFBR") ); _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); _map.insert( 0x8953, new QString("SIOCDARP") ); _map.insert( 0x8954, new QString("SIOCGARP") ); _map.insert( 0x8955, new QString("SIOCSARP") ); _map.insert( 0x8960, new QString("SIOCDRARP") ); _map.insert( 0x8961, new QString("SIOCGRARP") ); _map.insert( 0x8962, new QString("SIOCSRARP") ); _map.insert( 0x8970, new QString("SIOCGIFMAP") ); _map.insert( 0x8971, new QString("SIOCSIFMAP") ); _map.insert( 0x8980, new QString("SIOCADDDLCI") ); _map.insert( 0x8981, new QString("SIOCDELDLCI") ); _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); _map.insert( 0x1fff, new QString("SIOCPARM_MASK") ); _map.insert( 0x00000000, new QString("SIOC_VOID") ); _map.insert( 0x20000000, new QString("SIOC_OUT") ); _map.insert( 0x40000000, new QString("SIOC_IN") ); _map.insert( 0x8B00, new QString("SIOCSIWCOMMIT") ); _map.insert( 0x8B01, new QString("SIOCGIWNAME") ); _map.insert( 0x8B02, new QString("SIOCSIWNWID") ); _map.insert( 0x8B03, new QString("SIOCGIWNWID") ); _map.insert( 0x8B04, new QString("SIOCSIWFREQ") ); _map.insert( 0x8B05, new QString("SIOCGIWFREQ") ); _map.insert( 0x8B06, new QString("SIOCSIWMODE") ); _map.insert( 0x8B07, new QString("SIOCGIWMODE") ); _map.insert( 0x8B08, new QString("SIOCSIWSENS") ); _map.insert( 0x8B09, new QString("SIOCGIWSENS") ); _map.insert( 0x8B0A, new QString("SIOCSIWRANGE") ); _map.insert( 0x8B0B, new QString("SIOCGIWRANGE") ); _map.insert( 0x8B0C, new QString("SIOCSIWPRIV") ); _map.insert( 0x8B0D, new QString("SIOCGIWPRIV") ); _map.insert( 0x8B0E, new QString("SIOCSIWSTATS") ); _map.insert( 0x8B0F, new QString("SIOCGIWSTATS") ); _map.insert( 0x8B10, new QString("SIOCSIWSPY") ); _map.insert( 0x8B11, new QString("SIOCGIWSPY") ); _map.insert( 0x8B14, new QString("SIOCSIWAP") ); _map.insert( 0x8B15, new QString("SIOCGIWAP") ); _map.insert( 0x8B17, new QString("SIOCGIWAPLIST") ); _map.insert( 0x8B18, new QString("SIOCSIWSCAN") ); _map.insert( 0x8B19, new QString("SIOCGIWSCAN") ); _map.insert( 0x8B1A, new QString("SIOCSIWESSID") ); _map.insert( 0x8B1B, new QString("SIOCGIWESSID") ); _map.insert( 0x8B1C, new QString("SIOCSIWNICKN") ); _map.insert( 0x8B1D, new QString("SIOCGIWNICKN") ); _map.insert( 0x8B20, new QString("SIOCSIWRATE") ); _map.insert( 0x8B21, new QString("SIOCGIWRATE") ); _map.insert( 0x8B22, new QString("SIOCSIWRTS") ); _map.insert( 0x8B23, new QString("SIOCGIWRTS") ); _map.insert( 0x8B24, new QString("SIOCSIWFRAG") ); _map.insert( 0x8B25, new QString("SIOCGIWFRAG") ); _map.insert( 0x8B26, new QString("SIOCSIWTXPOW") ); _map.insert( 0x8B27, new QString("SIOCGIWTXPOW") ); _map.insert( 0x8B28, new QString("SIOCSIWRETRY") ); _map.insert( 0x8B29, new QString("SIOCGIWRETRY") ); _map.insert( 0x8B2A, new QString("SIOCSIWENCODE") ); _map.insert( 0x8B2B, new QString("SIOCGIWENCODE") ); _map.insert( 0x8B2C, new QString("SIOCSIWPOWER") ); _map.insert( 0x8B2D, new QString("SIOCGIWPOWER") ); _map.insert( 0x8BE0, new QString("SIOCIWFIRSTPRIV") ); _map.insert( 0x8BFF, new QString("SIOCIWLASTPRIV") ); _map.insert( 0x8B00, new QString("SIOCIWFIRST") ); _map.insert( 0x5000, new QString("SIOCGBPQETHPARAM") ); _map.insert( 0x5001, new QString("SIOCSBPQETHPARAM") ); _map.insert( 0x890B, new QString("SIOCADDRT") ); _map.insert( 0x890C, new QString("SIOCDELRT") ); _map.insert( 0x890D, new QString("SIOCRTMSG") ); _map.insert( 0x8910, new QString("SIOCGIFNAME") ); _map.insert( 0x8911, new QString("SIOCSIFLINK") ); _map.insert( 0x8912, new QString("SIOCGIFCONF") ); _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); _map.insert( 0x8914, new QString("SIOCSIFFLAGS") ); _map.insert( 0x8915, new QString("SIOCGIFADDR") ); _map.insert( 0x8916, new QString("SIOCSIFADDR") ); _map.insert( 0x8917, new QString("SIOCGIFDSTADDR") ); _map.insert( 0x8918, new QString("SIOCSIFDSTADDR") ); _map.insert( 0x8919, new QString("SIOCGIFBRDADDR") ); _map.insert( 0x891a, new QString("SIOCSIFBRDADDR") ); _map.insert( 0x891b, new QString("SIOCGIFNETMASK") ); _map.insert( 0x891c, new QString("SIOCSIFNETMASK") ); _map.insert( 0x891d, new QString("SIOCGIFMETRIC") ); _map.insert( 0x891e, new QString("SIOCSIFMETRIC") ); _map.insert( 0x891f, new QString("SIOCGIFMEM") ); _map.insert( 0x8920, new QString("SIOCSIFMEM") ); _map.insert( 0x8921, new QString("SIOCGIFMTU") ); _map.insert( 0x8922, new QString("SIOCSIFMTU") ); _map.insert( 0x8923, new QString("SIOCSIFNAME") ); _map.insert( 0x8924, new QString("SIOCSIFHWADDR") ); _map.insert( 0x8925, new QString("SIOCGIFENCAP") ); _map.insert( 0x8926, new QString("SIOCSIFENCAP") ); _map.insert( 0x8927, new QString("SIOCGIFHWADDR") ); _map.insert( 0x8929, new QString("SIOCGIFSLAVE") ); _map.insert( 0x8930, new QString("SIOCSIFSLAVE") ); _map.insert( 0x8931, new QString("SIOCADDMULTI") ); _map.insert( 0x8932, new QString("SIOCDELMULTI") ); _map.insert( 0x8933, new QString("SIOCGIFINDEX") ); _map.insert( 0x8934, new QString("SIOCSIFPFLAGS") ); _map.insert( 0x8935, new QString("SIOCGIFPFLAGS") ); _map.insert( 0x8936, new QString("SIOCDIFADDR") ); _map.insert( 0x8937, new QString("SIOCSIFHWBROADCAST") ); _map.insert( 0x8938, new QString("SIOCGIFCOUNT") ); _map.insert( 0x8940, new QString("SIOCGIFBR") ); _map.insert( 0x8941, new QString("SIOCSIFBR") ); _map.insert( 0x8942, new QString("SIOCGIFTXQLEN") ); _map.insert( 0x8943, new QString("SIOCSIFTXQLEN") ); _map.insert( 0x8944, new QString("SIOCGIFDIVERT") ); _map.insert( 0x8945, new QString("SIOCSIFDIVERT") ); _map.insert( 0x8946, new QString("SIOCETHTOOL") ); _map.insert( 0x8947, new QString("SIOCGMIIPHY") ); _map.insert( 0x8948, new QString("SIOCGMIIREG") ); _map.insert( 0x8949, new QString("SIOCSMIIREG") ); _map.insert( 0x894A, new QString("SIOCWANDEV") ); _map.insert( 0x8953, new QString("SIOCDARP") ); _map.insert( 0x8954, new QString("SIOCGARP") ); _map.insert( 0x8955, new QString("SIOCSARP") ); _map.insert( 0x8960, new QString("SIOCDRARP") ); _map.insert( 0x8961, new QString("SIOCGRARP") ); _map.insert( 0x8962, new QString("SIOCSRARP") ); _map.insert( 0x8970, new QString("SIOCGIFMAP") ); _map.insert( 0x8971, new QString("SIOCSIFMAP") ); _map.insert( 0x8980, new QString("SIOCADDDLCI") ); _map.insert( 0x8981, new QString("SIOCDELDLCI") ); _map.insert( 0x8982, new QString("SIOCGIFVLAN") ); _map.insert( 0x8983, new QString("SIOCSIFVLAN") ); _map.insert( 0x8990, new QString("SIOCBONDENSLAVE") ); _map.insert( 0x8991, new QString("SIOCBONDRELEASE") ); _map.insert( 0x8992, new QString("SIOCBONDSETHWADDR") ); _map.insert( 0x8993, new QString("SIOCBONDSLAVEINFOQUERY") ); _map.insert( 0x8994, new QString("SIOCBONDINFOQUERY") ); _map.insert( 0x8995, new QString("SIOCBONDCHANGEACTIVE") ); _map.insert( 0x89F0, new QString("SIOCDEVPRIVATE") ); _map.insert( 0x89E0, new QString("SIOCPROTOPRIVATE") ); }; DebugMapper::~DebugMapper() { - qDebug( "DebugMapper::~DebugMapper()" ); + odebug << "DebugMapper::~DebugMapper()" << oendl; } const QString& DebugMapper::map( int value ) const { QString* result = _map[ value ]; if ( !result ) { - qDebug( "DebugMapper::map() - value not found." ); + owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; return QString::null; } else { return *result; } } diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index c3c213c..bcce11f 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp @@ -1,118 +1,131 @@ -/********************************************************************** -** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. -** -** This file is part of Opie Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -**********************************************************************/ +/* + This file is part of the Opie Project + (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #include "omanufacturerdb.h" +/* OPIE CORE */ +#include <opie2/odebug.h> + /* QT */ #include <qstring.h> #include <qfile.h> #include <qtextstream.h> OManufacturerDB* OManufacturerDB::_instance = 0; OManufacturerDB* OManufacturerDB::instance() { if ( !OManufacturerDB::_instance ) { - qDebug( "OManufacturerDB::instance(): creating OManufacturerDB..." ); + odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; _instance = new OManufacturerDB(); } return _instance; } OManufacturerDB::OManufacturerDB() { QString filename( "/etc/manufacturers" ); - qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); + odebug << "OManufacturerDB: trying to read " << filename << oendl; if ( !QFile::exists( filename ) ) { filename = "/opt/QtPalmtop/etc/manufacturers"; - qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); + odebug << "OManufacturerDB: trying to read " << filename << oendl; if ( !QFile::exists( filename ) ) { filename = "/usr/share/wellenreiter/manufacturers"; - qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename ); + odebug << "OManufacturerDB: trying to read " << filename << oendl; } } QFile file( filename ); bool hasFile = file.open( IO_ReadOnly ); if (!hasFile) { - qWarning( "OManufacturerDB: no valid manufacturer list found.", (const char*) filename ); + owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; } else { - qDebug( "OManufacturerDB: found manufacturer list in '%s'...", (const char*) filename ); + odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; QTextStream s( &file ); QString addr; QString manu; QString extManu; while (!s.atEnd()) { s >> addr; if ( !addr ) // read nothing!? { continue; } else if ( addr[0] == '#' ) { continue; } s.skipWhiteSpace(); s >> manu; s.skipWhiteSpace(); s >> extManu; if ( extManu[0] == '#' ) // we have an extended manufacturer { s.skipWhiteSpace(); extManu = s.readLine(); - #ifdef DEBUG - qDebug( "OManufacturerDB: read '%s' as extended manufacturer string", (const char*) extManu ); - #endif + odebug << "OManufacturerDB: read " << extManu << " as extended manufacturer string" << oendl; manufacturersExt.insert( addr, extManu ); } else s.readLine(); - #ifdef DEBUG - qDebug( "ManufacturerDB: read tuple %s, %s", (const char*) addr, (const char*) manu ); - #endif + odebug << "OManufacturerDB: read tuple " << addr << ", " << manu << oendl; manufacturers.insert( addr, manu ); - } } } 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; } diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h index 651f624..c2712e5 100644 --- a/libopie2/opienet/omanufacturerdb.h +++ b/libopie2/opienet/omanufacturerdb.h @@ -1,54 +1,69 @@ -/********************************************************************** -** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. -** -** This file is part of Opie Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -**********************************************************************/ +/* + This file is part of the Opie Project + (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #ifndef OMANUFACTURERDB_H #define OMANUFACTURERDB_H #include <qmap.h> /** * @brief A Ethernet card vendor database. * * This class encapsulates the lookup of Ethernet vendor given a * certain Mac Address. Only the first three bytes define the vendor. */ class OManufacturerDB { public: /** * @returns the one-and-only @ref OManufacturerDB instance. */ static OManufacturerDB* instance(); /** * @returns the short manufacturer string given a @a macaddr. */ const QString& lookup( const QString& macaddr ) const; /** * @returns the enhanced manufacturer string given a @a macaddr. */ const QString& lookupExt( const QString& macaddr ) const; protected: OManufacturerDB(); virtual ~OManufacturerDB(); private: QMap<QString, QString> manufacturers; QMap<QString, QString> manufacturersExt; static OManufacturerDB* _instance; }; #endif diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index e3eb327..48cfa43 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp @@ -1,100 +1,100 @@ /* This file is part of the Opie Project - (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <opie2/onetutils.h> #include <opie2/onetwork.h> #include <opie2/omanufacturerdb.h> #include <net/if.h> #include <assert.h> #include <stdio.h> /*====================================================================================== * OMacAddress *======================================================================================*/ // static initializer for broadcast and unknown MAC Adresses const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) OMacAddress::OMacAddress() { memcpy( _bytes, __unknown, 6 ); } OMacAddress::OMacAddress( unsigned char* p ) { memcpy( _bytes, p, 6 ); } OMacAddress::OMacAddress( const unsigned char* p ) { memcpy( _bytes, p, 6 ); } OMacAddress::OMacAddress( struct ifreq& ifr ) { memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); } OMacAddress::~OMacAddress() { } //#ifdef QT_NO_DEBUG //inline //#endif const unsigned char* OMacAddress::native() const { return (const unsigned char*) &_bytes; } OMacAddress OMacAddress::fromString( const QString& str ) { QString addr( str ); unsigned char buf[6]; bool ok = true; int index = 14; for ( int i = 5; i >= 0; --i ) { buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); if ( !ok ) return OMacAddress::unknown; addr.truncate( index ); diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 95c813f..6a9280f 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -1,102 +1,99 @@ /* This file is part of the Opie Project - Copyright (C) 2003 by the Wellenreiter team: - Martin J. Muench <mjm@remote-exploit.org> - Max Moser <mmo@remote-exploit.org - Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* OPIE */ #include <opie2/onetwork.h> #include <opie2/ostation.h> /* QT */ #include <qfile.h> #include <qtextstream.h> /* UNIX */ #include <assert.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> #include <linux/sockios.h> #include <net/if_arp.h> #include <stdarg.h> #ifndef NODEBUG #include <opie2/odebugmapper.h> DebugMapper* debugmapper = new DebugMapper(); #endif /*====================================================================================== * ONetwork *======================================================================================*/ ONetwork* ONetwork::_instance = 0; ONetwork::ONetwork() { qDebug( "ONetwork::ONetwork()" ); qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT ); synchronize(); } void ONetwork::synchronize() { // gather available interfaces by inspecting /proc/net/dev //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev _interfaces.clear(); QString str; QFile f( "/proc/net/dev" ); bool hasFile = f.open( IO_ReadOnly ); if ( !hasFile ) { qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" ); return; } QTextStream s( &f ); s.readLine(); s.readLine(); while ( !s.atEnd() ) { s >> str; str.truncate( str.find( ':' ) ); qDebug( "ONetwork: found interface '%s'", (const char*) str ); ONetworkInterface* iface; @@ -857,192 +854,193 @@ OStationList* OWirelessNetworkInterface::scanNetwork() tv.tv_usec = 250000; // initial timeout ~ 250ms char buffer[IW_SCAN_MAX_DATA]; while ( !results && timeout > 0 ) { timeout -= tv.tv_usec; select( 0, 0, 0, 0, &tv ); _iwr.u.data.pointer = &buffer[0]; _iwr.u.data.flags = 0; _iwr.u.data.length = sizeof buffer; if ( wioctl( SIOCGIWSCAN ) ) { results = true; continue; } else if ( errno == EAGAIN) { qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." ); #if 0 if ( qApp ) { qApp->processEvents( 100 ); continue; } #endif tv.tv_sec = 0; tv.tv_usec = 100000; continue; } } qDebug( "ONetworkInterface::scanNetwork() - scan finished." ); if ( results ) { qDebug( " - result length = %d", _iwr.u.data.length ); if ( !_iwr.u.data.length ) { qDebug( " - no results (empty neighbourhood)" ); return stations; } qDebug( " - results are in!" ); dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length ); // parse results int offset = 0; struct iw_event* we = (struct iw_event*) &buffer[0]; while ( offset < _iwr.u.data.length ) { //const char* cmd = *(*_ioctlmap)[we->cmd]; //if ( !cmd ) cmd = "<unknown>"; qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len ); switch (we->cmd) { case SIOCGIWAP: { qDebug( "SIOCGIWAP" ); stations->append( new OStation() ); stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0]; break; } case SIOCGIWMODE: { qDebug( "SIOCGIWMODE" ); stations->last()->type = modeToString( we->u.mode ); break; } case SIOCGIWFREQ: { qDebug( "SIOCGIWFREQ" ); stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ]; break; } case SIOCGIWESSID: { qDebug( "SIOCGIWESSID" ); stations->last()->ssid = we->u.essid.pointer; break; } case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break; case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break; case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */ case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */ case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */ case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */ case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */ default: qDebug( "unhandled event" ); } offset += we->len; we = (struct iw_event*) &buffer[offset]; } + return stations; return stations; } else { qDebug( " - no results (timeout) :(" ); return stations; } } bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const { #ifndef NODEBUG int result = ::ioctl( _sfd, call, &iwreq ); if ( result == -1 ) qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) ); else qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call ); return ( result != -1 ); #else return ::ioctl( _sfd, call, &iwreq ) != -1; #endif } bool OWirelessNetworkInterface::wioctl( int call ) const { strcpy( _iwr.ifr_name, name() ); return wioctl( call, _iwr ); } /*====================================================================================== * OMonitoringInterface *======================================================================================*/ OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) { } OMonitoringInterface::~OMonitoringInterface() { } void OMonitoringInterface::setChannel( int c ) { // use standard WE channel switching protocol memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); _if->_iwr.u.freq.m = c; _if->_iwr.u.freq.e = 0; _if->wioctl( SIOCSIWFREQ ); } void OMonitoringInterface::setEnabled( bool b ) { } /*====================================================================================== * OCiscoMonitoringInterface *======================================================================================*/ OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) :OMonitoringInterface( iface, prismHeader ) { iface->setMonitoring( this ); } OCiscoMonitoringInterface::~OCiscoMonitoringInterface() { } void OCiscoMonitoringInterface::setEnabled( bool b ) { QString fname; fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); QFile f( fname ); if ( !f.exists() ) return; if ( f.open( IO_WriteOnly ) ) { QTextStream s( &f ); s << "Mode: r"; s << "Mode: y"; s << "XmitPower: 1"; } // flushing and closing will be done automatically when f goes out of scope diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index eb6c86e..bc9e299 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -1,102 +1,99 @@ /* This file is part of the Opie Project - Copyright (C) 2003 by the Wellenreiter team: - Martin J. Muench <mjm@remote-exploit.org> - Max Moser <mmo@remote-exploit.org - Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ONETWORK_H #define ONETWORK_H #include "wireless.h" /* OPIE */ #include <opie2/onetutils.h> #include <opie2/ostation.h> /* QT */ #include <qvaluelist.h> #include <qdict.h> #include <qmap.h> #include <qobject.h> #include <qhostaddress.h> class ONetworkInterface; class OWirelessNetworkInterface; class OChannelHopper; class OMonitoringInterface; /*====================================================================================== * ONetwork *======================================================================================*/ /** * @brief A container class for all network interfaces * * This class provides access to all available network interfaces of your computer. * * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> */ class ONetwork : public QObject { Q_OBJECT public: typedef QDict<ONetworkInterface> InterfaceMap; typedef QDictIterator<ONetworkInterface> InterfaceIterator; public: /** * @returns the number of available interfaces */ int count() const; /** * @returns a pointer to the (one and only) @ref ONetwork instance. */ static ONetwork* instance(); /** * @returns an iterator usable for iterating through all network interfaces. */ InterfaceIterator iterator() const; /** * @returns true, if the @a interface supports the wireless extension protocol. */ bool isWirelessInterface( const char* interface ) const; /** * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. * @see ONetworkInterface */ ONetworkInterface* interface( const QString& interface ) const; /** * @internal Rebuild the internal interface database * @note Sometimes it might be useful to call this from client code, * e.g. after issuing a cardctl insert */ diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 6331b2d..635224c 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -1,102 +1,99 @@ /* This file is part of the Opie Project - Copyright (C) 2003 by the Wellenreiter team: - Martin J. Muench <mjm@remote-exploit.org> - Max Moser <mmo@remote-exploit.org - Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* OPIE */ #include <opie2/opcap.h> /* QT */ #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) #include <qsocketnotifier.h> #include <qobjectlist.h> /* SYSTEM */ #include <sys/time.h> #include <sys/types.h> #include <unistd.h> /* LOCAL */ #include "udp_ports.h" /*====================================================================================== * OPacket *======================================================================================*/ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) :QObject( parent, "Generic" ), _hdr( header ), _data( data ) { //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); _end = (unsigned char*) data + header.len; //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); switch ( datalink ) { case DLT_EN10MB: qDebug( "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" ); new OEthernetPacket( _end, (const struct ether_header*) data, this ); break; case DLT_IEEE802_11: qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" ); new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); break; case DLT_PRISM_HEADER: qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" ); new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); break; default: qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink (type %d)!", datalink ); } } OPacket::~OPacket() { } timevalstruct OPacket::timeval() const { return _hdr.ts; } int OPacket::caplen() const { return _hdr.caplen; } void OPacket::updateStats( QMap<QString,int>& stats, QObjectList* l ) diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index 54b256b..497fd6b 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h @@ -1,102 +1,99 @@ /* This file is part of the Opie Project - Copyright (C) 2003 by the Wellenreiter team: - Martin J. Muench <mjm@remote-exploit.org> - Max Moser <mmo@remote-exploit.org - Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OPCAP_H #define OPCAP_H /* LINUX */ extern "C" // work around a bpf/pcap conflict in recent headers { #include <pcap.h> } #include <netinet/ether.h> #include <netinet/ip.h> #include <netinet/udp.h> #include <netinet/tcp.h> #include <time.h> /* QT */ #include <qevent.h> #include <qfile.h> #include <qhostaddress.h> #include <qobject.h> #include <qstring.h> #include <qmap.h> /* OPIE */ #include <opie2/onetutils.h> /* Custom Network Includes */ #include "802_11_user.h" #include "dhcp.h" /* TYPEDEFS */ typedef struct timeval timevalstruct; typedef struct pcap_pkthdr packetheaderstruct; /* FORWARDS */ class OPacketCapturer; class QSocketNotifier; /*====================================================================================== * OPacket - A frame on the wire *======================================================================================*/ /** @brief A class representing a data frame on the wire. * * The whole family of the packet classes are used when capturing frames from a network. * Most standard network protocols in use share a common architecture, which mostly is * a packet header and then the packet payload. In layered architectures, each lower layer * encapsulates data from its upper layer - that is it * treats the data from its upper layer as payload and prepends an own header to the packet, * which - again - is treated as the payload for the layer below. The figure below is an * example for how such a data frame is composed out of packets, e.g. when sending a mail. * * <pre> * | User Data | == Mail Data * | SMTP Header | User Data | == SMTP * | TCP Header | SMTP Header | User Data | == TCP * | IP Header | TCP Header | SMTP Header | User Data | == IP * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC * * </pre> * * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer * also contains a few more levels of encapsulation. * Since the type of the payload is more or less independent from the encapsulating protocol, * the header must be inspected before attempting to decode the payload. Hence, the * encapsulation level varies and can't be deduced without actually looking into the packets. * * For actually working with captured frames, it's useful to identify the packets via names and * insert them into a parent/child - relationship based on the encapsulation. This is why * all packet classes derive from QObject. The amount of overhead caused by the QObject is diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro index 386c2db..2027481 100644 --- a/libopie2/opienet/opienet.pro +++ b/libopie2/opienet/opienet.pro @@ -1,34 +1,34 @@ TEMPLATE = lib CONFIG += qt warn_on debug DESTDIR = $(OPIEDIR)/lib HEADERS = 802_11_user.h \ dhcp.h \ udp_ports.h \ wireless.h \ odebugmapper.h \ omanufacturerdb.h \ onetutils.h \ onetwork.h \ opcap.h \ ostation.h SOURCES = odebugmapper.cpp \ omanufacturerdb.cpp \ onetutils.cpp \ onetwork.cpp \ opcap.cpp \ ostation.cpp INTERFACES = TARGET = opienet2 -VERSION = 1.8.1 +VERSION = 1.8.2 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lpcap !contains( platform, x11 ) { include ( $(OPIEDIR)/include.pro ) } contains( platform, x11 ) { LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib } diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index ba1e4f6..c363f0c 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp @@ -1,64 +1,63 @@ /* This file is part of the Opie Project - - (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <opie2/ostation.h> /*====================================================================================== * OStation *======================================================================================*/ OStation::OStation() { qDebug( "OStation::OStation()" ); type = "<unknown>"; macAddress = OMacAddress::unknown; ssid = "<unknown>"; channel = 0; apAddress = OMacAddress::unknown; } OStation::~OStation() { qDebug( "OStation::~OStation()" ); } void OStation::dump() { qDebug( "------- OStation::dump() ------------" ); qDebug( "type: %s", (const char*) type ); qDebug( "mac: %s", (const char*) macAddress.toString() ); qDebug( "ap: %s", (const char*) apAddress.toString() ); qDebug( "ip: %s", (const char*) ipAddress.toString() ); } diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h index a6956c9..1e7366d 100644 --- a/libopie2/opienet/ostation.h +++ b/libopie2/opienet/ostation.h @@ -1,74 +1,73 @@ /* This file is part of the Opie Project - - (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OSTATION_H #define OSTATION_H #include <opie2/onetutils.h> #include <qlist.h> #include <qstring.h> #include <qhostaddress.h> #include <qobject.h> #include <sys/types.h> class OStation; typedef QList<OStation> OStationList; /*====================================================================================== * OStation *======================================================================================*/ class OStation { public: OStation(); ~OStation(); void dump(); /* Ethernet */ QString type; OMacAddress macAddress; QHostAddress ipAddress; /* WaveLan */ QString ssid; OMacAddress apAddress; int channel; bool encrypted; }; #endif // OSTATION_H diff --git a/libopie2/opienet/udp_ports.h b/libopie2/opienet/udp_ports.h index 5e92497..3fb1c85 100644 --- a/libopie2/opienet/udp_ports.h +++ b/libopie2/opienet/udp_ports.h @@ -1,89 +1,89 @@ /* * This file has been generated by doing * find . -name "*"|xargs grep -h '#define UDP_PORT' > udp_ports.h * in the root directory of Ethereal 0.9.15. Cudos to the Ethereal Team. - * -- Michael 'Mickey' Lauer <mickeyl@handhelds.org> + * -- Michael 'Mickey' Lauer <mickey@Vanille.de> */ #define UDP_PORT_AODV 654 #define UDP_PORT_LENGTH 2 #define UDP_PORT_OFFSET PARAMETER_VALUE_OFFSET #define UDP_PORT_RAS1 1718 #define UDP_PORT_RAS2 1719 #define UDP_PORT_CPHA 8116 #define UDP_PORT_DDTP 1052 #define UDP_PORT_CUPS 631 #define UDP_PORT_DLSW 2067 #define UDP_PORT_ISAKMP 500 #define UDP_PORT_L2TP 1701 #define UDP_PORT_IAPP 2313 #define UDP_PORT_HSRP 1985 #define UDP_PORT_SSDP 1900 #define UDP_PORT_TACACS 49 #define UDP_PORT_CLDAP 389 #define UDP_PORT_VINES 573 #define UDP_PORT_NBNS 137 #define UDP_PORT_NBDGM 138 #define UDP_PORT_XYPLEX 173 #define UDP_PORT_PIM_RP_DISC 496 #define UDP_PORT_SLIMP3_V1 1069 #define UDP_PORT_SLIMP3_V2 3483 #define UDP_PORT_RMCP 623 #define UDP_PORT_RMCP_SECURE 664 #define UDP_PORT_SYSLOG 514 #define UDP_PORT_SNMP 161 #define UDP_PORT_SNMP_TRAP 162 #define UDP_PORT_TFTP 69 #define UDP_PORT_TIME 37 #define UDP_PORT_STUN 3478 #define UDP_PORT_SRVLOC 427 #define UDP_PORT_TZSP 0x9090 #define UDP_PORT_WCCP 2048 #define UDP_PORT_MSPROXY 1745 #define UDP_PORT_BOOTPS 67 #define UDP_PORT_BOOTPC 68 #define UDP_PORT_XDMCP 177 #define UDP_PORT_DHCPV6_DOWNSTREAM 546 #define UDP_PORT_DHCPV6_UPSTREAM 547 #define UDP_PORT_DNS 53 #define UDP_PORT_MDNS 5353 #define UDP_PORT_ICP 3130 #define UDP_PORT_ICQ 4000 #define UDP_PORT_IPX 213 /* RFC 1234 */ #define UDP_PORT_LDP 646 #define UDP_PORT_LLC1 12000 #define UDP_PORT_LLC2 12001 #define UDP_PORT_LLC3 12002 #define UDP_PORT_LLC4 12003 #define UDP_PORT_LLC5 12004 #define UDP_PORT_MIP 434 #define UDP_PORT_NCP 524 #define UDP_PORT_NTP 123 #define UDP_PORT_RIP 520 #define UDP_PORT_SAP 9875 #define UDP_PORT_SIP 5060 #define UDP_PORT_TIMED 525 #define UDP_PORT_RIPNG 521 #define UDP_PORT_WSP 9200 /* wap-wsp */ #define UDP_PORT_WTP_WSP 9201 /* wap-wsp-wtp */ #define UDP_PORT_WTLS_WSP 9202 /* wap-wsp-s */ #define UDP_PORT_WTLS_WTP_WSP 9203 /* wap-wsp-wtp-s */ #define UDP_PORT_WSP_PUSH 2948 /* wap-wsp */ #define UDP_PORT_WTLS_WSP_PUSH 2949 /* wap-wsp-s */ #define UDP_PORT_WHO 513 #define UDP_PORT_KERBEROS 88 #define UDP_PORT_SFLOW 6343 #define UDP_PORT_LAPLINK 1547 #define UDP_PORT_NETFLOW 2055 #define UDP_PORT_RX_LOW 7000 #define UDP_PORT_RX_HIGH 7009 #define UDP_PORT_RX_AFS_BACKUPS 7021 #define UDP_PORT_MGCP_GATEWAY 2427 #define UDP_PORT_MGCP_CALLAGENT 2727 #define UDP_PORT_PCLI 9000 #define UDP_PORT_ARTNET 0x1936 #define UDP_PORT_TERREDO 3544 #define UDP_PORT_RADIUS 1645 #define UDP_PORT_RADIUS_NEW 1812 #define UDP_PORT_RADACCT 1646 #define UDP_PORT_RADACCT_NEW 1813 |