Gnutella::Packets::Extensions::Ggep Class Reference
#include <Ggep.h> [code]
Inherited by Gnutella::Packets::Extensions::Ggeps::DailyUptime, Gnutella::Packets::Extensions::Ggeps::IpPort, Gnutella::Packets::Extensions::Ggeps::PackedHostCaches, Gnutella::Packets::Extensions::Ggeps::SupportsCachedPongs, Gnutella::Packets::Extensions::Ggeps::UdpHostCache, Gnutella::Packets::Extensions::Ggeps::Ultrapeer, Gnutella::Packets::Extensions::Ggeps::UnknownGgep, and Gnutella::Packets::Extensions::Ggeps::VendorCode.
Inheritance diagram for Gnutella::Packets::Extensions::Ggep:
[legend]Collaboration diagram for Gnutella::Packets::Extensions::Ggep:
[legend]List of all members.
Detailed Description
Encapsulates a packet extension as gefined by the GGEP.
The derived classes need not care about COBS and deflate encodings. All this is handled in the base class. The virtual functions prepareReadData(), readData(), prepareWriteData(), writeData() will receive only unencoded / uncompressed data.
- Todo:
- Add reference to the specs.
- Todo:
- Test if encoding/decoding works.
Definition at line 43 of file Ggep.h.
Member Typedef Documentation
|
|
GGEP extension ID as written in the extension header.
- Note:
- GgepId is currently a typedef of QByteArray. It is important that the ID contains no ending zero; therefore, when declaring a variable, make sure you always use the constructor QByteArray::QByteArray (char *, int) by explicitly specifying the ID length!
Definition at line 64 of file Ggep.h. |
Member Enumeration Documentation
|
|
- Enumerator:
-
| LastExtension |
|
| Encoding |
|
| Compression |
|
| Reserved |
|
| IDLength |
|
Definition at line 46 of file Ggep.h. |
Constructor & Destructor Documentation
| Ggep::~Ggep |
( |
|
) |
[virtual] |
|
| Ggep::Ggep |
( |
const GgepId & |
id, |
|
|
int |
flags = 0, |
|
|
int |
dataSize = 0 |
|
) |
[protected] |
|
| Gnutella::Packets::Extensions::Ggep::Ggep |
( |
const Ggep & |
other |
) |
[inline, protected] |
|
Member Function Documentation
| virtual Ggep* Gnutella::Packets::Extensions::Ggep::copy |
( |
|
) |
const [pure virtual] |
|
| int Gnutella::Packets::Extensions::Ggep::dataLength |
( |
|
) |
const [inline, protected] |
|
| Ggep * Ggep::fromId |
( |
const GgepId & |
id, |
|
|
int |
flags, |
|
|
int |
dataSize |
|
) |
[static] |
|
| Ggep::GgepId Gnutella::Packets::Extensions::Ggep::id |
( |
|
) |
const [inline] |
|
| void Ggep::invalidateData |
( |
|
) |
[private] |
|
| bool Gnutella::Packets::Extensions::Ggep::isFlagSet |
( |
HeaderFlag |
flag |
) |
const [inline] |
|
| Ggep & Ggep::operator= |
( |
const Ggep & |
other |
) |
[protected] |
|
| void Ggep::prepareRead |
( |
const QByteArray & |
rawExtensionData |
) |
|
|
|
|
The header of this extension was already verified and read out in GgepBlock::prepareRead(). We need to only verify the data here. However, if the data is compressed or encoded we will postpone the call to prepareReadData() until read() where we will decode the data. It is actually not important where the check is made, becuase prepareRead() returns no value. If the isValid flag is false, then in readData() the data should be read wihtout trying to parse it, as it is not with correct structure. This will allow the following extensions to be read correctly, as the stream will be on the correct byte in the underlying buffer.
Definition at line 119 of file Ggep.cpp. |
| virtual bool Gnutella::Packets::Extensions::Ggep::prepareReadData |
( |
const QByteArray & |
rawData |
) |
[protected, pure virtual] |
|
| int Ggep::prepareWrite |
( |
|
) |
const |
|
| virtual int Gnutella::Packets::Extensions::Ggep::prepareWriteData |
( |
|
) |
const [protected, pure virtual] |
|
| void Ggep::read |
( |
QDataStream & |
stream |
) |
|
|
| virtual void Gnutella::Packets::Extensions::Ggep::readData |
( |
QDataStream & |
stream |
) |
[protected, pure virtual] |
|
| void Gnutella::Packets::Extensions::Ggep::resetFlag |
( |
HeaderFlag |
flag |
) |
[inline] |
|
| void Gnutella::Packets::Extensions::Ggep::setFlag |
( |
HeaderFlag |
flag |
) |
[inline] |
|
| void Ggep::write |
( |
QDataStream & |
stream |
) |
const |
|
| virtual void Gnutella::Packets::Extensions::Ggep::writeData |
( |
QDataStream & |
stream |
) |
const [protected, pure virtual] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
- Gnutella/Packets/Extensions/Ggep.h
- Gnutella/Packets/Extensions/Ggep.cpp