LZ4: shortcuts to easy compress/decompress data
Functions
| Name | |
|---|---|
| N_STR * | zip4_nstr(N_STR * src) Return a compressed version of src using LZ4 block format. |
| N_STR * | unzip4_nstr(N_STR * src) Return an uncompressed version of src produced by zip4_nstr. |
Functions Documentation
function zip4_nstr
N_STR * zip4_nstr(
N_STR * src
)
Return a compressed version of src using LZ4 block format.
Compress src with LZ4 block format.
Self-framing, the output starts with a u32 (network byte order) carrying the original uncompressed length, followed by the lz4-compressed payload. Returns NULL on error.
Return a compressed version of src using LZ4 block format.
Self-framing, the produced N_STR begins with a u32 (network byte order) holding the original uncompressed length, followed by the LZ4-compressed bytes. Matches zip_nstr's framing so unzip{4,}_nstr can be selected per inbound packet without a separate framing header.
function unzip4_nstr
N_STR * unzip4_nstr(
N_STR * src
)
Return an uncompressed version of src produced by zip4_nstr.
Decompress an N_STR produced by zip4_nstr.
Rejects payloads whose decoded-size header is absurdly large to stop a malicious sender from over-allocating. Returns NULL on error.
Return an uncompressed version of src produced by zip4_nstr.
Rejects inputs whose declared original size exceeds 256 MiB as a defence against malicious / corrupt frames causing a large allocation. Matches the same cap unzip_nstr uses.
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB