Gnutella::Packets::QueryRouting Class Reference

#include <QueryRouting.h> [code]

Inherits Gnutella::Packets::Packet.

Inherited by Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

Inheritance diagram for Gnutella::Packets::QueryRouting:

Inheritance graph
[legend]
Collaboration diagram for Gnutella::Packets::QueryRouting:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 33 of file QueryRouting.h.

Public Types

enum  Variant {
  ResetVariant = 0x0,
  PatchVariant = 0x1,
  UnknownVariant
}

Public Member Functions

 ~QueryRouting ()
Packetcopy () const =0
 A virtual copy contructor.
Variant variant () const

Static Public Member Functions

static QueryRoutingcastFrom (Packet &packet)
static const QueryRoutingcastFrom (const Packet &packet)

Protected Member Functions

 QueryRouting (const QByteArray &rawHeader, const QByteArray &rawPayload)
 QueryRouting (Variant variant)
bool prepareReadPayload (const QByteArray &rawPayload)=0
 Verifies the structure of the rawPayload.
void readPayload (QDataStream &stream)=0
 Reads the payload fields from the stream. The structure of the data in the stream is already verified by verifyPayload().
int prepareWritePayload () const =0
 Gets ready to write the payload and returns the payload length.
void writePayload (QDataStream &stream) const =0
 Writes the payload fields into the stream.

Private Attributes

Gnutella::Packets::QueryRouting::Private p

Classes

struct  Private


Member Enumeration Documentation

enum Gnutella::Packets::QueryRouting::Variant
 

Enumerator:
ResetVariant 
PatchVariant 
UnknownVariant 

Definition at line 38 of file QueryRouting.h.


Constructor & Destructor Documentation

QueryRouting::~QueryRouting  ) 
 

Definition at line 63 of file QueryRouting.cpp.

QueryRouting::QueryRouting const QByteArray &  rawHeader,
const QByteArray &  rawPayload
[protected]
 

Creates a QueryRouting object from the raw bytes in rawHeader and rawPayload.

Note:
This is an abstract packet class, so do NOT call parse() here!

Definition at line 52 of file QueryRouting.cpp.

QueryRouting::QueryRouting Variant  variant  )  [protected]
 

Definition at line 57 of file QueryRouting.cpp.


Member Function Documentation

static const QueryRouting& Gnutella::Packets::QueryRouting::castFrom const Packet packet  )  [inline, static]
 

Reimplemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

Definition at line 45 of file QueryRouting.h.

static QueryRouting& Gnutella::Packets::QueryRouting::castFrom Packet packet  )  [inline, static]
 

Reimplemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

Definition at line 44 of file QueryRouting.h.

Packet* Gnutella::Packets::QueryRouting::copy  )  const [pure virtual]
 

A virtual copy contructor.

Implements Gnutella::Packets::Packet.

Implemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

bool Gnutella::Packets::QueryRouting::prepareReadPayload const QByteArray &  rawPayload  )  [protected, pure virtual]
 

Verifies the structure of the rawPayload.

Verifies if the rawPayload can be correctly parsed by readPayload(). The function just goes over the whole rawPayload and checks if the structure of the payload is correct. Some data may be gathered and stored to ease the work of readPayload(). For example, the size of the query hit data field can only be calculated with knowledge of the payloadLength, which is not available in the QDataStream object passed to readPayload(). The size of this field is read here and stored for use later in readPayload().

Implements Gnutella::Packets::Packet.

Implemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

int Gnutella::Packets::QueryRouting::prepareWritePayload  )  const [protected, pure virtual]
 

Gets ready to write the payload and returns the payload length.

Implements Gnutella::Packets::Packet.

Implemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

void QueryRouting::readPayload QDataStream &  stream  )  [protected, pure virtual]
 

Reads the payload fields from the stream. The structure of the data in the stream is already verified by verifyPayload().

Implements Gnutella::Packets::Packet.

Implemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

Definition at line 76 of file QueryRouting.cpp.

Variant Gnutella::Packets::QueryRouting::variant  )  const [inline]
 

Definition at line 48 of file QueryRouting.h.

void QueryRouting::writePayload QDataStream &  stream  )  const [protected, pure virtual]
 

Writes the payload fields into the stream.

Implements Gnutella::Packets::Packet.

Implemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.

Definition at line 81 of file QueryRouting.cpp.


Member Data Documentation

struct Gnutella::Packets::QueryRouting::Private Gnutella::Packets::QueryRouting::p [private]
 

Reimplemented in Gnutella::Packets::QueryRoutingPatch, and Gnutella::Packets::QueryRoutingReset.


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