Protocols::Gnutella::Packets::Extensions::Ggep Class Reference

#include <Ggep.h> [code]

Inherited by Protocols::Gnutella::Packets::Extensions::Ggeps::Unknown.

Inheritance diagram for Protocols::Gnutella::Packets::Extensions::Ggep:

Inheritance graph
[legend]
List of all members.

Detailed Description

Encapsulates a packet extension as gefined by the GGEP.

Base class for a GGEP extension as defined in: http://rfc-gnutella.sourceforge.net/src/GnutellaGenericExtensionProtocol.0.51.html

The derived classes need not care about COBS and deflate encodings. All this is handled in the base class. The virtual functions, readData() and writeData() will receive, respectively provide, only unencoded and uncompressed data of the GGEP extension data (without header).

Definition at line 45 of file Ggep.h.

Public Types

typedef QByteArray GgepId
 GGEP extension ID as written in the extension header.
enum  HeaderFlag {
  Encoding = 0x40,
  Compression = 0x20,
  Reserved = 0x10,
  IDLength = 0x0F
}

Public Member Functions

 Ggep (int flags)
virtual ~Ggep ()
virtual Ggepcopy () const =0
virtual GgepId id () const =0
bool isFlagSet (HeaderFlag flag) const
void setFlag (HeaderFlag flag)
void resetFlag (HeaderFlag flag)
bool parse (const QByteArray &)
QByteArray rawData () const
bool operator== (const Ggep &ggep) const
bool operator!= (const Ggep &ggep) const

Static Public Member Functions

static GgepfromId (const GgepId &id, int flags, const QByteArray &rawData)

Static Public Attributes

static const uchar LastExtension = 0x80
 The last extension flag, which cannot be set directly from clients.
static const int MaxIdLength = 8

Protected Member Functions

virtual void readData (BinaryReader &reader)=0
virtual void writeData (BinaryWriter &writer) const =0

Protected Attributes

HeaderFlags flags


Member Typedef Documentation

typedef QByteArray Protocols::Gnutella::Packets::Extensions::Ggep::GgepId
 

GGEP extension ID as written in the extension header.

Note:
A GGEP ID can be at most 8 bytes long.

Definition at line 67 of file Ggep.h.


Member Enumeration Documentation

enum Protocols::Gnutella::Packets::Extensions::Ggep::HeaderFlag
 

Enumerator:
Encoding 
Compression 
Reserved 
IDLength 

Definition at line 52 of file Ggep.h.


Constructor & Destructor Documentation

Ggep::Ggep int  flags  ) 
 

Definition at line 44 of file Ggep.cpp.

Ggep::~Ggep  )  [virtual]
 

Definition at line 52 of file Ggep.cpp.


Member Function Documentation

virtual Ggep* Protocols::Gnutella::Packets::Extensions::Ggep::copy  )  const [pure virtual]
 

Implemented in Protocols::Gnutella::Packets::Extensions::Ggeps::Unknown.

Ggep * Ggep::fromId const GgepId id,
int  flags,
const QByteArray &  rawData
[static]
 

if (id == Ggeps::Ultrapeer::Id) ggep = new Ggeps::Ultrapeer (id, flags);

if (id == Ggeps::VendorCode::Id) ggep = new Ggeps::VendorCode (id, flags);

if (id == Ggeps::DailyUptime::Id) ggep = new Ggeps::DailyUptime (id, flags);

if (id == Ggeps::PackedHostCaches::Id) ggep = new Ggeps::PackedHostCaches (id, flags);

if (id == Ggeps::SupportsCachedPongs::Id) ggep = new Ggeps::SupportsCachedPongs (id, flags);

if (id == Ggeps::UdpHostCache::Id) ggep = new Ggeps::UdpHostCache (id, flags);

if (id == Ggeps::IpPort::Id) ggep = new Ggeps::IpPort (id, flags);

Definition at line 56 of file Ggep.cpp.

virtual GgepId Protocols::Gnutella::Packets::Extensions::Ggep::id  )  const [pure virtual]
 

Implemented in Protocols::Gnutella::Packets::Extensions::Ggeps::Unknown.

bool Protocols::Gnutella::Packets::Extensions::Ggep::isFlagSet HeaderFlag  flag  )  const [inline]
 

Definition at line 97 of file Ggep.h.

bool Ggep::operator!= const Ggep ggep  )  const
 

Definition at line 138 of file Ggep.cpp.

bool Ggep::operator== const Ggep ggep  )  const
 

Definition at line 127 of file Ggep.cpp.

bool Ggep::parse const QByteArray &   ) 
 

Definition at line 93 of file Ggep.cpp.

QByteArray Ggep::rawData  )  const
 

Definition at line 107 of file Ggep.cpp.

virtual void Protocols::Gnutella::Packets::Extensions::Ggep::readData BinaryReader reader  )  [protected, pure virtual]
 

Implemented in Protocols::Gnutella::Packets::Extensions::Ggeps::Unknown.

void Protocols::Gnutella::Packets::Extensions::Ggep::resetFlag HeaderFlag  flag  )  [inline]
 

Definition at line 103 of file Ggep.h.

void Protocols::Gnutella::Packets::Extensions::Ggep::setFlag HeaderFlag  flag  )  [inline]
 

Definition at line 100 of file Ggep.h.

virtual void Protocols::Gnutella::Packets::Extensions::Ggep::writeData BinaryWriter writer  )  const [protected, pure virtual]
 

Implemented in Protocols::Gnutella::Packets::Extensions::Ggeps::Unknown.


Member Data Documentation

HeaderFlags Protocols::Gnutella::Packets::Extensions::Ggep::flags [protected]
 

Definition at line 92 of file Ggep.h.

const uchar Protocols::Gnutella::Packets::Extensions::Ggep::LastExtension = 0x80 [static]
 

The last extension flag, which cannot be set directly from clients.

Definition at line 49 of file Ggep.h.

const int Protocols::Gnutella::Packets::Extensions::Ggep::MaxIdLength = 8 [static]
 

Definition at line 50 of file Ggep.h.


The documentation for this class was generated from the following files: