Furrent
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
fur::download::message::PieceMessage Class Referencefinal

#include <message.hpp>

Inheritance diagram for fur::download::message::PieceMessage:
Inheritance graph
[legend]
Collaboration diagram for fur::download::message::PieceMessage:
Collaboration graph
[legend]

Public Member Functions

 PieceMessage (int64_t index, int64_t begin, std::vector< uint8_t > block)
 
MessageKind kind () const override
 
- Public Member Functions inherited from fur::download::message::Message
virtual ~Message ()=default
 
virtual std::vector< uint8_t > encode () const
 

Static Public Member Functions

static Result< std::unique_ptr< PieceMessage >, DecodeErrordecode (const std::vector< uint8_t > &buf)
 
- Static Public Member Functions inherited from fur::download::message::Message
static Result< std::unique_ptr< Message >, DecodeErrordecode (const TorrentFile &torrent, const std::vector< uint8_t > &buf)
 

Public Attributes

const int64_t index
 Index of the piece. More...
 
const int64_t begin
 Offset from the beginning of the piece. More...
 
const std::vector< uint8_t > block
 The actual bytes from the piece. More...
 

Detailed Description

A message containing a subset of the bytes from a piece. <length=9+X><id=7><index><begin><block> where X is the length of the block.

Constructor & Destructor Documentation

◆ PieceMessage()

fur::download::message::PieceMessage::PieceMessage ( int64_t  index,
int64_t  begin,
std::vector< uint8_t >  block 
)
inline

Member Function Documentation

◆ decode()

Result< std::unique_ptr< PieceMessage >, DecodeError > fur::download::message::PieceMessage::decode ( const std::vector< uint8_t > &  buf)
static

◆ kind()

MessageKind fur::download::message::PieceMessage::kind ( ) const
inlineoverridevirtual

Returns the kind of this message. Used before dynamic_casting when the underlying type is not known beforehand.

Implements fur::download::message::Message.

Member Data Documentation

◆ begin

const int64_t fur::download::message::PieceMessage::begin

Offset from the beginning of the piece.

◆ block

const std::vector<uint8_t> fur::download::message::PieceMessage::block

The actual bytes from the piece.

◆ index

const int64_t fur::download::message::PieceMessage::index

Index of the piece.


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