author | mickeyl <mickeyl> | 2003-04-30 18:42:07 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-30 18:42:07 (UTC) |
commit | 027458b66cffbfaf07c394a1a622a1f01970e11c (patch) (unidiff) | |
tree | 9cfbbfcebf60c2515719c0e9e2957cc18271dbe5 /libopie2/opienet | |
parent | 30aac378ab13a7dffbd3b6a0978cabc0372cd530 (diff) | |
download | opie-027458b66cffbfaf07c394a1a622a1f01970e11c.zip opie-027458b66cffbfaf07c394a1a622a1f01970e11c.tar.gz opie-027458b66cffbfaf07c394a1a622a1f01970e11c.tar.bz2 |
add some more documentation
-rw-r--r-- | libopie2/opienet/onetwork.h | 30 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 5 |
2 files changed, 28 insertions, 7 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 2348bbc..f052317 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -52,129 +52,129 @@ | |||
52 | #ifndef IW_MAX_PRIV_DEF | 52 | #ifndef IW_MAX_PRIV_DEF |
53 | #define IW_MAX_PRIV_DEF 128 | 53 | #define IW_MAX_PRIV_DEF 128 |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | // ML: Yeah, I hate to include kernel headers, but it's necessary here | 56 | // 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> | 57 | // 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> | 58 | // 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> | 59 | // 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 | 60 | // ML: I will drop Jean a mail on that subject |
61 | 61 | ||
62 | #include <net/if.h> | 62 | #include <net/if.h> |
63 | #define _LINUX_IF_H | 63 | #define _LINUX_IF_H |
64 | #include <linux/wireless.h> | 64 | #include <linux/wireless.h> |
65 | 65 | ||
66 | class ONetworkInterface; | 66 | class ONetworkInterface; |
67 | class OWirelessNetworkInterface; | 67 | class OWirelessNetworkInterface; |
68 | class OChannelHopper; | 68 | class OChannelHopper; |
69 | class OMonitoringInterface; | 69 | class OMonitoringInterface; |
70 | 70 | ||
71 | /*====================================================================================== | 71 | /*====================================================================================== |
72 | * ONetwork | 72 | * ONetwork |
73 | *======================================================================================*/ | 73 | *======================================================================================*/ |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * @brief A container class for all network interfaces | 76 | * @brief A container class for all network interfaces |
77 | * | 77 | * |
78 | * This class provides access to all available network interfaces of your computer. | 78 | * This class provides access to all available network interfaces of your computer. |
79 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 79 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
80 | */ | 80 | */ |
81 | class ONetwork : public QObject | 81 | class ONetwork : public QObject |
82 | { | 82 | { |
83 | Q_OBJECT | 83 | Q_OBJECT |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QDict<ONetworkInterface> InterfaceMap; | 86 | typedef QDict<ONetworkInterface> InterfaceMap; |
87 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 87 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
88 | 88 | ||
89 | public: | 89 | public: |
90 | /** | 90 | /** |
91 | * @returns the number of available interfaces | 91 | * @returns the number of available interfaces |
92 | */ | 92 | */ |
93 | int count() const; | 93 | int count() const; |
94 | /** | 94 | /** |
95 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 95 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
96 | */ | 96 | */ |
97 | static ONetwork* instance(); | 97 | static ONetwork* instance(); |
98 | /** | 98 | /** |
99 | * @returns an iterator usable for iterating through all network interfaces. | 99 | * @returns an iterator usable for iterating through all network interfaces. |
100 | */ | 100 | */ |
101 | InterfaceIterator iterator() const; | 101 | InterfaceIterator iterator() const; |
102 | /** | 102 | /** |
103 | * @returns true, if the @p interface supports the wireless extension protocol. | 103 | * @returns true, if the @p interface supports the wireless extension protocol. |
104 | */ | 104 | */ |
105 | // FIXME QString? -zecke | 105 | // FIXME QString? -zecke |
106 | bool isWirelessInterface( const char* interface ) const; | 106 | bool isWirelessInterface( const char* interface ) const; |
107 | /** | 107 | /** |
108 | * @returns a pointer to the @ref ONetworkInterface object for the specified @p interface or 0, if not found | 108 | * @returns a pointer to the @ref ONetworkInterface object for the specified @p interface or 0, if not found |
109 | * @see ONetworkInterface | 109 | * @see ONetworkInterface |
110 | */ | 110 | */ |
111 | // FIXME: const QString& is prefered over QString!!! -zecke | 111 | // FIXME: const QString& is prefered over QString!!! -zecke |
112 | ONetworkInterface* interface( const QString& interface ) const; | 112 | ONetworkInterface* interface( const QString& interface ) const; |
113 | /** | 113 | /** |
114 | * @internal Rebuild the internal interface database | 114 | * @internal Rebuild the internal interface database |
115 | * @note Sometimes it might be useful to call this from client code, | 115 | * @note Sometimes it might be useful to call this from client code, |
116 | * e.g. after cardctl insert | 116 | * e.g. after issuing a cardctl insert |
117 | */ | 117 | */ |
118 | void synchronize(); | 118 | void synchronize(); |
119 | 119 | ||
120 | protected: | 120 | protected: |
121 | ONetwork(); | 121 | ONetwork(); |
122 | 122 | ||
123 | private: | 123 | private: |
124 | static ONetwork* _instance; | 124 | static ONetwork* _instance; |
125 | InterfaceMap _interfaces; | 125 | InterfaceMap _interfaces; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | 128 | ||
129 | /*====================================================================================== | 129 | /*====================================================================================== |
130 | * ONetworkInterface | 130 | * ONetworkInterface |
131 | *======================================================================================*/ | 131 | *======================================================================================*/ |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * @brief A network interface wrapper. | 134 | * @brief A network interface wrapper. |
135 | * | 135 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 136 | * This class provides a wrapper for a network interface. All the cumbersume details of |
137 | * Linux ioctls are hidden under a convenient high-level interface. | 137 | * Linux ioctls are hidden under a convenient high-level interface. |
138 | * @warning Most of the setting methods contained in this class require the appropriate | 138 | * @warning Most of the setting methods contained in this class require the appropriate |
139 | * process permissions to work. | 139 | * process permissions to work. |
140 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 140 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
141 | */ | 141 | */ |
142 | class ONetworkInterface : public QObject | 142 | class ONetworkInterface : public QObject |
143 | { | 143 | { |
144 | friend class OMonitoringInterface; | 144 | friend class OMonitoringInterface; |
145 | friend class OCiscoMonitoringInterface; | 145 | friend class OCiscoMonitoringInterface; |
146 | friend class OWlanNGMonitoringInterface; | 146 | friend class OWlanNGMonitoringInterface; |
147 | friend class OHostAPMonitoringInterface; | 147 | friend class OHostAPMonitoringInterface; |
148 | friend class OOrinocoMonitoringInterface; | 148 | friend class OOrinocoMonitoringInterface; |
149 | 149 | ||
150 | public: | 150 | public: |
151 | /** | 151 | /** |
152 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, | 152 | * Constructor. Normally you don't create @ref ONetworkInterface objects yourself, |
153 | * but access them via @ref ONetwork::interface(). | 153 | * but access them via @ref ONetwork::interface(). |
154 | */ | 154 | */ |
155 | ONetworkInterface( QObject* parent, const char* name ); | 155 | ONetworkInterface( QObject* parent, const char* name ); |
156 | /** | 156 | /** |
157 | * Destructor. | 157 | * Destructor. |
158 | */ | 158 | */ |
159 | virtual ~ONetworkInterface(); | 159 | virtual ~ONetworkInterface(); |
160 | /** | 160 | /** |
161 | * Associates a @a monitoring interface with this network interface. | 161 | * Associates a @a monitoring interface with this network interface. |
162 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. | 162 | * @note This is currently only useful with @ref OWirelessNetworkInterface objects. |
163 | */ | 163 | */ |
164 | void setMonitoring( OMonitoringInterface* monitoring ); | 164 | void setMonitoring( OMonitoringInterface* monitoring ); |
165 | /** | 165 | /** |
166 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. | 166 | * @returns the currently associated monitoring interface or 0, if no monitoring is associated. |
167 | */ | 167 | */ |
168 | OMonitoringInterface* monitoring() const; | 168 | OMonitoringInterface* monitoring() const; |
169 | /** | 169 | /** |
170 | * Setting an interface to promiscuous mode enables the device to receive | 170 | * Setting an interface to promiscuous mode enables the device to receive |
171 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. | 171 | * all packets on the shared medium - as opposed to packets which are addressed to this interface. |
172 | */ | 172 | */ |
173 | bool setPromiscuousMode( bool ); | 173 | bool setPromiscuousMode( bool ); |
174 | /** | 174 | /** |
175 | * @returns true if the interface is set to promiscuous mode. | 175 | * @returns true if the interface is set to promiscuous mode. |
176 | */ | 176 | */ |
177 | bool promiscuousMode() const; | 177 | bool promiscuousMode() const; |
178 | /** | 178 | /** |
179 | * Setting an interface to up enables it to receive packets. | 179 | * Setting an interface to up enables it to receive packets. |
180 | */ | 180 | */ |
@@ -192,139 +192,163 @@ class ONetworkInterface : public QObject | |||
192 | */ | 192 | */ |
193 | bool isWireless() const; | 193 | bool isWireless() const; |
194 | /** | 194 | /** |
195 | * Associate the IP address @ addr with the interface. | 195 | * Associate the IP address @ addr with the interface. |
196 | */ | 196 | */ |
197 | void setIPV4Address( const QHostAddress& addr ); | 197 | void setIPV4Address( const QHostAddress& addr ); |
198 | /** | 198 | /** |
199 | * @returns the IPv4 address associated with the interface. | 199 | * @returns the IPv4 address associated with the interface. |
200 | */ | 200 | */ |
201 | QString ipV4Address() const; | 201 | QString ipV4Address() const; |
202 | /** | 202 | /** |
203 | * Associate the MAC address @a addr with the interface. | 203 | * Associate the MAC address @a addr with the interface. |
204 | * @note It can be necessary to shut down the interface prior to calling this method. | 204 | * @note It can be necessary to shut down the interface prior to calling this method. |
205 | * @warning This is not supported by all drivers. | 205 | * @warning This is not supported by all drivers. |
206 | */ | 206 | */ |
207 | void setMacAddress( const OMacAddress& addr ); | 207 | void setMacAddress( const OMacAddress& addr ); |
208 | /** | 208 | /** |
209 | * @returns the MAC address associated with the interface. | 209 | * @returns the MAC address associated with the interface. |
210 | */ | 210 | */ |
211 | OMacAddress macAddress() const; | 211 | OMacAddress macAddress() const; |
212 | /** | 212 | /** |
213 | * Associate the IPv4 @a netmask with the interface. | 213 | * Associate the IPv4 @a netmask with the interface. |
214 | */ | 214 | */ |
215 | void setIPV4Netmask( const QHostAddress& netmask ); | 215 | void setIPV4Netmask( const QHostAddress& netmask ); |
216 | /** | 216 | /** |
217 | * @returns the IPv4 netmask associated with the interface. | 217 | * @returns the IPv4 netmask associated with the interface. |
218 | */ | 218 | */ |
219 | QString ipV4Netmask() const; | 219 | QString ipV4Netmask() const; |
220 | /** | 220 | /** |
221 | * @returns the data link type currently associated with the interface. | 221 | * @returns the data link type currently associated with the interface. |
222 | * @see #include <net/if_arp.h> for possible values. | 222 | * @see #include <net/if_arp.h> for possible values. |
223 | */ | 223 | */ |
224 | int dataLinkType() const; | 224 | int dataLinkType() const; |
225 | 225 | ||
226 | protected: | 226 | protected: |
227 | const int _sfd; | 227 | const int _sfd; |
228 | mutable ifreq _ifr; | 228 | mutable ifreq _ifr; |
229 | OMonitoringInterface* _mon; | 229 | OMonitoringInterface* _mon; |
230 | 230 | ||
231 | protected: | 231 | protected: |
232 | struct ifreq& ifr() const; | 232 | struct ifreq& ifr() const; |
233 | virtual void init(); | 233 | virtual void init(); |
234 | bool ioctl( int call ) const; | 234 | bool ioctl( int call ) const; |
235 | bool ioctl( int call, struct ifreq& ) const; | 235 | bool ioctl( int call, struct ifreq& ) const; |
236 | }; | 236 | }; |
237 | 237 | ||
238 | /*====================================================================================== | 238 | /*====================================================================================== |
239 | * OChannelHopper | 239 | * OChannelHopper |
240 | *======================================================================================*/ | 240 | *======================================================================================*/ |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * @brief A radio frequency channel hopper. | 243 | * @brief A radio frequency channel hopper. |
244 | * | 244 | * |
245 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 245 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
246 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 246 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
247 | * This is necessary when in monitoring mode and scanning for other devices, because | 247 | * This is necessary when in monitoring mode and scanning for other devices, because |
248 | * the radio frequency hardware can only detect packets sent on the same frequency. | 248 | * the radio frequency hardware can only detect packets sent on the same frequency. |
249 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 249 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
250 | */ | 250 | */ |
251 | class OChannelHopper : public QObject | 251 | class OChannelHopper : public QObject |
252 | { | 252 | { |
253 | Q_OBJECT | 253 | Q_OBJECT |
254 | 254 | ||
255 | public: | 255 | public: |
256 | /** | ||
257 | * Constructor. | ||
258 | */ | ||
256 | OChannelHopper( OWirelessNetworkInterface* ); | 259 | OChannelHopper( OWirelessNetworkInterface* ); |
260 | /** | ||
261 | * Destructor. | ||
262 | */ | ||
257 | virtual ~OChannelHopper(); | 263 | virtual ~OChannelHopper(); |
264 | /** | ||
265 | * @returns true, if the channel hopper is hopping channels | ||
266 | */ | ||
258 | bool isActive() const; | 267 | bool isActive() const; |
268 | /** | ||
269 | * @returns the last hopped channel | ||
270 | */ | ||
259 | int channel() const; | 271 | int channel() const; |
260 | virtual void timerEvent( QTimerEvent* ); | 272 | /** |
261 | void setInterval( int ); | 273 | * Set the channel hopping @a interval. |
274 | * An interval of 0 deactivates the channel hopper. | ||
275 | */ | ||
276 | void setInterval( int interval ); | ||
277 | /** | ||
278 | * @returns the channel hopping interval | ||
279 | */ | ||
262 | int interval() const; | 280 | int interval() const; |
263 | 281 | ||
264 | signals: | 282 | signals: |
283 | /** | ||
284 | * This signal is emitted right after the channel hopper performed a hop | ||
285 | */ | ||
265 | void hopped( int ); | 286 | void hopped( int ); |
266 | 287 | ||
288 | protected: | ||
289 | virtual void timerEvent( QTimerEvent* ); | ||
290 | |||
267 | private: | 291 | private: |
268 | OWirelessNetworkInterface* _iface; | 292 | OWirelessNetworkInterface* _iface; |
269 | int _interval; | 293 | int _interval; |
270 | int _tid; | 294 | int _tid; |
271 | QValueList<int> _channels; | 295 | QValueList<int> _channels; |
272 | QValueList<int>::Iterator _channel; | 296 | QValueList<int>::Iterator _channel; |
273 | }; | 297 | }; |
274 | 298 | ||
275 | 299 | ||
276 | /*====================================================================================== | 300 | /*====================================================================================== |
277 | * OWirelessNetworkInterface | 301 | * OWirelessNetworkInterface |
278 | *======================================================================================*/ | 302 | *======================================================================================*/ |
279 | 303 | ||
280 | /** | 304 | /** |
281 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 305 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
282 | * | 306 | * |
283 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 307 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
284 | */ | 308 | */ |
285 | class OWirelessNetworkInterface : public ONetworkInterface | 309 | class OWirelessNetworkInterface : public ONetworkInterface |
286 | { | 310 | { |
287 | friend class OMonitoringInterface; | 311 | friend class OMonitoringInterface; |
288 | friend class OCiscoMonitoringInterface; | 312 | friend class OCiscoMonitoringInterface; |
289 | friend class OWlanNGMonitoringInterface; | 313 | friend class OWlanNGMonitoringInterface; |
290 | friend class OHostAPMonitoringInterface; | 314 | friend class OHostAPMonitoringInterface; |
291 | friend class OOrinocoMonitoringInterface; | 315 | friend class OOrinocoMonitoringInterface; |
292 | 316 | ||
293 | friend class OPrivateIOCTL; | 317 | friend class OPrivateIOCTL; |
294 | 318 | ||
295 | public: | 319 | public: |
296 | enum Mode { AdHoc, Managed, Monitor }; | 320 | enum Mode { AdHoc, Managed, Monitor }; |
297 | 321 | ||
298 | /** | 322 | /** |
299 | * Constructor. | 323 | * Constructor. |
300 | */ | 324 | */ |
301 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 325 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
302 | /** | 326 | /** |
303 | * Destructor. | 327 | * Destructor. |
304 | */ | 328 | */ |
305 | virtual ~OWirelessNetworkInterface(); | 329 | virtual ~OWirelessNetworkInterface(); |
306 | /** | 330 | /** |
307 | * Setting the @a channel of the interface changes the radio frequency (RF) | 331 | * Setting the @a channel of the interface changes the radio frequency (RF) |
308 | * of the corresponding wireless network device. | 332 | * of the corresponding wireless network device. |
309 | */ | 333 | */ |
310 | virtual void setChannel( int channel ) const; | 334 | virtual void setChannel( int channel ) const; |
311 | /** | 335 | /** |
312 | * @returns the channel index of the current radio frequency. | 336 | * @returns the channel index of the current radio frequency. |
313 | */ | 337 | */ |
314 | virtual int channel() const; | 338 | virtual int channel() const; |
315 | /** | 339 | /** |
316 | * @returns the current radio frequency (in MHz). | 340 | * @returns the current radio frequency (in MHz). |
317 | */ | 341 | */ |
318 | virtual double frequency() const; | 342 | virtual double frequency() const; |
319 | /** | 343 | /** |
320 | * @returns the number of radio frequency channels for the | 344 | * @returns the number of radio frequency channels for the |
321 | * corresponding wireless network device. | 345 | * corresponding wireless network device. |
322 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | 346 | * @note European devices usually have 14 channels, while American typically feature 11 channels. |
323 | */ | 347 | */ |
324 | virtual int channels() const; | 348 | virtual int channels() const; |
325 | //virtual double frequency(int) const; | 349 | //virtual double frequency(int) const; |
326 | 350 | ||
327 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this | 351 | virtual void setMode( Mode ) {}; //FIXME: Implement and document this |
328 | virtual bool mode() const {}; //FIXME: Implement and document this | 352 | virtual bool mode() const {}; //FIXME: Implement and document this |
329 | 353 | ||
330 | /** | 354 | /** |
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index 83f7115..bee0ca0 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h | |||
@@ -92,148 +92,146 @@ class QSocketNotifier; | |||
92 | * also contains a few more levels of encapsulation. | 92 | * also contains a few more levels of encapsulation. |
93 | * Since the type of the payload is more or less independent from the encapsulating protocol, | 93 | * Since the type of the payload is more or less independent from the encapsulating protocol, |
94 | * the header must be inspected before attempting to decode the payload. Hence, the | 94 | * the header must be inspected before attempting to decode the payload. Hence, the |
95 | * encapsulation level varies and can't be deduced without actually looking into the packets. | 95 | * encapsulation level varies and can't be deduced without actually looking into the packets. |
96 | * | 96 | * |
97 | * For actually working with captured frames, it's useful to identify the packets via names and | 97 | * For actually working with captured frames, it's useful to identify the packets via names and |
98 | * insert them into a parent/child - relationship based on the encapsulation. This is why | 98 | * insert them into a parent/child - relationship based on the encapsulation. This is why |
99 | * all packet classes derive from QObject. The amount of overhead caused by the QObject is | 99 | * all packet classes derive from QObject. The amount of overhead caused by the QObject is |
100 | * not a problem in this case, because we're talking about a theoratical maximum of about | 100 | * not a problem in this case, because we're talking about a theoratical maximum of about |
101 | * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the | 101 | * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the |
102 | * QObject also cares about destroying the sub-, (child-) packets. | 102 | * QObject also cares about destroying the sub-, (child-) packets. |
103 | * | 103 | * |
104 | * This enables us to perform a simple look for packets of a certain type: | 104 | * This enables us to perform a simple look for packets of a certain type: |
105 | * @code | 105 | * @code |
106 | * OPacketCapturer* pcap = new OPacketCapturer(); | 106 | * OPacketCapturer* pcap = new OPacketCapturer(); |
107 | * pcap->open( "eth0" ); | 107 | * pcap->open( "eth0" ); |
108 | * OPacket* p = pcap->next(); | 108 | * OPacket* p = pcap->next(); |
109 | * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists | 109 | * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists |
110 | * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl; | 110 | * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl; |
111 | * | 111 | * |
112 | */ | 112 | */ |
113 | 113 | ||
114 | class OPacket : public QObject | 114 | class OPacket : public QObject |
115 | { | 115 | { |
116 | Q_OBJECT | 116 | Q_OBJECT |
117 | 117 | ||
118 | public: | 118 | public: |
119 | OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); | 119 | OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); |
120 | virtual ~OPacket(); | 120 | virtual ~OPacket(); |
121 | 121 | ||
122 | timevalstruct timeval() const; | 122 | timevalstruct timeval() const; |
123 | 123 | ||
124 | int caplen() const; | 124 | int caplen() const; |
125 | int len() const; | 125 | int len() const; |
126 | QString dump( int = 32 ) const; | 126 | QString dump( int = 32 ) const; |
127 | 127 | ||
128 | void updateStats( QMap<QString,int>&, QObjectList* ); | 128 | void updateStats( QMap<QString,int>&, QObjectList* ); |
129 | 129 | ||
130 | private: | 130 | private: |
131 | const packetheaderstruct _hdr; // pcap packet header | 131 | const packetheaderstruct _hdr; // pcap packet header |
132 | const unsigned char* _data; // pcap packet data | 132 | const unsigned char* _data; // pcap packet data |
133 | const unsigned char* _end; // end of pcap packet data | 133 | const unsigned char* _end; // end of pcap packet data |
134 | }; | 134 | }; |
135 | 135 | ||
136 | /*====================================================================================== | 136 | /*====================================================================================== |
137 | * OEthernetPacket - DLT_EN10MB frame | 137 | * OEthernetPacket - DLT_EN10MB frame |
138 | *======================================================================================*/ | 138 | *======================================================================================*/ |
139 | 139 | ||
140 | class OEthernetPacket : public QObject | 140 | class OEthernetPacket : public QObject |
141 | { | 141 | { |
142 | Q_OBJECT | 142 | Q_OBJECT |
143 | 143 | ||
144 | public: | 144 | public: |
145 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); | 145 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); |
146 | virtual ~OEthernetPacket(); | 146 | virtual ~OEthernetPacket(); |
147 | 147 | ||
148 | OMacAddress sourceAddress() const; | 148 | OMacAddress sourceAddress() const; |
149 | OMacAddress destinationAddress() const; | 149 | OMacAddress destinationAddress() const; |
150 | int type() const; | 150 | int type() const; |
151 | 151 | ||
152 | private: | 152 | private: |
153 | const struct ether_header* _ether; | 153 | const struct ether_header* _ether; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | |||
157 | /*====================================================================================== | 156 | /*====================================================================================== |
158 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame | 157 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame |
159 | *======================================================================================*/ | 158 | *======================================================================================*/ |
160 | 159 | ||
161 | class OPrismHeaderPacket : public QObject | 160 | class OPrismHeaderPacket : public QObject |
162 | { | 161 | { |
163 | Q_OBJECT | 162 | Q_OBJECT |
164 | 163 | ||
165 | public: | 164 | public: |
166 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); | 165 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); |
167 | virtual ~OPrismHeaderPacket(); | 166 | virtual ~OPrismHeaderPacket(); |
168 | 167 | ||
169 | unsigned int signalStrength() const; | 168 | unsigned int signalStrength() const; |
170 | 169 | ||
171 | private: | 170 | private: |
172 | const struct prism_hdr* _header; | 171 | const struct prism_hdr* _header; |
173 | }; | 172 | }; |
174 | 173 | ||
175 | |||
176 | /*====================================================================================== | 174 | /*====================================================================================== |
177 | * OWaveLanPacket - DLT_IEEE802_11 frame | 175 | * OWaveLanPacket - DLT_IEEE802_11 frame |
178 | *======================================================================================*/ | 176 | *======================================================================================*/ |
179 | 177 | ||
180 | class OWaveLanPacket : public QObject | 178 | class OWaveLanPacket : public QObject |
181 | { | 179 | { |
182 | Q_OBJECT | 180 | Q_OBJECT |
183 | 181 | ||
184 | public: | 182 | public: |
185 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); | 183 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); |
186 | virtual ~OWaveLanPacket(); | 184 | virtual ~OWaveLanPacket(); |
187 | 185 | ||
188 | int duration() const; | 186 | int duration() const; |
189 | bool fromDS() const; | 187 | bool fromDS() const; |
190 | bool toDS() const; | 188 | bool toDS() const; |
191 | virtual OMacAddress macAddress1() const; | 189 | virtual OMacAddress macAddress1() const; |
192 | virtual OMacAddress macAddress2() const; | 190 | virtual OMacAddress macAddress2() const; |
193 | virtual OMacAddress macAddress3() const; | 191 | virtual OMacAddress macAddress3() const; |
194 | virtual OMacAddress macAddress4() const; | 192 | virtual OMacAddress macAddress4() const; |
195 | bool usesPowerManagement() const; | 193 | bool usesPowerManagement() const; |
196 | int type() const; | 194 | int type() const; |
197 | int subType() const; | 195 | int subType() const; |
198 | int version() const; | 196 | int version() const; |
199 | bool usesWep() const; | 197 | bool usesWep() const; |
200 | 198 | ||
201 | private: | 199 | private: |
202 | const struct ieee_802_11_header* _wlanhdr; | 200 | const struct ieee_802_11_header* _wlanhdr; |
203 | }; | 201 | }; |
204 | 202 | ||
205 | 203 | ||
206 | /*====================================================================================== | 204 | /*====================================================================================== |
207 | * OWaveLanManagementPacket - type: management (T_MGMT) | 205 | * OWaveLanManagementPacket - type: management (T_MGMT) |
208 | *======================================================================================*/ | 206 | *======================================================================================*/ |
209 | 207 | ||
210 | class OWaveLanManagementPacket : public QObject | 208 | class OWaveLanManagementPacket : public QObject |
211 | { | 209 | { |
212 | Q_OBJECT | 210 | Q_OBJECT |
213 | 211 | ||
214 | public: | 212 | public: |
215 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); | 213 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); |
216 | virtual ~OWaveLanManagementPacket(); | 214 | virtual ~OWaveLanManagementPacket(); |
217 | 215 | ||
218 | QString managementType() const; | 216 | QString managementType() const; |
219 | 217 | ||
220 | int beaconInterval() const; | 218 | int beaconInterval() const; |
221 | int capabilities() const; // generic | 219 | int capabilities() const; // generic |
222 | 220 | ||
223 | bool canESS() const; | 221 | bool canESS() const; |
224 | bool canIBSS() const; | 222 | bool canIBSS() const; |
225 | bool canCFP() const; | 223 | bool canCFP() const; |
226 | bool canCFP_REQ() const; | 224 | bool canCFP_REQ() const; |
227 | bool canPrivacy() const; | 225 | bool canPrivacy() const; |
228 | 226 | ||
229 | private: | 227 | private: |
230 | const struct ieee_802_11_mgmt_header* _header; | 228 | const struct ieee_802_11_mgmt_header* _header; |
231 | const struct ieee_802_11_mgmt_body* _body; | 229 | const struct ieee_802_11_mgmt_body* _body; |
232 | }; | 230 | }; |
233 | 231 | ||
234 | 232 | ||
235 | /*====================================================================================== | 233 | /*====================================================================================== |
236 | * OWaveLanManagementSSID | 234 | * OWaveLanManagementSSID |
237 | *======================================================================================*/ | 235 | *======================================================================================*/ |
238 | 236 | ||
239 | class OWaveLanManagementSSID : public QObject | 237 | class OWaveLanManagementSSID : public QObject |
@@ -291,145 +289,144 @@ class OWaveLanManagementFH : public QObject | |||
291 | Q_OBJECT | 289 | Q_OBJECT |
292 | 290 | ||
293 | public: | 291 | public: |
294 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); | 292 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); |
295 | virtual ~OWaveLanManagementFH(); | 293 | virtual ~OWaveLanManagementFH(); |
296 | 294 | ||
297 | private: | 295 | private: |
298 | const struct fh_t* _data; | 296 | const struct fh_t* _data; |
299 | }; | 297 | }; |
300 | 298 | ||
301 | /*====================================================================================== | 299 | /*====================================================================================== |
302 | * OWaveLanManagementDS | 300 | * OWaveLanManagementDS |
303 | *======================================================================================*/ | 301 | *======================================================================================*/ |
304 | 302 | ||
305 | class OWaveLanManagementDS : public QObject | 303 | class OWaveLanManagementDS : public QObject |
306 | { | 304 | { |
307 | Q_OBJECT | 305 | Q_OBJECT |
308 | 306 | ||
309 | public: | 307 | public: |
310 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); | 308 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); |
311 | virtual ~OWaveLanManagementDS(); | 309 | virtual ~OWaveLanManagementDS(); |
312 | 310 | ||
313 | int channel() const; | 311 | int channel() const; |
314 | 312 | ||
315 | private: | 313 | private: |
316 | const struct ds_t* _data; | 314 | const struct ds_t* _data; |
317 | }; | 315 | }; |
318 | 316 | ||
319 | /*====================================================================================== | 317 | /*====================================================================================== |
320 | * OWaveLanManagementTim | 318 | * OWaveLanManagementTim |
321 | *======================================================================================*/ | 319 | *======================================================================================*/ |
322 | 320 | ||
323 | class OWaveLanManagementTim : public QObject | 321 | class OWaveLanManagementTim : public QObject |
324 | { | 322 | { |
325 | Q_OBJECT | 323 | Q_OBJECT |
326 | 324 | ||
327 | public: | 325 | public: |
328 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); | 326 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); |
329 | virtual ~OWaveLanManagementTim(); | 327 | virtual ~OWaveLanManagementTim(); |
330 | 328 | ||
331 | private: | 329 | private: |
332 | const struct tim_t* _data; | 330 | const struct tim_t* _data; |
333 | }; | 331 | }; |
334 | 332 | ||
335 | /*====================================================================================== | 333 | /*====================================================================================== |
336 | * OWaveLanManagementIBSS | 334 | * OWaveLanManagementIBSS |
337 | *======================================================================================*/ | 335 | *======================================================================================*/ |
338 | 336 | ||
339 | class OWaveLanManagementIBSS : public QObject | 337 | class OWaveLanManagementIBSS : public QObject |
340 | { | 338 | { |
341 | Q_OBJECT | 339 | Q_OBJECT |
342 | 340 | ||
343 | public: | 341 | public: |
344 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); | 342 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); |
345 | virtual ~OWaveLanManagementIBSS(); | 343 | virtual ~OWaveLanManagementIBSS(); |
346 | 344 | ||
347 | private: | 345 | private: |
348 | const struct ibss_t* _data; | 346 | const struct ibss_t* _data; |
349 | }; | 347 | }; |
350 | 348 | ||
351 | /*====================================================================================== | 349 | /*====================================================================================== |
352 | * OWaveLanManagementChallenge | 350 | * OWaveLanManagementChallenge |
353 | *======================================================================================*/ | 351 | *======================================================================================*/ |
354 | 352 | ||
355 | // Qobject do we need that?? | ||
356 | class OWaveLanManagementChallenge : public QObject | 353 | class OWaveLanManagementChallenge : public QObject |
357 | { | 354 | { |
358 | Q_OBJECT | 355 | Q_OBJECT |
359 | 356 | ||
360 | public: | 357 | public: |
361 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); | 358 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); |
362 | virtual ~OWaveLanManagementChallenge(); | 359 | virtual ~OWaveLanManagementChallenge(); |
363 | 360 | ||
364 | private: | 361 | private: |
365 | const struct challenge_t* _data; | 362 | const struct challenge_t* _data; |
366 | }; | 363 | }; |
367 | 364 | ||
368 | /*====================================================================================== | 365 | /*====================================================================================== |
369 | * OWaveLanDataPacket - type: data (T_DATA) | 366 | * OWaveLanDataPacket - type: data (T_DATA) |
370 | *======================================================================================*/ | 367 | *======================================================================================*/ |
371 | // Qobject? | 368 | |
372 | class OWaveLanDataPacket : public QObject | 369 | class OWaveLanDataPacket : public QObject |
373 | { | 370 | { |
374 | Q_OBJECT | 371 | Q_OBJECT |
375 | 372 | ||
376 | public: | 373 | public: |
377 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); | 374 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); |
378 | virtual ~OWaveLanDataPacket(); | 375 | virtual ~OWaveLanDataPacket(); |
379 | 376 | ||
380 | private: | 377 | private: |
381 | const struct ieee_802_11_data_header* _header; | 378 | const struct ieee_802_11_data_header* _header; |
382 | }; | 379 | }; |
383 | 380 | ||
384 | /*====================================================================================== | 381 | /*====================================================================================== |
385 | * OWaveLanControlPacket - type: control (T_CTRL) | 382 | * OWaveLanControlPacket - type: control (T_CTRL) |
386 | *======================================================================================*/ | 383 | *======================================================================================*/ |
387 | 384 | ||
388 | class OWaveLanControlPacket : public QObject | 385 | class OWaveLanControlPacket : public QObject |
389 | { | 386 | { |
390 | Q_OBJECT | 387 | Q_OBJECT |
391 | 388 | ||
392 | public: | 389 | public: |
393 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); | 390 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); |
394 | virtual ~OWaveLanControlPacket(); | 391 | virtual ~OWaveLanControlPacket(); |
395 | 392 | ||
396 | private: | 393 | private: |
397 | const struct ieee_802_11_control_header* _header; | 394 | const struct ieee_802_11_control_header* _header; |
398 | }; | 395 | }; |
399 | 396 | ||
400 | /*====================================================================================== | 397 | /*====================================================================================== |
401 | * OLLCPacket - IEEE 802.2 Link Level Control | 398 | * OLLCPacket - IEEE 802.2 Link Level Control |
402 | *======================================================================================*/ | 399 | *======================================================================================*/ |
403 | 400 | ||
404 | class OLLCPacket : public QObject | 401 | class OLLCPacket : public QObject |
405 | { | 402 | { |
406 | Q_OBJECT | 403 | Q_OBJECT |
407 | 404 | ||
408 | public: | 405 | public: |
409 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); | 406 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); |
410 | virtual ~OLLCPacket(); | 407 | virtual ~OLLCPacket(); |
411 | 408 | ||
412 | private: | 409 | private: |
413 | const struct ieee_802_11_802_2_header* _header; | 410 | const struct ieee_802_11_802_2_header* _header; |
414 | }; | 411 | }; |
415 | 412 | ||
416 | /*====================================================================================== | 413 | /*====================================================================================== |
417 | * OIPPacket | 414 | * OIPPacket |
418 | *======================================================================================*/ | 415 | *======================================================================================*/ |
419 | 416 | ||
420 | class OIPPacket : public QObject | 417 | class OIPPacket : public QObject |
421 | { | 418 | { |
422 | Q_OBJECT | 419 | Q_OBJECT |
423 | 420 | ||
424 | public: | 421 | public: |
425 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); | 422 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); |
426 | virtual ~OIPPacket(); | 423 | virtual ~OIPPacket(); |
427 | 424 | ||
428 | QHostAddress fromIPAddress() const; | 425 | QHostAddress fromIPAddress() const; |
429 | QHostAddress toIPAddress() const; | 426 | QHostAddress toIPAddress() const; |
430 | 427 | ||
431 | int tos() const; | 428 | int tos() const; |
432 | int len() const; | 429 | int len() const; |
433 | int id() const; | 430 | int id() const; |
434 | int offset() const; | 431 | int offset() const; |
435 | int ttl() const; | 432 | int ttl() const; |