summaryrefslogtreecommitdiff
Unidiff
Diffstat (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
@@ -68,7 +68,49 @@ class QSocketNotifier;
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
@@ -95,7 +137,6 @@ class OPacket : public QObject
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
@@ -116,7 +157,7 @@ class OEthernetPacket : public QObject
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
@@ -146,7 +187,7 @@ class OWaveLanPacket : public QObject
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
@@ -175,7 +216,7 @@ class OWaveLanManagementPacket : public QObject
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
@@ -193,7 +234,7 @@ class OWaveLanManagementSSID : public QObject
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
@@ -210,7 +251,6 @@ class OWaveLanManagementRates : public QObject
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
@@ -227,7 +267,6 @@ class OWaveLanManagementCF : public QObject
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
@@ -243,7 +282,7 @@ class OWaveLanManagementFH : public QObject
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
@@ -262,7 +301,6 @@ class OWaveLanManagementDS : public QObject
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
@@ -279,7 +317,6 @@ class OWaveLanManagementTim : public QObject
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
@@ -328,7 +365,7 @@ class OWaveLanDataPacket : public QObject
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
@@ -345,7 +382,6 @@ class OWaveLanControlPacket : public QObject
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
@@ -355,7 +391,6 @@ class OLLCPacket : public QObject
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
@@ -363,7 +398,6 @@ class OLLCPacket : public QObject
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
@@ -390,7 +424,7 @@ class OIPPacket : public QObject
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
@@ -410,7 +444,6 @@ class OUDPPacket : public QObject
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