Protocols::Generics::PacketProtocol Class Reference

#include <PacketProtocol.h> [code]

Inherited by Protocols::BitTorrent::Packets::PacketProtocol.

Inheritance diagram for Protocols::Generics::PacketProtocol:

Inheritance graph
[legend]
List of all members.

Detailed Description

Interface describing the binary format of packets.

A concrete protocol could implement this interface to describe the format of its binary packets on the wire by means of the lengths of the three basic packet parts - header, payload and trailer. We assume that:

Definition at line 44 of file PacketProtocol.h.

Public Member Functions

virtual ~PacketProtocol ()
virtual int headerLength () const =0
 Returns the length of a packet header.
virtual int payloadLength (const QByteArray &header) const =0
 Extracts the payload length from header.
virtual Packet createPacket (const QByteArray &header, const QByteArray &payload) const =0


Constructor & Destructor Documentation

virtual Protocols::Generics::PacketProtocol::~PacketProtocol  )  [inline, virtual]
 

Definition at line 49 of file PacketProtocol.h.


Member Function Documentation

virtual Packet Protocols::Generics::PacketProtocol::createPacket const QByteArray &  header,
const QByteArray &  payload
const [pure virtual]
 

Implemented in Protocols::BitTorrent::Packets::PacketProtocol.

int PacketProtocol::headerLength  )  const [pure virtual]
 

Returns the length of a packet header.

Returns:
the length in bytes of a packet header.

Implemented in Protocols::BitTorrent::Packets::PacketProtocol.

int PacketProtocol::payloadLength const QByteArray &  header  )  const [pure virtual]
 

Extracts the payload length from header.

Returns:
the length of a packet payload as encoded in the raw header bytes.

Implemented in Protocols::BitTorrent::Packets::PacketProtocol.


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