4#ifdef USE_PACKET_INTERFACE_LZSS
31 static constexpr size_t buffer_size(
size_t lower_size,
size_t max_packet_size) {
32 return 2 * (max_packet_size != 0 ? max_packet_size :
packet_size(lower_size)) + lower_size;
43 uint8_t check, uint8_t *buffers, uint16_t *chains);
45 void setup()
override;
LZSS compression of a block of data on its own, with a preset dictionary: text that both ends hold,...
static constexpr size_t CHAIN_WORDS
The working space compress() needs: the latest position for each hash, then the previous one for each...
A compression layer: each packet is compressed on its own with LZSS, so a lost packet costs nothing m...
static constexpr uint8_t HEADER_COMPRESSED
The bit flagging compressed data, and the dictionary check in the bits below it.
size_t get_send_capacity() const override
bool send_to_interface(const PacketBuffer &data, const PacketMetaData &meta_data) override
void dump_config() override
static constexpr size_t packet_size(size_t lower_size)
The largest packet the layer takes by default, over a layer below whose largest packet is lower_size.
void receive_(const PacketBuffer &data, const PacketMetaData &meta_data)
static constexpr size_t buffer_size(size_t lower_size, size_t max_packet_size)
The packet to compress, the compressed packet, and an expanded packet.
static constexpr uint8_t HEADER_CHECK_MASK
static constexpr size_t HEADER_SIZE
bool send_(const PacketBuffer &data, const PacketMetaData &meta_data)
static constexpr size_t CHAIN_WORDS
LzssCompression(PacketInterface *lower, size_t max_packet_size, const uint8_t *dictionary, size_t dictionary_size, uint8_t check, uint8_t *buffers, uint16_t *chains)
A buffer class that efficiently represents a composite buffer with three sections:
A class that will transport data to and from an abstract channel.
virtual size_t get_send_capacity() const
How many packets send_to_interface() would accept now, so a layer above can tell before sending a ser...
constexpr size_t remaining_packet_size(size_t size, size_t used)
The room left for a packet of size bytes after used bytes, or 0 if it is too small.