lz4s.h
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2014, Ben Charrow
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 ********************************************************************/
34 
35 #ifndef ROSLZ4_LZ4S_H
36 #define ROSLZ4_LZ4S_H
37 
38 #include <lz4.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 // Return codes
45 const int ROSLZ4_MEMORY_ERROR = -5;
46 const int ROSLZ4_PARAM_ERROR = -4;
47 const int ROSLZ4_DATA_ERROR = -3;
48 const int ROSLZ4_OUTPUT_SMALL = -2;
49 const int ROSLZ4_ERROR = -1;
50 const int ROSLZ4_OK = 0;
51 const int ROSLZ4_STREAM_END = 2;
52 
53 // Actions
54 const int ROSLZ4_RUN = 0;
55 const int ROSLZ4_FINISH = 1;
56 
57 typedef struct {
58  char *input_next;
60 
61  char *output_next;
63 
64  int total_in;
65  int total_out;
66 
68 
69  // Internal use
70  void *state;
72 
73 // Low level functions
74 int roslz4_blockSizeFromIndex(int block_id);
75 
76 int roslz4_compressStart(roslz4_stream *stream, int block_size_id);
77 int roslz4_compress(roslz4_stream *stream, int action);
78 void roslz4_compressEnd(roslz4_stream *stream);
79 
81 int roslz4_decompress(roslz4_stream *stream);
83 
84 // Oneshot compression / decompression
85 int roslz4_buffToBuffCompress(char *input, unsigned int input_size,
86  char *output, unsigned int *output_size,
87  int block_size_id);
88 int roslz4_buffToBuffDecompress(char *input, unsigned int input_size,
89  char *output, unsigned int *output_size);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif // ROSLZ4_LZ4S_H
void roslz4_compressEnd(roslz4_stream *stream)
Definition: lz4s.c:355
const int ROSLZ4_MEMORY_ERROR
Definition: lz4s.h:45
int roslz4_blockSizeFromIndex(int block_id)
Definition: lz4s.c:309
int roslz4_compress(roslz4_stream *stream, int action)
Definition: lz4s.c:319
int total_out
Definition: lz4s.h:65
int block_size_id
Definition: lz4s.h:67
const int ROSLZ4_OUTPUT_SMALL
Definition: lz4s.h:48
int roslz4_decompressStart(roslz4_stream *stream)
Definition: lz4s.c:361
int total_in
Definition: lz4s.h:64
int roslz4_buffToBuffDecompress(char *input, unsigned int input_size, char *output, unsigned int *output_size)
Definition: lz4s.c:609
const int ROSLZ4_STREAM_END
Definition: lz4s.h:51
int input_left
Definition: lz4s.h:59
const int ROSLZ4_PARAM_ERROR
Definition: lz4s.h:46
void roslz4_decompressEnd(roslz4_stream *str)
Definition: lz4s.c:569
char * output_next
Definition: lz4s.h:61
void * state
Definition: lz4s.h:70
char * input_next
Definition: lz4s.h:58
const int ROSLZ4_DATA_ERROR
Definition: lz4s.h:47
const int ROSLZ4_OK
Definition: lz4s.h:50
int roslz4_buffToBuffCompress(char *input, unsigned int input_size, char *output, unsigned int *output_size, int block_size_id)
Definition: lz4s.c:575
int roslz4_compressStart(roslz4_stream *stream, int block_size_id)
Definition: lz4s.c:313
const int ROSLZ4_FINISH
Definition: lz4s.h:55
int roslz4_decompress(roslz4_stream *stream)
Definition: lz4s.c:538
const int ROSLZ4_ERROR
Definition: lz4s.h:49
const int ROSLZ4_RUN
Definition: lz4s.h:54
int output_left
Definition: lz4s.h:62


roslz4
Author(s): Ben Charrow
autogenerated on Sun Feb 3 2019 03:29:46