44 File(
const std::shared_ptr<Transmitter::FileDescription> &file_description);
60 std::string content_location,
61 std::string content_type,
65 bool copy_data =
false);
85 char*
buffer()
const {
return _buffer; };
107 bool is_encoded()
const {
return _been_encoded || !_been_decoded; };
142 void mark_completed(
const std::vector<EncodingSymbol>& symbols,
bool success);
155 void calculate_partitioning();
156 void create_blocks();
166 std::map<uint16_t, Symbol> symbols;
169 void check_source_block_completion(SourceBlock& block);
170 void check_file_completion();
172 std::map<uint16_t, SourceBlock> _source_blocks;
174 bool _complete =
false;;
176 uint32_t _nof_source_symbols = 0;
177 uint32_t _nof_source_blocks = 0;
178 uint32_t _nof_large_source_blocks = 0;
179 uint32_t _large_source_block_length = 0;
180 uint32_t _small_source_block_length = 0;
182 char* _buffer =
nullptr;
183 bool _own_buffer =
false;
184 bool _been_encoded =
false;
185 bool _been_decoded =
false;
188 unsigned long _received_at;
189 unsigned _access_count = 0;
191 uint16_t _fdt_instance_id = 0;
193 std::shared_ptr<Transmitter::FileDescription> _file_description;
A class for handling FEC encoding symbols.
Represents a file being transmitted or received.
const FecOti & fec_oti() const
Get the FEC OTI values.
bool complete() const
Check if the file is complete.
void put_symbol(const EncodingSymbol &symbol)
Write the data from an encoding symbol into the appropriate place in the buffer.
unsigned access_count() const
Get the access counter value.
size_t length() const
Get the data buffer length.
virtual ~File()
Default destructor.
char * buffer() const
Get the data buffer.
void encode()
Encode the buffer using the Content-Encoding.
uint16_t fdt_instance_id()
Get the FDT instance ID.
File(LibFlute::FileDeliveryTable::FileEntry entry)
Create a file from an FDT entry (used for reception)
void mark_completed(const std::vector< EncodingSymbol > &symbols, bool success)
Mark encoding symbols as completed.
void log_access()
Log access to the file by incrementing a counter.
void set_fdt_instance_id(uint16_t id)
Set the FDT instance ID.
std::vector< EncodingSymbol > get_next_symbols(size_t max_size)
Get the next encoding symbols that fit in max_size bytes.
unsigned long received_at() const
Timestamp of file reception.
void decode()
Decode the buffer using the Content-Encoding.
const LibFlute::FileDeliveryTable::FileEntry & meta() const
Get the file metadata from its FDT entry.
bool is_encoded() const
Check if the buffer is content encoded.
An entry for a file in the FDT.