tftp_common  1.3.0
Public Member Functions | Friends | List of all members
tftp_common::packets::Data Class Referencefinal

Data Trivial File Transfer Protocol packet. More...

#include <packets.hpp>

Public Member Functions

 Data ()=default
 Use with parsing functions only. More...
 
 Data (std::uint16_t Block, const std::vector< std::uint8_t > &Buffer)
 
 Data (std::uint16_t Block, std::vector< std::uint8_t > &&Buffer) noexcept
 
template<class OutputIterator >
std::size_t serialize (OutputIterator It) const noexcept
 
std::uint16_t getType () const noexcept
 
std::uint16_t getBlock () const noexcept
 
const std::vector< std::uint8_t > & getData () const noexcept
 

Friends

ParseResult parse (const std::uint8_t *Buffer, std::size_t Len, Data &Packet)
 

Detailed Description

Data Trivial File Transfer Protocol packet.

Constructor & Destructor Documentation

◆ Data() [1/3]

tftp_common::packets::Data::Data ( )
default

Use with parsing functions only.

◆ Data() [2/3]

tftp_common::packets::Data::Data ( std::uint16_t  Block,
const std::vector< std::uint8_t > &  Buffer 
)
inline
Parameters
[Block]Assumptions: The Block value is greater than one
[Buffer]Assumptions: The Buffer size is greater or equal than 0 and less or equal than 512

◆ Data() [3/3]

tftp_common::packets::Data::Data ( std::uint16_t  Block,
std::vector< std::uint8_t > &&  Buffer 
)
inlinenoexcept
Parameters
[Block]Assumptions: The Block value is greater than one
[Buffer]Assumptions: The Buffer size is greater or equal than 0 and less or equal than 512

Member Function Documentation

◆ getBlock()

std::uint16_t tftp_common::packets::Data::getBlock ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ getData()

const std::vector<std::uint8_t>& tftp_common::packets::Data::getData ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ getType()

std::uint16_t tftp_common::packets::Data::getType ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ serialize()

template<class OutputIterator >
std::size_t tftp_common::packets::Data::serialize ( OutputIterator  It) const
inlinenoexcept

Convert packet to network byte order and serialize it into the given buffer by the iterator

Parameters
[It]Requirements: *(It) must be assignable from std::uint8_t
Returns
Size of the packet (in bytes)
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ parse

ParseResult parse ( const std::uint8_t *  Buffer,
std::size_t  Len,
Data Packet 
)
friend

Parse data packet from buffer converting all fields to host byte order

Parameters
[Buffer]Assumptions: Buffer is not a nullptr, it's size is greater or equal than Len
[Len]Assumptions: Len is greater than zero
If parsing wasn't successful, Packet remains in valid but unspecified state

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