127b27ec6Sopenharmony_ci/* 227b27ec6Sopenharmony_ci LZ4io.h - LZ4 File/Stream Interface 327b27ec6Sopenharmony_ci Copyright (C) Yann Collet 2011-2020 427b27ec6Sopenharmony_ci GPL v2 License 527b27ec6Sopenharmony_ci 627b27ec6Sopenharmony_ci This program is free software; you can redistribute it and/or modify 727b27ec6Sopenharmony_ci it under the terms of the GNU General Public License as published by 827b27ec6Sopenharmony_ci the Free Software Foundation; either version 2 of the License, or 927b27ec6Sopenharmony_ci (at your option) any later version. 1027b27ec6Sopenharmony_ci 1127b27ec6Sopenharmony_ci This program is distributed in the hope that it will be useful, 1227b27ec6Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 1327b27ec6Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1427b27ec6Sopenharmony_ci GNU General Public License for more details. 1527b27ec6Sopenharmony_ci 1627b27ec6Sopenharmony_ci You should have received a copy of the GNU General Public License along 1727b27ec6Sopenharmony_ci with this program; if not, write to the Free Software Foundation, Inc., 1827b27ec6Sopenharmony_ci 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 1927b27ec6Sopenharmony_ci 2027b27ec6Sopenharmony_ci You can contact the author at : 2127b27ec6Sopenharmony_ci - LZ4 source repository : https://github.com/lz4/lz4 2227b27ec6Sopenharmony_ci - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c 2327b27ec6Sopenharmony_ci*/ 2427b27ec6Sopenharmony_ci/* 2527b27ec6Sopenharmony_ci Note : this is stand-alone program. 2627b27ec6Sopenharmony_ci It is not part of LZ4 compression library, it is a user code of the LZ4 library. 2727b27ec6Sopenharmony_ci - The license of LZ4 library is BSD. 2827b27ec6Sopenharmony_ci - The license of xxHash library is BSD. 2927b27ec6Sopenharmony_ci - The license of this source file is GPLv2. 3027b27ec6Sopenharmony_ci*/ 3127b27ec6Sopenharmony_ci 3227b27ec6Sopenharmony_ci#ifndef LZ4IO_H_237902873 3327b27ec6Sopenharmony_ci#define LZ4IO_H_237902873 3427b27ec6Sopenharmony_ci 3527b27ec6Sopenharmony_ci/*--- Dependency ---*/ 3627b27ec6Sopenharmony_ci#include <stddef.h> /* size_t */ 3727b27ec6Sopenharmony_ci 3827b27ec6Sopenharmony_ci 3927b27ec6Sopenharmony_ci/* ************************************************** */ 4027b27ec6Sopenharmony_ci/* Special input/output values */ 4127b27ec6Sopenharmony_ci/* ************************************************** */ 4227b27ec6Sopenharmony_ci#define stdinmark "stdin" 4327b27ec6Sopenharmony_ci#define stdoutmark "stdout" 4427b27ec6Sopenharmony_ci#define NULL_OUTPUT "null" 4527b27ec6Sopenharmony_ci#ifdef _WIN32 4627b27ec6Sopenharmony_ci#define nulmark "nul" 4727b27ec6Sopenharmony_ci#else 4827b27ec6Sopenharmony_ci#define nulmark "/dev/null" 4927b27ec6Sopenharmony_ci#endif 5027b27ec6Sopenharmony_ci 5127b27ec6Sopenharmony_ci/* ************************************************** */ 5227b27ec6Sopenharmony_ci/* ****************** Type Definitions ************** */ 5327b27ec6Sopenharmony_ci/* ************************************************** */ 5427b27ec6Sopenharmony_ci 5527b27ec6Sopenharmony_citypedef struct LZ4IO_prefs_s LZ4IO_prefs_t; 5627b27ec6Sopenharmony_ci 5727b27ec6Sopenharmony_ciLZ4IO_prefs_t* LZ4IO_defaultPreferences(void); 5827b27ec6Sopenharmony_civoid LZ4IO_freePreferences(LZ4IO_prefs_t* prefs); 5927b27ec6Sopenharmony_ci 6027b27ec6Sopenharmony_ci 6127b27ec6Sopenharmony_ci/* ************************************************** */ 6227b27ec6Sopenharmony_ci/* ****************** Functions ********************* */ 6327b27ec6Sopenharmony_ci/* ************************************************** */ 6427b27ec6Sopenharmony_ci 6527b27ec6Sopenharmony_ci/* if output_filename == stdoutmark, writes to stdout */ 6627b27ec6Sopenharmony_ciint LZ4IO_compressFilename(const char* input_filename, const char* output_filename, int compressionlevel, const LZ4IO_prefs_t* prefs); 6727b27ec6Sopenharmony_ciint LZ4IO_decompressFilename(const char* input_filename, const char* output_filename, const LZ4IO_prefs_t* prefs); 6827b27ec6Sopenharmony_ci 6927b27ec6Sopenharmony_ci/* if suffix == stdoutmark, writes to stdout */ 7027b27ec6Sopenharmony_ciint LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix, int compressionlevel, const LZ4IO_prefs_t* prefs); 7127b27ec6Sopenharmony_ciint LZ4IO_decompressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix, const LZ4IO_prefs_t* prefs); 7227b27ec6Sopenharmony_ci 7327b27ec6Sopenharmony_ci 7427b27ec6Sopenharmony_ci/* ************************************************** */ 7527b27ec6Sopenharmony_ci/* ****************** Parameters ******************** */ 7627b27ec6Sopenharmony_ci/* ************************************************** */ 7727b27ec6Sopenharmony_ci 7827b27ec6Sopenharmony_ciint LZ4IO_setDictionaryFilename(LZ4IO_prefs_t* const prefs, const char* dictionaryFilename); 7927b27ec6Sopenharmony_ci 8027b27ec6Sopenharmony_ci/* Default setting : passThrough = 0; 8127b27ec6Sopenharmony_ci return : passThrough mode (0/1) */ 8227b27ec6Sopenharmony_ciint LZ4IO_setPassThrough(LZ4IO_prefs_t* const prefs, int yes); 8327b27ec6Sopenharmony_ci 8427b27ec6Sopenharmony_ci/* Default setting : overwrite = 1; 8527b27ec6Sopenharmony_ci return : overwrite mode (0/1) */ 8627b27ec6Sopenharmony_ciint LZ4IO_setOverwrite(LZ4IO_prefs_t* const prefs, int yes); 8727b27ec6Sopenharmony_ci 8827b27ec6Sopenharmony_ci/* Default setting : testMode = 0; 8927b27ec6Sopenharmony_ci return : testMode (0/1) */ 9027b27ec6Sopenharmony_ciint LZ4IO_setTestMode(LZ4IO_prefs_t* const prefs, int yes); 9127b27ec6Sopenharmony_ci 9227b27ec6Sopenharmony_ci/* blockSizeID : valid values : 4-5-6-7 9327b27ec6Sopenharmony_ci return : 0 if error, blockSize if OK */ 9427b27ec6Sopenharmony_cisize_t LZ4IO_setBlockSizeID(LZ4IO_prefs_t* const prefs, unsigned blockSizeID); 9527b27ec6Sopenharmony_ci 9627b27ec6Sopenharmony_ci/* blockSize : valid values : 32 -> 4MB 9727b27ec6Sopenharmony_ci return : 0 if error, actual blocksize if OK */ 9827b27ec6Sopenharmony_cisize_t LZ4IO_setBlockSize(LZ4IO_prefs_t* const prefs, size_t blockSize); 9927b27ec6Sopenharmony_ci 10027b27ec6Sopenharmony_ci/* Default setting : independent blocks */ 10127b27ec6Sopenharmony_citypedef enum { LZ4IO_blockLinked=0, LZ4IO_blockIndependent} LZ4IO_blockMode_t; 10227b27ec6Sopenharmony_ciint LZ4IO_setBlockMode(LZ4IO_prefs_t* const prefs, LZ4IO_blockMode_t blockMode); 10327b27ec6Sopenharmony_ci 10427b27ec6Sopenharmony_ci/* Default setting : no block checksum */ 10527b27ec6Sopenharmony_ciint LZ4IO_setBlockChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash); 10627b27ec6Sopenharmony_ci 10727b27ec6Sopenharmony_ci/* Default setting : stream checksum enabled */ 10827b27ec6Sopenharmony_ciint LZ4IO_setStreamChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash); 10927b27ec6Sopenharmony_ci 11027b27ec6Sopenharmony_ci/* Default setting : 0 (no notification) */ 11127b27ec6Sopenharmony_ciint LZ4IO_setNotificationLevel(int level); 11227b27ec6Sopenharmony_ci 11327b27ec6Sopenharmony_ci/* Default setting : 0 (disabled) */ 11427b27ec6Sopenharmony_ciint LZ4IO_setSparseFile(LZ4IO_prefs_t* const prefs, int enable); 11527b27ec6Sopenharmony_ci 11627b27ec6Sopenharmony_ci/* Default setting : 0 == no content size present in frame header */ 11727b27ec6Sopenharmony_ciint LZ4IO_setContentSize(LZ4IO_prefs_t* const prefs, int enable); 11827b27ec6Sopenharmony_ci 11927b27ec6Sopenharmony_ci/* Default setting : 0 == src file preserved */ 12027b27ec6Sopenharmony_civoid LZ4IO_setRemoveSrcFile(LZ4IO_prefs_t* const prefs, unsigned flag); 12127b27ec6Sopenharmony_ci 12227b27ec6Sopenharmony_ci/* Default setting : 0 == favor compression ratio 12327b27ec6Sopenharmony_ci * Note : 1 only works for high compression levels (10+) */ 12427b27ec6Sopenharmony_civoid LZ4IO_favorDecSpeed(LZ4IO_prefs_t* const prefs, int favor); 12527b27ec6Sopenharmony_ci 12627b27ec6Sopenharmony_ci 12727b27ec6Sopenharmony_ci/* implement --list 12827b27ec6Sopenharmony_ci * @return 0 on success, 1 on error */ 12927b27ec6Sopenharmony_ciint LZ4IO_displayCompressedFilesInfo(const char** inFileNames, size_t ifnIdx); 13027b27ec6Sopenharmony_ci 13127b27ec6Sopenharmony_ci 13227b27ec6Sopenharmony_ci#endif /* LZ4IO_H_237902873 */ 133