archive.h revision 232153
1228753Smm/*-
2232153Smm * Copyright (c) 2003-2010 Tim Kientzle
3228753Smm * All rights reserved.
4228753Smm *
5228753Smm * Redistribution and use in source and binary forms, with or without
6228753Smm * modification, are permitted provided that the following conditions
7228753Smm * are met:
8228753Smm * 1. Redistributions of source code must retain the above copyright
9228753Smm *    notice, this list of conditions and the following disclaimer.
10228753Smm * 2. Redistributions in binary form must reproduce the above copyright
11228753Smm *    notice, this list of conditions and the following disclaimer in the
12228753Smm *    documentation and/or other materials provided with the distribution.
13228753Smm *
14228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15228753Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16228753Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17228753Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18228753Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19228753Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20228753Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21228753Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22228753Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23228753Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24228753Smm *
25228763Smm * $FreeBSD: head/contrib/libarchive/libarchive/archive.h 232153 2012-02-25 10:58:02Z mm $
26228753Smm */
27228753Smm
28228753Smm#ifndef ARCHIVE_H_INCLUDED
29228753Smm#define	ARCHIVE_H_INCLUDED
30228753Smm
31232153Smm#include <sys/stat.h>
32232153Smm#include <stddef.h>  /* for wchar_t */
33232153Smm#include <stdio.h> /* For FILE * */
34232153Smm
35228753Smm/*
36228753Smm * Note: archive.h is for use outside of libarchive; the configuration
37228753Smm * headers (config.h, archive_platform.h, etc.) are purely internal.
38228753Smm * Do NOT use HAVE_XXX configuration macros to control the behavior of
39228753Smm * this header!  If you must conditionalize, use predefined compiler and/or
40228753Smm * platform macros.
41228753Smm */
42228753Smm#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
43232153Smm# include <stdint.h>
44232153Smm#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS)
45232153Smm# include <inttypes.h>
46228753Smm#endif
47228753Smm
48228753Smm/* Get appropriate definitions of standard POSIX-style types. */
49228753Smm/* These should match the types used in 'struct stat' */
50228753Smm#if defined(_WIN32) && !defined(__CYGWIN__)
51232153Smm# define	__LA_INT64_T	__int64
52228753Smm# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
53228753Smm#  define	__LA_SSIZE_T	ssize_t
54228753Smm# elif defined(_WIN64)
55228753Smm#  define	__LA_SSIZE_T	__int64
56228753Smm# else
57228753Smm#  define	__LA_SSIZE_T	long
58228753Smm# endif
59228753Smm# if defined(__BORLANDC__)
60228753Smm#  define	__LA_UID_T	uid_t
61228753Smm#  define	__LA_GID_T	gid_t
62228753Smm# else
63228753Smm#  define	__LA_UID_T	short
64228753Smm#  define	__LA_GID_T	short
65228753Smm# endif
66228753Smm#else
67232153Smm# include <unistd.h>  /* ssize_t, uid_t, and gid_t */
68232153Smm# if defined(_SCO_DS)
69232153Smm#  define	__LA_INT64_T	long long
70232153Smm# else
71232153Smm#  define	__LA_INT64_T	int64_t
72232153Smm# endif
73232153Smm# define	__LA_SSIZE_T	ssize_t
74232153Smm# define	__LA_UID_T	uid_t
75232153Smm# define	__LA_GID_T	gid_t
76228753Smm#endif
77228753Smm
78228753Smm/*
79228753Smm * On Windows, define LIBARCHIVE_STATIC if you're building or using a
80228753Smm * .lib.  The default here assumes you're building a DLL.  Only
81228753Smm * libarchive source should ever define __LIBARCHIVE_BUILD.
82228753Smm */
83228753Smm#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
84228753Smm# ifdef __LIBARCHIVE_BUILD
85228753Smm#  ifdef __GNUC__
86228753Smm#   define __LA_DECL	__attribute__((dllexport)) extern
87228753Smm#  else
88228753Smm#   define __LA_DECL	__declspec(dllexport)
89228753Smm#  endif
90228753Smm# else
91228753Smm#  ifdef __GNUC__
92232153Smm#   define __LA_DECL
93228753Smm#  else
94228753Smm#   define __LA_DECL	__declspec(dllimport)
95228753Smm#  endif
96228753Smm# endif
97228753Smm#else
98228753Smm/* Static libraries or non-Windows needs no special declaration. */
99228753Smm# define __LA_DECL
100228753Smm#endif
101228753Smm
102232153Smm#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__)
103228753Smm#define	__LA_PRINTF(fmtarg, firstvararg) \
104228753Smm	__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
105228753Smm#else
106228753Smm#define	__LA_PRINTF(fmtarg, firstvararg)	/* nothing */
107228753Smm#endif
108228753Smm
109228753Smm#ifdef __cplusplus
110228753Smmextern "C" {
111228753Smm#endif
112228753Smm
113228753Smm/*
114228753Smm * The version number is provided as both a macro and a function.
115228753Smm * The macro identifies the installed header; the function identifies
116228753Smm * the library version (which may not be the same if you're using a
117228753Smm * dynamically-linked version of the library).  Of course, if the
118228753Smm * header and library are very different, you should expect some
119228753Smm * strangeness.  Don't do that.
120228753Smm */
121228753Smm
122228753Smm/*
123228753Smm * The version number is expressed as a single integer that makes it
124228753Smm * easy to compare versions at build time: for version a.b.c, the
125228753Smm * version number is printf("%d%03d%03d",a,b,c).  For example, if you
126228753Smm * know your application requires version 2.12.108 or later, you can
127232153Smm * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
128228753Smm */
129232153Smm/* Note: Compiler will complain if this does not match archive_entry.h! */
130232153Smm#define	ARCHIVE_VERSION_NUMBER 3000003
131228753Smm__LA_DECL int		archive_version_number(void);
132228753Smm
133228753Smm/*
134228753Smm * Textual name/version of the library, useful for version displays.
135228753Smm */
136232153Smm#define	ARCHIVE_VERSION_STRING "libarchive 3.0.3"
137228753Smm__LA_DECL const char *	archive_version_string(void);
138228753Smm
139228753Smm/* Declare our basic types. */
140228753Smmstruct archive;
141228753Smmstruct archive_entry;
142228753Smm
143228753Smm/*
144228753Smm * Error codes: Use archive_errno() and archive_error_string()
145228753Smm * to retrieve details.  Unless specified otherwise, all functions
146228753Smm * that return 'int' use these codes.
147228753Smm */
148228753Smm#define	ARCHIVE_EOF	  1	/* Found end of archive. */
149228753Smm#define	ARCHIVE_OK	  0	/* Operation was successful. */
150228753Smm#define	ARCHIVE_RETRY	(-10)	/* Retry might succeed. */
151228753Smm#define	ARCHIVE_WARN	(-20)	/* Partial success. */
152228753Smm/* For example, if write_header "fails", then you can't push data. */
153228753Smm#define	ARCHIVE_FAILED	(-25)	/* Current operation cannot complete. */
154228753Smm/* But if write_header is "fatal," then this archive is dead and useless. */
155228753Smm#define	ARCHIVE_FATAL	(-30)	/* No more operations are possible. */
156228753Smm
157228753Smm/*
158228753Smm * As far as possible, archive_errno returns standard platform errno codes.
159228753Smm * Of course, the details vary by platform, so the actual definitions
160228753Smm * here are stored in "archive_platform.h".  The symbols are listed here
161228753Smm * for reference; as a rule, clients should not need to know the exact
162228753Smm * platform-dependent error code.
163228753Smm */
164228753Smm/* Unrecognized or invalid file format. */
165228753Smm/* #define	ARCHIVE_ERRNO_FILE_FORMAT */
166228753Smm/* Illegal usage of the library. */
167228753Smm/* #define	ARCHIVE_ERRNO_PROGRAMMER_ERROR */
168228753Smm/* Unknown or unclassified error. */
169228753Smm/* #define	ARCHIVE_ERRNO_MISC */
170228753Smm
171228753Smm/*
172228753Smm * Callbacks are invoked to automatically read/skip/write/open/close the
173228753Smm * archive. You can provide your own for complex tasks (like breaking
174228753Smm * archives across multiple tapes) or use standard ones built into the
175228753Smm * library.
176228753Smm */
177228753Smm
178228753Smm/* Returns pointer and size of next block of data from archive. */
179228753Smmtypedef __LA_SSIZE_T	archive_read_callback(struct archive *,
180228753Smm			    void *_client_data, const void **_buffer);
181228753Smm
182232153Smm/* Skips at most request bytes from archive and returns the skipped amount.
183232153Smm * This may skip fewer bytes than requested; it may even skip zero bytes.
184232153Smm * If you do skip fewer bytes than requested, libarchive will invoke your
185232153Smm * read callback and discard data as necessary to make up the full skip.
186232153Smm */
187228753Smmtypedef __LA_INT64_T	archive_skip_callback(struct archive *,
188228753Smm			    void *_client_data, __LA_INT64_T request);
189228753Smm
190232153Smm/* Seeks to specified location in the file and returns the position.
191232153Smm * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h.
192232153Smm * Return ARCHIVE_FATAL if the seek fails for any reason.
193232153Smm */
194232153Smmtypedef __LA_INT64_T	archive_seek_callback(struct archive *,
195232153Smm    void *_client_data, __LA_INT64_T offset, int whence);
196232153Smm
197228753Smm/* Returns size actually written, zero on EOF, -1 on error. */
198228753Smmtypedef __LA_SSIZE_T	archive_write_callback(struct archive *,
199228753Smm			    void *_client_data,
200228753Smm			    const void *_buffer, size_t _length);
201228753Smm
202228753Smmtypedef int	archive_open_callback(struct archive *, void *_client_data);
203228753Smm
204228753Smmtypedef int	archive_close_callback(struct archive *, void *_client_data);
205228753Smm
206228753Smm/*
207232153Smm * Codes to identify various stream filters.
208228753Smm */
209232153Smm#define	ARCHIVE_FILTER_NONE	0
210232153Smm#define	ARCHIVE_FILTER_GZIP	1
211232153Smm#define	ARCHIVE_FILTER_BZIP2	2
212232153Smm#define	ARCHIVE_FILTER_COMPRESS	3
213232153Smm#define	ARCHIVE_FILTER_PROGRAM	4
214232153Smm#define	ARCHIVE_FILTER_LZMA	5
215232153Smm#define	ARCHIVE_FILTER_XZ	6
216232153Smm#define	ARCHIVE_FILTER_UU	7
217232153Smm#define	ARCHIVE_FILTER_RPM	8
218232153Smm#define	ARCHIVE_FILTER_LZIP	9
219228753Smm
220232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
221232153Smm#define	ARCHIVE_COMPRESSION_NONE	ARCHIVE_FILTER_NONE
222232153Smm#define	ARCHIVE_COMPRESSION_GZIP	ARCHIVE_FILTER_GZIP
223232153Smm#define	ARCHIVE_COMPRESSION_BZIP2	ARCHIVE_FILTER_BZIP2
224232153Smm#define	ARCHIVE_COMPRESSION_COMPRESS	ARCHIVE_FILTER_COMPRESS
225232153Smm#define	ARCHIVE_COMPRESSION_PROGRAM	ARCHIVE_FILTER_PROGRAM
226232153Smm#define	ARCHIVE_COMPRESSION_LZMA	ARCHIVE_FILTER_LZMA
227232153Smm#define	ARCHIVE_COMPRESSION_XZ		ARCHIVE_FILTER_XZ
228232153Smm#define	ARCHIVE_COMPRESSION_UU		ARCHIVE_FILTER_UU
229232153Smm#define	ARCHIVE_COMPRESSION_RPM		ARCHIVE_FILTER_RPM
230232153Smm#define	ARCHIVE_COMPRESSION_LZIP	ARCHIVE_FILTER_LZIP
231232153Smm#endif
232232153Smm
233228753Smm/*
234228753Smm * Codes returned by archive_format.
235228753Smm *
236228753Smm * Top 16 bits identifies the format family (e.g., "tar"); lower
237228753Smm * 16 bits indicate the variant.  This is updated by read_next_header.
238228753Smm * Note that the lower 16 bits will often vary from entry to entry.
239228753Smm * In some cases, this variation occurs as libarchive learns more about
240228753Smm * the archive (for example, later entries might utilize extensions that
241228753Smm * weren't necessary earlier in the archive; in this case, libarchive
242228753Smm * will change the format code to indicate the extended format that
243228753Smm * was used).  In other cases, it's because different tools have
244228753Smm * modified the archive and so different parts of the archive
245232153Smm * actually have slightly different formats.  (Both tar and cpio store
246228753Smm * format codes in each entry, so it is quite possible for each
247228753Smm * entry to be in a different format.)
248228753Smm */
249228753Smm#define	ARCHIVE_FORMAT_BASE_MASK		0xff0000
250228753Smm#define	ARCHIVE_FORMAT_CPIO			0x10000
251228753Smm#define	ARCHIVE_FORMAT_CPIO_POSIX		(ARCHIVE_FORMAT_CPIO | 1)
252228753Smm#define	ARCHIVE_FORMAT_CPIO_BIN_LE		(ARCHIVE_FORMAT_CPIO | 2)
253228753Smm#define	ARCHIVE_FORMAT_CPIO_BIN_BE		(ARCHIVE_FORMAT_CPIO | 3)
254228753Smm#define	ARCHIVE_FORMAT_CPIO_SVR4_NOCRC		(ARCHIVE_FORMAT_CPIO | 4)
255228753Smm#define	ARCHIVE_FORMAT_CPIO_SVR4_CRC		(ARCHIVE_FORMAT_CPIO | 5)
256232153Smm#define	ARCHIVE_FORMAT_CPIO_AFIO_LARGE		(ARCHIVE_FORMAT_CPIO | 6)
257228753Smm#define	ARCHIVE_FORMAT_SHAR			0x20000
258228753Smm#define	ARCHIVE_FORMAT_SHAR_BASE		(ARCHIVE_FORMAT_SHAR | 1)
259228753Smm#define	ARCHIVE_FORMAT_SHAR_DUMP		(ARCHIVE_FORMAT_SHAR | 2)
260228753Smm#define	ARCHIVE_FORMAT_TAR			0x30000
261228753Smm#define	ARCHIVE_FORMAT_TAR_USTAR		(ARCHIVE_FORMAT_TAR | 1)
262228753Smm#define	ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE	(ARCHIVE_FORMAT_TAR | 2)
263228753Smm#define	ARCHIVE_FORMAT_TAR_PAX_RESTRICTED	(ARCHIVE_FORMAT_TAR | 3)
264228753Smm#define	ARCHIVE_FORMAT_TAR_GNUTAR		(ARCHIVE_FORMAT_TAR | 4)
265228753Smm#define	ARCHIVE_FORMAT_ISO9660			0x40000
266228753Smm#define	ARCHIVE_FORMAT_ISO9660_ROCKRIDGE	(ARCHIVE_FORMAT_ISO9660 | 1)
267228753Smm#define	ARCHIVE_FORMAT_ZIP			0x50000
268228753Smm#define	ARCHIVE_FORMAT_EMPTY			0x60000
269228753Smm#define	ARCHIVE_FORMAT_AR			0x70000
270228753Smm#define	ARCHIVE_FORMAT_AR_GNU			(ARCHIVE_FORMAT_AR | 1)
271228753Smm#define	ARCHIVE_FORMAT_AR_BSD			(ARCHIVE_FORMAT_AR | 2)
272228753Smm#define	ARCHIVE_FORMAT_MTREE			0x80000
273228753Smm#define	ARCHIVE_FORMAT_RAW			0x90000
274228753Smm#define	ARCHIVE_FORMAT_XAR			0xA0000
275232153Smm#define	ARCHIVE_FORMAT_LHA			0xB0000
276232153Smm#define	ARCHIVE_FORMAT_CAB			0xC0000
277232153Smm#define	ARCHIVE_FORMAT_RAR			0xD0000
278232153Smm#define	ARCHIVE_FORMAT_7ZIP			0xE0000
279228753Smm
280228753Smm/*-
281228753Smm * Basic outline for reading an archive:
282228753Smm *   1) Ask archive_read_new for an archive reader object.
283228753Smm *   2) Update any global properties as appropriate.
284228753Smm *      In particular, you'll certainly want to call appropriate
285228753Smm *      archive_read_support_XXX functions.
286228753Smm *   3) Call archive_read_open_XXX to open the archive
287228753Smm *   4) Repeatedly call archive_read_next_header to get information about
288228753Smm *      successive archive entries.  Call archive_read_data to extract
289228753Smm *      data for entries of interest.
290228753Smm *   5) Call archive_read_finish to end processing.
291228753Smm */
292228753Smm__LA_DECL struct archive	*archive_read_new(void);
293228753Smm
294228753Smm/*
295228753Smm * The archive_read_support_XXX calls enable auto-detect for this
296228753Smm * archive handle.  They also link in the necessary support code.
297228753Smm * For example, if you don't want bzlib linked in, don't invoke
298228753Smm * support_compression_bzip2().  The "all" functions provide the
299228753Smm * obvious shorthand.
300228753Smm */
301232153Smm
302232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
303232153Smm__LA_DECL int archive_read_support_compression_all(struct archive *);
304232153Smm__LA_DECL int archive_read_support_compression_bzip2(struct archive *);
305232153Smm__LA_DECL int archive_read_support_compression_compress(struct archive *);
306232153Smm__LA_DECL int archive_read_support_compression_gzip(struct archive *);
307232153Smm__LA_DECL int archive_read_support_compression_lzip(struct archive *);
308232153Smm__LA_DECL int archive_read_support_compression_lzma(struct archive *);
309232153Smm__LA_DECL int archive_read_support_compression_none(struct archive *);
310232153Smm__LA_DECL int archive_read_support_compression_program(struct archive *,
311228753Smm		     const char *command);
312232153Smm__LA_DECL int archive_read_support_compression_program_signature
313232153Smm		(struct archive *, const char *,
314228753Smm				    const void * /* match */, size_t);
315228753Smm
316232153Smm__LA_DECL int archive_read_support_compression_rpm(struct archive *);
317232153Smm__LA_DECL int archive_read_support_compression_uu(struct archive *);
318232153Smm__LA_DECL int archive_read_support_compression_xz(struct archive *);
319232153Smm#endif
320228753Smm
321232153Smm__LA_DECL int archive_read_support_filter_all(struct archive *);
322232153Smm__LA_DECL int archive_read_support_filter_bzip2(struct archive *);
323232153Smm__LA_DECL int archive_read_support_filter_compress(struct archive *);
324232153Smm__LA_DECL int archive_read_support_filter_gzip(struct archive *);
325232153Smm__LA_DECL int archive_read_support_filter_lzip(struct archive *);
326232153Smm__LA_DECL int archive_read_support_filter_lzma(struct archive *);
327232153Smm__LA_DECL int archive_read_support_filter_none(struct archive *);
328232153Smm__LA_DECL int archive_read_support_filter_program(struct archive *,
329232153Smm		     const char *command);
330232153Smm__LA_DECL int archive_read_support_filter_program_signature
331232153Smm		(struct archive *, const char *,
332232153Smm				    const void * /* match */, size_t);
333228753Smm
334232153Smm__LA_DECL int archive_read_support_filter_rpm(struct archive *);
335232153Smm__LA_DECL int archive_read_support_filter_uu(struct archive *);
336232153Smm__LA_DECL int archive_read_support_filter_xz(struct archive *);
337228753Smm
338232153Smm__LA_DECL int archive_read_support_format_7zip(struct archive *);
339232153Smm__LA_DECL int archive_read_support_format_all(struct archive *);
340232153Smm__LA_DECL int archive_read_support_format_ar(struct archive *);
341232153Smm__LA_DECL int archive_read_support_format_by_code(struct archive *, int);
342232153Smm__LA_DECL int archive_read_support_format_cab(struct archive *);
343232153Smm__LA_DECL int archive_read_support_format_cpio(struct archive *);
344232153Smm__LA_DECL int archive_read_support_format_empty(struct archive *);
345232153Smm__LA_DECL int archive_read_support_format_gnutar(struct archive *);
346232153Smm__LA_DECL int archive_read_support_format_iso9660(struct archive *);
347232153Smm__LA_DECL int archive_read_support_format_lha(struct archive *);
348232153Smm__LA_DECL int archive_read_support_format_mtree(struct archive *);
349232153Smm__LA_DECL int archive_read_support_format_rar(struct archive *);
350232153Smm__LA_DECL int archive_read_support_format_raw(struct archive *);
351232153Smm__LA_DECL int archive_read_support_format_tar(struct archive *);
352232153Smm__LA_DECL int archive_read_support_format_xar(struct archive *);
353232153Smm__LA_DECL int archive_read_support_format_zip(struct archive *);
354232153Smm
355232153Smm/* Set various callbacks. */
356232153Smm__LA_DECL int archive_read_set_open_callback(struct archive *,
357232153Smm    archive_open_callback *);
358232153Smm__LA_DECL int archive_read_set_read_callback(struct archive *,
359232153Smm    archive_read_callback *);
360232153Smm__LA_DECL int archive_read_set_seek_callback(struct archive *,
361232153Smm    archive_seek_callback *);
362232153Smm__LA_DECL int archive_read_set_skip_callback(struct archive *,
363232153Smm    archive_skip_callback *);
364232153Smm__LA_DECL int archive_read_set_close_callback(struct archive *,
365232153Smm    archive_close_callback *);
366232153Smm/* The callback data is provided to all of the callbacks above. */
367232153Smm__LA_DECL int archive_read_set_callback_data(struct archive *, void *);
368232153Smm/* Opening freezes the callbacks. */
369232153Smm__LA_DECL int archive_read_open1(struct archive *);
370232153Smm
371232153Smm/* Convenience wrappers around the above. */
372232153Smm__LA_DECL int archive_read_open(struct archive *, void *_client_data,
373228753Smm		     archive_open_callback *, archive_read_callback *,
374228753Smm		     archive_close_callback *);
375232153Smm__LA_DECL int archive_read_open2(struct archive *, void *_client_data,
376228753Smm		     archive_open_callback *, archive_read_callback *,
377228753Smm		     archive_skip_callback *, archive_close_callback *);
378228753Smm
379228753Smm/*
380228753Smm * A variety of shortcuts that invoke archive_read_open() with
381228753Smm * canned callbacks suitable for common situations.  The ones that
382228753Smm * accept a block size handle tape blocking correctly.
383228753Smm */
384228753Smm/* Use this if you know the filename.  Note: NULL indicates stdin. */
385232153Smm__LA_DECL int archive_read_open_filename(struct archive *,
386228753Smm		     const char *_filename, size_t _block_size);
387232153Smm__LA_DECL int archive_read_open_filename_w(struct archive *,
388232153Smm		     const wchar_t *_filename, size_t _block_size);
389228753Smm/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
390232153Smm__LA_DECL int archive_read_open_file(struct archive *,
391228753Smm		     const char *_filename, size_t _block_size);
392228753Smm/* Read an archive that's stored in memory. */
393232153Smm__LA_DECL int archive_read_open_memory(struct archive *,
394228753Smm		     void * buff, size_t size);
395228753Smm/* A more involved version that is only used for internal testing. */
396232153Smm__LA_DECL int archive_read_open_memory2(struct archive *a, void *buff,
397228753Smm		     size_t size, size_t read_size);
398228753Smm/* Read an archive that's already open, using the file descriptor. */
399232153Smm__LA_DECL int archive_read_open_fd(struct archive *, int _fd,
400228753Smm		     size_t _block_size);
401228753Smm/* Read an archive that's already open, using a FILE *. */
402228753Smm/* Note: DO NOT use this with tape drives. */
403232153Smm__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);
404228753Smm
405228753Smm/* Parses and returns next entry header. */
406232153Smm__LA_DECL int archive_read_next_header(struct archive *,
407228753Smm		     struct archive_entry **);
408228753Smm
409228753Smm/* Parses and returns next entry header using the archive_entry passed in */
410232153Smm__LA_DECL int archive_read_next_header2(struct archive *,
411228753Smm		     struct archive_entry *);
412228753Smm
413228753Smm/*
414228753Smm * Retrieve the byte offset in UNCOMPRESSED data where last-read
415228753Smm * header started.
416228753Smm */
417228753Smm__LA_DECL __LA_INT64_T		 archive_read_header_position(struct archive *);
418228753Smm
419228753Smm/* Read data from the body of an entry.  Similar to read(2). */
420228753Smm__LA_DECL __LA_SSIZE_T		 archive_read_data(struct archive *,
421228753Smm				    void *, size_t);
422228753Smm
423228753Smm/*
424228753Smm * A zero-copy version of archive_read_data that also exposes the file offset
425228753Smm * of each returned block.  Note that the client has no way to specify
426228753Smm * the desired size of the block.  The API does guarantee that offsets will
427228753Smm * be strictly increasing and that returned blocks will not overlap.
428228753Smm */
429232153Smm__LA_DECL int archive_read_data_block(struct archive *a,
430232153Smm		    const void **buff, size_t *size, __LA_INT64_T *offset);
431228753Smm
432228753Smm/*-
433228753Smm * Some convenience functions that are built on archive_read_data:
434228753Smm *  'skip': skips entire entry
435228753Smm *  'into_buffer': writes data into memory buffer that you provide
436228753Smm *  'into_fd': writes data to specified filedes
437228753Smm */
438232153Smm__LA_DECL int archive_read_data_skip(struct archive *);
439232153Smm__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
440228753Smm
441228753Smm/*
442228753Smm * Set read options.
443228753Smm */
444232153Smm/* Apply option to the format only. */
445232153Smm__LA_DECL int archive_read_set_format_option(struct archive *_a,
446232153Smm			    const char *m, const char *o,
447232153Smm			    const char *v);
448232153Smm/* Apply option to the filter only. */
449232153Smm__LA_DECL int archive_read_set_filter_option(struct archive *_a,
450232153Smm			    const char *m, const char *o,
451232153Smm			    const char *v);
452232153Smm/* Apply option to both the format and the filter. */
453232153Smm__LA_DECL int archive_read_set_option(struct archive *_a,
454232153Smm			    const char *m, const char *o,
455232153Smm			    const char *v);
456228753Smm/* Apply option string to both the format and the filter. */
457232153Smm__LA_DECL int archive_read_set_options(struct archive *_a,
458232153Smm			    const char *opts);
459228753Smm
460228753Smm/*-
461228753Smm * Convenience function to recreate the current entry (whose header
462228753Smm * has just been read) on disk.
463228753Smm *
464228753Smm * This does quite a bit more than just copy data to disk. It also:
465228753Smm *  - Creates intermediate directories as required.
466228753Smm *  - Manages directory permissions:  non-writable directories will
467228753Smm *    be initially created with write permission enabled; when the
468228753Smm *    archive is closed, dir permissions are edited to the values specified
469228753Smm *    in the archive.
470228753Smm *  - Checks hardlinks:  hardlinks will not be extracted unless the
471228753Smm *    linked-to file was also extracted within the same session. (TODO)
472228753Smm */
473228753Smm
474228753Smm/* The "flags" argument selects optional behavior, 'OR' the flags you want. */
475228753Smm
476228753Smm/* Default: Do not try to set owner/group. */
477228753Smm#define	ARCHIVE_EXTRACT_OWNER			(0x0001)
478228753Smm/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
479228753Smm#define	ARCHIVE_EXTRACT_PERM			(0x0002)
480228753Smm/* Default: Do not restore mtime/atime. */
481228753Smm#define	ARCHIVE_EXTRACT_TIME			(0x0004)
482228753Smm/* Default: Replace existing files. */
483228753Smm#define	ARCHIVE_EXTRACT_NO_OVERWRITE 		(0x0008)
484228753Smm/* Default: Try create first, unlink only if create fails with EEXIST. */
485228753Smm#define	ARCHIVE_EXTRACT_UNLINK			(0x0010)
486228753Smm/* Default: Do not restore ACLs. */
487228753Smm#define	ARCHIVE_EXTRACT_ACL			(0x0020)
488228753Smm/* Default: Do not restore fflags. */
489228753Smm#define	ARCHIVE_EXTRACT_FFLAGS			(0x0040)
490228753Smm/* Default: Do not restore xattrs. */
491228753Smm#define	ARCHIVE_EXTRACT_XATTR 			(0x0080)
492228753Smm/* Default: Do not try to guard against extracts redirected by symlinks. */
493228753Smm/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
494228753Smm#define	ARCHIVE_EXTRACT_SECURE_SYMLINKS		(0x0100)
495228753Smm/* Default: Do not reject entries with '..' as path elements. */
496228753Smm#define	ARCHIVE_EXTRACT_SECURE_NODOTDOT		(0x0200)
497228753Smm/* Default: Create parent directories as needed. */
498228753Smm#define	ARCHIVE_EXTRACT_NO_AUTODIR		(0x0400)
499228753Smm/* Default: Overwrite files, even if one on disk is newer. */
500228753Smm#define	ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER	(0x0800)
501228753Smm/* Detect blocks of 0 and write holes instead. */
502228753Smm#define	ARCHIVE_EXTRACT_SPARSE			(0x1000)
503232153Smm/* Default: Do not restore Mac extended metadata. */
504232153Smm/* This has no effect except on Mac OS. */
505232153Smm#define	ARCHIVE_EXTRACT_MAC_METADATA		(0x2000)
506228753Smm
507232153Smm__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
508228753Smm		     int flags);
509232153Smm__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,
510228753Smm		     struct archive * /* dest */);
511228753Smm__LA_DECL void	 archive_read_extract_set_progress_callback(struct archive *,
512228753Smm		     void (*_progress_func)(void *), void *_user_data);
513228753Smm
514228753Smm/* Record the dev/ino of a file that will not be written.  This is
515228753Smm * generally set to the dev/ino of the archive being read. */
516228753Smm__LA_DECL void		archive_read_extract_set_skip_file(struct archive *,
517232153Smm		     __LA_INT64_T, __LA_INT64_T);
518228753Smm
519228753Smm/* Close the file and release most resources. */
520228753Smm__LA_DECL int		 archive_read_close(struct archive *);
521228753Smm/* Release all resources and destroy the object. */
522228773Smm/* Note that archive_read_free will call archive_read_close for you. */
523228773Smm__LA_DECL int		 archive_read_free(struct archive *);
524228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000
525228773Smm/* Synonym for archive_read_free() for backwards compatibility. */
526228753Smm__LA_DECL int		 archive_read_finish(struct archive *);
527228753Smm#endif
528228753Smm
529228753Smm/*-
530228753Smm * To create an archive:
531232153Smm *   1) Ask archive_write_new for an archive writer object.
532228753Smm *   2) Set any global properties.  In particular, you should set
533228753Smm *      the compression and format to use.
534228753Smm *   3) Call archive_write_open to open the file (most people
535228753Smm *       will use archive_write_open_file or archive_write_open_fd,
536228753Smm *       which provide convenient canned I/O callbacks for you).
537228753Smm *   4) For each entry:
538228753Smm *      - construct an appropriate struct archive_entry structure
539228753Smm *      - archive_write_header to write the header
540228753Smm *      - archive_write_data to write the entry data
541228753Smm *   5) archive_write_close to close the output
542228773Smm *   6) archive_write_free to cleanup the writer and release resources
543228753Smm */
544228753Smm__LA_DECL struct archive	*archive_write_new(void);
545232153Smm__LA_DECL int archive_write_set_bytes_per_block(struct archive *,
546228753Smm		     int bytes_per_block);
547232153Smm__LA_DECL int archive_write_get_bytes_per_block(struct archive *);
548228753Smm/* XXX This is badly misnamed; suggestions appreciated. XXX */
549232153Smm__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,
550228753Smm		     int bytes_in_last_block);
551232153Smm__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);
552228753Smm
553228753Smm/* The dev/ino of a file that won't be archived.  This is used
554228753Smm * to avoid recursively adding an archive to itself. */
555232153Smm__LA_DECL int archive_write_set_skip_file(struct archive *,
556232153Smm    __LA_INT64_T, __LA_INT64_T);
557228753Smm
558232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
559232153Smm__LA_DECL int archive_write_set_compression_bzip2(struct archive *);
560232153Smm__LA_DECL int archive_write_set_compression_compress(struct archive *);
561232153Smm__LA_DECL int archive_write_set_compression_gzip(struct archive *);
562232153Smm__LA_DECL int archive_write_set_compression_lzip(struct archive *);
563232153Smm__LA_DECL int archive_write_set_compression_lzma(struct archive *);
564232153Smm__LA_DECL int archive_write_set_compression_none(struct archive *);
565232153Smm__LA_DECL int archive_write_set_compression_program(struct archive *,
566228753Smm		     const char *cmd);
567232153Smm__LA_DECL int archive_write_set_compression_xz(struct archive *);
568232153Smm#endif
569232153Smm
570232153Smm__LA_DECL int archive_write_add_filter_bzip2(struct archive *);
571232153Smm__LA_DECL int archive_write_add_filter_compress(struct archive *);
572232153Smm__LA_DECL int archive_write_add_filter_gzip(struct archive *);
573232153Smm__LA_DECL int archive_write_add_filter_lzip(struct archive *);
574232153Smm__LA_DECL int archive_write_add_filter_lzma(struct archive *);
575232153Smm__LA_DECL int archive_write_add_filter_none(struct archive *);
576232153Smm__LA_DECL int archive_write_add_filter_program(struct archive *,
577232153Smm		     const char *cmd);
578232153Smm__LA_DECL int archive_write_add_filter_xz(struct archive *);
579232153Smm
580232153Smm
581228753Smm/* A convenience function to set the format based on the code or name. */
582232153Smm__LA_DECL int archive_write_set_format(struct archive *, int format_code);
583232153Smm__LA_DECL int archive_write_set_format_by_name(struct archive *,
584228753Smm		     const char *name);
585228753Smm/* To minimize link pollution, use one or more of the following. */
586232153Smm__LA_DECL int archive_write_set_format_7zip(struct archive *);
587232153Smm__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
588232153Smm__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
589232153Smm__LA_DECL int archive_write_set_format_cpio(struct archive *);
590232153Smm__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
591232153Smm__LA_DECL int archive_write_set_format_gnutar(struct archive *);
592232153Smm__LA_DECL int archive_write_set_format_iso9660(struct archive *);
593232153Smm__LA_DECL int archive_write_set_format_mtree(struct archive *);
594228753Smm/* TODO: int archive_write_set_format_old_tar(struct archive *); */
595232153Smm__LA_DECL int archive_write_set_format_pax(struct archive *);
596232153Smm__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);
597232153Smm__LA_DECL int archive_write_set_format_shar(struct archive *);
598232153Smm__LA_DECL int archive_write_set_format_shar_dump(struct archive *);
599232153Smm__LA_DECL int archive_write_set_format_ustar(struct archive *);
600232153Smm__LA_DECL int archive_write_set_format_xar(struct archive *);
601232153Smm__LA_DECL int archive_write_set_format_zip(struct archive *);
602232153Smm__LA_DECL int archive_write_open(struct archive *, void *,
603228753Smm		     archive_open_callback *, archive_write_callback *,
604228753Smm		     archive_close_callback *);
605232153Smm__LA_DECL int archive_write_open_fd(struct archive *, int _fd);
606232153Smm__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
607232153Smm__LA_DECL int archive_write_open_filename_w(struct archive *,
608232153Smm		     const wchar_t *_file);
609228753Smm/* A deprecated synonym for archive_write_open_filename() */
610232153Smm__LA_DECL int archive_write_open_file(struct archive *, const char *_file);
611232153Smm__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);
612228753Smm/* _buffSize is the size of the buffer, _used refers to a variable that
613228753Smm * will be updated after each write into the buffer. */
614232153Smm__LA_DECL int archive_write_open_memory(struct archive *,
615228753Smm			void *_buffer, size_t _buffSize, size_t *_used);
616228753Smm
617228753Smm/*
618228753Smm * Note that the library will truncate writes beyond the size provided
619228753Smm * to archive_write_header or pad if the provided data is short.
620228753Smm */
621232153Smm__LA_DECL int archive_write_header(struct archive *,
622228753Smm		     struct archive_entry *);
623232153Smm__LA_DECL __LA_SSIZE_T	archive_write_data(struct archive *,
624228753Smm			    const void *, size_t);
625228753Smm
626232153Smm/* This interface is currently only available for archive_write_disk handles.  */
627228753Smm__LA_DECL __LA_SSIZE_T	 archive_write_data_block(struct archive *,
628228753Smm				    const void *, size_t, __LA_INT64_T);
629232153Smm
630228753Smm__LA_DECL int		 archive_write_finish_entry(struct archive *);
631228753Smm__LA_DECL int		 archive_write_close(struct archive *);
632228773Smm/* This can fail if the archive wasn't already closed, in which case
633228773Smm * archive_write_free() will implicitly call archive_write_close(). */
634228773Smm__LA_DECL int		 archive_write_free(struct archive *);
635228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000
636228773Smm/* Synonym for archive_write_free() for backwards compatibility. */
637228753Smm__LA_DECL int		 archive_write_finish(struct archive *);
638228753Smm#endif
639228753Smm
640228753Smm/*
641228753Smm * Set write options.
642228753Smm */
643232153Smm/* Apply option to the format only. */
644232153Smm__LA_DECL int archive_write_set_format_option(struct archive *_a,
645232153Smm			    const char *m, const char *o,
646232153Smm			    const char *v);
647232153Smm/* Apply option to the filter only. */
648232153Smm__LA_DECL int archive_write_set_filter_option(struct archive *_a,
649232153Smm			    const char *m, const char *o,
650232153Smm			    const char *v);
651232153Smm/* Apply option to both the format and the filter. */
652232153Smm__LA_DECL int archive_write_set_option(struct archive *_a,
653232153Smm			    const char *m, const char *o,
654232153Smm			    const char *v);
655232153Smm/* Apply option string to both the format and the filter. */
656232153Smm__LA_DECL int archive_write_set_options(struct archive *_a,
657232153Smm			    const char *opts);
658228753Smm
659228753Smm/*-
660228753Smm * ARCHIVE_WRITE_DISK API
661228753Smm *
662228753Smm * To create objects on disk:
663228753Smm *   1) Ask archive_write_disk_new for a new archive_write_disk object.
664228753Smm *   2) Set any global properties.  In particular, you probably
665228753Smm *      want to set the options.
666228753Smm *   3) For each entry:
667228753Smm *      - construct an appropriate struct archive_entry structure
668228753Smm *      - archive_write_header to create the file/dir/etc on disk
669228753Smm *      - archive_write_data to write the entry data
670228773Smm *   4) archive_write_free to cleanup the writer and release resources
671228753Smm *
672228753Smm * In particular, you can use this in conjunction with archive_read()
673228753Smm * to pull entries out of an archive and create them on disk.
674228753Smm */
675228753Smm__LA_DECL struct archive	*archive_write_disk_new(void);
676228753Smm/* This file will not be overwritten. */
677232153Smm__LA_DECL int archive_write_disk_set_skip_file(struct archive *,
678232153Smm    __LA_INT64_T, __LA_INT64_T);
679228753Smm/* Set flags to control how the next item gets created.
680228753Smm * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
681228753Smm__LA_DECL int		 archive_write_disk_set_options(struct archive *,
682228753Smm		     int flags);
683228753Smm/*
684228753Smm * The lookup functions are given uname/uid (or gname/gid) pairs and
685228753Smm * return a uid (gid) suitable for this system.  These are used for
686228753Smm * restoring ownership and for setting ACLs.  The default functions
687228753Smm * are naive, they just return the uid/gid.  These are small, so reasonable
688228753Smm * for applications that don't need to preserve ownership; they
689228753Smm * are probably also appropriate for applications that are doing
690228753Smm * same-system backup and restore.
691228753Smm */
692228753Smm/*
693228753Smm * The "standard" lookup functions use common system calls to lookup
694228753Smm * the uname/gname, falling back to the uid/gid if the names can't be
695228753Smm * found.  They cache lookups and are reasonably fast, but can be very
696228753Smm * large, so they are not used unless you ask for them.  In
697228753Smm * particular, these match the specifications of POSIX "pax" and old
698228753Smm * POSIX "tar".
699228753Smm */
700228753Smm__LA_DECL int	 archive_write_disk_set_standard_lookup(struct archive *);
701228753Smm/*
702228753Smm * If neither the default (naive) nor the standard (big) functions suit
703228753Smm * your needs, you can write your own and register them.  Be sure to
704228753Smm * include a cleanup function if you have allocated private data.
705228753Smm */
706232153Smm__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,
707232153Smm    void * /* private_data */,
708232153Smm    __LA_INT64_T (*)(void *, const char *, __LA_INT64_T),
709232153Smm    void (* /* cleanup */)(void *));
710232153Smm__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,
711232153Smm    void * /* private_data */,
712232153Smm    __LA_INT64_T (*)(void *, const char *, __LA_INT64_T),
713232153Smm    void (* /* cleanup */)(void *));
714232153Smm__LA_DECL __LA_INT64_T archive_write_disk_gid(struct archive *, const char *, __LA_INT64_T);
715232153Smm__LA_DECL __LA_INT64_T archive_write_disk_uid(struct archive *, const char *, __LA_INT64_T);
716228753Smm
717228753Smm/*
718228753Smm * ARCHIVE_READ_DISK API
719228753Smm *
720228753Smm * This is still evolving and somewhat experimental.
721228753Smm */
722228753Smm__LA_DECL struct archive *archive_read_disk_new(void);
723228753Smm/* The names for symlink modes here correspond to an old BSD
724228753Smm * command-line argument convention: -L, -P, -H */
725228753Smm/* Follow all symlinks. */
726228753Smm__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
727228753Smm/* Follow no symlinks. */
728228753Smm__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
729228753Smm/* Follow symlink initially, then not. */
730228753Smm__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
731228753Smm/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
732228753Smm__LA_DECL int archive_read_disk_entry_from_file(struct archive *,
733228753Smm    struct archive_entry *, int /* fd */, const struct stat *);
734228753Smm/* Look up gname for gid or uname for uid. */
735228753Smm/* Default implementations are very, very stupid. */
736232153Smm__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_INT64_T);
737232153Smm__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_INT64_T);
738228753Smm/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
739228753Smm * results for performance. */
740228753Smm__LA_DECL int	archive_read_disk_set_standard_lookup(struct archive *);
741228753Smm/* You can install your own lookups if you like. */
742228753Smm__LA_DECL int	archive_read_disk_set_gname_lookup(struct archive *,
743228753Smm    void * /* private_data */,
744232153Smm    const char *(* /* lookup_fn */)(void *, __LA_INT64_T),
745228753Smm    void (* /* cleanup_fn */)(void *));
746228753Smm__LA_DECL int	archive_read_disk_set_uname_lookup(struct archive *,
747228753Smm    void * /* private_data */,
748232153Smm    const char *(* /* lookup_fn */)(void *, __LA_INT64_T),
749228753Smm    void (* /* cleanup_fn */)(void *));
750232153Smm/* Start traversal. */
751232153Smm__LA_DECL int	archive_read_disk_open(struct archive *, const char *);
752232153Smm__LA_DECL int	archive_read_disk_open_w(struct archive *, const wchar_t *);
753232153Smm/*
754232153Smm * Request that current entry be visited.  If you invoke it on every
755232153Smm * directory, you'll get a physical traversal.  This is ignored if the
756232153Smm * current entry isn't a directory or a link to a directory.  So, if
757232153Smm * you invoke this on every returned path, you'll get a full logical
758232153Smm * traversal.
759232153Smm */
760232153Smm__LA_DECL int	archive_read_disk_descend(struct archive *);
761232153Smm__LA_DECL int	archive_read_disk_current_filesystem(struct archive *);
762232153Smm__LA_DECL int	archive_read_disk_current_filesystem_is_synthetic(struct archive *);
763232153Smm__LA_DECL int	archive_read_disk_current_filesystem_is_remote(struct archive *);
764232153Smm/* Request that the access time of the entry visited by travesal be restored. */
765232153Smm__LA_DECL int  archive_read_disk_set_atime_restored(struct archive *);
766228753Smm
767228753Smm/*
768228753Smm * Accessor functions to read/set various information in
769228753Smm * the struct archive object:
770228753Smm */
771232153Smm
772232153Smm/* Number of filters in the current filter pipeline. */
773232153Smm/* Filter #0 is the one closest to the format, -1 is a synonym for the
774232153Smm * last filter, which is always the pseudo-filter that wraps the
775232153Smm * client callbacks. */
776232153Smm__LA_DECL int		 archive_filter_count(struct archive *);
777232153Smm__LA_DECL __LA_INT64_T	 archive_filter_bytes(struct archive *, int);
778232153Smm__LA_DECL int		 archive_filter_code(struct archive *, int);
779232153Smm__LA_DECL const char *	 archive_filter_name(struct archive *, int);
780232153Smm
781232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
782232153Smm/* These don't properly handle multiple filters, so are deprecated and
783232153Smm * will eventually be removed. */
784232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */
785228753Smm__LA_DECL __LA_INT64_T	 archive_position_compressed(struct archive *);
786232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */
787228753Smm__LA_DECL __LA_INT64_T	 archive_position_uncompressed(struct archive *);
788232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */
789228753Smm__LA_DECL const char	*archive_compression_name(struct archive *);
790232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */
791228753Smm__LA_DECL int		 archive_compression(struct archive *);
792232153Smm#endif
793232153Smm
794228753Smm__LA_DECL int		 archive_errno(struct archive *);
795228753Smm__LA_DECL const char	*archive_error_string(struct archive *);
796228753Smm__LA_DECL const char	*archive_format_name(struct archive *);
797228753Smm__LA_DECL int		 archive_format(struct archive *);
798228753Smm__LA_DECL void		 archive_clear_error(struct archive *);
799228753Smm__LA_DECL void		 archive_set_error(struct archive *, int _err,
800228753Smm			    const char *fmt, ...) __LA_PRINTF(3, 4);
801228753Smm__LA_DECL void		 archive_copy_error(struct archive *dest,
802228753Smm			    struct archive *src);
803228753Smm__LA_DECL int		 archive_file_count(struct archive *);
804228753Smm
805228753Smm#ifdef __cplusplus
806228753Smm}
807228753Smm#endif
808228753Smm
809228753Smm/* These are meaningless outside of this header. */
810228753Smm#undef __LA_DECL
811228753Smm#undef __LA_GID_T
812228753Smm#undef __LA_UID_T
813228753Smm
814228753Smm/* These need to remain defined because they're used in the
815228753Smm * callback type definitions.  XXX Fix this.  This is ugly. XXX */
816228753Smm/* #undef __LA_INT64_T */
817228753Smm/* #undef __LA_SSIZE_T */
818228753Smm
819228753Smm#endif /* !ARCHIVE_H_INCLUDED */
820