Gnutella::Packets::Bye Class Reference

#include <Bye.h> [code]

Inherits Gnutella::Packets::Packet.

Inherited by Gnutella::Packets::Testing::ByeConcretePacket.

Inheritance diagram for Gnutella::Packets::Bye:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 31 of file Bye.h.

Public Member Functions

 Bye (const QByteArray &rawHeader, const QByteArray &rawPayload)
 Bye (quint16 code, const QByteArray &message)
 Bye (const Bye &other)
Byeoperator= (const Bye &other)
 ~Bye ()
Byecopy () const
 A virtual copy contructor.
QString name () const
quint16 code () const
QByteArray message () const
void setCode (quint16 code)
void setMessage (const QByteArray &message)

Static Public Member Functions

static ByecastFrom (Packet &packet)
static const ByecastFrom (const Packet &packet)

Protected Member Functions

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

Private Attributes

Data d
 Private data with reference counting.

Classes

struct  Data


Constructor & Destructor Documentation

Bye::Bye const QByteArray &  rawHeader,
const QByteArray &  rawPayload
 

Definition at line 39 of file Bye.cpp.

Bye::Bye quint16  code,
const QByteArray &  message
 

Definition at line 45 of file Bye.cpp.

Gnutella::Packets::Bye::Bye const Bye other  )  [inline]
 

Definition at line 78 of file Bye.h.

Bye::~Bye  ) 
 

Definition at line 61 of file Bye.cpp.


Member Function Documentation

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

Definition at line 75 of file Bye.h.

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

Definition at line 72 of file Bye.h.

quint16 Gnutella::Packets::Bye::code  )  const [inline]
 

Definition at line 85 of file Bye.h.

Bye * Gnutella::Packets::Bye::copy  )  const [inline, virtual]
 

A virtual copy contructor.

Implements Gnutella::Packets::Packet.

Definition at line 82 of file Bye.h.

void Bye::invalidatePayload  )  [protected, virtual]
 

Nothing special to do here. We do not need reference counting for Bye packets. Objects of this class will be created only rarely and will not be copied too much.

Just call tha base implementation!

Reimplemented from Gnutella::Packets::Packet.

Reimplemented in Gnutella::Packets::Testing::ByeConcretePacket.

Definition at line 71 of file Bye.cpp.

QByteArray Gnutella::Packets::Bye::message  )  const [inline]
 

Definition at line 88 of file Bye.h.

QString Gnutella::Packets::Bye::name  )  const [inline, virtual]
 

Todo:
remove this?

Implements Gnutella::Packets::Packet.

Definition at line 45 of file Bye.h.

Bye & Bye::operator= const Bye other  ) 
 

Definition at line 52 of file Bye.cpp.

bool Bye::prepareReadPayload const QByteArray &  rawPayload  )  [protected, 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.

Definition at line 76 of file Bye.cpp.

int Bye::prepareWritePayload  )  const [protected, virtual]
 

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

Implements Gnutella::Packets::Packet.

Definition at line 90 of file Bye.cpp.

void Bye::readPayload QDataStream &  stream  )  [protected, 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.

Definition at line 84 of file Bye.cpp.

void Gnutella::Packets::Bye::setCode quint16  code  )  [inline]
 

Definition at line 91 of file Bye.h.

void Gnutella::Packets::Bye::setMessage const QByteArray &  message  )  [inline]
 

Definition at line 94 of file Bye.h.

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

Writes the payload fields into the stream.

Implements Gnutella::Packets::Packet.

Definition at line 95 of file Bye.cpp.


Member Data Documentation

Data Gnutella::Packets::Bye::d [private]
 

Private data with reference counting.

Reimplemented from Gnutella::Packets::Packet.

Definition at line 69 of file Bye.h.


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