Telnet++
A C++ library for interacting with Telnet streams
Classes | Public Member Functions | List of all members
telnetpp::options::mccp::codec Class Reference

A class responsible for compressing and decompressing data for the MCCP server option. More...

#include <codec.hpp>

Inheritance diagram for telnetpp::options::mccp::codec:

Classes

struct  impl
 

Public Member Functions

 codec (std::shared_ptr< compressor > const &co, std::shared_ptr< decompressor > const &dec)
 Constructor.
 
 ~codec ()
 Destructor.
 
std::vector< telnetpp::stream_tokensend (std::vector< telnetpp::stream_token > const &tokens)
 In a manner consistent with the rest of the telnetpp library, interprets the stream and returns a similar stream that is either compressed or uncompressed, as appropriate, that can be sent to the next lower layer. More...
 
telnetpp::u8stream receive (telnetpp::u8 byte)
 Receive a byte from the lower layer, decompress it if necessary, and return the result as a stream of bytes. More...
 

Detailed Description

A class responsible for compressing and decompressing data for the MCCP server option.

In the mccp::codec class, control flow is managed by interleaving certain tags within the data stream.

In particular, the begin_compression tag will cause all data from the next token to be sent in a compressed format. The end_compression tag ends this process.

Additionally, sending a begin_decompression tag will cause all data from the next token to be received in a compressed format, and will be returned in a decompressed format. This can be cancelled by either sending an end_decompression tag, or if the compressed stream is marked as finished.

Actual compression and decompression is handled by the compressor and decompressor objects passed in during construction.

Member Function Documentation

telnetpp::u8stream telnetpp::options::mccp::codec::receive ( telnetpp::u8  byte)

Receive a byte from the lower layer, decompress it if necessary, and return the result as a stream of bytes.

std::vector< telnetpp::stream_token > telnetpp::options::mccp::codec::send ( std::vector< telnetpp::stream_token > const &  tokens)

In a manner consistent with the rest of the telnetpp library, interprets the stream and returns a similar stream that is either compressed or uncompressed, as appropriate, that can be sent to the next lower layer.


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