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


Definition at line 37 of file PacketProtocol.h.
Public Types | |
| enum | Constants { HeaderLength = 4 } |
Public Member Functions | |
| int | headerLength () const |
| Returns the length of a BitTorrent packet's header. | |
| int | payloadLength (const QByteArray &header) const |
| Extracts the payload length encoded in header. | |
| GenericsPacket | createPacket (const QByteArray &header, const QByteArray &payload) const |
| Creates a BitTorrent packet from raw data. | |
Static Private Member Functions | |
| static Packet | getPacketFromTypeByte (uchar byte) |
| Helper that returns a Packet of type corresponding to bytes. | |
| static Packet | parsedOrBadPacket (Packet &packet, const QByteArray &rawHeader, const QByteArray &rawPayload) |
| Helper that parses the raw bytes and returns a BadPacket if parsing failed. | |
|
|
Definition at line 40 of file PacketProtocol.h. |
|
||||||||||||
|
Creates a BitTorrent packet from raw data.
Implements Protocols::Generics::PacketProtocol. Definition at line 82 of file PacketProtocol.cpp. |
|
|
Helper that returns a Packet of type corresponding to bytes.
Definition at line 95 of file PacketProtocol.cpp. |
|
|
Returns the length of a BitTorrent packet's header.
Implements Protocols::Generics::PacketProtocol. Definition at line 45 of file PacketProtocol.cpp. |
|
||||||||||||||||
|
Helper that parses the raw bytes and returns a BadPacket if parsing failed.
Definition at line 149 of file PacketProtocol.cpp. |
|
|
Extracts the payload length encoded in header.
Implements Protocols::Generics::PacketProtocol. Definition at line 58 of file PacketProtocol.cpp. |