summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-16 17:54:46 (UTC)
committer mickeyl <mickeyl>2003-04-16 17:54:46 (UTC)
commitfc4eab06caed9892ded036fc0dcacaf8074f00f9 (patch) (unidiff)
tree663a812e2e1af9c2bbc5a1c84fb89fcf72eb4376
parentbe5832dc22255be38884e352917f48d5b71ae657 (diff)
downloadopie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.zip
opie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.tar.gz
opie-fc4eab06caed9892ded036fc0dcacaf8074f00f9.tar.bz2
start documenting the packet class family - explain why deriving from QObject is clever
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
@@ -69,5 +69,47 @@ class QSocketNotifier;
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{
@@ -96,5 +138,4 @@ class OPacket : public QObject
96 *======================================================================================*/ 138 *======================================================================================*/
97 139
98//FIXME same critic as above -zecke
99class OEthernetPacket : public QObject 140class OEthernetPacket : public QObject
100{ 141{
@@ -117,5 +158,5 @@ class OEthernetPacket : public QObject
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{
@@ -147,5 +188,5 @@ class OWaveLanPacket : public QObject
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{
@@ -176,5 +217,5 @@ class OWaveLanManagementPacket : public QObject
176 * OWaveLanManagementSSID 217 * OWaveLanManagementSSID
177 *======================================================================================*/ 218 *======================================================================================*/
178//FIXME is QObject necessary? -zecke 219
179class OWaveLanManagementSSID : public QObject 220class OWaveLanManagementSSID : public QObject
180{ 221{
@@ -194,5 +235,5 @@ class OWaveLanManagementSSID : public QObject
194 * OWaveLanManagementRates 235 * OWaveLanManagementRates
195 *======================================================================================*/ 236 *======================================================================================*/
196// FIXME same as above -zecke 237
197class OWaveLanManagementRates : public QObject 238class OWaveLanManagementRates : public QObject
198{ 239{
@@ -211,5 +252,4 @@ class OWaveLanManagementRates : public QObject
211 *======================================================================================*/ 252 *======================================================================================*/
212 253
213//FIXME same....
214class OWaveLanManagementCF : public QObject 254class OWaveLanManagementCF : public QObject
215{ 255{
@@ -228,5 +268,4 @@ class OWaveLanManagementCF : public QObject
228 *======================================================================================*/ 268 *======================================================================================*/
229 269
230//FIXME same
231class OWaveLanManagementFH : public QObject 270class OWaveLanManagementFH : public QObject
232{ 271{
@@ -244,5 +283,5 @@ class OWaveLanManagementFH : public QObject
244 * OWaveLanManagementDS 283 * OWaveLanManagementDS
245 *======================================================================================*/ 284 *======================================================================================*/
246//FIXME same 285
247class OWaveLanManagementDS : public QObject 286class OWaveLanManagementDS : public QObject
248{ 287{
@@ -263,5 +302,4 @@ class OWaveLanManagementDS : public QObject
263 *======================================================================================*/ 302 *======================================================================================*/
264 303
265//FIXME guess what?
266class OWaveLanManagementTim : public QObject 304class OWaveLanManagementTim : public QObject
267{ 305{
@@ -280,5 +318,4 @@ class OWaveLanManagementTim : public QObject
280 *======================================================================================*/ 318 *======================================================================================*/
281 319
282//FIXME same as above ( Qobject )
283class OWaveLanManagementIBSS : public QObject 320class OWaveLanManagementIBSS : public QObject
284{ 321{
@@ -329,5 +366,5 @@ class OWaveLanDataPacket : public QObject
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{
@@ -346,5 +383,4 @@ class OWaveLanControlPacket : public QObject
346 *======================================================================================*/ 383 *======================================================================================*/
347 384
348// QObject needed?
349class OLLCPacket : public QObject 385class OLLCPacket : public QObject
350{ 386{
@@ -356,5 +392,4 @@ class OLLCPacket : public QObject
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};
@@ -364,5 +399,4 @@ class OLLCPacket : public QObject
364 *======================================================================================*/ 399 *======================================================================================*/
365 400
366// Qobject as baseclass?
367class OIPPacket : public QObject 401class OIPPacket : public QObject
368{ 402{
@@ -391,5 +425,5 @@ class OIPPacket : public QObject
391 * OUDPPacket 425 * OUDPPacket
392 *======================================================================================*/ 426 *======================================================================================*/
393// QObject? 427
394class OUDPPacket : public QObject 428class OUDPPacket : public QObject
395{ 429{
@@ -411,5 +445,4 @@ class OUDPPacket : public QObject
411 *======================================================================================*/ 445 *======================================================================================*/
412 446
413// Qobect needed?
414class OTCPPacket : public QObject 447class OTCPPacket : public QObject
415{ 448{