summaryrefslogtreecommitdiff
path: root/libopie2/opienet
Unidiff
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.h67
1 files changed, 50 insertions, 17 deletions
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index 6bf7416..fe88e68 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -67,9 +67,51 @@ class QSocketNotifier;
67 67
68/*====================================================================================== 68/*======================================================================================
69 * OPacket - A frame on the wire 69 * OPacket - A frame on the wire
70 *======================================================================================*/ 70 *======================================================================================*/
71// FIXME how many OPackets do we've at a time? QObject seams to be a big for that usage 71
72/** @brief A class representing a data frame on the wire.
73 *
74 * The whole family of the packet classes are used when capturing frames from a network.
75 * Most standard network protocols in use share a common architecture, which mostly is
76 * a packet header and then the packet payload. In layered architectures, each lower layer
77 * encapsulates data from its upper layer - that is it
78 * treats the data from its upper layer as payload and prepends an own header to the packet,
79 * which - again - is treated as the payload for the layer below. The figure below is an
80 * example for how such a data frame is composed out of packets, e.g. when sending a mail.
81 *
82 * <pre>
83 * | User Data | == Mail Data
84 * | SMTP Header | User Data | == SMTP
85 * | TCP Header | SMTP Header | User Data | == TCP
86 * | IP Header | TCP Header | SMTP Header | User Data | == IP
87 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC
88 *
89 * </pre>
90 *
91 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer
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,
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.
96 *
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
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
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.
103 *
104 * This enables us to perform a simple look for packets of a certain type:
105 * @code
106 * OPacketCapturer* pcap = new OPacketCapturer();
107 * pcap->open( "eth0" );
108 * OPacket* p = pcap->next();
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;
111 *
112 */
113
72class OPacket : public QObject 114class OPacket : public QObject
73{ 115{
74 Q_OBJECT 116 Q_OBJECT
75 117
@@ -94,9 +136,8 @@ class OPacket : public QObject
94/*====================================================================================== 136/*======================================================================================
95 * OEthernetPacket - DLT_EN10MB frame 137 * OEthernetPacket - DLT_EN10MB frame
96 *======================================================================================*/ 138 *======================================================================================*/
97 139
98//FIXME same critic as above -zecke
99class OEthernetPacket : public QObject 140class OEthernetPacket : public QObject
100{ 141{
101 Q_OBJECT 142 Q_OBJECT
102 143
@@ -115,9 +156,9 @@ class OEthernetPacket : public QObject
115 156
116/*====================================================================================== 157/*======================================================================================
117 * OWaveLanPacket - DLT_IEEE802_11 frame 158 * OWaveLanPacket - DLT_IEEE802_11 frame
118 *======================================================================================*/ 159 *======================================================================================*/
119//FIXME same 160
120class OWaveLanPacket : public QObject 161class OWaveLanPacket : public QObject
121{ 162{
122 Q_OBJECT 163 Q_OBJECT
123 164
@@ -145,9 +186,9 @@ class OWaveLanPacket : public QObject
145 186
146/*====================================================================================== 187/*======================================================================================
147 * OWaveLanManagementPacket - type: management (T_MGMT) 188 * OWaveLanManagementPacket - type: management (T_MGMT)
148 *======================================================================================*/ 189 *======================================================================================*/
149//FIXME same as above -zecke 190
150class OWaveLanManagementPacket : public QObject 191class OWaveLanManagementPacket : public QObject
151{ 192{
152 Q_OBJECT 193 Q_OBJECT
153 194
@@ -174,9 +215,9 @@ class OWaveLanManagementPacket : public QObject
174 215
175/*====================================================================================== 216/*======================================================================================
176 * OWaveLanManagementSSID 217 * OWaveLanManagementSSID
177 *======================================================================================*/ 218 *======================================================================================*/
178//FIXME is QObject necessary? -zecke 219
179class OWaveLanManagementSSID : public QObject 220class OWaveLanManagementSSID : public QObject
180{ 221{
181 Q_OBJECT 222 Q_OBJECT
182 223
@@ -192,9 +233,9 @@ class OWaveLanManagementSSID : public QObject
192 233
193/*====================================================================================== 234/*======================================================================================
194 * OWaveLanManagementRates 235 * OWaveLanManagementRates
195 *======================================================================================*/ 236 *======================================================================================*/
196// FIXME same as above -zecke 237
197class OWaveLanManagementRates : public QObject 238class OWaveLanManagementRates : public QObject
198{ 239{
199 Q_OBJECT 240 Q_OBJECT
200 241
@@ -209,9 +250,8 @@ class OWaveLanManagementRates : public QObject
209/*====================================================================================== 250/*======================================================================================
210 * OWaveLanManagementCF 251 * OWaveLanManagementCF
211 *======================================================================================*/ 252 *======================================================================================*/
212 253
213//FIXME same....
214class OWaveLanManagementCF : public QObject 254class OWaveLanManagementCF : public QObject
215{ 255{
216 Q_OBJECT 256 Q_OBJECT
217 257
@@ -226,9 +266,8 @@ class OWaveLanManagementCF : public QObject
226/*====================================================================================== 266/*======================================================================================
227 * OWaveLanManagementFH 267 * OWaveLanManagementFH
228 *======================================================================================*/ 268 *======================================================================================*/
229 269
230//FIXME same
231class OWaveLanManagementFH : public QObject 270class OWaveLanManagementFH : public QObject
232{ 271{
233 Q_OBJECT 272 Q_OBJECT
234 273
@@ -242,9 +281,9 @@ class OWaveLanManagementFH : public QObject
242 281
243/*====================================================================================== 282/*======================================================================================
244 * OWaveLanManagementDS 283 * OWaveLanManagementDS
245 *======================================================================================*/ 284 *======================================================================================*/
246//FIXME same 285
247class OWaveLanManagementDS : public QObject 286class OWaveLanManagementDS : public QObject
248{ 287{
249 Q_OBJECT 288 Q_OBJECT
250 289
@@ -261,9 +300,8 @@ class OWaveLanManagementDS : public QObject
261/*====================================================================================== 300/*======================================================================================
262 * OWaveLanManagementTim 301 * OWaveLanManagementTim
263 *======================================================================================*/ 302 *======================================================================================*/
264 303
265//FIXME guess what?
266class OWaveLanManagementTim : public QObject 304class OWaveLanManagementTim : public QObject
267{ 305{
268 Q_OBJECT 306 Q_OBJECT
269 307
@@ -278,9 +316,8 @@ class OWaveLanManagementTim : public QObject
278/*====================================================================================== 316/*======================================================================================
279 * OWaveLanManagementIBSS 317 * OWaveLanManagementIBSS
280 *======================================================================================*/ 318 *======================================================================================*/
281 319
282//FIXME same as above ( Qobject )
283class OWaveLanManagementIBSS : public QObject 320class OWaveLanManagementIBSS : public QObject
284{ 321{
285 Q_OBJECT 322 Q_OBJECT
286 323
@@ -327,9 +364,9 @@ class OWaveLanDataPacket : public QObject
327 364
328/*====================================================================================== 365/*======================================================================================
329 * OWaveLanControlPacket - type: control (T_CTRL) 366 * OWaveLanControlPacket - type: control (T_CTRL)
330 *======================================================================================*/ 367 *======================================================================================*/
331// Qobject needed? 368
332class OWaveLanControlPacket : public QObject 369class OWaveLanControlPacket : public QObject
333{ 370{
334 Q_OBJECT 371 Q_OBJECT
335 372
@@ -344,9 +381,8 @@ class OWaveLanControlPacket : public QObject
344/*====================================================================================== 381/*======================================================================================
345 * OLLCPacket - IEEE 802.2 Link Level Control 382 * OLLCPacket - IEEE 802.2 Link Level Control
346 *======================================================================================*/ 383 *======================================================================================*/
347 384
348// QObject needed?
349class OLLCPacket : public QObject 385class OLLCPacket : public QObject
350{ 386{
351 Q_OBJECT 387 Q_OBJECT
352 388
@@ -354,17 +390,15 @@ class OLLCPacket : public QObject
354 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); 390 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 );
355 virtual ~OLLCPacket(); 391 virtual ~OLLCPacket();
356 392
357 private: 393 private:
358 //FIXME how to get that header?
359 const struct ieee_802_11_802_2_header* _header; 394 const struct ieee_802_11_802_2_header* _header;
360}; 395};
361 396
362/*====================================================================================== 397/*======================================================================================
363 * OIPPacket 398 * OIPPacket
364 *======================================================================================*/ 399 *======================================================================================*/
365 400
366// Qobject as baseclass?
367class OIPPacket : public QObject 401class OIPPacket : public QObject
368{ 402{
369 Q_OBJECT 403 Q_OBJECT
370 404
@@ -389,9 +423,9 @@ class OIPPacket : public QObject
389 423
390/*====================================================================================== 424/*======================================================================================
391 * OUDPPacket 425 * OUDPPacket
392 *======================================================================================*/ 426 *======================================================================================*/
393// QObject? 427
394class OUDPPacket : public QObject 428class OUDPPacket : public QObject
395{ 429{
396 Q_OBJECT 430 Q_OBJECT
397 431
@@ -409,9 +443,8 @@ class OUDPPacket : public QObject
409/*====================================================================================== 443/*======================================================================================
410 * OTCPPacket 444 * OTCPPacket
411 *======================================================================================*/ 445 *======================================================================================*/
412 446
413// Qobect needed?
414class OTCPPacket : public QObject 447class OTCPPacket : public QObject
415{ 448{
416 Q_OBJECT 449 Q_OBJECT
417 450