2014-02-04 14:11:10 +00:00
|
|
|
/*
|
|
|
|
LZ4io.h - LZ4 File/Stream Interface
|
2016-11-21 23:51:39 +00:00
|
|
|
Copyright (C) Yann Collet 2011-2016
|
2014-02-04 14:11:10 +00:00
|
|
|
GPL v2 License
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
You can contact the author at :
|
2016-11-03 14:12:57 +00:00
|
|
|
- LZ4 source repository : https://github.com/lz4/lz4
|
2014-02-04 14:11:10 +00:00
|
|
|
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Note : this is stand-alone program.
|
|
|
|
It is not part of LZ4 compression library, it is a user code of the LZ4 library.
|
|
|
|
- The license of LZ4 library is BSD.
|
|
|
|
- The license of xxHash library is BSD.
|
|
|
|
- The license of this source file is GPLv2.
|
|
|
|
*/
|
|
|
|
|
2016-11-09 22:36:42 +00:00
|
|
|
#ifndef LZ4IO_H_237902873
|
|
|
|
#define LZ4IO_H_237902873
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2016-11-15 22:01:37 +00:00
|
|
|
/*--- Dependency ---*/
|
|
|
|
#include <stddef.h> /* size_t */
|
|
|
|
|
|
|
|
|
2014-02-04 14:11:10 +00:00
|
|
|
/* ************************************************** */
|
|
|
|
/* Special input/output values */
|
|
|
|
/* ************************************************** */
|
|
|
|
#define NULL_OUTPUT "null"
|
2016-11-15 22:01:37 +00:00
|
|
|
static const char stdinmark[] = "stdin";
|
|
|
|
static const char stdoutmark[] = "stdout";
|
2014-02-04 14:11:10 +00:00
|
|
|
#ifdef _WIN32
|
2016-11-15 22:01:37 +00:00
|
|
|
static const char nulmark[] = "nul";
|
2014-02-04 14:11:10 +00:00
|
|
|
#else
|
2016-11-15 22:01:37 +00:00
|
|
|
static const char nulmark[] = "/dev/null";
|
2014-02-04 14:11:10 +00:00
|
|
|
#endif
|
|
|
|
|
2019-01-10 23:27:47 +00:00
|
|
|
/* ************************************************** */
|
|
|
|
/* ****************** Type Definitions ************** */
|
|
|
|
/* ************************************************** */
|
|
|
|
|
|
|
|
typedef struct LZ4IO_prefs_s LZ4IO_prefs_t;
|
|
|
|
|
|
|
|
LZ4IO_prefs_t* LZ4IO_defaultPreferences(void);
|
2019-01-11 04:40:00 +00:00
|
|
|
void LZ4IO_freePreferences(LZ4IO_prefs_t* const prefs);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
|
|
|
/* ************************************************** */
|
|
|
|
/* ****************** Functions ********************* */
|
|
|
|
/* ************************************************** */
|
|
|
|
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_compressFilename(LZ4IO_prefs_t* const prefs, const char* input_filename, const char* output_filename, int compressionlevel);
|
|
|
|
int LZ4IO_decompressFilename(LZ4IO_prefs_t* const prefs, const char* input_filename, const char* output_filename);
|
2015-03-07 12:23:00 +00:00
|
|
|
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_compressMultipleFilenames(LZ4IO_prefs_t* const prefs, const char** inFileNamesTable, int ifntSize, const char* suffix, int compressionlevel);
|
|
|
|
int LZ4IO_decompressMultipleFilenames(LZ4IO_prefs_t* const prefs, const char** inFileNamesTable, int ifntSize, const char* suffix);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2016-11-09 22:36:42 +00:00
|
|
|
|
2014-02-04 14:11:10 +00:00
|
|
|
/* ************************************************** */
|
|
|
|
/* ****************** Parameters ******************** */
|
|
|
|
/* ************************************************** */
|
|
|
|
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setDictionaryFilename(LZ4IO_prefs_t* const prefs, const char* dictionaryFilename);
|
2017-09-22 18:55:42 +00:00
|
|
|
|
2019-01-10 18:20:17 +00:00
|
|
|
/* Default setting : passThrough = 0;
|
|
|
|
return : passThrough mode (0/1) */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setPassThrough(LZ4IO_prefs_t* const prefs, int yes);
|
2019-01-10 18:20:17 +00:00
|
|
|
|
2014-02-04 14:11:10 +00:00
|
|
|
/* Default setting : overwrite = 1;
|
|
|
|
return : overwrite mode (0/1) */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setOverwrite(LZ4IO_prefs_t* const prefs, int yes);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2016-11-04 01:50:25 +00:00
|
|
|
/* Default setting : testMode = 0;
|
|
|
|
return : testMode (0/1) */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setTestMode(LZ4IO_prefs_t* const prefs, int yes);
|
2016-11-03 22:41:09 +00:00
|
|
|
|
2014-02-04 14:11:10 +00:00
|
|
|
/* blockSizeID : valid values : 4-5-6-7
|
2016-11-15 22:01:37 +00:00
|
|
|
return : 0 if error, blockSize if OK */
|
2019-01-11 04:40:00 +00:00
|
|
|
size_t LZ4IO_setBlockSizeID(LZ4IO_prefs_t* const prefs, unsigned blockSizeID);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2018-09-28 15:02:49 +00:00
|
|
|
/* blockSize : valid values : 32 -> 4MB
|
|
|
|
return : 0 if error, actual blocksize if OK */
|
2019-01-11 04:40:00 +00:00
|
|
|
size_t LZ4IO_setBlockSize(LZ4IO_prefs_t* const prefs, size_t blockSize);
|
2018-09-28 15:02:49 +00:00
|
|
|
|
2014-02-04 14:11:10 +00:00
|
|
|
/* Default setting : independent blocks */
|
2014-11-30 16:59:31 +00:00
|
|
|
typedef enum { LZ4IO_blockLinked=0, LZ4IO_blockIndependent} LZ4IO_blockMode_t;
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setBlockMode(LZ4IO_prefs_t* const prefs, LZ4IO_blockMode_t blockMode);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2015-03-11 18:42:37 +00:00
|
|
|
/* Default setting : no block checksum */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setBlockChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
2015-03-11 18:42:37 +00:00
|
|
|
/* Default setting : stream checksum enabled */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setStreamChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash);
|
2014-02-04 14:11:10 +00:00
|
|
|
|
|
|
|
/* Default setting : 0 (no notification) */
|
|
|
|
int LZ4IO_setNotificationLevel(int level);
|
2015-03-11 18:42:37 +00:00
|
|
|
|
|
|
|
/* Default setting : 0 (disabled) */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setSparseFile(LZ4IO_prefs_t* const prefs, int enable);
|
2015-03-11 18:42:37 +00:00
|
|
|
|
2018-04-26 22:49:32 +00:00
|
|
|
/* Default setting : 0 == no content size present in frame header */
|
2019-01-11 04:40:00 +00:00
|
|
|
int LZ4IO_setContentSize(LZ4IO_prefs_t* const prefs, int enable);
|
2016-11-07 13:50:58 +00:00
|
|
|
|
2018-04-26 22:49:32 +00:00
|
|
|
/* Default setting : 0 == src file preserved */
|
2019-01-11 04:40:00 +00:00
|
|
|
void LZ4IO_setRemoveSrcFile(LZ4IO_prefs_t* const prefs, unsigned flag);
|
2016-11-09 22:36:42 +00:00
|
|
|
|
2018-04-26 22:49:32 +00:00
|
|
|
/* Default setting : 0 == favor compression ratio
|
|
|
|
* Note : 1 only works for high compression levels (10+) */
|
2019-01-11 04:40:00 +00:00
|
|
|
void LZ4IO_favorDecSpeed(LZ4IO_prefs_t* const prefs, int favor);
|
2018-04-26 22:49:32 +00:00
|
|
|
|
2016-11-09 22:36:42 +00:00
|
|
|
|
|
|
|
#endif /* LZ4IO_H_237902873 */
|