author | mickeyl <mickeyl> | 2003-04-16 17:54:46 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-16 17:54:46 (UTC) |
commit | fc4eab06caed9892ded036fc0dcacaf8074f00f9 (patch) (unidiff) | |
tree | 663a812e2e1af9c2bbc5a1c84fb89fcf72eb4376 | |
parent | be5832dc22255be38884e352917f48d5b71ae657 (diff) | |
download | opie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.zip opie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.tar.gz opie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.tar.bz2 |
start documenting the packet class family - explain why deriving from QObject is clever
-rw-r--r-- | libopie2/opienet/opcap.h | 67 |
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 | |||
@@ -70,3 +70,45 @@ class QSocketNotifier; | |||
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 | |||
72 | class OPacket : public QObject | 114 | class OPacket : public QObject |
@@ -97,3 +139,2 @@ class OPacket : public QObject | |||
97 | 139 | ||
98 | //FIXME same critic as above -zecke | ||
99 | class OEthernetPacket : public QObject | 140 | class OEthernetPacket : public QObject |
@@ -118,3 +159,3 @@ class OEthernetPacket : public QObject | |||
118 | *======================================================================================*/ | 159 | *======================================================================================*/ |
119 | //FIXME same | 160 | |
120 | class OWaveLanPacket : public QObject | 161 | class OWaveLanPacket : public QObject |
@@ -148,3 +189,3 @@ class OWaveLanPacket : public QObject | |||
148 | *======================================================================================*/ | 189 | *======================================================================================*/ |
149 | //FIXME same as above -zecke | 190 | |
150 | class OWaveLanManagementPacket : public QObject | 191 | class OWaveLanManagementPacket : public QObject |
@@ -177,3 +218,3 @@ class OWaveLanManagementPacket : public QObject | |||
177 | *======================================================================================*/ | 218 | *======================================================================================*/ |
178 | //FIXME is QObject necessary? -zecke | 219 | |
179 | class OWaveLanManagementSSID : public QObject | 220 | class OWaveLanManagementSSID : public QObject |
@@ -195,3 +236,3 @@ class OWaveLanManagementSSID : public QObject | |||
195 | *======================================================================================*/ | 236 | *======================================================================================*/ |
196 | // FIXME same as above -zecke | 237 | |
197 | class OWaveLanManagementRates : public QObject | 238 | class OWaveLanManagementRates : public QObject |
@@ -212,3 +253,2 @@ class OWaveLanManagementRates : public QObject | |||
212 | 253 | ||
213 | //FIXME same.... | ||
214 | class OWaveLanManagementCF : public QObject | 254 | class OWaveLanManagementCF : public QObject |
@@ -229,3 +269,2 @@ class OWaveLanManagementCF : public QObject | |||
229 | 269 | ||
230 | //FIXME same | ||
231 | class OWaveLanManagementFH : public QObject | 270 | class OWaveLanManagementFH : public QObject |
@@ -245,3 +284,3 @@ class OWaveLanManagementFH : public QObject | |||
245 | *======================================================================================*/ | 284 | *======================================================================================*/ |
246 | //FIXME same | 285 | |
247 | class OWaveLanManagementDS : public QObject | 286 | class OWaveLanManagementDS : public QObject |
@@ -264,3 +303,2 @@ class OWaveLanManagementDS : public QObject | |||
264 | 303 | ||
265 | //FIXME guess what? | ||
266 | class OWaveLanManagementTim : public QObject | 304 | class OWaveLanManagementTim : public QObject |
@@ -281,3 +319,2 @@ class OWaveLanManagementTim : public QObject | |||
281 | 319 | ||
282 | //FIXME same as above ( Qobject ) | ||
283 | class OWaveLanManagementIBSS : public QObject | 320 | class OWaveLanManagementIBSS : public QObject |
@@ -330,3 +367,3 @@ class OWaveLanDataPacket : public QObject | |||
330 | *======================================================================================*/ | 367 | *======================================================================================*/ |
331 | // Qobject needed? | 368 | |
332 | class OWaveLanControlPacket : public QObject | 369 | class OWaveLanControlPacket : public QObject |
@@ -347,3 +384,2 @@ class OWaveLanControlPacket : public QObject | |||
347 | 384 | ||
348 | // QObject needed? | ||
349 | class OLLCPacket : public QObject | 385 | class OLLCPacket : public QObject |
@@ -357,3 +393,2 @@ class OLLCPacket : public QObject | |||
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; |
@@ -365,3 +400,2 @@ class OLLCPacket : public QObject | |||
365 | 400 | ||
366 | // Qobject as baseclass? | ||
367 | class OIPPacket : public QObject | 401 | class OIPPacket : public QObject |
@@ -392,3 +426,3 @@ class OIPPacket : public QObject | |||
392 | *======================================================================================*/ | 426 | *======================================================================================*/ |
393 | // QObject? | 427 | |
394 | class OUDPPacket : public QObject | 428 | class OUDPPacket : public QObject |
@@ -412,3 +446,2 @@ class OUDPPacket : public QObject | |||
412 | 446 | ||
413 | // Qobect needed? | ||
414 | class OTCPPacket : public QObject | 447 | class OTCPPacket : public QObject |