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: stable/11/contrib/libarchive/libarchive/archive.h 370535 2021-09-10 08:34:36Z git2svn $
26228753Smm */
27228753Smm
28228753Smm#ifndef ARCHIVE_H_INCLUDED
29228753Smm#define	ARCHIVE_H_INCLUDED
30228753Smm
31299529Smm/*
32299529Smm * The version number is expressed as a single integer that makes it
33299529Smm * easy to compare versions at build time: for version a.b.c, the
34299529Smm * version number is printf("%d%03d%03d",a,b,c).  For example, if you
35299529Smm * know your application requires version 2.12.108 or later, you can
36299529Smm * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
37299529Smm */
38299529Smm/* Note: Compiler will complain if this does not match archive_entry.h! */
39370535Sgit2svn#define	ARCHIVE_VERSION_NUMBER 3005002
40299529Smm
41232153Smm#include <sys/stat.h>
42232153Smm#include <stddef.h>  /* for wchar_t */
43232153Smm#include <stdio.h> /* For FILE * */
44299529Smm#include <time.h> /* For time_t */
45232153Smm
46228753Smm/*
47228753Smm * Note: archive.h is for use outside of libarchive; the configuration
48228753Smm * headers (config.h, archive_platform.h, etc.) are purely internal.
49228753Smm * Do NOT use HAVE_XXX configuration macros to control the behavior of
50228753Smm * this header!  If you must conditionalize, use predefined compiler and/or
51228753Smm * platform macros.
52228753Smm */
53228753Smm#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
54232153Smm# include <stdint.h>
55353376Smm#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H)
56232153Smm# include <inttypes.h>
57228753Smm#endif
58228753Smm
59299529Smm/* Get appropriate definitions of 64-bit integer */
60299529Smm#if !defined(__LA_INT64_T_DEFINED)
61299529Smm/* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */
62299529Smm# if ARCHIVE_VERSION_NUMBER < 4000000
63299529Smm#define __LA_INT64_T la_int64_t
64299529Smm# endif
65299529Smm#define __LA_INT64_T_DEFINED
66299529Smm# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
67299529Smmtypedef __int64 la_int64_t;
68228753Smm# else
69299529Smm# include <unistd.h>  /* ssize_t */
70299529Smm#  if defined(_SCO_DS) || defined(__osf__)
71299529Smmtypedef long long la_int64_t;
72299529Smm#  else
73299529Smmtypedef int64_t la_int64_t;
74299529Smm#  endif
75228753Smm# endif
76299529Smm#endif
77299529Smm
78299529Smm/* The la_ssize_t should match the type used in 'struct stat' */
79299529Smm#if !defined(__LA_SSIZE_T_DEFINED)
80299529Smm/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */
81299529Smm# if ARCHIVE_VERSION_NUMBER < 4000000
82299529Smm#define __LA_SSIZE_T la_ssize_t
83299529Smm# endif
84299529Smm#define __LA_SSIZE_T_DEFINED
85299529Smm# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
86299529Smm#  if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
87299529Smmtypedef ssize_t la_ssize_t;
88299529Smm#  elif defined(_WIN64)
89299529Smmtypedef __int64 la_ssize_t;
90299529Smm#  else
91299529Smmtypedef long la_ssize_t;
92299529Smm#  endif
93299529Smm# else
94238856Smm# include <unistd.h>  /* ssize_t */
95299529Smmtypedef ssize_t la_ssize_t;
96232153Smm# endif
97228753Smm#endif
98228753Smm
99299529Smm/* Large file support for Android */
100299529Smm#ifdef __ANDROID__
101299529Smm#include "android_lf.h"
102299529Smm#endif
103299529Smm
104228753Smm/*
105228753Smm * On Windows, define LIBARCHIVE_STATIC if you're building or using a
106228753Smm * .lib.  The default here assumes you're building a DLL.  Only
107228753Smm * libarchive source should ever define __LIBARCHIVE_BUILD.
108228753Smm */
109228753Smm#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
110228753Smm# ifdef __LIBARCHIVE_BUILD
111228753Smm#  ifdef __GNUC__
112228753Smm#   define __LA_DECL	__attribute__((dllexport)) extern
113228753Smm#  else
114228753Smm#   define __LA_DECL	__declspec(dllexport)
115228753Smm#  endif
116228753Smm# else
117228753Smm#  ifdef __GNUC__
118232153Smm#   define __LA_DECL
119228753Smm#  else
120228753Smm#   define __LA_DECL	__declspec(dllimport)
121228753Smm#  endif
122228753Smm# endif
123228753Smm#else
124228753Smm/* Static libraries or non-Windows needs no special declaration. */
125228753Smm# define __LA_DECL
126228753Smm#endif
127228753Smm
128232153Smm#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__)
129228753Smm#define	__LA_PRINTF(fmtarg, firstvararg) \
130228753Smm	__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
131228753Smm#else
132228753Smm#define	__LA_PRINTF(fmtarg, firstvararg)	/* nothing */
133228753Smm#endif
134228753Smm
135248616Smm#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1
136248616Smm# define __LA_DEPRECATED __attribute__((deprecated))
137248616Smm#else
138248616Smm# define __LA_DEPRECATED
139248616Smm#endif
140248616Smm
141228753Smm#ifdef __cplusplus
142228753Smmextern "C" {
143228753Smm#endif
144228753Smm
145228753Smm/*
146228753Smm * The version number is provided as both a macro and a function.
147228753Smm * The macro identifies the installed header; the function identifies
148228753Smm * the library version (which may not be the same if you're using a
149228753Smm * dynamically-linked version of the library).  Of course, if the
150228753Smm * header and library are very different, you should expect some
151228753Smm * strangeness.  Don't do that.
152228753Smm */
153228753Smm__LA_DECL int		archive_version_number(void);
154228753Smm
155228753Smm/*
156228753Smm * Textual name/version of the library, useful for version displays.
157228753Smm */
158370535Sgit2svn#define	ARCHIVE_VERSION_ONLY_STRING "3.5.2"
159299529Smm#define	ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
160228753Smm__LA_DECL const char *	archive_version_string(void);
161228753Smm
162299529Smm/*
163299529Smm * Detailed textual name/version of the library and its dependencies.
164299529Smm * This has the form:
165299529Smm *    "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..."
166299529Smm * the list of libraries described here will vary depending on how
167299529Smm * libarchive was compiled.
168299529Smm */
169299529Smm__LA_DECL const char *	archive_version_details(void);
170299529Smm
171299529Smm/*
172299529Smm * Returns NULL if libarchive was compiled without the associated library.
173299529Smm * Otherwise, returns the version number that libarchive was compiled
174299529Smm * against.
175299529Smm */
176299529Smm__LA_DECL const char *  archive_zlib_version(void);
177299529Smm__LA_DECL const char *  archive_liblzma_version(void);
178299529Smm__LA_DECL const char *  archive_bzlib_version(void);
179299529Smm__LA_DECL const char *  archive_liblz4_version(void);
180324417Smm__LA_DECL const char *  archive_libzstd_version(void);
181299529Smm
182228753Smm/* Declare our basic types. */
183228753Smmstruct archive;
184228753Smmstruct archive_entry;
185228753Smm
186228753Smm/*
187228753Smm * Error codes: Use archive_errno() and archive_error_string()
188228753Smm * to retrieve details.  Unless specified otherwise, all functions
189228753Smm * that return 'int' use these codes.
190228753Smm */
191228753Smm#define	ARCHIVE_EOF	  1	/* Found end of archive. */
192228753Smm#define	ARCHIVE_OK	  0	/* Operation was successful. */
193228753Smm#define	ARCHIVE_RETRY	(-10)	/* Retry might succeed. */
194228753Smm#define	ARCHIVE_WARN	(-20)	/* Partial success. */
195228753Smm/* For example, if write_header "fails", then you can't push data. */
196228753Smm#define	ARCHIVE_FAILED	(-25)	/* Current operation cannot complete. */
197228753Smm/* But if write_header is "fatal," then this archive is dead and useless. */
198228753Smm#define	ARCHIVE_FATAL	(-30)	/* No more operations are possible. */
199228753Smm
200228753Smm/*
201228753Smm * As far as possible, archive_errno returns standard platform errno codes.
202228753Smm * Of course, the details vary by platform, so the actual definitions
203228753Smm * here are stored in "archive_platform.h".  The symbols are listed here
204228753Smm * for reference; as a rule, clients should not need to know the exact
205228753Smm * platform-dependent error code.
206228753Smm */
207228753Smm/* Unrecognized or invalid file format. */
208228753Smm/* #define	ARCHIVE_ERRNO_FILE_FORMAT */
209228753Smm/* Illegal usage of the library. */
210228753Smm/* #define	ARCHIVE_ERRNO_PROGRAMMER_ERROR */
211228753Smm/* Unknown or unclassified error. */
212228753Smm/* #define	ARCHIVE_ERRNO_MISC */
213228753Smm
214228753Smm/*
215228753Smm * Callbacks are invoked to automatically read/skip/write/open/close the
216228753Smm * archive. You can provide your own for complex tasks (like breaking
217228753Smm * archives across multiple tapes) or use standard ones built into the
218228753Smm * library.
219228753Smm */
220228753Smm
221228753Smm/* Returns pointer and size of next block of data from archive. */
222299529Smmtypedef la_ssize_t	archive_read_callback(struct archive *,
223228753Smm			    void *_client_data, const void **_buffer);
224228753Smm
225232153Smm/* Skips at most request bytes from archive and returns the skipped amount.
226232153Smm * This may skip fewer bytes than requested; it may even skip zero bytes.
227232153Smm * If you do skip fewer bytes than requested, libarchive will invoke your
228232153Smm * read callback and discard data as necessary to make up the full skip.
229232153Smm */
230299529Smmtypedef la_int64_t	archive_skip_callback(struct archive *,
231299529Smm			    void *_client_data, la_int64_t request);
232228753Smm
233232153Smm/* Seeks to specified location in the file and returns the position.
234232153Smm * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h.
235232153Smm * Return ARCHIVE_FATAL if the seek fails for any reason.
236232153Smm */
237299529Smmtypedef la_int64_t	archive_seek_callback(struct archive *,
238299529Smm    void *_client_data, la_int64_t offset, int whence);
239232153Smm
240228753Smm/* Returns size actually written, zero on EOF, -1 on error. */
241299529Smmtypedef la_ssize_t	archive_write_callback(struct archive *,
242228753Smm			    void *_client_data,
243228753Smm			    const void *_buffer, size_t _length);
244228753Smm
245228753Smmtypedef int	archive_open_callback(struct archive *, void *_client_data);
246228753Smm
247228753Smmtypedef int	archive_close_callback(struct archive *, void *_client_data);
248228753Smm
249368707Smmtypedef int	archive_free_callback(struct archive *, void *_client_data);
250368707Smm
251248616Smm/* Switches from one client data object to the next/prev client data object.
252248616Smm * This is useful for reading from different data blocks such as a set of files
253248616Smm * that make up one large file.
254248616Smm */
255248616Smmtypedef int archive_switch_callback(struct archive *, void *_client_data1,
256248616Smm			    void *_client_data2);
257248616Smm
258228753Smm/*
259299529Smm * Returns a passphrase used for encryption or decryption, NULL on nothing
260299529Smm * to do and give it up.
261299529Smm */
262299529Smmtypedef const char *archive_passphrase_callback(struct archive *,
263299529Smm			    void *_client_data);
264299529Smm
265299529Smm/*
266232153Smm * Codes to identify various stream filters.
267228753Smm */
268232153Smm#define	ARCHIVE_FILTER_NONE	0
269232153Smm#define	ARCHIVE_FILTER_GZIP	1
270232153Smm#define	ARCHIVE_FILTER_BZIP2	2
271232153Smm#define	ARCHIVE_FILTER_COMPRESS	3
272232153Smm#define	ARCHIVE_FILTER_PROGRAM	4
273232153Smm#define	ARCHIVE_FILTER_LZMA	5
274232153Smm#define	ARCHIVE_FILTER_XZ	6
275232153Smm#define	ARCHIVE_FILTER_UU	7
276232153Smm#define	ARCHIVE_FILTER_RPM	8
277232153Smm#define	ARCHIVE_FILTER_LZIP	9
278248616Smm#define	ARCHIVE_FILTER_LRZIP	10
279248616Smm#define	ARCHIVE_FILTER_LZOP	11
280248616Smm#define	ARCHIVE_FILTER_GRZIP	12
281299529Smm#define	ARCHIVE_FILTER_LZ4	13
282324417Smm#define	ARCHIVE_FILTER_ZSTD	14
283228753Smm
284232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
285232153Smm#define	ARCHIVE_COMPRESSION_NONE	ARCHIVE_FILTER_NONE
286232153Smm#define	ARCHIVE_COMPRESSION_GZIP	ARCHIVE_FILTER_GZIP
287232153Smm#define	ARCHIVE_COMPRESSION_BZIP2	ARCHIVE_FILTER_BZIP2
288232153Smm#define	ARCHIVE_COMPRESSION_COMPRESS	ARCHIVE_FILTER_COMPRESS
289232153Smm#define	ARCHIVE_COMPRESSION_PROGRAM	ARCHIVE_FILTER_PROGRAM
290232153Smm#define	ARCHIVE_COMPRESSION_LZMA	ARCHIVE_FILTER_LZMA
291232153Smm#define	ARCHIVE_COMPRESSION_XZ		ARCHIVE_FILTER_XZ
292232153Smm#define	ARCHIVE_COMPRESSION_UU		ARCHIVE_FILTER_UU
293232153Smm#define	ARCHIVE_COMPRESSION_RPM		ARCHIVE_FILTER_RPM
294232153Smm#define	ARCHIVE_COMPRESSION_LZIP	ARCHIVE_FILTER_LZIP
295248616Smm#define	ARCHIVE_COMPRESSION_LRZIP	ARCHIVE_FILTER_LRZIP
296232153Smm#endif
297232153Smm
298228753Smm/*
299228753Smm * Codes returned by archive_format.
300228753Smm *
301228753Smm * Top 16 bits identifies the format family (e.g., "tar"); lower
302228753Smm * 16 bits indicate the variant.  This is updated by read_next_header.
303228753Smm * Note that the lower 16 bits will often vary from entry to entry.
304228753Smm * In some cases, this variation occurs as libarchive learns more about
305228753Smm * the archive (for example, later entries might utilize extensions that
306228753Smm * weren't necessary earlier in the archive; in this case, libarchive
307228753Smm * will change the format code to indicate the extended format that
308228753Smm * was used).  In other cases, it's because different tools have
309228753Smm * modified the archive and so different parts of the archive
310232153Smm * actually have slightly different formats.  (Both tar and cpio store
311228753Smm * format codes in each entry, so it is quite possible for each
312228753Smm * entry to be in a different format.)
313228753Smm */
314228753Smm#define	ARCHIVE_FORMAT_BASE_MASK		0xff0000
315228753Smm#define	ARCHIVE_FORMAT_CPIO			0x10000
316228753Smm#define	ARCHIVE_FORMAT_CPIO_POSIX		(ARCHIVE_FORMAT_CPIO | 1)
317228753Smm#define	ARCHIVE_FORMAT_CPIO_BIN_LE		(ARCHIVE_FORMAT_CPIO | 2)
318228753Smm#define	ARCHIVE_FORMAT_CPIO_BIN_BE		(ARCHIVE_FORMAT_CPIO | 3)
319228753Smm#define	ARCHIVE_FORMAT_CPIO_SVR4_NOCRC		(ARCHIVE_FORMAT_CPIO | 4)
320228753Smm#define	ARCHIVE_FORMAT_CPIO_SVR4_CRC		(ARCHIVE_FORMAT_CPIO | 5)
321232153Smm#define	ARCHIVE_FORMAT_CPIO_AFIO_LARGE		(ARCHIVE_FORMAT_CPIO | 6)
322370535Sgit2svn#define	ARCHIVE_FORMAT_CPIO_PWB			(ARCHIVE_FORMAT_CPIO | 7)
323228753Smm#define	ARCHIVE_FORMAT_SHAR			0x20000
324228753Smm#define	ARCHIVE_FORMAT_SHAR_BASE		(ARCHIVE_FORMAT_SHAR | 1)
325228753Smm#define	ARCHIVE_FORMAT_SHAR_DUMP		(ARCHIVE_FORMAT_SHAR | 2)
326228753Smm#define	ARCHIVE_FORMAT_TAR			0x30000
327228753Smm#define	ARCHIVE_FORMAT_TAR_USTAR		(ARCHIVE_FORMAT_TAR | 1)
328228753Smm#define	ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE	(ARCHIVE_FORMAT_TAR | 2)
329228753Smm#define	ARCHIVE_FORMAT_TAR_PAX_RESTRICTED	(ARCHIVE_FORMAT_TAR | 3)
330228753Smm#define	ARCHIVE_FORMAT_TAR_GNUTAR		(ARCHIVE_FORMAT_TAR | 4)
331228753Smm#define	ARCHIVE_FORMAT_ISO9660			0x40000
332228753Smm#define	ARCHIVE_FORMAT_ISO9660_ROCKRIDGE	(ARCHIVE_FORMAT_ISO9660 | 1)
333228753Smm#define	ARCHIVE_FORMAT_ZIP			0x50000
334228753Smm#define	ARCHIVE_FORMAT_EMPTY			0x60000
335228753Smm#define	ARCHIVE_FORMAT_AR			0x70000
336228753Smm#define	ARCHIVE_FORMAT_AR_GNU			(ARCHIVE_FORMAT_AR | 1)
337228753Smm#define	ARCHIVE_FORMAT_AR_BSD			(ARCHIVE_FORMAT_AR | 2)
338228753Smm#define	ARCHIVE_FORMAT_MTREE			0x80000
339228753Smm#define	ARCHIVE_FORMAT_RAW			0x90000
340228753Smm#define	ARCHIVE_FORMAT_XAR			0xA0000
341232153Smm#define	ARCHIVE_FORMAT_LHA			0xB0000
342232153Smm#define	ARCHIVE_FORMAT_CAB			0xC0000
343232153Smm#define	ARCHIVE_FORMAT_RAR			0xD0000
344232153Smm#define	ARCHIVE_FORMAT_7ZIP			0xE0000
345299529Smm#define	ARCHIVE_FORMAT_WARC			0xF0000
346348607Smm#define	ARCHIVE_FORMAT_RAR_V5			0x100000
347228753Smm
348299529Smm/*
349299529Smm * Codes returned by archive_read_format_capabilities().
350299529Smm *
351299529Smm * This list can be extended with values between 0 and 0xffff.
352299529Smm * The original purpose of this list was to let different archive
353299529Smm * format readers expose their general capabilities in terms of
354299529Smm * encryption.
355299529Smm */
356299529Smm#define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */
357299529Smm#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0)  /* reader can detect encrypted data */
358299529Smm#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1)  /* reader can detect encryptable metadata (pathname, mtime, etc.) */
359299529Smm
360299529Smm/*
361299529Smm * Codes returned by archive_read_has_encrypted_entries().
362299529Smm *
363299529Smm * In case the archive does not support encryption detection at all
364299529Smm * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader
365299529Smm * for some other reason (e.g. not enough bytes read) cannot say if
366299529Smm * there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW
367299529Smm * is returned.
368299529Smm */
369299529Smm#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2
370299529Smm#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1
371299529Smm
372228753Smm/*-
373228753Smm * Basic outline for reading an archive:
374228753Smm *   1) Ask archive_read_new for an archive reader object.
375228753Smm *   2) Update any global properties as appropriate.
376228753Smm *      In particular, you'll certainly want to call appropriate
377228753Smm *      archive_read_support_XXX functions.
378228753Smm *   3) Call archive_read_open_XXX to open the archive
379228753Smm *   4) Repeatedly call archive_read_next_header to get information about
380228753Smm *      successive archive entries.  Call archive_read_data to extract
381228753Smm *      data for entries of interest.
382311041Smm *   5) Call archive_read_free to end processing.
383228753Smm */
384228753Smm__LA_DECL struct archive	*archive_read_new(void);
385228753Smm
386228753Smm/*
387228753Smm * The archive_read_support_XXX calls enable auto-detect for this
388228753Smm * archive handle.  They also link in the necessary support code.
389228753Smm * For example, if you don't want bzlib linked in, don't invoke
390228753Smm * support_compression_bzip2().  The "all" functions provide the
391228753Smm * obvious shorthand.
392228753Smm */
393232153Smm
394232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
395248616Smm__LA_DECL int archive_read_support_compression_all(struct archive *)
396248616Smm		__LA_DEPRECATED;
397248616Smm__LA_DECL int archive_read_support_compression_bzip2(struct archive *)
398248616Smm		__LA_DEPRECATED;
399248616Smm__LA_DECL int archive_read_support_compression_compress(struct archive *)
400248616Smm		__LA_DEPRECATED;
401248616Smm__LA_DECL int archive_read_support_compression_gzip(struct archive *)
402248616Smm		__LA_DEPRECATED;
403248616Smm__LA_DECL int archive_read_support_compression_lzip(struct archive *)
404248616Smm		__LA_DEPRECATED;
405248616Smm__LA_DECL int archive_read_support_compression_lzma(struct archive *)
406248616Smm		__LA_DEPRECATED;
407248616Smm__LA_DECL int archive_read_support_compression_none(struct archive *)
408248616Smm		__LA_DEPRECATED;
409232153Smm__LA_DECL int archive_read_support_compression_program(struct archive *,
410248616Smm		     const char *command) __LA_DEPRECATED;
411232153Smm__LA_DECL int archive_read_support_compression_program_signature
412232153Smm		(struct archive *, const char *,
413248616Smm		 const void * /* match */, size_t) __LA_DEPRECATED;
414228753Smm
415248616Smm__LA_DECL int archive_read_support_compression_rpm(struct archive *)
416248616Smm		__LA_DEPRECATED;
417248616Smm__LA_DECL int archive_read_support_compression_uu(struct archive *)
418248616Smm		__LA_DEPRECATED;
419248616Smm__LA_DECL int archive_read_support_compression_xz(struct archive *)
420248616Smm		__LA_DEPRECATED;
421232153Smm#endif
422228753Smm
423232153Smm__LA_DECL int archive_read_support_filter_all(struct archive *);
424368707Smm__LA_DECL int archive_read_support_filter_by_code(struct archive *, int);
425232153Smm__LA_DECL int archive_read_support_filter_bzip2(struct archive *);
426232153Smm__LA_DECL int archive_read_support_filter_compress(struct archive *);
427232153Smm__LA_DECL int archive_read_support_filter_gzip(struct archive *);
428248616Smm__LA_DECL int archive_read_support_filter_grzip(struct archive *);
429248616Smm__LA_DECL int archive_read_support_filter_lrzip(struct archive *);
430299529Smm__LA_DECL int archive_read_support_filter_lz4(struct archive *);
431232153Smm__LA_DECL int archive_read_support_filter_lzip(struct archive *);
432232153Smm__LA_DECL int archive_read_support_filter_lzma(struct archive *);
433248616Smm__LA_DECL int archive_read_support_filter_lzop(struct archive *);
434232153Smm__LA_DECL int archive_read_support_filter_none(struct archive *);
435232153Smm__LA_DECL int archive_read_support_filter_program(struct archive *,
436232153Smm		     const char *command);
437232153Smm__LA_DECL int archive_read_support_filter_program_signature
438248616Smm		(struct archive *, const char * /* cmd */,
439232153Smm				    const void * /* match */, size_t);
440232153Smm__LA_DECL int archive_read_support_filter_rpm(struct archive *);
441232153Smm__LA_DECL int archive_read_support_filter_uu(struct archive *);
442232153Smm__LA_DECL int archive_read_support_filter_xz(struct archive *);
443324417Smm__LA_DECL int archive_read_support_filter_zstd(struct archive *);
444228753Smm
445232153Smm__LA_DECL int archive_read_support_format_7zip(struct archive *);
446232153Smm__LA_DECL int archive_read_support_format_all(struct archive *);
447232153Smm__LA_DECL int archive_read_support_format_ar(struct archive *);
448232153Smm__LA_DECL int archive_read_support_format_by_code(struct archive *, int);
449232153Smm__LA_DECL int archive_read_support_format_cab(struct archive *);
450232153Smm__LA_DECL int archive_read_support_format_cpio(struct archive *);
451232153Smm__LA_DECL int archive_read_support_format_empty(struct archive *);
452232153Smm__LA_DECL int archive_read_support_format_gnutar(struct archive *);
453232153Smm__LA_DECL int archive_read_support_format_iso9660(struct archive *);
454232153Smm__LA_DECL int archive_read_support_format_lha(struct archive *);
455232153Smm__LA_DECL int archive_read_support_format_mtree(struct archive *);
456232153Smm__LA_DECL int archive_read_support_format_rar(struct archive *);
457342360Smm__LA_DECL int archive_read_support_format_rar5(struct archive *);
458232153Smm__LA_DECL int archive_read_support_format_raw(struct archive *);
459232153Smm__LA_DECL int archive_read_support_format_tar(struct archive *);
460299529Smm__LA_DECL int archive_read_support_format_warc(struct archive *);
461232153Smm__LA_DECL int archive_read_support_format_xar(struct archive *);
462299529Smm/* archive_read_support_format_zip() enables both streamable and seekable
463299529Smm * zip readers. */
464232153Smm__LA_DECL int archive_read_support_format_zip(struct archive *);
465299529Smm/* Reads Zip archives as stream from beginning to end.  Doesn't
466299529Smm * correctly handle SFX ZIP files or ZIP archives that have been modified
467299529Smm * in-place. */
468299529Smm__LA_DECL int archive_read_support_format_zip_streamable(struct archive *);
469299529Smm/* Reads starting from central directory; requires seekable input. */
470299529Smm__LA_DECL int archive_read_support_format_zip_seekable(struct archive *);
471232153Smm
472248616Smm/* Functions to manually set the format and filters to be used. This is
473248616Smm * useful to bypass the bidding process when the format and filters to use
474248616Smm * is known in advance.
475248616Smm */
476248616Smm__LA_DECL int archive_read_set_format(struct archive *, int);
477248616Smm__LA_DECL int archive_read_append_filter(struct archive *, int);
478248616Smm__LA_DECL int archive_read_append_filter_program(struct archive *,
479248616Smm    const char *);
480248616Smm__LA_DECL int archive_read_append_filter_program_signature
481248616Smm    (struct archive *, const char *, const void * /* match */, size_t);
482248616Smm
483232153Smm/* Set various callbacks. */
484232153Smm__LA_DECL int archive_read_set_open_callback(struct archive *,
485232153Smm    archive_open_callback *);
486232153Smm__LA_DECL int archive_read_set_read_callback(struct archive *,
487232153Smm    archive_read_callback *);
488232153Smm__LA_DECL int archive_read_set_seek_callback(struct archive *,
489232153Smm    archive_seek_callback *);
490232153Smm__LA_DECL int archive_read_set_skip_callback(struct archive *,
491232153Smm    archive_skip_callback *);
492232153Smm__LA_DECL int archive_read_set_close_callback(struct archive *,
493232153Smm    archive_close_callback *);
494248616Smm/* Callback used to switch between one data object to the next */
495248616Smm__LA_DECL int archive_read_set_switch_callback(struct archive *,
496248616Smm    archive_switch_callback *);
497248616Smm
498248616Smm/* This sets the first data object. */
499232153Smm__LA_DECL int archive_read_set_callback_data(struct archive *, void *);
500248616Smm/* This sets data object at specified index */
501248616Smm__LA_DECL int archive_read_set_callback_data2(struct archive *, void *,
502248616Smm    unsigned int);
503248616Smm/* This adds a data object at the specified index. */
504248616Smm__LA_DECL int archive_read_add_callback_data(struct archive *, void *,
505248616Smm    unsigned int);
506248616Smm/* This appends a data object to the end of list */
507248616Smm__LA_DECL int archive_read_append_callback_data(struct archive *, void *);
508248616Smm/* This prepends a data object to the beginning of list */
509248616Smm__LA_DECL int archive_read_prepend_callback_data(struct archive *, void *);
510248616Smm
511232153Smm/* Opening freezes the callbacks. */
512232153Smm__LA_DECL int archive_read_open1(struct archive *);
513232153Smm
514232153Smm/* Convenience wrappers around the above. */
515232153Smm__LA_DECL int archive_read_open(struct archive *, void *_client_data,
516228753Smm		     archive_open_callback *, archive_read_callback *,
517228753Smm		     archive_close_callback *);
518232153Smm__LA_DECL int archive_read_open2(struct archive *, void *_client_data,
519228753Smm		     archive_open_callback *, archive_read_callback *,
520228753Smm		     archive_skip_callback *, archive_close_callback *);
521228753Smm
522228753Smm/*
523228753Smm * A variety of shortcuts that invoke archive_read_open() with
524228753Smm * canned callbacks suitable for common situations.  The ones that
525228753Smm * accept a block size handle tape blocking correctly.
526228753Smm */
527228753Smm/* Use this if you know the filename.  Note: NULL indicates stdin. */
528232153Smm__LA_DECL int archive_read_open_filename(struct archive *,
529228753Smm		     const char *_filename, size_t _block_size);
530248616Smm/* Use this for reading multivolume files by filenames.
531248616Smm * NOTE: Must be NULL terminated. Sorting is NOT done. */
532248616Smm__LA_DECL int archive_read_open_filenames(struct archive *,
533248616Smm		     const char **_filenames, size_t _block_size);
534232153Smm__LA_DECL int archive_read_open_filename_w(struct archive *,
535232153Smm		     const wchar_t *_filename, size_t _block_size);
536228753Smm/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
537232153Smm__LA_DECL int archive_read_open_file(struct archive *,
538248616Smm		     const char *_filename, size_t _block_size) __LA_DEPRECATED;
539228753Smm/* Read an archive that's stored in memory. */
540232153Smm__LA_DECL int archive_read_open_memory(struct archive *,
541299529Smm		     const void * buff, size_t size);
542228753Smm/* A more involved version that is only used for internal testing. */
543299529Smm__LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff,
544228753Smm		     size_t size, size_t read_size);
545228753Smm/* Read an archive that's already open, using the file descriptor. */
546232153Smm__LA_DECL int archive_read_open_fd(struct archive *, int _fd,
547228753Smm		     size_t _block_size);
548228753Smm/* Read an archive that's already open, using a FILE *. */
549228753Smm/* Note: DO NOT use this with tape drives. */
550232153Smm__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);
551228753Smm
552228753Smm/* Parses and returns next entry header. */
553232153Smm__LA_DECL int archive_read_next_header(struct archive *,
554228753Smm		     struct archive_entry **);
555228753Smm
556228753Smm/* Parses and returns next entry header using the archive_entry passed in */
557232153Smm__LA_DECL int archive_read_next_header2(struct archive *,
558228753Smm		     struct archive_entry *);
559228753Smm
560228753Smm/*
561228753Smm * Retrieve the byte offset in UNCOMPRESSED data where last-read
562228753Smm * header started.
563228753Smm */
564299529Smm__LA_DECL la_int64_t		 archive_read_header_position(struct archive *);
565228753Smm
566299529Smm/*
567299529Smm * Returns 1 if the archive contains at least one encrypted entry.
568299529Smm * If the archive format not support encryption at all
569299529Smm * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned.
570299529Smm * If for any other reason (e.g. not enough data read so far)
571299529Smm * we cannot say whether there are encrypted entries, then
572299529Smm * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned.
573299529Smm * In general, this function will return values below zero when the
574311041Smm * reader is uncertain or totally incapable of encryption support.
575299529Smm * When this function returns 0 you can be sure that the reader
576299529Smm * supports encryption detection but no encrypted entries have
577299529Smm * been found yet.
578299529Smm *
579299529Smm * NOTE: If the metadata/header of an archive is also encrypted, you
580299529Smm * cannot rely on the number of encrypted entries. That is why this
581299529Smm * function does not return the number of encrypted entries but#
582299529Smm * just shows that there are some.
583299529Smm */
584299529Smm__LA_DECL int	archive_read_has_encrypted_entries(struct archive *);
585299529Smm
586299529Smm/*
587299529Smm * Returns a bitmask of capabilities that are supported by the archive format reader.
588299529Smm * If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned.
589299529Smm */
590299529Smm__LA_DECL int		 archive_read_format_capabilities(struct archive *);
591299529Smm
592228753Smm/* Read data from the body of an entry.  Similar to read(2). */
593299529Smm__LA_DECL la_ssize_t		 archive_read_data(struct archive *,
594228753Smm				    void *, size_t);
595228753Smm
596248616Smm/* Seek within the body of an entry.  Similar to lseek(2). */
597299529Smm__LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int);
598248616Smm
599228753Smm/*
600228753Smm * A zero-copy version of archive_read_data that also exposes the file offset
601228753Smm * of each returned block.  Note that the client has no way to specify
602228753Smm * the desired size of the block.  The API does guarantee that offsets will
603228753Smm * be strictly increasing and that returned blocks will not overlap.
604228753Smm */
605232153Smm__LA_DECL int archive_read_data_block(struct archive *a,
606299529Smm		    const void **buff, size_t *size, la_int64_t *offset);
607228753Smm
608228753Smm/*-
609228753Smm * Some convenience functions that are built on archive_read_data:
610228753Smm *  'skip': skips entire entry
611228753Smm *  'into_buffer': writes data into memory buffer that you provide
612228753Smm *  'into_fd': writes data to specified filedes
613228753Smm */
614232153Smm__LA_DECL int archive_read_data_skip(struct archive *);
615232153Smm__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
616228753Smm
617228753Smm/*
618228753Smm * Set read options.
619228753Smm */
620232153Smm/* Apply option to the format only. */
621232153Smm__LA_DECL int archive_read_set_format_option(struct archive *_a,
622232153Smm			    const char *m, const char *o,
623232153Smm			    const char *v);
624232153Smm/* Apply option to the filter only. */
625232153Smm__LA_DECL int archive_read_set_filter_option(struct archive *_a,
626232153Smm			    const char *m, const char *o,
627232153Smm			    const char *v);
628232153Smm/* Apply option to both the format and the filter. */
629232153Smm__LA_DECL int archive_read_set_option(struct archive *_a,
630232153Smm			    const char *m, const char *o,
631232153Smm			    const char *v);
632228753Smm/* Apply option string to both the format and the filter. */
633232153Smm__LA_DECL int archive_read_set_options(struct archive *_a,
634232153Smm			    const char *opts);
635228753Smm
636299529Smm/*
637299529Smm * Add a decryption passphrase.
638299529Smm */
639299529Smm__LA_DECL int archive_read_add_passphrase(struct archive *, const char *);
640299529Smm__LA_DECL int archive_read_set_passphrase_callback(struct archive *,
641299529Smm			    void *client_data, archive_passphrase_callback *);
642299529Smm
643299529Smm
644228753Smm/*-
645228753Smm * Convenience function to recreate the current entry (whose header
646228753Smm * has just been read) on disk.
647228753Smm *
648228753Smm * This does quite a bit more than just copy data to disk. It also:
649228753Smm *  - Creates intermediate directories as required.
650228753Smm *  - Manages directory permissions:  non-writable directories will
651228753Smm *    be initially created with write permission enabled; when the
652228753Smm *    archive is closed, dir permissions are edited to the values specified
653228753Smm *    in the archive.
654228753Smm *  - Checks hardlinks:  hardlinks will not be extracted unless the
655228753Smm *    linked-to file was also extracted within the same session. (TODO)
656228753Smm */
657228753Smm
658228753Smm/* The "flags" argument selects optional behavior, 'OR' the flags you want. */
659228753Smm
660228753Smm/* Default: Do not try to set owner/group. */
661228753Smm#define	ARCHIVE_EXTRACT_OWNER			(0x0001)
662228753Smm/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
663228753Smm#define	ARCHIVE_EXTRACT_PERM			(0x0002)
664228753Smm/* Default: Do not restore mtime/atime. */
665228753Smm#define	ARCHIVE_EXTRACT_TIME			(0x0004)
666228753Smm/* Default: Replace existing files. */
667228753Smm#define	ARCHIVE_EXTRACT_NO_OVERWRITE 		(0x0008)
668228753Smm/* Default: Try create first, unlink only if create fails with EEXIST. */
669228753Smm#define	ARCHIVE_EXTRACT_UNLINK			(0x0010)
670228753Smm/* Default: Do not restore ACLs. */
671228753Smm#define	ARCHIVE_EXTRACT_ACL			(0x0020)
672228753Smm/* Default: Do not restore fflags. */
673228753Smm#define	ARCHIVE_EXTRACT_FFLAGS			(0x0040)
674228753Smm/* Default: Do not restore xattrs. */
675228753Smm#define	ARCHIVE_EXTRACT_XATTR 			(0x0080)
676228753Smm/* Default: Do not try to guard against extracts redirected by symlinks. */
677228753Smm/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
678228753Smm#define	ARCHIVE_EXTRACT_SECURE_SYMLINKS		(0x0100)
679228753Smm/* Default: Do not reject entries with '..' as path elements. */
680228753Smm#define	ARCHIVE_EXTRACT_SECURE_NODOTDOT		(0x0200)
681228753Smm/* Default: Create parent directories as needed. */
682228753Smm#define	ARCHIVE_EXTRACT_NO_AUTODIR		(0x0400)
683228753Smm/* Default: Overwrite files, even if one on disk is newer. */
684228753Smm#define	ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER	(0x0800)
685228753Smm/* Detect blocks of 0 and write holes instead. */
686228753Smm#define	ARCHIVE_EXTRACT_SPARSE			(0x1000)
687232153Smm/* Default: Do not restore Mac extended metadata. */
688232153Smm/* This has no effect except on Mac OS. */
689232153Smm#define	ARCHIVE_EXTRACT_MAC_METADATA		(0x2000)
690248616Smm/* Default: Use HFS+ compression if it was compressed. */
691248616Smm/* This has no effect except on Mac OS v10.6 or later. */
692248616Smm#define	ARCHIVE_EXTRACT_NO_HFS_COMPRESSION	(0x4000)
693248616Smm/* Default: Do not use HFS+ compression if it was not compressed. */
694248616Smm/* This has no effect except on Mac OS v10.6 or later. */
695248616Smm#define	ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED	(0x8000)
696299529Smm/* Default: Do not reject entries with absolute paths */
697299529Smm#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)
698299529Smm/* Default: Do not clear no-change flags when unlinking object */
699299529Smm#define	ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS	(0x20000)
700358088Smm/* Default: Do not extract atomically (using rename) */
701358088Smm#define	ARCHIVE_EXTRACT_SAFE_WRITES		(0x40000)
702228753Smm
703232153Smm__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
704228753Smm		     int flags);
705232153Smm__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,
706228753Smm		     struct archive * /* dest */);
707228753Smm__LA_DECL void	 archive_read_extract_set_progress_callback(struct archive *,
708228753Smm		     void (*_progress_func)(void *), void *_user_data);
709228753Smm
710228753Smm/* Record the dev/ino of a file that will not be written.  This is
711228753Smm * generally set to the dev/ino of the archive being read. */
712228753Smm__LA_DECL void		archive_read_extract_set_skip_file(struct archive *,
713299529Smm		     la_int64_t, la_int64_t);
714228753Smm
715228753Smm/* Close the file and release most resources. */
716228753Smm__LA_DECL int		 archive_read_close(struct archive *);
717228753Smm/* Release all resources and destroy the object. */
718228773Smm/* Note that archive_read_free will call archive_read_close for you. */
719228773Smm__LA_DECL int		 archive_read_free(struct archive *);
720228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000
721228773Smm/* Synonym for archive_read_free() for backwards compatibility. */
722248616Smm__LA_DECL int		 archive_read_finish(struct archive *) __LA_DEPRECATED;
723228753Smm#endif
724228753Smm
725228753Smm/*-
726228753Smm * To create an archive:
727232153Smm *   1) Ask archive_write_new for an archive writer object.
728228753Smm *   2) Set any global properties.  In particular, you should set
729228753Smm *      the compression and format to use.
730228753Smm *   3) Call archive_write_open to open the file (most people
731228753Smm *       will use archive_write_open_file or archive_write_open_fd,
732228753Smm *       which provide convenient canned I/O callbacks for you).
733228753Smm *   4) For each entry:
734228753Smm *      - construct an appropriate struct archive_entry structure
735228753Smm *      - archive_write_header to write the header
736228753Smm *      - archive_write_data to write the entry data
737228753Smm *   5) archive_write_close to close the output
738228773Smm *   6) archive_write_free to cleanup the writer and release resources
739228753Smm */
740228753Smm__LA_DECL struct archive	*archive_write_new(void);
741232153Smm__LA_DECL int archive_write_set_bytes_per_block(struct archive *,
742228753Smm		     int bytes_per_block);
743232153Smm__LA_DECL int archive_write_get_bytes_per_block(struct archive *);
744228753Smm/* XXX This is badly misnamed; suggestions appreciated. XXX */
745232153Smm__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,
746228753Smm		     int bytes_in_last_block);
747232153Smm__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);
748228753Smm
749228753Smm/* The dev/ino of a file that won't be archived.  This is used
750228753Smm * to avoid recursively adding an archive to itself. */
751232153Smm__LA_DECL int archive_write_set_skip_file(struct archive *,
752299529Smm    la_int64_t, la_int64_t);
753228753Smm
754232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
755248616Smm__LA_DECL int archive_write_set_compression_bzip2(struct archive *)
756248616Smm		__LA_DEPRECATED;
757248616Smm__LA_DECL int archive_write_set_compression_compress(struct archive *)
758248616Smm		__LA_DEPRECATED;
759248616Smm__LA_DECL int archive_write_set_compression_gzip(struct archive *)
760248616Smm		__LA_DEPRECATED;
761248616Smm__LA_DECL int archive_write_set_compression_lzip(struct archive *)
762248616Smm		__LA_DEPRECATED;
763248616Smm__LA_DECL int archive_write_set_compression_lzma(struct archive *)
764248616Smm		__LA_DEPRECATED;
765248616Smm__LA_DECL int archive_write_set_compression_none(struct archive *)
766248616Smm		__LA_DEPRECATED;
767232153Smm__LA_DECL int archive_write_set_compression_program(struct archive *,
768248616Smm		     const char *cmd) __LA_DEPRECATED;
769248616Smm__LA_DECL int archive_write_set_compression_xz(struct archive *)
770248616Smm		__LA_DEPRECATED;
771232153Smm#endif
772232153Smm
773238856Smm/* A convenience function to set the filter based on the code. */
774238856Smm__LA_DECL int archive_write_add_filter(struct archive *, int filter_code);
775248616Smm__LA_DECL int archive_write_add_filter_by_name(struct archive *,
776248616Smm		     const char *name);
777248616Smm__LA_DECL int archive_write_add_filter_b64encode(struct archive *);
778232153Smm__LA_DECL int archive_write_add_filter_bzip2(struct archive *);
779232153Smm__LA_DECL int archive_write_add_filter_compress(struct archive *);
780248616Smm__LA_DECL int archive_write_add_filter_grzip(struct archive *);
781232153Smm__LA_DECL int archive_write_add_filter_gzip(struct archive *);
782248616Smm__LA_DECL int archive_write_add_filter_lrzip(struct archive *);
783299529Smm__LA_DECL int archive_write_add_filter_lz4(struct archive *);
784232153Smm__LA_DECL int archive_write_add_filter_lzip(struct archive *);
785232153Smm__LA_DECL int archive_write_add_filter_lzma(struct archive *);
786248616Smm__LA_DECL int archive_write_add_filter_lzop(struct archive *);
787232153Smm__LA_DECL int archive_write_add_filter_none(struct archive *);
788232153Smm__LA_DECL int archive_write_add_filter_program(struct archive *,
789232153Smm		     const char *cmd);
790248616Smm__LA_DECL int archive_write_add_filter_uuencode(struct archive *);
791232153Smm__LA_DECL int archive_write_add_filter_xz(struct archive *);
792324417Smm__LA_DECL int archive_write_add_filter_zstd(struct archive *);
793232153Smm
794232153Smm
795228753Smm/* A convenience function to set the format based on the code or name. */
796232153Smm__LA_DECL int archive_write_set_format(struct archive *, int format_code);
797232153Smm__LA_DECL int archive_write_set_format_by_name(struct archive *,
798228753Smm		     const char *name);
799228753Smm/* To minimize link pollution, use one or more of the following. */
800232153Smm__LA_DECL int archive_write_set_format_7zip(struct archive *);
801232153Smm__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
802232153Smm__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
803232153Smm__LA_DECL int archive_write_set_format_cpio(struct archive *);
804370535Sgit2svn__LA_DECL int archive_write_set_format_cpio_bin(struct archive *);
805232153Smm__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
806370535Sgit2svn__LA_DECL int archive_write_set_format_cpio_odc(struct archive *);
807370535Sgit2svn__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *);
808232153Smm__LA_DECL int archive_write_set_format_gnutar(struct archive *);
809232153Smm__LA_DECL int archive_write_set_format_iso9660(struct archive *);
810232153Smm__LA_DECL int archive_write_set_format_mtree(struct archive *);
811248616Smm__LA_DECL int archive_write_set_format_mtree_classic(struct archive *);
812228753Smm/* TODO: int archive_write_set_format_old_tar(struct archive *); */
813232153Smm__LA_DECL int archive_write_set_format_pax(struct archive *);
814232153Smm__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);
815299529Smm__LA_DECL int archive_write_set_format_raw(struct archive *);
816232153Smm__LA_DECL int archive_write_set_format_shar(struct archive *);
817232153Smm__LA_DECL int archive_write_set_format_shar_dump(struct archive *);
818232153Smm__LA_DECL int archive_write_set_format_ustar(struct archive *);
819248616Smm__LA_DECL int archive_write_set_format_v7tar(struct archive *);
820299529Smm__LA_DECL int archive_write_set_format_warc(struct archive *);
821232153Smm__LA_DECL int archive_write_set_format_xar(struct archive *);
822232153Smm__LA_DECL int archive_write_set_format_zip(struct archive *);
823299529Smm__LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename);
824299529Smm__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext);
825248616Smm__LA_DECL int archive_write_zip_set_compression_deflate(struct archive *);
826248616Smm__LA_DECL int archive_write_zip_set_compression_store(struct archive *);
827368707Smm/* Deprecated; use archive_write_open2 instead */
828232153Smm__LA_DECL int archive_write_open(struct archive *, void *,
829228753Smm		     archive_open_callback *, archive_write_callback *,
830228753Smm		     archive_close_callback *);
831368707Smm__LA_DECL int archive_write_open2(struct archive *, void *,
832368707Smm		     archive_open_callback *, archive_write_callback *,
833368707Smm		     archive_close_callback *, archive_free_callback *);
834232153Smm__LA_DECL int archive_write_open_fd(struct archive *, int _fd);
835232153Smm__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
836232153Smm__LA_DECL int archive_write_open_filename_w(struct archive *,
837232153Smm		     const wchar_t *_file);
838228753Smm/* A deprecated synonym for archive_write_open_filename() */
839248616Smm__LA_DECL int archive_write_open_file(struct archive *, const char *_file)
840248616Smm		__LA_DEPRECATED;
841232153Smm__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);
842228753Smm/* _buffSize is the size of the buffer, _used refers to a variable that
843228753Smm * will be updated after each write into the buffer. */
844232153Smm__LA_DECL int archive_write_open_memory(struct archive *,
845228753Smm			void *_buffer, size_t _buffSize, size_t *_used);
846228753Smm
847228753Smm/*
848228753Smm * Note that the library will truncate writes beyond the size provided
849228753Smm * to archive_write_header or pad if the provided data is short.
850228753Smm */
851232153Smm__LA_DECL int archive_write_header(struct archive *,
852228753Smm		     struct archive_entry *);
853299529Smm__LA_DECL la_ssize_t	archive_write_data(struct archive *,
854228753Smm			    const void *, size_t);
855228753Smm
856232153Smm/* This interface is currently only available for archive_write_disk handles.  */
857299529Smm__LA_DECL la_ssize_t	 archive_write_data_block(struct archive *,
858299529Smm				    const void *, size_t, la_int64_t);
859232153Smm
860228753Smm__LA_DECL int		 archive_write_finish_entry(struct archive *);
861228753Smm__LA_DECL int		 archive_write_close(struct archive *);
862248616Smm/* Marks the archive as FATAL so that a subsequent free() operation
863248616Smm * won't try to close() cleanly.  Provides a fast abort capability
864248616Smm * when the client discovers that things have gone wrong. */
865248616Smm__LA_DECL int            archive_write_fail(struct archive *);
866228773Smm/* This can fail if the archive wasn't already closed, in which case
867228773Smm * archive_write_free() will implicitly call archive_write_close(). */
868228773Smm__LA_DECL int		 archive_write_free(struct archive *);
869228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000
870228773Smm/* Synonym for archive_write_free() for backwards compatibility. */
871248616Smm__LA_DECL int		 archive_write_finish(struct archive *) __LA_DEPRECATED;
872228753Smm#endif
873228753Smm
874228753Smm/*
875228753Smm * Set write options.
876228753Smm */
877232153Smm/* Apply option to the format only. */
878232153Smm__LA_DECL int archive_write_set_format_option(struct archive *_a,
879232153Smm			    const char *m, const char *o,
880232153Smm			    const char *v);
881232153Smm/* Apply option to the filter only. */
882232153Smm__LA_DECL int archive_write_set_filter_option(struct archive *_a,
883232153Smm			    const char *m, const char *o,
884232153Smm			    const char *v);
885232153Smm/* Apply option to both the format and the filter. */
886232153Smm__LA_DECL int archive_write_set_option(struct archive *_a,
887232153Smm			    const char *m, const char *o,
888232153Smm			    const char *v);
889232153Smm/* Apply option string to both the format and the filter. */
890232153Smm__LA_DECL int archive_write_set_options(struct archive *_a,
891232153Smm			    const char *opts);
892228753Smm
893299529Smm/*
894299529Smm * Set a encryption passphrase.
895299529Smm */
896299529Smm__LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p);
897299529Smm__LA_DECL int archive_write_set_passphrase_callback(struct archive *,
898299529Smm			    void *client_data, archive_passphrase_callback *);
899299529Smm
900228753Smm/*-
901228753Smm * ARCHIVE_WRITE_DISK API
902228753Smm *
903228753Smm * To create objects on disk:
904228753Smm *   1) Ask archive_write_disk_new for a new archive_write_disk object.
905228753Smm *   2) Set any global properties.  In particular, you probably
906228753Smm *      want to set the options.
907228753Smm *   3) For each entry:
908228753Smm *      - construct an appropriate struct archive_entry structure
909228753Smm *      - archive_write_header to create the file/dir/etc on disk
910228753Smm *      - archive_write_data to write the entry data
911228773Smm *   4) archive_write_free to cleanup the writer and release resources
912228753Smm *
913228753Smm * In particular, you can use this in conjunction with archive_read()
914228753Smm * to pull entries out of an archive and create them on disk.
915228753Smm */
916228753Smm__LA_DECL struct archive	*archive_write_disk_new(void);
917228753Smm/* This file will not be overwritten. */
918232153Smm__LA_DECL int archive_write_disk_set_skip_file(struct archive *,
919299529Smm    la_int64_t, la_int64_t);
920228753Smm/* Set flags to control how the next item gets created.
921228753Smm * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
922228753Smm__LA_DECL int		 archive_write_disk_set_options(struct archive *,
923228753Smm		     int flags);
924228753Smm/*
925228753Smm * The lookup functions are given uname/uid (or gname/gid) pairs and
926228753Smm * return a uid (gid) suitable for this system.  These are used for
927228753Smm * restoring ownership and for setting ACLs.  The default functions
928228753Smm * are naive, they just return the uid/gid.  These are small, so reasonable
929228753Smm * for applications that don't need to preserve ownership; they
930228753Smm * are probably also appropriate for applications that are doing
931228753Smm * same-system backup and restore.
932228753Smm */
933228753Smm/*
934228753Smm * The "standard" lookup functions use common system calls to lookup
935228753Smm * the uname/gname, falling back to the uid/gid if the names can't be
936228753Smm * found.  They cache lookups and are reasonably fast, but can be very
937228753Smm * large, so they are not used unless you ask for them.  In
938228753Smm * particular, these match the specifications of POSIX "pax" and old
939228753Smm * POSIX "tar".
940228753Smm */
941228753Smm__LA_DECL int	 archive_write_disk_set_standard_lookup(struct archive *);
942228753Smm/*
943228753Smm * If neither the default (naive) nor the standard (big) functions suit
944228753Smm * your needs, you can write your own and register them.  Be sure to
945228753Smm * include a cleanup function if you have allocated private data.
946228753Smm */
947232153Smm__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,
948232153Smm    void * /* private_data */,
949299529Smm    la_int64_t (*)(void *, const char *, la_int64_t),
950232153Smm    void (* /* cleanup */)(void *));
951232153Smm__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,
952232153Smm    void * /* private_data */,
953299529Smm    la_int64_t (*)(void *, const char *, la_int64_t),
954232153Smm    void (* /* cleanup */)(void *));
955299529Smm__LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t);
956299529Smm__LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t);
957228753Smm
958228753Smm/*
959228753Smm * ARCHIVE_READ_DISK API
960228753Smm *
961228753Smm * This is still evolving and somewhat experimental.
962228753Smm */
963228753Smm__LA_DECL struct archive *archive_read_disk_new(void);
964228753Smm/* The names for symlink modes here correspond to an old BSD
965228753Smm * command-line argument convention: -L, -P, -H */
966228753Smm/* Follow all symlinks. */
967228753Smm__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
968228753Smm/* Follow no symlinks. */
969228753Smm__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
970228753Smm/* Follow symlink initially, then not. */
971228753Smm__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
972228753Smm/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
973228753Smm__LA_DECL int archive_read_disk_entry_from_file(struct archive *,
974228753Smm    struct archive_entry *, int /* fd */, const struct stat *);
975228753Smm/* Look up gname for gid or uname for uid. */
976228753Smm/* Default implementations are very, very stupid. */
977299529Smm__LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t);
978299529Smm__LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t);
979228753Smm/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
980228753Smm * results for performance. */
981228753Smm__LA_DECL int	archive_read_disk_set_standard_lookup(struct archive *);
982228753Smm/* You can install your own lookups if you like. */
983228753Smm__LA_DECL int	archive_read_disk_set_gname_lookup(struct archive *,
984228753Smm    void * /* private_data */,
985299529Smm    const char *(* /* lookup_fn */)(void *, la_int64_t),
986228753Smm    void (* /* cleanup_fn */)(void *));
987228753Smm__LA_DECL int	archive_read_disk_set_uname_lookup(struct archive *,
988228753Smm    void * /* private_data */,
989299529Smm    const char *(* /* lookup_fn */)(void *, la_int64_t),
990228753Smm    void (* /* cleanup_fn */)(void *));
991232153Smm/* Start traversal. */
992232153Smm__LA_DECL int	archive_read_disk_open(struct archive *, const char *);
993232153Smm__LA_DECL int	archive_read_disk_open_w(struct archive *, const wchar_t *);
994232153Smm/*
995232153Smm * Request that current entry be visited.  If you invoke it on every
996232153Smm * directory, you'll get a physical traversal.  This is ignored if the
997232153Smm * current entry isn't a directory or a link to a directory.  So, if
998232153Smm * you invoke this on every returned path, you'll get a full logical
999232153Smm * traversal.
1000232153Smm */
1001232153Smm__LA_DECL int	archive_read_disk_descend(struct archive *);
1002238856Smm__LA_DECL int	archive_read_disk_can_descend(struct archive *);
1003232153Smm__LA_DECL int	archive_read_disk_current_filesystem(struct archive *);
1004232153Smm__LA_DECL int	archive_read_disk_current_filesystem_is_synthetic(struct archive *);
1005232153Smm__LA_DECL int	archive_read_disk_current_filesystem_is_remote(struct archive *);
1006311041Smm/* Request that the access time of the entry visited by traversal be restored. */
1007232153Smm__LA_DECL int  archive_read_disk_set_atime_restored(struct archive *);
1008238856Smm/*
1009238856Smm * Set behavior. The "flags" argument selects optional behavior.
1010238856Smm */
1011311041Smm/* Request that the access time of the entry visited by traversal be restored.
1012238856Smm * This is the same as archive_read_disk_set_atime_restored. */
1013238856Smm#define	ARCHIVE_READDISK_RESTORE_ATIME		(0x0001)
1014238856Smm/* Default: Do not skip an entry which has nodump flags. */
1015238856Smm#define	ARCHIVE_READDISK_HONOR_NODUMP		(0x0002)
1016238856Smm/* Default: Skip a mac resource fork file whose prefix is "._" because of
1017238856Smm * using copyfile. */
1018238856Smm#define	ARCHIVE_READDISK_MAC_COPYFILE		(0x0004)
1019299529Smm/* Default: Traverse mount points. */
1020238856Smm#define	ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS	(0x0008)
1021299529Smm/* Default: Xattrs are read from disk. */
1022299529Smm#define	ARCHIVE_READDISK_NO_XATTR		(0x0010)
1023315432Smm/* Default: ACLs are read from disk. */
1024315432Smm#define	ARCHIVE_READDISK_NO_ACL			(0x0020)
1025315432Smm/* Default: File flags are read from disk. */
1026315432Smm#define	ARCHIVE_READDISK_NO_FFLAGS		(0x0040)
1027228753Smm
1028238856Smm__LA_DECL int  archive_read_disk_set_behavior(struct archive *,
1029238856Smm		    int flags);
1030238856Smm
1031228753Smm/*
1032238856Smm * Set archive_match object that will be used in archive_read_disk to
1033238856Smm * know whether an entry should be skipped. The callback function
1034238856Smm * _excluded_func will be invoked when an entry is skipped by the result
1035238856Smm * of archive_match.
1036238856Smm */
1037238856Smm__LA_DECL int	archive_read_disk_set_matching(struct archive *,
1038238856Smm		    struct archive *_matching, void (*_excluded_func)
1039238856Smm		    (struct archive *, void *, struct archive_entry *),
1040238856Smm		    void *_client_data);
1041238856Smm__LA_DECL int	archive_read_disk_set_metadata_filter_callback(struct archive *,
1042238856Smm		    int (*_metadata_filter_func)(struct archive *, void *,
1043238856Smm		    	struct archive_entry *), void *_client_data);
1044238856Smm
1045299529Smm/* Simplified cleanup interface;
1046299529Smm * This calls archive_read_free() or archive_write_free() as needed. */
1047299529Smm__LA_DECL int	archive_free(struct archive *);
1048299529Smm
1049238856Smm/*
1050228753Smm * Accessor functions to read/set various information in
1051228753Smm * the struct archive object:
1052228753Smm */
1053232153Smm
1054232153Smm/* Number of filters in the current filter pipeline. */
1055232153Smm/* Filter #0 is the one closest to the format, -1 is a synonym for the
1056232153Smm * last filter, which is always the pseudo-filter that wraps the
1057232153Smm * client callbacks. */
1058232153Smm__LA_DECL int		 archive_filter_count(struct archive *);
1059299529Smm__LA_DECL la_int64_t	 archive_filter_bytes(struct archive *, int);
1060232153Smm__LA_DECL int		 archive_filter_code(struct archive *, int);
1061232153Smm__LA_DECL const char *	 archive_filter_name(struct archive *, int);
1062232153Smm
1063232153Smm#if ARCHIVE_VERSION_NUMBER < 4000000
1064232153Smm/* These don't properly handle multiple filters, so are deprecated and
1065232153Smm * will eventually be removed. */
1066232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */
1067299529Smm__LA_DECL la_int64_t	 archive_position_compressed(struct archive *)
1068248616Smm				__LA_DEPRECATED;
1069232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */
1070299529Smm__LA_DECL la_int64_t	 archive_position_uncompressed(struct archive *)
1071248616Smm				__LA_DEPRECATED;
1072232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */
1073248616Smm__LA_DECL const char	*archive_compression_name(struct archive *)
1074248616Smm				__LA_DEPRECATED;
1075232153Smm/* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */
1076248616Smm__LA_DECL int		 archive_compression(struct archive *)
1077248616Smm				__LA_DEPRECATED;
1078232153Smm#endif
1079232153Smm
1080228753Smm__LA_DECL int		 archive_errno(struct archive *);
1081228753Smm__LA_DECL const char	*archive_error_string(struct archive *);
1082228753Smm__LA_DECL const char	*archive_format_name(struct archive *);
1083228753Smm__LA_DECL int		 archive_format(struct archive *);
1084228753Smm__LA_DECL void		 archive_clear_error(struct archive *);
1085228753Smm__LA_DECL void		 archive_set_error(struct archive *, int _err,
1086228753Smm			    const char *fmt, ...) __LA_PRINTF(3, 4);
1087228753Smm__LA_DECL void		 archive_copy_error(struct archive *dest,
1088228753Smm			    struct archive *src);
1089228753Smm__LA_DECL int		 archive_file_count(struct archive *);
1090228753Smm
1091238856Smm/*
1092238856Smm * ARCHIVE_MATCH API
1093238856Smm */
1094238856Smm__LA_DECL struct archive *archive_match_new(void);
1095238856Smm__LA_DECL int	archive_match_free(struct archive *);
1096238856Smm
1097238856Smm/*
1098238856Smm * Test if archive_entry is excluded.
1099238856Smm * This is a convenience function. This is the same as calling all
1100238856Smm * archive_match_path_excluded, archive_match_time_excluded
1101238856Smm * and archive_match_owner_excluded.
1102238856Smm */
1103238856Smm__LA_DECL int	archive_match_excluded(struct archive *,
1104238856Smm		    struct archive_entry *);
1105238856Smm
1106238856Smm/*
1107238856Smm * Test if pathname is excluded. The conditions are set by following functions.
1108238856Smm */
1109238856Smm__LA_DECL int	archive_match_path_excluded(struct archive *,
1110238856Smm		    struct archive_entry *);
1111348607Smm/* Control recursive inclusion of directory content when directory is included. Default on. */
1112348607Smm__LA_DECL int	archive_match_set_inclusion_recursion(struct archive *, int);
1113238856Smm/* Add exclusion pathname pattern. */
1114238856Smm__LA_DECL int	archive_match_exclude_pattern(struct archive *, const char *);
1115238856Smm__LA_DECL int	archive_match_exclude_pattern_w(struct archive *,
1116238856Smm		    const wchar_t *);
1117238856Smm/* Add exclusion pathname pattern from file. */
1118238856Smm__LA_DECL int	archive_match_exclude_pattern_from_file(struct archive *,
1119238856Smm		    const char *, int _nullSeparator);
1120238856Smm__LA_DECL int	archive_match_exclude_pattern_from_file_w(struct archive *,
1121238856Smm		    const wchar_t *, int _nullSeparator);
1122238856Smm/* Add inclusion pathname pattern. */
1123238856Smm__LA_DECL int	archive_match_include_pattern(struct archive *, const char *);
1124238856Smm__LA_DECL int	archive_match_include_pattern_w(struct archive *,
1125238856Smm		    const wchar_t *);
1126238856Smm/* Add inclusion pathname pattern from file. */
1127238856Smm__LA_DECL int	archive_match_include_pattern_from_file(struct archive *,
1128238856Smm		    const char *, int _nullSeparator);
1129238856Smm__LA_DECL int	archive_match_include_pattern_from_file_w(struct archive *,
1130238856Smm		    const wchar_t *, int _nullSeparator);
1131238856Smm/*
1132238856Smm * How to get statistic information for inclusion patterns.
1133238856Smm */
1134238856Smm/* Return the amount number of unmatched inclusion patterns. */
1135238856Smm__LA_DECL int	archive_match_path_unmatched_inclusions(struct archive *);
1136238856Smm/* Return the pattern of unmatched inclusion with ARCHIVE_OK.
1137238856Smm * Return ARCHIVE_EOF if there is no inclusion pattern. */
1138238856Smm__LA_DECL int	archive_match_path_unmatched_inclusions_next(
1139238856Smm		    struct archive *, const char **);
1140238856Smm__LA_DECL int	archive_match_path_unmatched_inclusions_next_w(
1141238856Smm		    struct archive *, const wchar_t **);
1142238856Smm
1143238856Smm/*
1144238856Smm * Test if a file is excluded by its time stamp.
1145238856Smm * The conditions are set by following functions.
1146238856Smm */
1147238856Smm__LA_DECL int	archive_match_time_excluded(struct archive *,
1148238856Smm		    struct archive_entry *);
1149238856Smm
1150238856Smm/*
1151238856Smm * Flags to tell a matching type of time stamps. These are used for
1152311041Smm * following functions.
1153238856Smm */
1154238856Smm/* Time flag: mtime to be tested. */
1155238856Smm#define ARCHIVE_MATCH_MTIME	(0x0100)
1156238856Smm/* Time flag: ctime to be tested. */
1157238856Smm#define ARCHIVE_MATCH_CTIME	(0x0200)
1158238856Smm/* Comparison flag: Match the time if it is newer than. */
1159238856Smm#define ARCHIVE_MATCH_NEWER	(0x0001)
1160238856Smm/* Comparison flag: Match the time if it is older than. */
1161238856Smm#define ARCHIVE_MATCH_OLDER	(0x0002)
1162238856Smm/* Comparison flag: Match the time if it is equal to. */
1163238856Smm#define ARCHIVE_MATCH_EQUAL	(0x0010)
1164238856Smm/* Set inclusion time. */
1165238856Smm__LA_DECL int	archive_match_include_time(struct archive *, int _flag,
1166238856Smm		    time_t _sec, long _nsec);
1167238856Smm/* Set inclusion time by a date string. */
1168238856Smm__LA_DECL int	archive_match_include_date(struct archive *, int _flag,
1169238856Smm		    const char *_datestr);
1170238856Smm__LA_DECL int	archive_match_include_date_w(struct archive *, int _flag,
1171238856Smm		    const wchar_t *_datestr);
1172311041Smm/* Set inclusion time by a particular file. */
1173238856Smm__LA_DECL int	archive_match_include_file_time(struct archive *,
1174238856Smm		    int _flag, const char *_pathname);
1175238856Smm__LA_DECL int	archive_match_include_file_time_w(struct archive *,
1176238856Smm		    int _flag, const wchar_t *_pathname);
1177238856Smm/* Add exclusion entry. */
1178238856Smm__LA_DECL int	archive_match_exclude_entry(struct archive *,
1179238856Smm		    int _flag, struct archive_entry *);
1180238856Smm
1181238856Smm/*
1182238856Smm * Test if a file is excluded by its uid ,gid, uname or gname.
1183238856Smm * The conditions are set by following functions.
1184238856Smm */
1185238856Smm__LA_DECL int	archive_match_owner_excluded(struct archive *,
1186238856Smm		    struct archive_entry *);
1187238856Smm/* Add inclusion uid, gid, uname and gname. */
1188299529Smm__LA_DECL int	archive_match_include_uid(struct archive *, la_int64_t);
1189299529Smm__LA_DECL int	archive_match_include_gid(struct archive *, la_int64_t);
1190238856Smm__LA_DECL int	archive_match_include_uname(struct archive *, const char *);
1191238856Smm__LA_DECL int	archive_match_include_uname_w(struct archive *,
1192238856Smm		    const wchar_t *);
1193238856Smm__LA_DECL int	archive_match_include_gname(struct archive *, const char *);
1194238856Smm__LA_DECL int	archive_match_include_gname_w(struct archive *,
1195238856Smm		    const wchar_t *);
1196238856Smm
1197299529Smm/* Utility functions */
1198299529Smm/* Convenience function to sort a NULL terminated list of strings */
1199299529Smm__LA_DECL int archive_utility_string_sort(char **);
1200299529Smm
1201228753Smm#ifdef __cplusplus
1202228753Smm}
1203228753Smm#endif
1204228753Smm
1205228753Smm/* These are meaningless outside of this header. */
1206228753Smm#undef __LA_DECL
1207228753Smm
1208228753Smm#endif /* !ARCHIVE_H_INCLUDED */
1209