-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/ostation.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/ostation.h | 4 |
10 files changed, 20 insertions, 20 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 7e185a2..123aee8 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -1,107 +1,107 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "omanufacturerdb.h" | 29 | #include "omanufacturerdb.h" |
30 | 30 | ||
31 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 31 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 36 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
37 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | #include <qfile.h> | 44 | #include <qfile.h> |
45 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
46 | 46 | ||
47 | using namespace Opie::Core; | 47 | using namespace Opie::Core; |
48 | namespace Opie { | 48 | namespace Opie { |
49 | namespace Net { | 49 | namespace Net { |
50 | 50 | ||
51 | OManufacturerDB* OManufacturerDB::_instance = 0; | 51 | OManufacturerDB* OManufacturerDB::_instance = 0; |
52 | 52 | ||
53 | OManufacturerDB* OManufacturerDB::instance() | 53 | OManufacturerDB* OManufacturerDB::instance() |
54 | { | 54 | { |
55 | if ( !OManufacturerDB::_instance ) | 55 | if ( !OManufacturerDB::_instance ) |
56 | { | 56 | { |
57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
58 | _instance = new OManufacturerDB(); | 58 | _instance = new OManufacturerDB(); |
59 | } | 59 | } |
60 | return _instance; | 60 | return _instance; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | OManufacturerDB::OManufacturerDB() | 64 | OManufacturerDB::OManufacturerDB() |
65 | { | 65 | { |
66 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 66 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
67 | Global::statusMessage( "Reading Manufacturers..." ); | 67 | Global::statusMessage( "Reading Manufacturers..." ); |
68 | #endif | 68 | #endif |
69 | QString filename( "/etc/manufacturers" ); | 69 | QString filename( "/etc/manufacturers" ); |
70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
71 | if ( !QFile::exists( filename ) ) | 71 | if ( !QFile::exists( filename ) ) |
72 | { | 72 | { |
73 | filename = QPEApplication::qpeDir()+"etc/manufacturers"; | 73 | filename = QPEApplication::qpeDir()+"etc/manufacturers"; |
74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
75 | if ( !QFile::exists( filename ) ) | 75 | if ( !QFile::exists( filename ) ) |
76 | { | 76 | { |
77 | filename = "/usr/share/wellenreiter/manufacturers"; | 77 | filename = "/usr/share/wellenreiter/manufacturers"; |
78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | QFile file( filename ); | 82 | QFile file( filename ); |
83 | bool hasFile = file.open( IO_ReadOnly ); | 83 | bool hasFile = file.open( IO_ReadOnly ); |
84 | if (!hasFile) | 84 | if (!hasFile) |
85 | { | 85 | { |
86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
91 | QTextStream s( &file ); | 91 | QTextStream s( &file ); |
92 | QString addr; | 92 | QString addr; |
93 | QString manu; | 93 | QString manu; |
94 | QString extManu; | 94 | QString extManu; |
95 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 95 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
96 | int counter = 0; | 96 | int counter = 0; |
97 | #endif | 97 | #endif |
98 | while (!s.atEnd()) | 98 | while (!s.atEnd()) |
99 | { | 99 | { |
100 | s >> addr; | 100 | s >> addr; |
101 | s >> manu; | 101 | s >> manu; |
102 | s >> extManu; | 102 | s >> extManu; |
103 | 103 | ||
104 | manufacturers.insert( addr, manu ); | 104 | manufacturers.insert( addr, manu ); |
105 | manufacturersExt.insert( addr, extManu ); | 105 | manufacturersExt.insert( addr, extManu ); |
106 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; | 106 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; |
107 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 107 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h index c667e20..2b3b7ed 100644 --- a/libopie2/opienet/omanufacturerdb.h +++ b/libopie2/opienet/omanufacturerdb.h | |||
@@ -1,75 +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-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OMANUFACTURERDB_H | 29 | #ifndef OMANUFACTURERDB_H |
30 | #define OMANUFACTURERDB_H | 30 | #define OMANUFACTURERDB_H |
31 | 31 | ||
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | 33 | ||
34 | namespace Opie { | 34 | namespace Opie { |
35 | namespace Net { | 35 | namespace Net { |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @brief A Ethernet card vendor database. | 38 | * @brief A Ethernet card vendor database. |
39 | * | 39 | * |
40 | * This class encapsulates the lookup of Ethernet vendor given a | 40 | * This class encapsulates the lookup of Ethernet vendor given a |
41 | * certain Mac Address. Only the first three bytes define the vendor. | 41 | * certain Mac Address. Only the first three bytes define the vendor. |
42 | */ | 42 | */ |
43 | class OManufacturerDB | 43 | class OManufacturerDB |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | /** | 46 | /** |
47 | * @returns the one-and-only @ref OManufacturerDB instance. | 47 | * @returns the one-and-only @ref OManufacturerDB instance. |
48 | */ | 48 | */ |
49 | static OManufacturerDB* instance(); | 49 | static OManufacturerDB* instance(); |
50 | /** | 50 | /** |
51 | * @returns the short manufacturer string given a @a macaddr. | 51 | * @returns the short manufacturer string given a @a macaddr. |
52 | */ | 52 | */ |
53 | const QString& lookup( const QString& macaddr ) const; | 53 | const QString& lookup( const QString& macaddr ) const; |
54 | /** | 54 | /** |
55 | * @returns the enhanced manufacturer string given a @a macaddr. | 55 | * @returns the enhanced manufacturer string given a @a macaddr. |
56 | */ | 56 | */ |
57 | const QString& lookupExt( const QString& macaddr ) const; | 57 | const QString& lookupExt( const QString& macaddr ) const; |
58 | 58 | ||
59 | protected: | 59 | protected: |
60 | OManufacturerDB(); | 60 | OManufacturerDB(); |
61 | virtual ~OManufacturerDB(); | 61 | virtual ~OManufacturerDB(); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | QMap<QString, QString> manufacturers; | 64 | QMap<QString, QString> manufacturers; |
65 | QMap<QString, QString> manufacturersExt; | 65 | QMap<QString, QString> manufacturersExt; |
66 | static OManufacturerDB* _instance; | 66 | static OManufacturerDB* _instance; |
67 | class Private; | 67 | class Private; |
68 | Private *d; | 68 | Private *d; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | #endif | 74 | #endif |
75 | 75 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 047a704..c8c494a 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -1,109 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | 4 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
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 | #include <assert.h> | 37 | #include <assert.h> |
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | 39 | ||
40 | namespace Opie { | 40 | namespace Opie { |
41 | namespace Net { | 41 | namespace Net { |
42 | 42 | ||
43 | /*====================================================================================== | 43 | /*====================================================================================== |
44 | * OMacAddress | 44 | * OMacAddress |
45 | *======================================================================================*/ | 45 | *======================================================================================*/ |
46 | 46 | ||
47 | // static initializer for broadcast and unknown MAC Adresses | 47 | // static initializer for broadcast and unknown MAC Adresses |
48 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 48 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
49 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); | 49 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); |
50 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; | 50 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; |
51 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); | 51 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); |
52 | 52 | ||
53 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) | 53 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) |
54 | 54 | ||
55 | OMacAddress::OMacAddress() | 55 | OMacAddress::OMacAddress() |
56 | { | 56 | { |
57 | memcpy( _bytes, __unknown, 6 ); | 57 | memcpy( _bytes, __unknown, 6 ); |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | OMacAddress::OMacAddress( unsigned char* p ) | 61 | OMacAddress::OMacAddress( unsigned char* p ) |
62 | { | 62 | { |
63 | memcpy( _bytes, p, 6 ); | 63 | memcpy( _bytes, p, 6 ); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | OMacAddress::OMacAddress( const unsigned char* p ) | 67 | OMacAddress::OMacAddress( const unsigned char* p ) |
68 | { | 68 | { |
69 | memcpy( _bytes, p, 6 ); | 69 | memcpy( _bytes, p, 6 ); |
70 | } | 70 | } |
71 | 71 | ||
72 | 72 | ||
73 | OMacAddress::OMacAddress( struct ifreq& ifr ) | 73 | OMacAddress::OMacAddress( struct ifreq& ifr ) |
74 | { | 74 | { |
75 | memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); | 75 | memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | OMacAddress::~OMacAddress() | 79 | OMacAddress::~OMacAddress() |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | //#ifdef QT_NO_DEBUG | 84 | //#ifdef QT_NO_DEBUG |
85 | //inline | 85 | //inline |
86 | //#endif | 86 | //#endif |
87 | const unsigned char* OMacAddress::native() const | 87 | const unsigned char* OMacAddress::native() const |
88 | { | 88 | { |
89 | return (const unsigned char*) &_bytes; | 89 | return (const unsigned char*) &_bytes; |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | OMacAddress OMacAddress::fromString( const QString& str ) | 93 | OMacAddress OMacAddress::fromString( const QString& str ) |
94 | { | 94 | { |
95 | QString addr( str ); | 95 | QString addr( str ); |
96 | unsigned char buf[6]; | 96 | unsigned char buf[6]; |
97 | bool ok = true; | 97 | bool ok = true; |
98 | int index = 14; | 98 | int index = 14; |
99 | for ( int i = 5; i >= 0; --i ) | 99 | for ( int i = 5; i >= 0; --i ) |
100 | { | 100 | { |
101 | buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); | 101 | buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); |
102 | if ( !ok ) return OMacAddress::unknown; | 102 | if ( !ok ) return OMacAddress::unknown; |
103 | addr.truncate( index ); | 103 | addr.truncate( index ); |
104 | index -= 3; | 104 | index -= 3; |
105 | } | 105 | } |
106 | return (const unsigned char*) &buf; | 106 | return (const unsigned char*) &buf; |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 4a09426..f1d34a0 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -1,109 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
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 | #ifndef ONETUTILS_H | 32 | #ifndef ONETUTILS_H |
33 | #define ONETUTILS_H | 33 | #define ONETUTILS_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <qdict.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qhostaddress.h> | 38 | #include <qhostaddress.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | 42 | ||
43 | struct ifreq; | 43 | struct ifreq; |
44 | 44 | ||
45 | namespace Opie { | 45 | namespace Opie { |
46 | namespace Net { | 46 | namespace Net { |
47 | 47 | ||
48 | class OWirelessNetworkInterface; | 48 | class OWirelessNetworkInterface; |
49 | 49 | ||
50 | /*====================================================================================== | 50 | /*====================================================================================== |
51 | * OMacAddress | 51 | * OMacAddress |
52 | *======================================================================================*/ | 52 | *======================================================================================*/ |
53 | 53 | ||
54 | class OMacAddress | 54 | class OMacAddress |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | // QString c'tor? -zecke | 57 | // QString c'tor? -zecke |
58 | OMacAddress(); | 58 | OMacAddress(); |
59 | OMacAddress( unsigned char* ); | 59 | OMacAddress( unsigned char* ); |
60 | OMacAddress( const unsigned char* ); | 60 | OMacAddress( const unsigned char* ); |
61 | OMacAddress( struct ifreq& ); | 61 | OMacAddress( struct ifreq& ); |
62 | ~OMacAddress(); | 62 | ~OMacAddress(); |
63 | 63 | ||
64 | QString manufacturer() const; | 64 | QString manufacturer() const; |
65 | QString toString( bool substitute = false ) const; | 65 | QString toString( bool substitute = false ) const; |
66 | const unsigned char* native() const; | 66 | const unsigned char* native() const; |
67 | 67 | ||
68 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? | 68 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? |
69 | static OMacAddress fromString( const QString& ); | 69 | static OMacAddress fromString( const QString& ); |
70 | 70 | ||
71 | public: | 71 | public: |
72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
74 | 74 | ||
75 | private: | 75 | private: |
76 | unsigned char _bytes[6]; | 76 | unsigned char _bytes[6]; |
77 | 77 | ||
78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | class Private; | 79 | class Private; |
80 | Private *d; | 80 | Private *d; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
85 | 85 | ||
86 | 86 | ||
87 | /*====================================================================================== | 87 | /*====================================================================================== |
88 | * OHostAddress | 88 | * OHostAddress |
89 | *======================================================================================*/ | 89 | *======================================================================================*/ |
90 | 90 | ||
91 | class OHostAddress : public QHostAddress | 91 | class OHostAddress : public QHostAddress |
92 | { | 92 | { |
93 | /*public: | 93 | /*public: |
94 | OHostAddress(); | 94 | OHostAddress(); |
95 | ~OHostAddress(); | 95 | ~OHostAddress(); |
96 | */ | 96 | */ |
97 | private: | 97 | private: |
98 | class Private; | 98 | class Private; |
99 | Private *d; | 99 | Private *d; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | 102 | ||
103 | /*====================================================================================== | 103 | /*====================================================================================== |
104 | * OPrivateIOCTL | 104 | * OPrivateIOCTL |
105 | *======================================================================================*/ | 105 | *======================================================================================*/ |
106 | 106 | ||
107 | class OPrivateIOCTL : public QObject | 107 | class OPrivateIOCTL : public QObject |
108 | { | 108 | { |
109 | public: | 109 | public: |
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 591681c..ae1865d 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,108 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer |
4 | =. <mickey@Vanille.de> | 4 | =. <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | 32 | ||
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/ostation.h> | 34 | #include <opie2/ostation.h> |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | 41 | ||
42 | /* UNIX */ | 42 | /* UNIX */ |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <arpa/inet.h> | 45 | #include <arpa/inet.h> |
46 | #include <errno.h> | 46 | #include <errno.h> |
47 | #include <string.h> | 47 | #include <string.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> |
52 | #include <sys/types.h> | 52 | #include <sys/types.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #include <linux/sockios.h> | 54 | #include <linux/sockios.h> |
55 | #include <net/if_arp.h> | 55 | #include <net/if_arp.h> |
56 | #include <stdarg.h> | 56 | #include <stdarg.h> |
57 | 57 | ||
58 | #ifndef NODEBUG | 58 | #ifndef NODEBUG |
59 | #include <opie2/odebugmapper.h> | 59 | #include <opie2/odebugmapper.h> |
60 | 60 | ||
61 | 61 | ||
62 | using namespace Opie::Core; | 62 | using namespace Opie::Core; |
63 | using namespace Opie::Net::Internal; | 63 | using namespace Opie::Net::Internal; |
64 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | /*====================================================================================== | 67 | /*====================================================================================== |
68 | * ONetwork | 68 | * ONetwork |
69 | *======================================================================================*/ | 69 | *======================================================================================*/ |
70 | 70 | ||
71 | namespace Opie { | 71 | namespace Opie { |
72 | namespace Net { | 72 | namespace Net { |
73 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
74 | 74 | ||
75 | ONetwork::ONetwork() | 75 | ONetwork::ONetwork() |
76 | { | 76 | { |
77 | odebug << "ONetwork::ONetwork()" << oendl; | 77 | odebug << "ONetwork::ONetwork()" << oendl; |
78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
79 | synchronize(); | 79 | synchronize(); |
80 | } | 80 | } |
81 | 81 | ||
82 | void ONetwork::synchronize() | 82 | void ONetwork::synchronize() |
83 | { | 83 | { |
84 | // gather available interfaces by inspecting /proc/net/dev | 84 | // gather available interfaces by inspecting /proc/net/dev |
85 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 85 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
86 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 86 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
87 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | 87 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev |
88 | 88 | ||
89 | _interfaces.clear(); | 89 | _interfaces.clear(); |
90 | QString str; | 90 | QString str; |
91 | QFile f( "/proc/net/dev" ); | 91 | QFile f( "/proc/net/dev" ); |
92 | bool hasFile = f.open( IO_ReadOnly ); | 92 | bool hasFile = f.open( IO_ReadOnly ); |
93 | if ( !hasFile ) | 93 | if ( !hasFile ) |
94 | { | 94 | { |
95 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; | 95 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | QTextStream s( &f ); | 98 | QTextStream s( &f ); |
99 | s.readLine(); | 99 | s.readLine(); |
100 | s.readLine(); | 100 | s.readLine(); |
101 | while ( !s.atEnd() ) | 101 | while ( !s.atEnd() ) |
102 | { | 102 | { |
103 | s >> str; | 103 | s >> str; |
104 | str.truncate( str.find( ':' ) ); | 104 | str.truncate( str.find( ':' ) ); |
105 | odebug << "ONetwork: found interface '" << str << "'" << oendl; | 105 | odebug << "ONetwork: found interface '" << str << "'" << oendl; |
106 | ONetworkInterface* iface = 0; | 106 | ONetworkInterface* iface = 0; |
107 | if ( isWirelessInterface( str ) ) | 107 | if ( isWirelessInterface( str ) ) |
108 | { | 108 | { |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 057b1a0..be4bb46 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,108 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer |
4 | =. <mickey@Vanille.de> | 4 | =. <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef ONETWORK_H | 31 | #ifndef ONETWORK_H |
32 | #define ONETWORK_H | 32 | #define ONETWORK_H |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/onetutils.h> | 35 | #include <opie2/onetutils.h> |
36 | #include <opie2/ostation.h> | 36 | #include <opie2/ostation.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qdict.h> | 40 | #include <qdict.h> |
41 | #include <qmap.h> | 41 | #include <qmap.h> |
42 | #include <qobject.h> | 42 | #include <qobject.h> |
43 | #include <qhostaddress.h> | 43 | #include <qhostaddress.h> |
44 | 44 | ||
45 | /* STD */ | 45 | /* STD */ |
46 | // hacky workaround until we have a user space wireless.h | 46 | // hacky workaround until we have a user space wireless.h |
47 | #include <net/if.h> | 47 | #include <net/if.h> |
48 | #define _LINUX_IF_H | 48 | #define _LINUX_IF_H |
49 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
50 | #ifndef IW_MAX_PRIV_DEF | 50 | #ifndef IW_MAX_PRIV_DEF |
51 | #define IW_MAX_PRIV_DEF 128 | 51 | #define IW_MAX_PRIV_DEF 128 |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | namespace Opie { | 54 | namespace Opie { |
55 | namespace Net { | 55 | namespace Net { |
56 | class ONetworkInterface; | 56 | class ONetworkInterface; |
57 | class OWirelessNetworkInterface; | 57 | class OWirelessNetworkInterface; |
58 | class OChannelHopper; | 58 | class OChannelHopper; |
59 | class OMonitoringInterface; | 59 | class OMonitoringInterface; |
60 | 60 | ||
61 | /*====================================================================================== | 61 | /*====================================================================================== |
62 | * ONetwork | 62 | * ONetwork |
63 | *======================================================================================*/ | 63 | *======================================================================================*/ |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @brief A container class for all network interfaces | 66 | * @brief A container class for all network interfaces |
67 | * | 67 | * |
68 | * This class provides access to all available network interfaces of your computer. | 68 | * This class provides access to all available network interfaces of your computer. |
69 | * | 69 | * |
70 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 70 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
71 | */ | 71 | */ |
72 | class ONetwork : public QObject | 72 | class ONetwork : public QObject |
73 | { | 73 | { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | 75 | ||
76 | public: | 76 | public: |
77 | typedef QDict<ONetworkInterface> InterfaceMap; | 77 | typedef QDict<ONetworkInterface> InterfaceMap; |
78 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 78 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
79 | 79 | ||
80 | public: | 80 | public: |
81 | /** | 81 | /** |
82 | * @returns the number of available interfaces | 82 | * @returns the number of available interfaces |
83 | */ | 83 | */ |
84 | int count() const; | 84 | int count() const; |
85 | /** | 85 | /** |
86 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 86 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
87 | */ | 87 | */ |
88 | static ONetwork* instance(); | 88 | static ONetwork* instance(); |
89 | /** | 89 | /** |
90 | * @returns an iterator usable for iterating through all network interfaces. | 90 | * @returns an iterator usable for iterating through all network interfaces. |
91 | */ | 91 | */ |
92 | InterfaceIterator iterator() const; | 92 | InterfaceIterator iterator() const; |
93 | /** | 93 | /** |
94 | * @returns true, if the @a interface is present. | 94 | * @returns true, if the @a interface is present. |
95 | */ | 95 | */ |
96 | bool isPresent( const char* interface ) const; | 96 | bool isPresent( const char* interface ) const; |
97 | /** | 97 | /** |
98 | * @returns true, if the @a interface supports the wireless extension protocol. | 98 | * @returns true, if the @a interface supports the wireless extension protocol. |
99 | */ | 99 | */ |
100 | bool isWirelessInterface( const char* interface ) const; | 100 | bool isWirelessInterface( const char* interface ) const; |
101 | /** | 101 | /** |
102 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. | 102 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. |
103 | * @see ONetworkInterface | 103 | * @see ONetworkInterface |
104 | */ | 104 | */ |
105 | ONetworkInterface* interface( const QString& interface ) const; | 105 | ONetworkInterface* interface( const QString& interface ) const; |
106 | /** | 106 | /** |
107 | * @internal Rebuild the internal interface database | 107 | * @internal Rebuild the internal interface database |
108 | * @note Sometimes it might be useful to call this from client code, | 108 | * @note Sometimes it might be useful to call this from client code, |
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 25ac09b..eafbeea 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -1,108 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003-2004 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "udp_ports.h" | 31 | #include "udp_ports.h" |
32 | #include "opcap.h" | 32 | #include "opcap.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | using namespace Opie::Core; | 36 | using namespace Opie::Core; |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) | 39 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) |
40 | #include <qsocketnotifier.h> | 40 | #include <qsocketnotifier.h> |
41 | #include <qobjectlist.h> | 41 | #include <qobjectlist.h> |
42 | 42 | ||
43 | /* STD */ | 43 | /* STD */ |
44 | #include <sys/time.h> | 44 | #include <sys/time.h> |
45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
46 | #include <assert.h> | 46 | #include <assert.h> |
47 | #include <unistd.h> | 47 | #include <unistd.h> |
48 | #include <string.h> | 48 | #include <string.h> |
49 | 49 | ||
50 | namespace Opie { | 50 | namespace Opie { |
51 | namespace Net { | 51 | namespace Net { |
52 | 52 | ||
53 | /*====================================================================================== | 53 | /*====================================================================================== |
54 | * OPacket | 54 | * OPacket |
55 | *======================================================================================*/ | 55 | *======================================================================================*/ |
56 | 56 | ||
57 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) | 57 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) |
58 | :QObject( parent, "Generic" ), _hdr( header ), _data( 0 ) | 58 | :QObject( parent, "Generic" ), _hdr( header ), _data( 0 ) |
59 | { | 59 | { |
60 | 60 | ||
61 | _data = new unsigned char[ header.len ]; | 61 | _data = new unsigned char[ header.len ]; |
62 | assert( _data ); | 62 | assert( _data ); |
63 | memcpy( const_cast<unsigned char*>(_data), data, header.len ); | 63 | memcpy( const_cast<unsigned char*>(_data), data, header.len ); |
64 | // We have to copy the data structure here, because the 'data' pointer handed by libpcap | 64 | // We have to copy the data structure here, because the 'data' pointer handed by libpcap |
65 | // points to an internal region which is reused by lipcap. | 65 | // points to an internal region which is reused by lipcap. |
66 | odebug << "OPacket: Length = " << header.len << ", Caplen = " << header.caplen << oendl; | 66 | odebug << "OPacket: Length = " << header.len << ", Caplen = " << header.caplen << oendl; |
67 | _end = (unsigned char*) _data + header.len; | 67 | _end = (unsigned char*) _data + header.len; |
68 | 68 | ||
69 | switch ( datalink ) | 69 | switch ( datalink ) |
70 | { | 70 | { |
71 | case DLT_EN10MB: | 71 | case DLT_EN10MB: |
72 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; | 72 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; |
73 | new OEthernetPacket( _end, (const struct ether_header*) _data, this ); | 73 | new OEthernetPacket( _end, (const struct ether_header*) _data, this ); |
74 | break; | 74 | break; |
75 | 75 | ||
76 | case DLT_IEEE802_11: | 76 | case DLT_IEEE802_11: |
77 | odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; | 77 | odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; |
78 | new OWaveLanPacket( _end, (const struct ieee_802_11_header*) _data, this ); | 78 | new OWaveLanPacket( _end, (const struct ieee_802_11_header*) _data, this ); |
79 | break; | 79 | break; |
80 | 80 | ||
81 | case DLT_PRISM_HEADER: | 81 | case DLT_PRISM_HEADER: |
82 | odebug << "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" << oendl; | 82 | odebug << "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" << oendl; |
83 | new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) _data, this ); | 83 | new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) _data, this ); |
84 | break; | 84 | break; |
85 | 85 | ||
86 | default: | 86 | default: |
87 | owarn << "OPacket::OPacket(): Received Packet over unsupported datalink, type " << datalink << "!" << oendl; | 87 | owarn << "OPacket::OPacket(): Received Packet over unsupported datalink, type " << datalink << "!" << oendl; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | OPacket::~OPacket() | 92 | OPacket::~OPacket() |
93 | { | 93 | { |
94 | odebug << "~OPacket( " << name() << " )" << oendl; | 94 | odebug << "~OPacket( " << name() << " )" << oendl; |
95 | delete [] _data; | 95 | delete [] _data; |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | timevalstruct OPacket::timeval() const | 99 | timevalstruct OPacket::timeval() const |
100 | { | 100 | { |
101 | return _hdr.ts; | 101 | return _hdr.ts; |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | int OPacket::caplen() const | 105 | int OPacket::caplen() const |
106 | { | 106 | { |
107 | return _hdr.caplen; | 107 | return _hdr.caplen; |
108 | } | 108 | } |
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index 9e718d5..149e573 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h | |||
@@ -1,108 +1,108 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OPCAP_H | 31 | #ifndef OPCAP_H |
32 | #define OPCAP_H | 32 | #define OPCAP_H |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/onetutils.h> | 35 | #include <opie2/onetutils.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qevent.h> | 38 | #include <qevent.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qhostaddress.h> | 40 | #include <qhostaddress.h> |
41 | #include <qobject.h> | 41 | #include <qobject.h> |
42 | #include <qstring.h> | 42 | #include <qstring.h> |
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | extern "C" // work around a bpf/pcap conflict in recent headers | 47 | extern "C" // work around a bpf/pcap conflict in recent headers |
48 | { | 48 | { |
49 | #include <pcap.h> | 49 | #include <pcap.h> |
50 | } | 50 | } |
51 | #include <netinet/ether.h> | 51 | #include <netinet/ether.h> |
52 | #include <netinet/ip.h> | 52 | #include <netinet/ip.h> |
53 | #include <netinet/udp.h> | 53 | #include <netinet/udp.h> |
54 | #include <netinet/tcp.h> | 54 | #include <netinet/tcp.h> |
55 | #include <time.h> | 55 | #include <time.h> |
56 | 56 | ||
57 | /* Custom Network Includes (must go here, don't reorder!) */ | 57 | /* Custom Network Includes (must go here, don't reorder!) */ |
58 | #include "802_11_user.h" | 58 | #include "802_11_user.h" |
59 | #include "dhcp.h" | 59 | #include "dhcp.h" |
60 | 60 | ||
61 | 61 | ||
62 | /* TYPEDEFS */ | 62 | /* TYPEDEFS */ |
63 | typedef struct timeval timevalstruct; | 63 | typedef struct timeval timevalstruct; |
64 | typedef struct pcap_pkthdr packetheaderstruct; | 64 | typedef struct pcap_pkthdr packetheaderstruct; |
65 | 65 | ||
66 | /* FORWARDS */ | 66 | /* FORWARDS */ |
67 | class QSocketNotifier; | 67 | class QSocketNotifier; |
68 | namespace Opie { | 68 | namespace Opie { |
69 | namespace Net { | 69 | namespace Net { |
70 | class OPacketCapturer; | 70 | class OPacketCapturer; |
71 | 71 | ||
72 | /*====================================================================================== | 72 | /*====================================================================================== |
73 | * OPacket - A frame on the wire | 73 | * OPacket - A frame on the wire |
74 | *======================================================================================*/ | 74 | *======================================================================================*/ |
75 | 75 | ||
76 | /** @brief A class representing a data frame on the wire. | 76 | /** @brief A class representing a data frame on the wire. |
77 | * | 77 | * |
78 | * The whole family of the packet classes are used when capturing frames from a network. | 78 | * The whole family of the packet classes are used when capturing frames from a network. |
79 | * Most standard network protocols in use share a common architecture, which mostly is | 79 | * Most standard network protocols in use share a common architecture, which mostly is |
80 | * a packet header and then the packet payload. In layered architectures, each lower layer | 80 | * a packet header and then the packet payload. In layered architectures, each lower layer |
81 | * encapsulates data from its upper layer - that is it | 81 | * encapsulates data from its upper layer - that is it |
82 | * treats the data from its upper layer as payload and prepends an own header to the packet, | 82 | * treats the data from its upper layer as payload and prepends an own header to the packet, |
83 | * which - again - is treated as the payload for the layer below. The figure below is an | 83 | * which - again - is treated as the payload for the layer below. The figure below is an |
84 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. | 84 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. |
85 | * | 85 | * |
86 | * <pre> | 86 | * <pre> |
87 | * | User Data | == Mail Data | 87 | * | User Data | == Mail Data |
88 | * | SMTP Header | User Data | == SMTP | 88 | * | SMTP Header | User Data | == SMTP |
89 | * | TCP Header | SMTP Header | User Data | == TCP | 89 | * | TCP Header | SMTP Header | User Data | == TCP |
90 | * | IP Header | TCP Header | SMTP Header | User Data | == IP | 90 | * | IP Header | TCP Header | SMTP Header | User Data | == IP |
91 | * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC | 91 | * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC |
92 | * | 92 | * |
93 | * </pre> | 93 | * </pre> |
94 | * | 94 | * |
95 | * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer | 95 | * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer |
96 | * also contains a few more levels of encapsulation. | 96 | * also contains a few more levels of encapsulation. |
97 | * Since the type of the payload is more or less independent from the encapsulating protocol, | 97 | * Since the type of the payload is more or less independent from the encapsulating protocol, |
98 | * the header must be inspected before attempting to decode the payload. Hence, the | 98 | * the header must be inspected before attempting to decode the payload. Hence, the |
99 | * encapsulation level varies and can't be deduced without actually looking into the packets. | 99 | * encapsulation level varies and can't be deduced without actually looking into the packets. |
100 | * | 100 | * |
101 | * For actually working with captured frames, it's useful to identify the packets via names and | 101 | * For actually working with captured frames, it's useful to identify the packets via names and |
102 | * insert them into a parent/child - relationship based on the encapsulation. This is why | 102 | * insert them into a parent/child - relationship based on the encapsulation. This is why |
103 | * all packet classes derive from QObject. The amount of overhead caused by the QObject is | 103 | * all packet classes derive from QObject. The amount of overhead caused by the QObject is |
104 | * not a problem in this case, because we're talking about a theoratical maximum of about | 104 | * not a problem in this case, because we're talking about a theoratical maximum of about |
105 | * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the | 105 | * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the |
106 | * QObject also cares about destroying the sub-, (child-) packets. | 106 | * QObject also cares about destroying the sub-, (child-) packets. |
107 | * | 107 | * |
108 | * This enables us to perform a simple look for packets of a certain type: | 108 | * This enables us to perform a simple look for packets of a certain type: |
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index b5ac325..88ad808 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp | |||
@@ -1,72 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | 34 | ||
35 | using namespace Opie::Core; | 35 | using namespace Opie::Core; |
36 | 36 | ||
37 | namespace Opie { | 37 | namespace Opie { |
38 | namespace Net { | 38 | namespace Net { |
39 | /*====================================================================================== | 39 | /*====================================================================================== |
40 | * OStation | 40 | * OStation |
41 | *======================================================================================*/ | 41 | *======================================================================================*/ |
42 | 42 | ||
43 | OStation::OStation() | 43 | OStation::OStation() |
44 | { | 44 | { |
45 | odebug << "OStation::OStation()" << oendl; | 45 | odebug << "OStation::OStation()" << oendl; |
46 | 46 | ||
47 | type = "<unknown>"; | 47 | type = "<unknown>"; |
48 | macAddress = OMacAddress::unknown; | 48 | macAddress = OMacAddress::unknown; |
49 | ssid = "<unknown>"; | 49 | ssid = "<unknown>"; |
50 | channel = 0; | 50 | channel = 0; |
51 | apAddress = OMacAddress::unknown; | 51 | apAddress = OMacAddress::unknown; |
52 | 52 | ||
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | OStation::~OStation() | 56 | OStation::~OStation() |
57 | { | 57 | { |
58 | odebug << "OStation::~OStation()" << oendl; | 58 | odebug << "OStation::~OStation()" << oendl; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void OStation::dump() | 62 | void OStation::dump() |
63 | { | 63 | { |
64 | odebug << "------- OStation::dump() ------------" << oendl; | 64 | odebug << "------- OStation::dump() ------------" << oendl; |
65 | odebug << "type: " << type << "" << oendl; | 65 | odebug << "type: " << type << "" << oendl; |
66 | odebug << "mac: " << macAddress.toString() << "" << oendl; | 66 | odebug << "mac: " << macAddress.toString() << "" << oendl; |
67 | odebug << "ap: " << apAddress.toString() << "" << oendl; | 67 | odebug << "ap: " << apAddress.toString() << "" << oendl; |
68 | odebug << "ip: " << ipAddress.toString() << "" << oendl; | 68 | odebug << "ip: " << ipAddress.toString() << "" << oendl; |
69 | } | 69 | } |
70 | 70 | ||
71 | } | 71 | } |
72 | } | 72 | } |
diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h index 68f1114..bdc653f 100644 --- a/libopie2/opienet/ostation.h +++ b/libopie2/opienet/ostation.h | |||
@@ -1,82 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OSTATION_H | 31 | #ifndef OSTATION_H |
32 | #define OSTATION_H | 32 | #define OSTATION_H |
33 | 33 | ||
34 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
35 | 35 | ||
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qhostaddress.h> | 38 | #include <qhostaddress.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | 42 | ||
43 | namespace Opie { | 43 | namespace Opie { |
44 | namespace Net { | 44 | namespace Net { |
45 | 45 | ||
46 | class OStation; | 46 | class OStation; |
47 | 47 | ||
48 | 48 | ||
49 | typedef QList<OStation> OStationList; | 49 | typedef QList<OStation> OStationList; |
50 | 50 | ||
51 | /*====================================================================================== | 51 | /*====================================================================================== |
52 | * OStation | 52 | * OStation |
53 | *======================================================================================*/ | 53 | *======================================================================================*/ |
54 | 54 | ||
55 | class OStation | 55 | class OStation |
56 | { | 56 | { |
57 | public: | 57 | public: |
58 | OStation(); | 58 | OStation(); |
59 | ~OStation(); | 59 | ~OStation(); |
60 | 60 | ||
61 | void dump(); | 61 | void dump(); |
62 | 62 | ||
63 | /* Ethernet */ | 63 | /* Ethernet */ |
64 | QString type; | 64 | QString type; |
65 | OMacAddress macAddress; | 65 | OMacAddress macAddress; |
66 | QHostAddress ipAddress; | 66 | QHostAddress ipAddress; |
67 | 67 | ||
68 | /* WaveLan */ | 68 | /* WaveLan */ |
69 | QString ssid; | 69 | QString ssid; |
70 | OMacAddress apAddress; | 70 | OMacAddress apAddress; |
71 | int channel; | 71 | int channel; |
72 | bool encrypted; | 72 | bool encrypted; |
73 | private: | 73 | private: |
74 | class Private; | 74 | class Private; |
75 | Private *d; | 75 | Private *d; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | #endif // OSTATION_H | 81 | #endif // OSTATION_H |
82 | 82 | ||