Open 3D Engine AzNetworking API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::ICompressor Class Referenceabstract

Packet data compressor interface. More...

#include <ICompressor.h>

Public Member Functions

virtual bool Init ()=0
 Initialize compressor.
virtual CompressorType GetType () const =0
 Unique identifier of a given compressor.
virtual AZStd::size_t GetMaxChunkSize (AZStd::size_t maxCompSize) const =0
 Returns max possible size of uncompressed data chunk needed to fit compressed data in maxCompSize bytes.
virtual AZStd::size_t GetMaxCompressedBufferSize (AZStd::size_t uncompSize) const =0
 Returns size of compressed buffer needed to uncompress uncompSize of bytes.
virtual CompressorError Compress (const void *uncompData, AZStd::size_t uncompSize, void *compData, AZStd::size_t compDataSize, AZStd::size_t &compSize)=0
virtual CompressorError Decompress (const void *compData, AZStd::size_t compDataSize, void *uncompData, AZStd::size_t uncompDataSize, AZStd::size_t &consumedSize, AZStd::size_t &uncompSize)=0

Detailed Description

Packet data compressor interface.

ICompressor is an abstract compression interface meant for user provided GEMs to implement (such as the Multiplayer Compression Gem). Compression is supported for both TCP and UDP connections. Instantiation of a compressor is controlled by the net_UdpCompressor or net_TcpCompressor cvar for their respective protocols.

Member Function Documentation

◆ Compress()

virtual CompressorError AzNetworking::ICompressor::Compress ( const void *  uncompData,
AZStd::size_t  uncompSize,
void *  compData,
AZStd::size_t  compDataSize,
AZStd::size_t &  compSize 
pure virtual

Finalizes the stream, and returns composed packet. Chunk based compressors should loop internally in Compress() to compress all chunks of uncompData.

uncompDatabuffer to compress
uncompSizelength of data to compress from uncompData
compDatashould be able to fit at least GetMaxCompressedBufferSize(uncompSize) bytes
compDataSizesize of compData buffer
compSizelength of compressed data written into compData

◆ Decompress()

virtual CompressorError AzNetworking::ICompressor::Decompress ( const void *  compData,
AZStd::size_t  compDataSize,
void *  uncompData,
AZStd::size_t  uncompDataSize,
AZStd::size_t &  consumedSize,
AZStd::size_t &  uncompSize 
pure virtual

Decompress packet. Chunk based decompressors should loop internally in Decompress() to decompress all chunks of compData.

compDatabuffer to decompress
compSizelength of data to decompress from compData
uncompDatashould be able to fit at least GetDecompressedBufferSize(compressedDataSize)
uncompDataSizesize of uncompData buffer.
consumedSizethe number of bytes processed out of compData. (previously named chunkSize)
uncompSizelength of decompressed data written into uncompData

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