-rw-r--r-- | libopie2/opienet/onetwork.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index eb9d506..cfb999d 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,126 +1,127 @@ | |||
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 the Wellenreiter team: | 3 | Copyright (C) 2003 by the Wellenreiter team: |
4 | Martin J. Muench <mjm@remote-exploit.org> | 4 | Martin J. Muench <mjm@remote-exploit.org> |
5 | Max Moser <mmo@remote-exploit.org | 5 | Max Moser <mmo@remote-exploit.org |
6 | Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 6 | Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef ONETWORK_H | 34 | #ifndef ONETWORK_H |
35 | #define ONETWORK_H | 35 | #define ONETWORK_H |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | 38 | ||
39 | #include <opie2/onetutils.h> | 39 | #include <opie2/onetutils.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | 42 | ||
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qdict.h> | 44 | #include <qdict.h> |
45 | #include <qmap.h> | 45 | #include <qmap.h> |
46 | #include <qobject.h> | 46 | #include <qobject.h> |
47 | #include <qhostaddress.h> | 47 | #include <qhostaddress.h> |
48 | 48 | ||
49 | #ifndef IFNAMSIZ | ||
50 | #define IFNAMSIZ 16 | ||
51 | #endif | ||
52 | #ifndef IW_MAX_PRIV_DEF | ||
53 | #define IW_MAX_PRIV_DEF 128 | ||
54 | #endif | ||
55 | |||
56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here | 49 | // ML: Yeah, I hate to include kernel headers, but it's necessary here |
57 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> | 50 | // ML: Here comes an ugly hack to prevent <linux/wireless.h> including <linux/if.h> |
58 | // ML: which conflicts with the user header <net/if.h> | 51 | // ML: which conflicts with the user header <net/if.h> |
59 | // ML: We really need a user header for the Wireless Extensions, something like <net/wireless.h> | 52 | // ML: We really need a user header for the Wireless Extensions, something like <net/wireless.h> |
60 | // ML: I will drop Jean a mail on that subject | 53 | // ML: I will drop Jean a mail on that subject |
61 | 54 | ||
62 | #include <net/if.h> | 55 | #include <net/if.h> |
56 | |||
57 | #ifndef IFNAMSIZ | ||
58 | #define IFNAMSIZ 16 | ||
59 | #endif | ||
60 | #ifndef IW_MAX_PRIV_DEF | ||
61 | #define IW_MAX_PRIV_DEF 128 | ||
62 | #endif | ||
63 | |||
63 | #define _LINUX_IF_H | 64 | #define _LINUX_IF_H |
64 | #include <linux/wireless.h> | 65 | #include <linux/wireless.h> |
65 | 66 | ||
66 | class ONetworkInterface; | 67 | class ONetworkInterface; |
67 | class OWirelessNetworkInterface; | 68 | class OWirelessNetworkInterface; |
68 | class OChannelHopper; | 69 | class OChannelHopper; |
69 | class OMonitoringInterface; | 70 | class OMonitoringInterface; |
70 | 71 | ||
71 | /*====================================================================================== | 72 | /*====================================================================================== |
72 | * ONetwork | 73 | * ONetwork |
73 | *======================================================================================*/ | 74 | *======================================================================================*/ |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * @brief A container class for all network interfaces | 77 | * @brief A container class for all network interfaces |
77 | * | 78 | * |
78 | * This class provides access to all available network interfaces of your computer. | 79 | * This class provides access to all available network interfaces of your computer. |
79 | * | 80 | * |
80 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 81 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
81 | */ | 82 | */ |
82 | class ONetwork : public QObject | 83 | class ONetwork : public QObject |
83 | { | 84 | { |
84 | Q_OBJECT | 85 | Q_OBJECT |
85 | 86 | ||
86 | public: | 87 | public: |
87 | typedef QDict<ONetworkInterface> InterfaceMap; | 88 | typedef QDict<ONetworkInterface> InterfaceMap; |
88 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 89 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
89 | 90 | ||
90 | public: | 91 | public: |
91 | /** | 92 | /** |
92 | * @returns the number of available interfaces | 93 | * @returns the number of available interfaces |
93 | */ | 94 | */ |
94 | int count() const; | 95 | int count() const; |
95 | /** | 96 | /** |
96 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 97 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
97 | */ | 98 | */ |
98 | static ONetwork* instance(); | 99 | static ONetwork* instance(); |
99 | /** | 100 | /** |
100 | * @returns an iterator usable for iterating through all network interfaces. | 101 | * @returns an iterator usable for iterating through all network interfaces. |
101 | */ | 102 | */ |
102 | InterfaceIterator iterator() const; | 103 | InterfaceIterator iterator() const; |
103 | /** | 104 | /** |
104 | * @returns true, if the @a interface supports the wireless extension protocol. | 105 | * @returns true, if the @a interface supports the wireless extension protocol. |
105 | */ | 106 | */ |
106 | // FIXME QString? -zecke | 107 | // FIXME QString? -zecke |
107 | bool isWirelessInterface( const char* interface ) const; | 108 | bool isWirelessInterface( const char* interface ) const; |
108 | /** | 109 | /** |
109 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found | 110 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found |
110 | * @see ONetworkInterface | 111 | * @see ONetworkInterface |
111 | */ | 112 | */ |
112 | // FIXME: const QString& is prefered over QString!!! -zecke | 113 | // FIXME: const QString& is prefered over QString!!! -zecke |
113 | ONetworkInterface* interface( const QString& interface ) const; | 114 | ONetworkInterface* interface( const QString& interface ) const; |
114 | /** | 115 | /** |
115 | * @internal Rebuild the internal interface database | 116 | * @internal Rebuild the internal interface database |
116 | * @note Sometimes it might be useful to call this from client code, | 117 | * @note Sometimes it might be useful to call this from client code, |
117 | * e.g. after issuing a cardctl insert | 118 | * e.g. after issuing a cardctl insert |
118 | */ | 119 | */ |
119 | void synchronize(); | 120 | void synchronize(); |
120 | 121 | ||
121 | protected: | 122 | protected: |
122 | ONetwork(); | 123 | ONetwork(); |
123 | 124 | ||
124 | private: | 125 | private: |
125 | static ONetwork* _instance; | 126 | static ONetwork* _instance; |
126 | InterfaceMap _interfaces; | 127 | InterfaceMap _interfaces; |