Entire-Metadata: .entire/metadata/fb87247f-2a75-407e-b336-cbc8c20ba5a6 Entire-Session: fb87247f-2a75-407e-b336-cbc8c20ba5a6 Entire-Strategy: manual-commit
703 lines
26 KiB
C
703 lines
26 KiB
C
/*
|
|
* (c) Copyright, Real-Time Innovations, 2018-2024.
|
|
* All rights reserved.
|
|
*
|
|
* No duplications, whole or partial, manual or electronic, may be made
|
|
* without express written permission. Any such copies, or
|
|
* revisions thereof, must display this notice unaltered.
|
|
* This code contains trade secrets of Real-Time Innovations, Inc.
|
|
*/
|
|
|
|
#ifndef osapi_compression_h
|
|
#define osapi_compression_h
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "osapi/osapi_type.h"
|
|
#include "osapi/osapi_dll.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
RTI_OSAPI_COMPRESSION_RETCODE_OK = 0,
|
|
RTI_OSAPI_COMPRESSION_RETCODE_ERROR = -1,
|
|
RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED = -2,
|
|
RTI_OSAPI_COMPRESSION_RETCODE_BUFFER_SIZE_ERROR = -3
|
|
} RTIOsapiCompressionRetcode;
|
|
|
|
typedef enum {
|
|
RTI_OSAPI_COMPRESSION_LEVEL_AUTO = -1,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_NO_COMPRESSION = 0,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_1 = 1,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_2 = 2,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_3 = 3,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_4 = 4,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_5 = 5,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_6 = 6,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_7 = 7,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_8 = 8,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_9 = 9,
|
|
RTI_OSAPI_COMPRESSION_LEVEL_10 = 10,
|
|
} RTIOsapiCompressionLevel;
|
|
|
|
#define RTI_OSAPI_COMPRESSION_LEVEL_BEST_SPEED RTI_OSAPI_COMPRESSION_LEVEL_1
|
|
#define RTI_OSAPI_COMPRESSION_LEVEL_BEST_COMPRESSION \
|
|
RTI_OSAPI_COMPRESSION_LEVEL_10
|
|
|
|
typedef enum {
|
|
RTI_OSAPI_COMPRESSION_CLASS_ID_NONE = 0,
|
|
RTI_OSAPI_COMPRESSION_CLASS_ID_ZLIB = 1,
|
|
RTI_OSAPI_COMPRESSION_CLASS_ID_BZIP2 = 2,
|
|
RTI_OSAPI_COMPRESSION_CLASS_ID_LZ4 = 3,
|
|
RTI_OSAPI_COMPRESSION_CLASS_ID_AUTO = -1
|
|
} RTIOsapiCompressionPluginClassId;
|
|
|
|
struct RTIOsapiCompressionPlugin;
|
|
|
|
typedef struct RTIOsapiCompressionPlugin RTIOsapiCompressionPlugin;
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Compress an input buffer using the passed library and compression
|
|
* level.
|
|
*
|
|
* @param self \b In. Plugin to use for the compression.
|
|
* @param bufferOut \b Out. Buffer to store the compressed bytes.
|
|
* @param lengthInOut \b InOut. Maximum size of bufferOut. After calling to
|
|
* this API it will contain the resulting compressed size.
|
|
* @param bufferIn \b In. Buffer containing the bytes to compress.
|
|
* @param lengthIn \b In. Maximum size of bufferIn.
|
|
* @param compressionLevel \b In. Compression level, it determines if the
|
|
* compression algorithm should prioritize speed or compression.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK if compression was successful, if
|
|
* not it will return an error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_compressFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int lengthIn,
|
|
RTIOsapiCompressionLevel compressionLevel);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Compress an input buffer using the passed library and compression
|
|
* level.
|
|
*
|
|
* @param self \b In. Plugin to use for the uncompression.
|
|
* @param bufferOut \b Out. Buffer to store the uncompressed bytes.
|
|
* @param lengthInOut \b InOut. Maximum size of bufferOut. After calling to
|
|
* this API it will contain the resulting uncompressed size.
|
|
* @param bufferIn \b In. Buffer containing the bytes to uncompress.
|
|
* @param lengthIn \b In. Maximum size of bufferIn.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK if compression was successful, if
|
|
* not it will return an error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_uncompressFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int lengthIn);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Destroys the plugin and releases associated resources.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (*RTIOsapiCompressionPlugin_destroyFunction)(
|
|
RTIOsapiCompressionPlugin *self);
|
|
|
|
/* ========================================= */
|
|
/* RTIOsapiCompressionStream */
|
|
/* ========================================= */
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* Data can be compressed in a stream of different kinds.
|
|
*/
|
|
typedef enum {
|
|
RTI_OSAPI_COMPRESSION_FILE_STREAM_KIND = 0,
|
|
RTI_OSAPI_COMPRESSION_BUFFER_STREAM_KIND = 1
|
|
} RTIOsapiCompressionStreamKind;
|
|
|
|
struct RTIOsapiCompressionStreamInfo {
|
|
RTI_INT32 compressionChunkSize;
|
|
RTIOsapiCompressionLevel compressionLevel;
|
|
};
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* Stream info type used when RTIOsapiCompressionStreamKind is
|
|
* RTI_OSAPI_COMPRESSION_FILE_STREAM_KIND.
|
|
* The user should set the file and the size of the chuckSize by default 16KB.
|
|
*/
|
|
struct RTIOsapiCompressionFileStreamInfo {
|
|
struct RTIOsapiCompressionStreamInfo parent;
|
|
FILE *f;
|
|
};
|
|
|
|
#define RTI_OSAPI_COMPRESSION_CHUNK_SIZE_DEFAULT 16384
|
|
#define RTIOsapiCompressionFileStreamInfo_INITIALIZER \
|
|
{ \
|
|
{ RTI_OSAPI_COMPRESSION_CHUNK_SIZE_DEFAULT, \
|
|
RTI_OSAPI_COMPRESSION_LEVEL_BEST_COMPRESSION }, \
|
|
NULL \
|
|
}
|
|
|
|
/** @internal \ingroup RTIOsapiHeapClass
|
|
* @brief Generic buffer to hold data, described by a pointer to the data, as
|
|
* well as the length of the data.
|
|
*
|
|
* This structure deliberately mirrors
|
|
* windows WSABUF so we can cast the passed in structure directly without
|
|
* copying the fields into a structure on the stack.
|
|
*/
|
|
#define RTIOsapiBuffer RTIBuffer
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* Stream info type used when RTIOsapiCompressionStreamKind is
|
|
* RTI_OSAPI_COMPRESSION_BUFFER_STREAM_KIND.
|
|
* The user should set the buffer and the size of the chuckSize.
|
|
*/
|
|
struct RTIOsapiCompressionBufferStreamInfo {
|
|
struct RTIOsapiCompressionStreamInfo parent;
|
|
struct RTIOsapiBuffer buffer;
|
|
};
|
|
|
|
#define RTIOsapiCompressionBufferStreamInfo_INITIALIZER \
|
|
{ \
|
|
{ RTI_OSAPI_COMPRESSION_CHUNK_SIZE_DEFAULT, \
|
|
RTI_OSAPI_COMPRESSION_LEVEL_BEST_COMPRESSION }, \
|
|
{ \
|
|
0, NULL \
|
|
} \
|
|
}
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* Data is compressed in a stream.
|
|
* RTIOsapiCompressionStreamHandle manages the stream. It keep track of:
|
|
* - Stream kind.
|
|
* - Stream info.
|
|
* - Stream data.
|
|
*
|
|
* It will be allocated in initializeStream() and release in finalizeStream().
|
|
*/
|
|
typedef void *RTIOsapiCompressionStreamHandle;
|
|
|
|
/* ========================================= */
|
|
/* RTIOsapiCompressionStream Functions */
|
|
/* ========================================= */
|
|
/*
|
|
* For more information about the lifecycle of the compression stream check
|
|
* the desing doc.
|
|
* https://docs.google.com/document/d/1A-0xGE2IQyu7EpgyeKakSmXMHByaisAOUrQs9Fi4SVQ/edit?usp=sharing
|
|
*/
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Initialize a stream in which to add compress data.
|
|
* The Stream is allocated and initialized.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param streamHandle \b Out. It is the stream where the data will be
|
|
* compressed. It will safe a reference to the kind and stream info. It may
|
|
* allocate memory, so it is necessary to call finalizeStream() to make sure any
|
|
* allocated memory is released.
|
|
* @param streamKind \b In. The destination stream info kind.
|
|
* @param streamInfo \b In. The destination stream info. This should match the
|
|
* corresponding streamKind. Witch ever the streamInfo is provided
|
|
* (RTIOsapiCompressionBufferStreamInfo or RTIOsapiCompressionFileStreamInfo) is
|
|
* legal to pass a NULL buffer output or a NULL file descriptor as long as it
|
|
* will be defined later by calling RTIOsapiCompressionPlugin_setStreamFunction
|
|
* with a valid output buffer before writing into the stream.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success, if
|
|
* not it will return an error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_initializeStreamFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
RTIOsapiCompressionStreamKind streamKind,
|
|
void *streamInfo,
|
|
RTIBool disableHeapTracking);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Configures an initialized stream. No memory allocation should occur
|
|
* when calling this function.
|
|
* This function can only be called after initialize the Stream or after a
|
|
* flush.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param streamHandle \b Out. It is the stream where the data will be
|
|
* compressed. The handle should be already created and allocated by
|
|
* initializeStreamFunction.
|
|
* @param streamInfo \b In. The destination stream info. The buffer output or
|
|
* the file descriptor must be allocated and valid.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success, if
|
|
* not it will return an error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_setStreamFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
void *streamInfo);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Write a buffer in the stream.
|
|
*
|
|
* With this function you can write into different stream using the same plugin.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param streamHandle \b Out. It is the stream where the data will be
|
|
* compressed.
|
|
* @param compressedBytesSize \b Out. The compressed output size.
|
|
* @param format \b In. Format that contains the text to be written.
|
|
* It can optionally contain embedded format tags that are replaced by the
|
|
* values specified in subsequent additional arguments and formatted as
|
|
* requested.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success, if
|
|
* not it will return an error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_writeFormattedStringFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *format,
|
|
...);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Write a set of bytes into the stream.
|
|
* Before calling this function we must to call setStream() or
|
|
* initializeStream() with a valid outputBuffer (check \ref
|
|
* RTIOsapiCompressionPlugin_initializeStreamFunction).
|
|
* This function can be called as many times in a row as buffers we want to
|
|
* write into the ouput as long as there are space left on the output buffer.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param compressedBytesSize \b Out. The compressed output size.
|
|
* @param streamHandle \b In. It is the stream where the data will be
|
|
* compressed.
|
|
* @param buffer \b In. Data to be pushed into the stream
|
|
* @param length \b In. Length of the data to write.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success,
|
|
* RTI_OSAPI_COMPRESSION_RETCODE_BUFFER_SIZE_ERROR if the input does not fit
|
|
* into the output buffer. In any other case return a different error retcode.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_writeBytesFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *buffer,
|
|
RTI_INT32 length);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Finish the stream and reset the state of the stream. This does not
|
|
* free any memory, to do so, the finalize function must be called.
|
|
* It's also possible to call finalizeStream after flushing.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param streamHandle \b In. It is the stream where the data will be
|
|
* compressed.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (*RTIOsapiCompressionPlugin_flushFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *totalCompressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Finalize the stream.
|
|
* Free the memory of the stream.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param streamHandle \b Out. It is the stream where the data will be
|
|
* compressed. The memory allocated in this parameter will be released.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_finalizeStreamFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief return the total of the bytes read at the moment by the stream. This
|
|
* value is reset each time flush/finalize is called.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param bytesRead \b Out. The total bytes read and compressed on the given
|
|
* compression stream.
|
|
* @param streamHandle \b Out. It is the stream where the data will be
|
|
* compressed.
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_getTotalBytesReadFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *bytesRead,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief return the maximum overhead size of a compressed stream given the
|
|
* number of inputs that are expected to be written and the maximum size across
|
|
* all the inputs. If this function is called with a serializedSampleMaxSize=0
|
|
* it will return the minimum overhead.
|
|
*
|
|
* @param self \b In. Compression plugin.
|
|
* @param overhead \b In. The maximum size on bytes that the given plugin it's
|
|
* going to add to the final output.
|
|
* @param serializedSampleMaxSize \b In. Maximum size across all the inputs.
|
|
* @param nSample \b In. The number of samples/inputs that are expected to be
|
|
* written
|
|
*
|
|
* @return RTI_OSAPI_COMPRESSION_RETCODE_OK on success.
|
|
*/
|
|
typedef RTIOsapiCompressionRetcode (
|
|
*RTIOsapiCompressionPlugin_getStreamMaxOverheadFunction)(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *overhead,
|
|
RTI_UINT32 maxWriteSize,
|
|
RTI_UINT32 numberOfWrites);
|
|
|
|
/** @internal \ingroup RTIOsapiCompressionClass
|
|
* @brief Plugin description attributes
|
|
*/
|
|
struct RTIOsapiCompressionPluginDesc {
|
|
/** @internal
|
|
* @brief Minimum overhead for a single compression using the compress
|
|
* operation.
|
|
*/
|
|
RTI_INT32 singleCompressionMinimumOverhead;
|
|
};
|
|
|
|
struct RTIOsapiCompressionPlugin {
|
|
RTIOsapiCompressionPluginClassId classId;
|
|
struct RTIOsapiCompressionPluginDesc desc;
|
|
RTIOsapiCompressionPlugin_compressFunction compress;
|
|
RTIOsapiCompressionPlugin_uncompressFunction uncompress;
|
|
RTIOsapiCompressionPlugin_destroyFunction destroy;
|
|
RTIOsapiCompressionPlugin_initializeStreamFunction initializeStream;
|
|
RTIOsapiCompressionPlugin_writeFormattedStringFunction writeFormattedString;
|
|
RTIOsapiCompressionPlugin_finalizeStreamFunction finalizeStream;
|
|
RTIOsapiCompressionPlugin_writeBytesFunction writeBytes;
|
|
RTIOsapiCompressionPlugin_flushFunction flushStream;
|
|
RTIOsapiCompressionPlugin_setStreamFunction setStream;
|
|
RTIOsapiCompressionPlugin_getTotalBytesReadFunction getTotalBytesRead;
|
|
RTIOsapiCompressionPlugin_getStreamMaxOverheadFunction getStreamMaxOverhead;
|
|
};
|
|
|
|
extern RTIBool RTIOsapiCompression_getCompressionPlugin(
|
|
RTIOsapiCompressionPluginClassId pluginId,
|
|
RTIOsapiCompressionPlugin **plugin);
|
|
|
|
|
|
extern RTIOsapiCompressionPluginClassId
|
|
RTIOsapiCompression_getCompressionPluginIdFromEncapsulationOpts(
|
|
unsigned short encapsulationOpts);
|
|
|
|
/******************************************************************************/
|
|
/* zlib builtin compression plugin */
|
|
/******************************************************************************/
|
|
extern RTIOsapiDllVariable const RTIOsapiCompressionPlugin
|
|
RTI_OSAPI_COMPRESSION_PLUGIN_ZLIB;
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Zlib_compress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int lengthIn,
|
|
RTIOsapiCompressionLevel compressionLevel);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Zlib_uncompress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int inLength);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_destroy(RTIOsapiCompressionPlugin *self);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_initializeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
RTIOsapiCompressionStreamKind streamKind,
|
|
void *streamInfo,
|
|
RTIBool disableHeapTracking);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Zlib_setStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
void *streamInfo);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_writeFormattedString(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *format,
|
|
...);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Zlib_writeBytes(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *buffer,
|
|
RTI_INT32 bufferLength);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_finalizeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Zlib_flushStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *totalCompressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_getTotalBytesRead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *bytesRead,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Zlib_getStreamMaxOverhead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *overhead,
|
|
RTI_UINT32 serializedSampleMaxSize,
|
|
RTI_UINT32 nSample);
|
|
|
|
/******************************************************************************/
|
|
/* bzip2 builtin compression plugin */
|
|
/******************************************************************************/
|
|
extern RTIOsapiDllVariable const RTIOsapiCompressionPlugin
|
|
RTI_OSAPI_COMPRESSION_PLUGIN_BZIP2;
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Bzip2_compress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int lengthIn,
|
|
RTIOsapiCompressionLevel compressionLevel);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Bzip2_uncompress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int inLength);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_destroy(RTIOsapiCompressionPlugin *self);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_initializeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
RTIOsapiCompressionStreamKind streamKind,
|
|
void *streamInfo,
|
|
RTIBool disableHeapTracking);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Bzip2_setStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
void *streamInfo);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_writeFormattedString(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *format,
|
|
...);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_finalizeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Bzip2_writeBytes(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *buffer,
|
|
RTI_INT32 bufferLength);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Bzip2_flushStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *totalCompressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_getTotalBytesRead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *bytesRead,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Bzip2_getStreamMaxOverhead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *overhead,
|
|
RTI_UINT32 serializedSampleMaxSize,
|
|
RTI_UINT32 nSample);
|
|
|
|
/******************************************************************************/
|
|
/* lz4 builtin compression plugin */
|
|
/******************************************************************************/
|
|
extern RTIOsapiDllVariable const RTIOsapiCompressionPlugin
|
|
RTI_OSAPI_COMPRESSION_PLUGIN_LZ4;
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_compress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int lengthIn,
|
|
RTIOsapiCompressionLevel compressionLevel);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_uncompress(
|
|
RTIOsapiCompressionPlugin *self,
|
|
char *bufferOut,
|
|
int *lengthInOut,
|
|
const char *bufferIn,
|
|
int inLength);
|
|
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Lz4_destroy(RTIOsapiCompressionPlugin *self);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Lz4_initializeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
RTIOsapiCompressionStreamKind streamKind,
|
|
void *streamInfo,
|
|
RTIBool disableHeapTracking);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_setStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle *streamHandle,
|
|
void *streamInfo);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Lz4_writeFormattedString(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *format,
|
|
...);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_finalizeStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_writeBytes(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *compressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle,
|
|
const char *buffer,
|
|
RTI_INT32 bufferLength);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode RTIOsapi_Lz4_flushStream(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *totalCompressedBytesSize,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Lz4_getTotalBytesRead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *bytesRead,
|
|
RTIOsapiCompressionStreamHandle streamHandle);
|
|
|
|
/*
|
|
* The following method is defined but not implemented.
|
|
* It returns 'RTI_OSAPI_COMPRESSION_RETCODE_NOT_SUPPORTED'.
|
|
*/
|
|
extern RTIOsapiDllExport RTIOsapiCompressionRetcode
|
|
RTIOsapi_Lz4_getStreamMaxOverhead(
|
|
RTIOsapiCompressionPlugin *self,
|
|
RTI_INT32 *overhead,
|
|
RTI_UINT32 serializedSampleMaxSize,
|
|
RTI_UINT32 nSample);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif /* osapi_compression_h */
|