|
Document of c-modernization-kit (porter) 1.0.0
|
データ圧縮・解凍モジュールの内部ヘッダー。 More...
Go to the source code of this file.
Macros | |
| #define | POTR_COMPRESS_HEADER_SIZE 4U |
| 圧縮ペイロード先頭に付加する元サイズフィールドのバイト数。 | |
| #define | POTR_COMPRESS_BUF_SIZE (POTR_COMPRESS_HEADER_SIZE + POTR_MAX_MESSAGE_SIZE + 64U) |
| 圧縮後の最大バッファサイズ (元データ + ヘッダー + DEFLATE オーバーヘッド)。 | |
Functions | |
| int | potr_compress (uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len) |
| データを圧縮します。 | |
| int | potr_decompress (uint8_t *dst, size_t *dst_len, const uint8_t *src, size_t src_len) |
| 圧縮データを解凍します。 | |
データ圧縮・解凍モジュールの内部ヘッダー。
プラットフォームごとに異なる圧縮 API を共通インターフェースで抽象化します。
| OS | 使用ライブラリ | フォーマット |
|---|---|---|
| Linux | zlib (deflate/inflate, windowBits = -15) | raw DEFLATE |
| Windows | Compression API (MSZIP | COMPRESS_RAW) | raw DEFLATE |
両 OS とも raw DEFLATE (RFC 1951) を出力するため、クロスプラットフォーム互換 通信が可能です。
圧縮ペイロードのフォーマット:
Definition in file compress.h.
| #define POTR_COMPRESS_HEADER_SIZE 4U |
圧縮ペイロード先頭に付加する元サイズフィールドのバイト数。
Definition at line 39 of file compress.h.
Referenced by potr_compress(), potr_decompress(), and potrOpenService().
| #define POTR_COMPRESS_BUF_SIZE (POTR_COMPRESS_HEADER_SIZE + POTR_MAX_MESSAGE_SIZE + 64U) |
圧縮後の最大バッファサイズ (元データ + ヘッダー + DEFLATE オーバーヘッド)。
Definition at line 42 of file compress.h.
|
extern |
データを圧縮します。
| [out] | dst | 圧縮後データを格納するバッファ。 先頭 4 バイトに元サイズ (NBO) が書き込まれます。 |
| [in,out] | dst_len | 入力: dst のバッファサイズ。 出力: 書き込んだバイト数。 |
| [in] | src | 圧縮前データへのポインタ。 |
| [in] | src_len | 圧縮前データのバイト数。 |
Definition at line 29 of file compress_linux.c.
References POTR_COMPRESS_HEADER_SIZE.
Referenced by potrSend().
|
extern |
圧縮データを解凍します。
| [out] | dst | 解凍後データを格納するバッファ。 |
| [in,out] | dst_len | 入力: dst のバッファサイズ。 出力: 書き込んだバイト数。 |
| [in] | src | 圧縮後データへのポインタ (先頭 4 バイトは元サイズ)。 |
| [in] | src_len | 圧縮後データのバイト数 (ヘッダーを含む)。 |
Definition at line 74 of file compress_linux.c.
References POTR_COMPRESS_HEADER_SIZE.
Referenced by n1_recv_deliver(), and recv_deliver().