2006-07-16 19:49:42 +00:00
|
|
|
/*
|
2025-02-14 10:24:30 -05:00
|
|
|
* Copyright (C) 2013-2025 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
2019-01-25 10:15:50 -05:00
|
|
|
* Copyright (C) 2007-2013 Sourcefire, Inc.
|
2008-04-02 15:24:51 +00:00
|
|
|
*
|
|
|
|
* Authors: Alberto Wu
|
2020-01-03 15:44:07 -05:00
|
|
|
*
|
|
|
|
* Acknowledgements: This contains an implementation of the LZMA algorithm
|
2018-03-05 16:34:35 -05:00
|
|
|
* from Igor Pavlov (see COPYING.lzma).
|
2007-12-13 19:45:38 +00:00
|
|
|
*
|
2006-07-16 19:49:42 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-04-05 19:44:44 +00:00
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
2006-07-16 19:49:42 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-12-13 19:45:38 +00:00
|
|
|
/* a cleaner state interface to LZMA */
|
|
|
|
|
|
|
|
#ifndef __LZMA_IFACE_H
|
|
|
|
#define __LZMA_IFACE_H
|
2006-07-16 19:49:42 +00:00
|
|
|
|
2009-08-05 16:51:09 +02:00
|
|
|
#include "7z/LzmaDec.h"
|
2018-12-05 20:46:20 -05:00
|
|
|
#include "clamav-types.h"
|
2009-08-05 16:51:09 +02:00
|
|
|
#include "others.h"
|
|
|
|
|
|
|
|
struct CLI_LZMA {
|
|
|
|
CLzmaDec state;
|
|
|
|
unsigned char header[LZMA_PROPS_SIZE];
|
|
|
|
unsigned int p_cnt;
|
|
|
|
unsigned int s_cnt;
|
|
|
|
unsigned int freeme;
|
|
|
|
unsigned int init;
|
|
|
|
uint64_t usize;
|
|
|
|
unsigned char *next_in;
|
|
|
|
unsigned char *next_out;
|
|
|
|
SizeT avail_in;
|
|
|
|
SizeT avail_out;
|
|
|
|
};
|
2006-07-16 19:49:42 +00:00
|
|
|
|
2008-02-05 18:25:22 +00:00
|
|
|
struct stream_state {
|
2009-08-05 16:51:09 +02:00
|
|
|
uint32_t avail_in;
|
|
|
|
unsigned char *next_in;
|
|
|
|
uint32_t avail_out;
|
|
|
|
unsigned char *next_out;
|
2008-02-05 18:25:22 +00:00
|
|
|
};
|
2007-12-13 19:45:38 +00:00
|
|
|
|
2009-08-05 16:51:09 +02:00
|
|
|
int cli_LzmaInit(struct CLI_LZMA *, uint64_t);
|
|
|
|
void cli_LzmaShutdown(struct CLI_LZMA *);
|
|
|
|
int cli_LzmaDecode(struct CLI_LZMA *);
|
2006-07-16 19:49:42 +00:00
|
|
|
|
2009-08-06 18:22:46 +02:00
|
|
|
void *__lzma_wrap_alloc(void *unused, size_t size);
|
|
|
|
void __lzma_wrap_free(void *unused, void *freeme);
|
|
|
|
|
2007-12-13 19:45:38 +00:00
|
|
|
#define LZMA_STREAM_END 2
|
2008-02-05 18:25:22 +00:00
|
|
|
#define LZMA_RESULT_OK 0
|
|
|
|
#define LZMA_RESULT_DATA_ERROR 1
|
2007-12-13 19:45:38 +00:00
|
|
|
#endif /* __LZMA_IFACE_H */
|