author | schurig <schurig> | 2003-06-04 11:53:19 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-04 11:53:19 (UTC) |
commit | e23848abe917d689ee9d8f7b78ff5e5047a3ed43 (patch) (unidiff) | |
tree | c23bf1cbb116ad2f8e523746867cf0494aa4af89 | |
parent | df76591a8ee920c6549bc55b026ab66926917667 (diff) | |
download | opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.zip opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.tar.gz opie-e23848abe917d689ee9d8f7b78ff5e5047a3ed43.tar.bz2 |
enable compilation
-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,190 +1,191 @@ | |||
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; |
127 | }; | 128 | }; |
128 | 129 | ||
129 | 130 | ||
130 | /*====================================================================================== | 131 | /*====================================================================================== |
131 | * ONetworkInterface | 132 | * ONetworkInterface |
132 | *======================================================================================*/ | 133 | *======================================================================================*/ |
133 | 134 | ||
134 | /** | 135 | /** |
135 | * @brief A network interface wrapper. | 136 | * @brief A network interface wrapper. |
136 | * | 137 | * |
137 | * This class provides a wrapper for a network interface. All the cumbersume details of | 138 | * This class provides a wrapper for a network interface. All the cumbersume details of |
138 | * Linux ioctls are hidden under a convenient high-level interface. | 139 | * Linux ioctls are hidden under a convenient high-level interface. |
139 | * @warning Most of the setting methods contained in this class require the appropriate | 140 | * @warning Most of the setting methods contained in this class require the appropriate |
140 | * process permissions to work. | 141 | * process permissions to work. |
141 | * | 142 | * |
142 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 143 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
143 | */ | 144 | */ |
144 | class ONetworkInterface : public QObject | 145 | class ONetworkInterface : public QObject |
145 | { | 146 | { |
146 | friend class OMonitoringInterface; | 147 | friend class OMonitoringInterface; |
147 | friend class OCiscoMonitoringInterface; | 148 | friend class OCiscoMonitoringInterface; |
148 | friend class OWlanNGMonitoringInterface; | 149 | friend class OWlanNGMonitoringInterface; |
149 | friend class OHostAPMonitoringInterface; | 150 | friend class OHostAPMonitoringInterface; |
150 | friend class OOrinocoMonitoringInterface; | 151 | friend class OOrinocoMonitoringInterface; |
151 | 152 | ||
152 | public: | 153 | public: |
153 | /** | 154 | /** |
154 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 155 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
155 | * but access them via @ref ONetwork::interface(). | 156 | * but access them via @ref ONetwork::interface(). |
156 | */ | 157 | */ |
157 | ONetworkInterface( QObject* parent, const char* name ); | 158 | ONetworkInterface( QObject* parent, const char* name ); |
158 | /** | 159 | /** |
159 | * Destructor. | 160 | * Destructor. |
160 | */ | 161 | */ |
161 | virtual ~ONetworkInterface(); | 162 | virtual ~ONetworkInterface(); |
162 | /** | 163 | /** |
163 | * Associates a @a monitoring interface with this network interface. | 164 | * Associates a @a monitoring interface with this network interface. |
164 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | 165 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. |
165 | */ | 166 | */ |
166 | void setMonitoring( OMonitoringInterface* monitoring ); | 167 | void setMonitoring( OMonitoringInterface* monitoring ); |
167 | /** | 168 | /** |
168 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. | 169 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. |
169 | */ | 170 | */ |
170 | OMonitoringInterface* monitoring() const; | 171 | OMonitoringInterface* monitoring() const; |
171 | /** | 172 | /** |
172 | * Setting an interface to promiscuous mode enables the device to receive | 173 | * Setting an interface to promiscuous mode enables the device to receive |
173 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. | 174 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. |
174 | */ | 175 | */ |
175 | bool setPromiscuousMode( bool ); | 176 | bool setPromiscuousMode( bool ); |
176 | /** | 177 | /** |
177 | * @returns true if the interface is set to promiscuous mode. | 178 | * @returns true if the interface is set to promiscuous mode. |
178 | */ | 179 | */ |
179 | bool promiscuousMode() const; | 180 | bool promiscuousMode() const; |
180 | /** | 181 | /** |
181 | * Setting an interface to up enables it to receive packets. | 182 | * Setting an interface to up enables it to receive packets. |
182 | */ | 183 | */ |
183 | bool setUp( bool ); | 184 | bool setUp( bool ); |
184 | /** | 185 | /** |
185 | * @returns true if the interface is up. | 186 | * @returns true if the interface is up. |
186 | */ | 187 | */ |
187 | bool isUp() const; | 188 | bool isUp() const; |
188 | /** | 189 | /** |
189 | * @returns true if the interface is a loopback interface. | 190 | * @returns true if the interface is a loopback interface. |
190 | */ | 191 | */ |