Utility class to segment an object into multiple Data packets. More...
#include <ndn-cxx/util/segmenter.hpp>
Public Member Functions | |
Segmenter (KeyChain &keyChain, const security::SigningInfo &signingInfo) | |
Constructor. More... | |
std::vector< std::shared_ptr< Data > > | segment (span< const uint8_t > buffer, const Name &dataName, size_t maxSegmentSize, time::milliseconds freshnessPeriod, uint32_t contentType=tlv::ContentType_Blob) |
Splits a blob of bytes into one or more Data packets (segments). More... | |
std::vector< std::shared_ptr< Data > > | segment (std::istream &input, const Name &dataName, size_t maxSegmentSize, time::milliseconds freshnessPeriod, uint32_t contentType=tlv::ContentType_Blob) |
Creates one or more Data packets (segments) with the bytes read from an input stream. More... | |
Utility class to segment an object into multiple Data packets.
Definition at line 33 of file segmenter.hpp.
ndn::Segmenter::Segmenter | ( | KeyChain & | keyChain, |
const security::SigningInfo & | signingInfo | ||
) |
Constructor.
keyChain | KeyChain instance used for signing the packets. |
signingInfo | How to sign the packets. |
Definition at line 28 of file segmenter.cpp.
std::vector< std::shared_ptr< Data > > ndn::Segmenter::segment | ( | span< const uint8_t > | buffer, |
const Name & | dataName, | ||
size_t | maxSegmentSize, | ||
time::milliseconds | freshnessPeriod, | ||
uint32_t | contentType = tlv::ContentType_Blob |
||
) |
Splits a blob of bytes into one or more Data packets (segments).
buffer | Contiguous range of bytes to divide into segments. |
dataName | Name prefix to use for the Data packets. A segment number will be appended to it. |
maxSegmentSize | Maximum size of the Content element (payload) of each created Data packet. |
freshnessPeriod | The FreshnessPeriod of created Data packets. |
contentType | The ContentType of created Data packets. |
buffer
is empty. Definition at line 35 of file segmenter.cpp.
std::vector< std::shared_ptr< Data > > ndn::Segmenter::segment | ( | std::istream & | input, |
const Name & | dataName, | ||
size_t | maxSegmentSize, | ||
time::milliseconds | freshnessPeriod, | ||
uint32_t | contentType = tlv::ContentType_Blob |
||
) |
Creates one or more Data packets (segments) with the bytes read from an input stream.
input | The input stream. Reading stops when EOF is encountered. |
dataName | Name prefix to use for the Data packets. A segment number will be appended to it. |
maxSegmentSize | Maximum size of the Content element (payload) of each created Data packet. |
freshnessPeriod | The FreshnessPeriod of created Data packets. |
contentType | The ContentType of created Data packets. |
input
is empty. Definition at line 70 of file segmenter.cpp.