#include <BadPacket.h> [code]
Inherits Protocols::BitTorrent::Packets::PacketBase.
Inheritance diagram for Protocols::BitTorrent::Packets::BadPacket:


BadPacket is intended to be used as a Null Object where a PacketBase object is required. It can also be used to store the raw bytes of packets that either cannot be parsed or whose PacketType is unknown.
Definition at line 41 of file BadPacket.h.
Public Member Functions | |
| QString | name () const |
| Returns the name of the PacketBase type the dynamic object belongs to. | |
| auto_ptr< DataBase > | copy () const |
| Virtual copy constructor. | |
| BadPacket (PacketType type=KeepalivePacket, const QByteArray &rawHeader=QByteArray(), const QByteArray &rawPayload=QByteArray()) | |
| Constructs an object from raw data. | |
Protected Member Functions | |
| void | invalidateHeader () |
| Invalidate the header raw data. | |
| void | invalidatePayload () |
| Invalidate the payload raw data. | |
| bool | readHeader (const QByteArray &rawHeader) |
| Parsing the header of a BadPacket always succeeds. | |
| bool | readPayload (const QByteArray &rawPayload) |
| Parsing the payload of a BadPacket always succeeds. | |
| QByteArray | writeHeader () const |
| Writes the PacketBase header and returns the raw bytes. | |
| QByteArray | writePayload () const |
| Returns the raw bytes representation of the payload fields. | |
| void | readPayload (BinaryReader &) |
| Reads the payload fields from binaryReader. | |
| void | writePayload (BinaryWriter &) const |
Private Member Functions | |
| Q_DECLARE_SHARED_DATA (Data) | |
Classes | |
| class | Data |
| BadPacket private data. More... | |
|
||||||||||||||||
|
Constructs an object from raw data.
Definition at line 40 of file BadPacket.cpp. |
|
|
Virtual copy constructor.
Implements Protocols::BitTorrent::Packets::PacketBase. Definition at line 32 of file BadPacket.cpp. |
|
|
Invalidate the header raw data. The raw header bytes will be rebuilt next time rawHeader() is called.
Reimplemented from Protocols::Generics::PacketBase. Definition at line 52 of file BadPacket.cpp. |
|
|
Invalidate the payload raw data. The payload is invalidated, due to the fact that the payloadLength field may have changed, and the header is marked as invalid too. These will be rebuilt next time rawHeader() and rawPayload() are called.
Reimplemented from Protocols::Generics::PacketBase. Definition at line 57 of file BadPacket.cpp. |
|
|
Returns the name of the PacketBase type the dynamic object belongs to.
Implements Protocols::BitTorrent::Packets::PacketBase. Definition at line 27 of file BadPacket.cpp. |
|
|
|
|
|
Parsing the header of a BadPacket always succeeds.
Reimplemented from Protocols::BitTorrent::Packets::PacketBase. Definition at line 63 of file BadPacket.cpp. |
|
|
Reads the payload fields from binaryReader.
Implements Protocols::BitTorrent::Packets::PacketBase. Definition at line 86 of file BadPacket.cpp. |
|
|
Parsing the payload of a BadPacket always succeeds.
Reimplemented from Protocols::BitTorrent::Packets::PacketBase. Definition at line 69 of file BadPacket.cpp. |
|
|
Writes the PacketBase header and returns the raw bytes. If the PacketBase is of type KeepalivePacket, then 4 zero bytes are returned. Otherwise the length of the payload + 1 will be written as 4 byte big-endian integer followed by a single byte denoting the PacketType. Reimplemented from Protocols::BitTorrent::Packets::PacketBase. Definition at line 74 of file BadPacket.cpp. |
|
|
Implements Protocols::BitTorrent::Packets::PacketBase. Definition at line 91 of file BadPacket.cpp. |
|
|
Returns the raw bytes representation of the payload fields.
Reimplemented from Protocols::BitTorrent::Packets::PacketBase. Definition at line 80 of file BadPacket.cpp. |