Path: blob/master/Utilities/cmlibarchive/libarchive/archive.h
5029 views
/*-1* Copyright (c) 2003-2010 Tim Kientzle2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR14* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES15* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.16* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,17* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT18* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,19* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY20* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF22* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.23*/2425#ifndef ARCHIVE_H_INCLUDED26#define ARCHIVE_H_INCLUDED2728/*29* The version number is expressed as a single integer that makes it30* easy to compare versions at build time: for version a.b.c, the31* version number is printf("%d%03d%03d",a,b,c). For example, if you32* know your application requires version 2.12.108 or later, you can33* assert that ARCHIVE_VERSION_NUMBER >= 2012108.34*/35/* Note: Compiler will complain if this does not match archive_entry.h! */36#define ARCHIVE_VERSION_NUMBER 30080053738#include <sys/stat.h>39#include <stddef.h> /* for wchar_t */40#include <stdio.h> /* For FILE * */41#if ARCHIVE_VERSION_NUMBER < 400000042/* time_t is slated to be removed from public includes in 4.0 */43#include <time.h> /* For time_t */44#endif4546/*47* Note: archive.h is for use outside of libarchive; the configuration48* headers (config.h, archive_platform.h, etc.) are purely internal.49* Do NOT use HAVE_XXX configuration macros to control the behavior of50* this header! If you must conditionalize, use predefined compiler and/or51* platform macros.52*/53#if defined(__BORLANDC__) && __BORLANDC__ >= 0x56054# include <stdint.h>55#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H)56# include <inttypes.h>57#endif5859/* Get appropriate definitions of 64-bit integer */60#if !defined(__LA_INT64_T_DEFINED)61/* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */62# if ARCHIVE_VERSION_NUMBER < 400000063#define __LA_INT64_T la_int64_t64# endif65#define __LA_INT64_T_DEFINED66# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)67typedef __int64 la_int64_t;68typedef unsigned __int64 la_uint64_t;69# else70# include <unistd.h> /* ssize_t */71# if defined(_SCO_DS) || defined(__osf__)72typedef long long la_int64_t;73typedef unsigned long long la_uint64_t;74# else75typedef int64_t la_int64_t;76typedef uint64_t la_uint64_t;77# endif78# endif79#endif8081/* The la_ssize_t should match the type used in 'struct stat' */82#if !defined(__LA_SSIZE_T_DEFINED)83/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */84# if ARCHIVE_VERSION_NUMBER < 400000085#define __LA_SSIZE_T la_ssize_t86# endif87#define __LA_SSIZE_T_DEFINED88# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)89# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)90typedef ssize_t la_ssize_t;91# elif defined(_WIN64)92typedef __int64 la_ssize_t;93# else94typedef long la_ssize_t;95# endif96# else97# include <unistd.h> /* ssize_t */98typedef ssize_t la_ssize_t;99# endif100#endif101102#if ARCHIVE_VERSION_NUMBER < 4000000103/* Use the platform types for time_t */104#define __LA_TIME_T time_t105#else106/* Use 64-bits integer types for time_t */107#define __LA_TIME_T la_int64_t108#endif109110#if ARCHIVE_VERSION_NUMBER < 4000000111/* Use the platform types for dev_t */112#define __LA_DEV_T dev_t113#else114/* Use 64-bits integer types for dev_t */115#define __LA_DEV_T la_int64_t116#endif117118/* Large file support for Android */119#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__)120#include "android_lf.h"121#endif122123/*124* On Windows, define LIBARCHIVE_STATIC if you're building or using a125* .lib. The default here assumes you're building a DLL. Only126* libarchive source should ever define __LIBARCHIVE_BUILD.127*/128#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)129# ifdef __LIBARCHIVE_BUILD130# ifdef __GNUC__131# define __LA_DECL __attribute__((dllexport)) extern132# else133# define __LA_DECL __declspec(dllexport)134# endif135# else136# ifdef __GNUC__137# define __LA_DECL138# else139# define __LA_DECL __declspec(dllimport)140# endif141# endif142#elif defined __LIBARCHIVE_ENABLE_VISIBILITY143# define __LA_DECL __attribute__((visibility("default")))144#else145/* Static libraries or non-Windows needs no special declaration. */146# define __LA_DECL147#endif148149#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__)150#define __LA_PRINTF(fmtarg, firstvararg) \151__attribute__((__format__ (__printf__, fmtarg, firstvararg)))152#else153#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */154#endif155156/* CMake uses some deprecated APIs to build with old libarchive versions. */157#define __LA_DEPRECATED158159#ifdef __cplusplus160extern "C" {161#endif162163/*164* The version number is provided as both a macro and a function.165* The macro identifies the installed header; the function identifies166* the library version (which may not be the same if you're using a167* dynamically-linked version of the library). Of course, if the168* header and library are very different, you should expect some169* strangeness. Don't do that.170*/171__LA_DECL int archive_version_number(void);172173/*174* Textual name/version of the library, useful for version displays.175*/176#define ARCHIVE_VERSION_ONLY_STRING "3.8.5"177#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING178__LA_DECL const char * archive_version_string(void);179180/*181* Detailed textual name/version of the library and its dependencies.182* This has the form:183* "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..."184* the list of libraries described here will vary depending on how185* libarchive was compiled.186*/187__LA_DECL const char * archive_version_details(void);188189/*190* Returns NULL if libarchive was compiled without the associated library.191* Otherwise, returns the version number that libarchive was compiled192* against.193*/194__LA_DECL const char * archive_zlib_version(void);195__LA_DECL const char * archive_liblzma_version(void);196__LA_DECL const char * archive_bzlib_version(void);197__LA_DECL const char * archive_liblz4_version(void);198__LA_DECL const char * archive_libzstd_version(void);199__LA_DECL const char * archive_liblzo2_version(void);200__LA_DECL const char * archive_libexpat_version(void);201__LA_DECL const char * archive_libbsdxml_version(void);202__LA_DECL const char * archive_libxml2_version(void);203__LA_DECL const char * archive_mbedtls_version(void);204__LA_DECL const char * archive_nettle_version(void);205__LA_DECL const char * archive_openssl_version(void);206__LA_DECL const char * archive_libmd_version(void);207__LA_DECL const char * archive_commoncrypto_version(void);208__LA_DECL const char * archive_cng_version(void);209__LA_DECL const char * archive_wincrypt_version(void);210__LA_DECL const char * archive_librichacl_version(void);211__LA_DECL const char * archive_libacl_version(void);212__LA_DECL const char * archive_libattr_version(void);213__LA_DECL const char * archive_libiconv_version(void);214__LA_DECL const char * archive_libpcre_version(void);215__LA_DECL const char * archive_libpcre2_version(void);216217/* Declare our basic types. */218struct archive;219struct archive_entry;220221/*222* Error codes: Use archive_errno() and archive_error_string()223* to retrieve details. Unless specified otherwise, all functions224* that return 'int' use these codes.225*/226#define ARCHIVE_EOF 1 /* Found end of archive. */227#define ARCHIVE_OK 0 /* Operation was successful. */228#define ARCHIVE_RETRY (-10) /* Retry might succeed. */229#define ARCHIVE_WARN (-20) /* Partial success. */230/* For example, if write_header "fails", then you can't push data. */231#define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */232/* But if write_header is "fatal," then this archive is dead and useless. */233#define ARCHIVE_FATAL (-30) /* No more operations are possible. */234235/*236* As far as possible, archive_errno returns standard platform errno codes.237* Of course, the details vary by platform, so the actual definitions238* here are stored in "archive_platform.h". The symbols are listed here239* for reference; as a rule, clients should not need to know the exact240* platform-dependent error code.241*/242/* Unrecognized or invalid file format. */243/* #define ARCHIVE_ERRNO_FILE_FORMAT */244/* Illegal usage of the library. */245/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */246/* Unknown or unclassified error. */247/* #define ARCHIVE_ERRNO_MISC */248249/*250* Callbacks are invoked to automatically read/skip/write/open/close the251* archive. You can provide your own for complex tasks (like breaking252* archives across multiple tapes) or use standard ones built into the253* library.254*/255256/* Returns pointer and size of next block of data from archive. */257typedef la_ssize_t archive_read_callback(struct archive *,258void *_client_data, const void **_buffer);259260/* Skips at most request bytes from archive and returns the skipped amount.261* This may skip fewer bytes than requested; it may even skip zero bytes.262* If you do skip fewer bytes than requested, libarchive will invoke your263* read callback and discard data as necessary to make up the full skip.264*/265typedef la_int64_t archive_skip_callback(struct archive *,266void *_client_data, la_int64_t request);267268/* Seeks to specified location in the file and returns the position.269* Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h.270* Return ARCHIVE_FATAL if the seek fails for any reason.271*/272typedef la_int64_t archive_seek_callback(struct archive *,273void *_client_data, la_int64_t offset, int whence);274275/* Returns size actually written, zero on EOF, -1 on error. */276typedef la_ssize_t archive_write_callback(struct archive *,277void *_client_data,278const void *_buffer, size_t _length);279280typedef int archive_open_callback(struct archive *, void *_client_data);281282typedef int archive_close_callback(struct archive *, void *_client_data);283284typedef int archive_free_callback(struct archive *, void *_client_data);285286/* Switches from one client data object to the next/prev client data object.287* This is useful for reading from different data blocks such as a set of files288* that make up one large file.289*/290typedef int archive_switch_callback(struct archive *, void *_client_data1,291void *_client_data2);292293/*294* Returns a passphrase used for encryption or decryption, NULL on nothing295* to do and give it up.296*/297typedef const char *archive_passphrase_callback(struct archive *,298void *_client_data);299300/*301* Codes to identify various stream filters.302*/303#define ARCHIVE_FILTER_NONE 0304#define ARCHIVE_FILTER_GZIP 1305#define ARCHIVE_FILTER_BZIP2 2306#define ARCHIVE_FILTER_COMPRESS 3307#define ARCHIVE_FILTER_PROGRAM 4308#define ARCHIVE_FILTER_LZMA 5309#define ARCHIVE_FILTER_XZ 6310#define ARCHIVE_FILTER_UU 7311#define ARCHIVE_FILTER_RPM 8312#define ARCHIVE_FILTER_LZIP 9313#define ARCHIVE_FILTER_LRZIP 10314#define ARCHIVE_FILTER_LZOP 11315#define ARCHIVE_FILTER_GRZIP 12316#define ARCHIVE_FILTER_LZ4 13317#define ARCHIVE_FILTER_ZSTD 14318319#if ARCHIVE_VERSION_NUMBER < 4000000320#define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE321#define ARCHIVE_COMPRESSION_GZIP ARCHIVE_FILTER_GZIP322#define ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_FILTER_BZIP2323#define ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_FILTER_COMPRESS324#define ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_FILTER_PROGRAM325#define ARCHIVE_COMPRESSION_LZMA ARCHIVE_FILTER_LZMA326#define ARCHIVE_COMPRESSION_XZ ARCHIVE_FILTER_XZ327#define ARCHIVE_COMPRESSION_UU ARCHIVE_FILTER_UU328#define ARCHIVE_COMPRESSION_RPM ARCHIVE_FILTER_RPM329#define ARCHIVE_COMPRESSION_LZIP ARCHIVE_FILTER_LZIP330#define ARCHIVE_COMPRESSION_LRZIP ARCHIVE_FILTER_LRZIP331#endif332333/*334* Codes returned by archive_format.335*336* Top 16 bits identifies the format family (e.g., "tar"); lower337* 16 bits indicate the variant. This is updated by read_next_header.338* Note that the lower 16 bits will often vary from entry to entry.339* In some cases, this variation occurs as libarchive learns more about340* the archive (for example, later entries might utilize extensions that341* weren't necessary earlier in the archive; in this case, libarchive342* will change the format code to indicate the extended format that343* was used). In other cases, it's because different tools have344* modified the archive and so different parts of the archive345* actually have slightly different formats. (Both tar and cpio store346* format codes in each entry, so it is quite possible for each347* entry to be in a different format.)348*/349#define ARCHIVE_FORMAT_BASE_MASK 0xff0000350#define ARCHIVE_FORMAT_CPIO 0x10000351#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1)352#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2)353#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3)354#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4)355#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5)356#define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6)357#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7)358#define ARCHIVE_FORMAT_SHAR 0x20000359#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1)360#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2)361#define ARCHIVE_FORMAT_TAR 0x30000362#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1)363#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2)364#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3)365#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4)366#define ARCHIVE_FORMAT_ISO9660 0x40000367#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1)368#define ARCHIVE_FORMAT_ZIP 0x50000369#define ARCHIVE_FORMAT_EMPTY 0x60000370#define ARCHIVE_FORMAT_AR 0x70000371#define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1)372#define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2)373#define ARCHIVE_FORMAT_MTREE 0x80000374#define ARCHIVE_FORMAT_RAW 0x90000375#define ARCHIVE_FORMAT_XAR 0xA0000376#define ARCHIVE_FORMAT_LHA 0xB0000377#define ARCHIVE_FORMAT_CAB 0xC0000378#define ARCHIVE_FORMAT_RAR 0xD0000379#define ARCHIVE_FORMAT_7ZIP 0xE0000380#define ARCHIVE_FORMAT_WARC 0xF0000381#define ARCHIVE_FORMAT_RAR_V5 0x100000382383/*384* Codes returned by archive_read_format_capabilities().385*386* This list can be extended with values between 0 and 0xffff.387* The original purpose of this list was to let different archive388* format readers expose their general capabilities in terms of389* encryption.390*/391#define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */392#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0) /* reader can detect encrypted data */393#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1) /* reader can detect encryptable metadata (pathname, mtime, etc.) */394395/*396* Codes returned by archive_read_has_encrypted_entries().397*398* In case the archive does not support encryption detection at all399* ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader400* for some other reason (e.g. not enough bytes read) cannot say if401* there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW402* is returned.403*/404#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2405#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1406407/*-408* Basic outline for reading an archive:409* 1) Ask archive_read_new for an archive reader object.410* 2) Update any global properties as appropriate.411* In particular, you'll certainly want to call appropriate412* archive_read_support_XXX functions.413* 3) Call archive_read_open_XXX to open the archive414* 4) Repeatedly call archive_read_next_header to get information about415* successive archive entries. Call archive_read_data to extract416* data for entries of interest.417* 5) Call archive_read_free to end processing.418*/419__LA_DECL struct archive *archive_read_new(void);420421/*422* The archive_read_support_XXX calls enable auto-detect for this423* archive handle. They also link in the necessary support code.424* For example, if you don't want bzlib linked in, don't invoke425* support_compression_bzip2(). The "all" functions provide the426* obvious shorthand.427*/428429#if ARCHIVE_VERSION_NUMBER < 4000000430__LA_DECL int archive_read_support_compression_all(struct archive *)431__LA_DEPRECATED;432__LA_DECL int archive_read_support_compression_bzip2(struct archive *)433__LA_DEPRECATED;434__LA_DECL int archive_read_support_compression_compress(struct archive *)435__LA_DEPRECATED;436__LA_DECL int archive_read_support_compression_gzip(struct archive *)437__LA_DEPRECATED;438__LA_DECL int archive_read_support_compression_lzip(struct archive *)439__LA_DEPRECATED;440__LA_DECL int archive_read_support_compression_lzma(struct archive *)441__LA_DEPRECATED;442__LA_DECL int archive_read_support_compression_none(struct archive *)443__LA_DEPRECATED;444__LA_DECL int archive_read_support_compression_program(struct archive *,445const char *command) __LA_DEPRECATED;446__LA_DECL int archive_read_support_compression_program_signature447(struct archive *, const char *,448const void * /* match */, size_t) __LA_DEPRECATED;449450__LA_DECL int archive_read_support_compression_rpm(struct archive *)451__LA_DEPRECATED;452__LA_DECL int archive_read_support_compression_uu(struct archive *)453__LA_DEPRECATED;454__LA_DECL int archive_read_support_compression_xz(struct archive *)455__LA_DEPRECATED;456#endif457458__LA_DECL int archive_read_support_filter_all(struct archive *);459__LA_DECL int archive_read_support_filter_by_code(struct archive *, int);460__LA_DECL int archive_read_support_filter_bzip2(struct archive *);461__LA_DECL int archive_read_support_filter_compress(struct archive *);462__LA_DECL int archive_read_support_filter_gzip(struct archive *);463__LA_DECL int archive_read_support_filter_grzip(struct archive *);464__LA_DECL int archive_read_support_filter_lrzip(struct archive *);465__LA_DECL int archive_read_support_filter_lz4(struct archive *);466__LA_DECL int archive_read_support_filter_lzip(struct archive *);467__LA_DECL int archive_read_support_filter_lzma(struct archive *);468__LA_DECL int archive_read_support_filter_lzop(struct archive *);469__LA_DECL int archive_read_support_filter_none(struct archive *);470__LA_DECL int archive_read_support_filter_program(struct archive *,471const char *command);472__LA_DECL int archive_read_support_filter_program_signature473(struct archive *, const char * /* cmd */,474const void * /* match */, size_t);475__LA_DECL int archive_read_support_filter_rpm(struct archive *);476__LA_DECL int archive_read_support_filter_uu(struct archive *);477__LA_DECL int archive_read_support_filter_xz(struct archive *);478__LA_DECL int archive_read_support_filter_zstd(struct archive *);479480__LA_DECL int archive_read_support_format_7zip(struct archive *);481__LA_DECL int archive_read_support_format_all(struct archive *);482__LA_DECL int archive_read_support_format_ar(struct archive *);483__LA_DECL int archive_read_support_format_by_code(struct archive *, int);484__LA_DECL int archive_read_support_format_cab(struct archive *);485__LA_DECL int archive_read_support_format_cpio(struct archive *);486__LA_DECL int archive_read_support_format_empty(struct archive *);487/* archive_read_support_format_gnutar() is an alias for historical reasons488* of archive_read_support_format_tar(). */489__LA_DECL int archive_read_support_format_gnutar(struct archive *);490__LA_DECL int archive_read_support_format_iso9660(struct archive *);491__LA_DECL int archive_read_support_format_lha(struct archive *);492__LA_DECL int archive_read_support_format_mtree(struct archive *);493__LA_DECL int archive_read_support_format_rar(struct archive *);494__LA_DECL int archive_read_support_format_rar5(struct archive *);495__LA_DECL int archive_read_support_format_raw(struct archive *);496__LA_DECL int archive_read_support_format_tar(struct archive *);497__LA_DECL int archive_read_support_format_warc(struct archive *);498__LA_DECL int archive_read_support_format_xar(struct archive *);499/* archive_read_support_format_zip() enables both streamable and seekable500* zip readers. */501__LA_DECL int archive_read_support_format_zip(struct archive *);502/* Reads Zip archives as stream from beginning to end. Doesn't503* correctly handle SFX ZIP files or ZIP archives that have been modified504* in-place. */505__LA_DECL int archive_read_support_format_zip_streamable(struct archive *);506/* Reads starting from central directory; requires seekable input. */507__LA_DECL int archive_read_support_format_zip_seekable(struct archive *);508509/* Functions to manually set the format and filters to be used. This is510* useful to bypass the bidding process when the format and filters to use511* is known in advance.512*/513__LA_DECL int archive_read_set_format(struct archive *, int);514__LA_DECL int archive_read_append_filter(struct archive *, int);515__LA_DECL int archive_read_append_filter_program(struct archive *,516const char *);517__LA_DECL int archive_read_append_filter_program_signature518(struct archive *, const char *, const void * /* match */, size_t);519520/* Set various callbacks. */521__LA_DECL int archive_read_set_open_callback(struct archive *,522archive_open_callback *);523__LA_DECL int archive_read_set_read_callback(struct archive *,524archive_read_callback *);525__LA_DECL int archive_read_set_seek_callback(struct archive *,526archive_seek_callback *);527__LA_DECL int archive_read_set_skip_callback(struct archive *,528archive_skip_callback *);529__LA_DECL int archive_read_set_close_callback(struct archive *,530archive_close_callback *);531/* Callback used to switch between one data object to the next */532__LA_DECL int archive_read_set_switch_callback(struct archive *,533archive_switch_callback *);534535/* This sets the first data object. */536__LA_DECL int archive_read_set_callback_data(struct archive *, void *);537/* This sets data object at specified index */538__LA_DECL int archive_read_set_callback_data2(struct archive *, void *,539unsigned int);540/* This adds a data object at the specified index. */541__LA_DECL int archive_read_add_callback_data(struct archive *, void *,542unsigned int);543/* This appends a data object to the end of list */544__LA_DECL int archive_read_append_callback_data(struct archive *, void *);545/* This prepends a data object to the beginning of list */546__LA_DECL int archive_read_prepend_callback_data(struct archive *, void *);547548/* Opening freezes the callbacks. */549__LA_DECL int archive_read_open1(struct archive *);550551/* Convenience wrappers around the above. */552__LA_DECL int archive_read_open(struct archive *, void *_client_data,553archive_open_callback *, archive_read_callback *,554archive_close_callback *);555__LA_DECL int archive_read_open2(struct archive *, void *_client_data,556archive_open_callback *, archive_read_callback *,557archive_skip_callback *, archive_close_callback *);558559/*560* A variety of shortcuts that invoke archive_read_open() with561* canned callbacks suitable for common situations. The ones that562* accept a block size handle tape blocking correctly.563*/564/* Use this if you know the filename. Note: NULL indicates stdin. */565__LA_DECL int archive_read_open_filename(struct archive *,566const char *_filename, size_t _block_size);567/* Use this for reading multivolume files by filenames.568* NOTE: Must be NULL terminated. Sorting is NOT done. */569__LA_DECL int archive_read_open_filenames(struct archive *,570const char **_filenames, size_t _block_size);571__LA_DECL int archive_read_open_filename_w(struct archive *,572const wchar_t *_filename, size_t _block_size);573#if defined(_WIN32) && !defined(__CYGWIN__)574__LA_DECL int archive_read_open_filenames_w(struct archive *,575const wchar_t **_filenames, size_t _block_size);576#endif577/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */578__LA_DECL int archive_read_open_file(struct archive *,579const char *_filename, size_t _block_size) __LA_DEPRECATED;580/* Read an archive that's stored in memory. */581__LA_DECL int archive_read_open_memory(struct archive *,582const void * buff, size_t size);583/* A more involved version that is only used for internal testing. */584__LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff,585size_t size, size_t read_size);586/* Read an archive that's already open, using the file descriptor. */587__LA_DECL int archive_read_open_fd(struct archive *, int _fd,588size_t _block_size);589/* Read an archive that's already open, using a FILE *. */590/* Note: DO NOT use this with tape drives. */591__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);592593/* Parses and returns next entry header. */594__LA_DECL int archive_read_next_header(struct archive *,595struct archive_entry **);596597/* Parses and returns next entry header using the archive_entry passed in */598__LA_DECL int archive_read_next_header2(struct archive *,599struct archive_entry *);600601/*602* Retrieve the byte offset in UNCOMPRESSED data where last-read603* header started.604*/605__LA_DECL la_int64_t archive_read_header_position(struct archive *);606607/*608* Returns 1 if the archive contains at least one encrypted entry.609* If the archive format not support encryption at all610* ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned.611* If for any other reason (e.g. not enough data read so far)612* we cannot say whether there are encrypted entries, then613* ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned.614* In general, this function will return values below zero when the615* reader is uncertain or totally incapable of encryption support.616* When this function returns 0 you can be sure that the reader617* supports encryption detection but no encrypted entries have618* been found yet.619*620* NOTE: If the metadata/header of an archive is also encrypted, you621* cannot rely on the number of encrypted entries. That is why this622* function does not return the number of encrypted entries but#623* just shows that there are some.624*/625__LA_DECL int archive_read_has_encrypted_entries(struct archive *);626627/*628* Returns a bitmask of capabilities that are supported by the archive format reader.629* If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned.630*/631__LA_DECL int archive_read_format_capabilities(struct archive *);632633/* Read data from the body of an entry. Similar to read(2). */634__LA_DECL la_ssize_t archive_read_data(struct archive *,635void *, size_t);636637/* Seek within the body of an entry. Similar to lseek(2). */638__LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int);639640/*641* A zero-copy version of archive_read_data that also exposes the file offset642* of each returned block. Note that the client has no way to specify643* the desired size of the block. The API does guarantee that offsets will644* be strictly increasing and that returned blocks will not overlap.645*/646__LA_DECL int archive_read_data_block(struct archive *a,647const void **buff, size_t *size, la_int64_t *offset);648649/*-650* Some convenience functions that are built on archive_read_data:651* 'skip': skips entire entry652* 'into_buffer': writes data into memory buffer that you provide653* 'into_fd': writes data to specified filedes654*/655__LA_DECL int archive_read_data_skip(struct archive *);656__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);657658/*659* Set read options.660*/661/* Apply option to the format only. */662__LA_DECL int archive_read_set_format_option(struct archive *_a,663const char *m, const char *o,664const char *v);665/* Apply option to the filter only. */666__LA_DECL int archive_read_set_filter_option(struct archive *_a,667const char *m, const char *o,668const char *v);669/* Apply option to both the format and the filter. */670__LA_DECL int archive_read_set_option(struct archive *_a,671const char *m, const char *o,672const char *v);673/* Apply option string to both the format and the filter. */674__LA_DECL int archive_read_set_options(struct archive *_a,675const char *opts);676677/*678* Add a decryption passphrase.679*/680__LA_DECL int archive_read_add_passphrase(struct archive *, const char *);681__LA_DECL int archive_read_set_passphrase_callback(struct archive *,682void *client_data, archive_passphrase_callback *);683684685/*-686* Convenience function to recreate the current entry (whose header687* has just been read) on disk.688*689* This does quite a bit more than just copy data to disk. It also:690* - Creates intermediate directories as required.691* - Manages directory permissions: non-writable directories will692* be initially created with write permission enabled; when the693* archive is closed, dir permissions are edited to the values specified694* in the archive.695* - Checks hardlinks: hardlinks will not be extracted unless the696* linked-to file was also extracted within the same session. (TODO)697*/698699/* The "flags" argument selects optional behavior, 'OR' the flags you want. */700701/* Default: Do not try to set owner/group. */702#define ARCHIVE_EXTRACT_OWNER (0x0001)703/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */704#define ARCHIVE_EXTRACT_PERM (0x0002)705/* Default: Do not restore mtime/atime. */706#define ARCHIVE_EXTRACT_TIME (0x0004)707/* Default: Replace existing files. */708#define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008)709/* Default: Try create first, unlink only if create fails with EEXIST. */710#define ARCHIVE_EXTRACT_UNLINK (0x0010)711/* Default: Do not restore ACLs. */712#define ARCHIVE_EXTRACT_ACL (0x0020)713/* Default: Do not restore fflags. */714#define ARCHIVE_EXTRACT_FFLAGS (0x0040)715/* Default: Do not restore xattrs. */716#define ARCHIVE_EXTRACT_XATTR (0x0080)717/* Default: Do not try to guard against extracts redirected by symlinks. */718/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */719#define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100)720/* Default: Do not reject entries with '..' as path elements. */721#define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200)722/* Default: Create parent directories as needed. */723#define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400)724/* Default: Overwrite files, even if one on disk is newer. */725#define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800)726/* Detect blocks of 0 and write holes instead. */727#define ARCHIVE_EXTRACT_SPARSE (0x1000)728/* Default: Do not restore Mac extended metadata. */729/* This has no effect except on Mac OS. */730#define ARCHIVE_EXTRACT_MAC_METADATA (0x2000)731/* Default: Use HFS+ compression if it was compressed. */732/* This has no effect except on Mac OS v10.6 or later. */733#define ARCHIVE_EXTRACT_NO_HFS_COMPRESSION (0x4000)734/* Default: Do not use HFS+ compression if it was not compressed. */735/* This has no effect except on Mac OS v10.6 or later. */736#define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000)737/* Default: Do not reject entries with absolute paths */738#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)739/* Default: Do not clear no-change flags when unlinking object */740#define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000)741/* Default: Do not extract atomically (using rename) */742#define ARCHIVE_EXTRACT_SAFE_WRITES (0x40000)743744__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,745int flags);746__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,747struct archive * /* dest */);748__LA_DECL void archive_read_extract_set_progress_callback(struct archive *,749void (*_progress_func)(void *), void *_user_data);750751/* Record the dev/ino of a file that will not be written. This is752* generally set to the dev/ino of the archive being read. */753__LA_DECL void archive_read_extract_set_skip_file(struct archive *,754la_int64_t, la_int64_t);755756/* Close the file and release most resources. */757__LA_DECL int archive_read_close(struct archive *);758/* Release all resources and destroy the object. */759/* Note that archive_read_free will call archive_read_close for you. */760__LA_DECL int archive_read_free(struct archive *);761#if ARCHIVE_VERSION_NUMBER < 4000000762/* Synonym for archive_read_free() for backwards compatibility. */763__LA_DECL int archive_read_finish(struct archive *) __LA_DEPRECATED;764#endif765766/*-767* To create an archive:768* 1) Ask archive_write_new for an archive writer object.769* 2) Set any global properties. In particular, you should set770* the compression and format to use.771* 3) Call archive_write_open to open the file (most people772* will use archive_write_open_file or archive_write_open_fd,773* which provide convenient canned I/O callbacks for you).774* 4) For each entry:775* - construct an appropriate struct archive_entry structure776* - archive_write_header to write the header777* - archive_write_data to write the entry data778* 5) archive_write_close to close the output779* 6) archive_write_free to cleanup the writer and release resources780*/781__LA_DECL struct archive *archive_write_new(void);782__LA_DECL int archive_write_set_bytes_per_block(struct archive *,783int bytes_per_block);784__LA_DECL int archive_write_get_bytes_per_block(struct archive *);785/* XXX This is badly misnamed; suggestions appreciated. XXX */786__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,787int bytes_in_last_block);788__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);789790/* The dev/ino of a file that won't be archived. This is used791* to avoid recursively adding an archive to itself. */792__LA_DECL int archive_write_set_skip_file(struct archive *,793la_int64_t, la_int64_t);794795#if ARCHIVE_VERSION_NUMBER < 4000000796__LA_DECL int archive_write_set_compression_bzip2(struct archive *)797__LA_DEPRECATED;798__LA_DECL int archive_write_set_compression_compress(struct archive *)799__LA_DEPRECATED;800__LA_DECL int archive_write_set_compression_gzip(struct archive *)801__LA_DEPRECATED;802__LA_DECL int archive_write_set_compression_lzip(struct archive *)803__LA_DEPRECATED;804__LA_DECL int archive_write_set_compression_lzma(struct archive *)805__LA_DEPRECATED;806__LA_DECL int archive_write_set_compression_none(struct archive *)807__LA_DEPRECATED;808__LA_DECL int archive_write_set_compression_program(struct archive *,809const char *cmd) __LA_DEPRECATED;810__LA_DECL int archive_write_set_compression_xz(struct archive *)811__LA_DEPRECATED;812#endif813814/* A convenience function to set the filter based on the code. */815__LA_DECL int archive_write_add_filter(struct archive *, int filter_code);816__LA_DECL int archive_write_add_filter_by_name(struct archive *,817const char *name);818__LA_DECL int archive_write_add_filter_b64encode(struct archive *);819__LA_DECL int archive_write_add_filter_bzip2(struct archive *);820__LA_DECL int archive_write_add_filter_compress(struct archive *);821__LA_DECL int archive_write_add_filter_grzip(struct archive *);822__LA_DECL int archive_write_add_filter_gzip(struct archive *);823__LA_DECL int archive_write_add_filter_lrzip(struct archive *);824__LA_DECL int archive_write_add_filter_lz4(struct archive *);825__LA_DECL int archive_write_add_filter_lzip(struct archive *);826__LA_DECL int archive_write_add_filter_lzma(struct archive *);827__LA_DECL int archive_write_add_filter_lzop(struct archive *);828__LA_DECL int archive_write_add_filter_none(struct archive *);829__LA_DECL int archive_write_add_filter_program(struct archive *,830const char *cmd);831__LA_DECL int archive_write_add_filter_uuencode(struct archive *);832__LA_DECL int archive_write_add_filter_xz(struct archive *);833__LA_DECL int archive_write_add_filter_zstd(struct archive *);834835836/* A convenience function to set the format based on the code or name. */837__LA_DECL int archive_write_set_format(struct archive *, int format_code);838__LA_DECL int archive_write_set_format_by_name(struct archive *,839const char *name);840/* To minimize link pollution, use one or more of the following. */841__LA_DECL int archive_write_set_format_7zip(struct archive *);842__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);843__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);844__LA_DECL int archive_write_set_format_cpio(struct archive *);845__LA_DECL int archive_write_set_format_cpio_bin(struct archive *);846__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);847__LA_DECL int archive_write_set_format_cpio_odc(struct archive *);848__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *);849__LA_DECL int archive_write_set_format_gnutar(struct archive *);850__LA_DECL int archive_write_set_format_iso9660(struct archive *);851__LA_DECL int archive_write_set_format_mtree(struct archive *);852__LA_DECL int archive_write_set_format_mtree_classic(struct archive *);853/* TODO: int archive_write_set_format_old_tar(struct archive *); */854__LA_DECL int archive_write_set_format_pax(struct archive *);855__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);856__LA_DECL int archive_write_set_format_raw(struct archive *);857__LA_DECL int archive_write_set_format_shar(struct archive *);858__LA_DECL int archive_write_set_format_shar_dump(struct archive *);859__LA_DECL int archive_write_set_format_ustar(struct archive *);860__LA_DECL int archive_write_set_format_v7tar(struct archive *);861__LA_DECL int archive_write_set_format_warc(struct archive *);862__LA_DECL int archive_write_set_format_xar(struct archive *);863__LA_DECL int archive_write_set_format_zip(struct archive *);864__LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename);865__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext);866__LA_DECL int archive_write_zip_set_compression_deflate(struct archive *);867__LA_DECL int archive_write_zip_set_compression_store(struct archive *);868__LA_DECL int archive_write_zip_set_compression_lzma(struct archive *);869__LA_DECL int archive_write_zip_set_compression_xz(struct archive *);870__LA_DECL int archive_write_zip_set_compression_bzip2(struct archive *);871__LA_DECL int archive_write_zip_set_compression_zstd(struct archive *);872/* Deprecated; use archive_write_open2 instead */873__LA_DECL int archive_write_open(struct archive *, void *,874archive_open_callback *, archive_write_callback *,875archive_close_callback *);876__LA_DECL int archive_write_open2(struct archive *, void *,877archive_open_callback *, archive_write_callback *,878archive_close_callback *, archive_free_callback *);879__LA_DECL int archive_write_open_fd(struct archive *, int _fd);880__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);881__LA_DECL int archive_write_open_filename_w(struct archive *,882const wchar_t *_file);883/* A deprecated synonym for archive_write_open_filename() */884__LA_DECL int archive_write_open_file(struct archive *, const char *_file)885__LA_DEPRECATED;886__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);887/* _buffSize is the size of the buffer, _used refers to a variable that888* will be updated after each write into the buffer. */889__LA_DECL int archive_write_open_memory(struct archive *,890void *_buffer, size_t _buffSize, size_t *_used);891892/*893* Note that the library will truncate writes beyond the size provided894* to archive_write_header or pad if the provided data is short.895*/896__LA_DECL int archive_write_header(struct archive *,897struct archive_entry *);898__LA_DECL la_ssize_t archive_write_data(struct archive *,899const void *, size_t);900901/* This interface is currently only available for archive_write_disk handles. */902__LA_DECL la_ssize_t archive_write_data_block(struct archive *,903const void *, size_t, la_int64_t);904905__LA_DECL int archive_write_finish_entry(struct archive *);906__LA_DECL int archive_write_close(struct archive *);907/* Marks the archive as FATAL so that a subsequent free() operation908* won't try to close() cleanly. Provides a fast abort capability909* when the client discovers that things have gone wrong. */910__LA_DECL int archive_write_fail(struct archive *);911/* This can fail if the archive wasn't already closed, in which case912* archive_write_free() will implicitly call archive_write_close(). */913__LA_DECL int archive_write_free(struct archive *);914#if ARCHIVE_VERSION_NUMBER < 4000000915/* Synonym for archive_write_free() for backwards compatibility. */916__LA_DECL int archive_write_finish(struct archive *) __LA_DEPRECATED;917#endif918919/*920* Set write options.921*/922/* Apply option to the format only. */923__LA_DECL int archive_write_set_format_option(struct archive *_a,924const char *m, const char *o,925const char *v);926/* Apply option to the filter only. */927__LA_DECL int archive_write_set_filter_option(struct archive *_a,928const char *m, const char *o,929const char *v);930/* Apply option to both the format and the filter. */931__LA_DECL int archive_write_set_option(struct archive *_a,932const char *m, const char *o,933const char *v);934/* Apply option string to both the format and the filter. */935__LA_DECL int archive_write_set_options(struct archive *_a,936const char *opts);937938/*939* Set an encryption passphrase.940*/941__LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p);942__LA_DECL int archive_write_set_passphrase_callback(struct archive *,943void *client_data, archive_passphrase_callback *);944945/*-946* ARCHIVE_WRITE_DISK API947*948* To create objects on disk:949* 1) Ask archive_write_disk_new for a new archive_write_disk object.950* 2) Set any global properties. In particular, you probably951* want to set the options.952* 3) For each entry:953* - construct an appropriate struct archive_entry structure954* - archive_write_header to create the file/dir/etc on disk955* - archive_write_data to write the entry data956* 4) archive_write_free to cleanup the writer and release resources957*958* In particular, you can use this in conjunction with archive_read()959* to pull entries out of an archive and create them on disk.960*/961__LA_DECL struct archive *archive_write_disk_new(void);962/* This file will not be overwritten. */963__LA_DECL int archive_write_disk_set_skip_file(struct archive *,964la_int64_t, la_int64_t);965/* Set flags to control how the next item gets created.966* This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */967__LA_DECL int archive_write_disk_set_options(struct archive *,968int flags);969/*970* The lookup functions are given uname/uid (or gname/gid) pairs and971* return a uid (gid) suitable for this system. These are used for972* restoring ownership and for setting ACLs. The default functions973* are naive, they just return the uid/gid. These are small, so reasonable974* for applications that don't need to preserve ownership; they975* are probably also appropriate for applications that are doing976* same-system backup and restore.977*/978/*979* The "standard" lookup functions use common system calls to lookup980* the uname/gname, falling back to the uid/gid if the names can't be981* found. They cache lookups and are reasonably fast, but can be very982* large, so they are not used unless you ask for them. In983* particular, these match the specifications of POSIX "pax" and old984* POSIX "tar".985*/986__LA_DECL int archive_write_disk_set_standard_lookup(struct archive *);987/*988* If neither the default (naive) nor the standard (big) functions suit989* your needs, you can write your own and register them. Be sure to990* include a cleanup function if you have allocated private data.991*/992__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,993void * /* private_data */,994la_int64_t (*)(void *, const char *, la_int64_t),995void (* /* cleanup */)(void *));996__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,997void * /* private_data */,998la_int64_t (*)(void *, const char *, la_int64_t),999void (* /* cleanup */)(void *));1000__LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t);1001__LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t);10021003/*1004* ARCHIVE_READ_DISK API1005*1006* This is still evolving and somewhat experimental.1007*/1008__LA_DECL struct archive *archive_read_disk_new(void);1009/* The names for symlink modes here correspond to an old BSD1010* command-line argument convention: -L, -P, -H */1011/* Follow all symlinks. */1012__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);1013/* Follow no symlinks. */1014__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);1015/* Follow symlink initially, then not. */1016__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);1017/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */1018__LA_DECL int archive_read_disk_entry_from_file(struct archive *,1019struct archive_entry *, int /* fd */, const struct stat *);1020/* Look up gname for gid or uname for uid. */1021/* Default implementations are very, very stupid. */1022__LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t);1023__LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t);1024/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the1025* results for performance. */1026__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *);1027/* You can install your own lookups if you like. */1028__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *,1029void * /* private_data */,1030const char *(* /* lookup_fn */)(void *, la_int64_t),1031void (* /* cleanup_fn */)(void *));1032__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *,1033void * /* private_data */,1034const char *(* /* lookup_fn */)(void *, la_int64_t),1035void (* /* cleanup_fn */)(void *));1036/* Start traversal. */1037__LA_DECL int archive_read_disk_open(struct archive *, const char *);1038__LA_DECL int archive_read_disk_open_w(struct archive *, const wchar_t *);1039/*1040* Request that current entry be visited. If you invoke it on every1041* directory, you'll get a physical traversal. This is ignored if the1042* current entry isn't a directory or a link to a directory. So, if1043* you invoke this on every returned path, you'll get a full logical1044* traversal.1045*/1046__LA_DECL int archive_read_disk_descend(struct archive *);1047__LA_DECL int archive_read_disk_can_descend(struct archive *);1048__LA_DECL int archive_read_disk_current_filesystem(struct archive *);1049__LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *);1050__LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *);1051/* Request that the access time of the entry visited by traversal be restored. */1052__LA_DECL int archive_read_disk_set_atime_restored(struct archive *);1053/*1054* Set behavior. The "flags" argument selects optional behavior.1055*/1056/* Request that the access time of the entry visited by traversal be restored.1057* This is the same as archive_read_disk_set_atime_restored. */1058#define ARCHIVE_READDISK_RESTORE_ATIME (0x0001)1059/* Default: Do not skip an entry which has nodump flags. */1060#define ARCHIVE_READDISK_HONOR_NODUMP (0x0002)1061/* Default: Skip a mac resource fork file whose prefix is "._" because of1062* using copyfile. */1063#define ARCHIVE_READDISK_MAC_COPYFILE (0x0004)1064/* Default: Traverse mount points. */1065#define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008)1066/* Default: Xattrs are read from disk. */1067#define ARCHIVE_READDISK_NO_XATTR (0x0010)1068/* Default: ACLs are read from disk. */1069#define ARCHIVE_READDISK_NO_ACL (0x0020)1070/* Default: File flags are read from disk. */1071#define ARCHIVE_READDISK_NO_FFLAGS (0x0040)1072/* Default: Sparse file information is read from disk. */1073#define ARCHIVE_READDISK_NO_SPARSE (0x0080)10741075__LA_DECL int archive_read_disk_set_behavior(struct archive *,1076int flags);10771078/*1079* Set archive_match object that will be used in archive_read_disk to1080* know whether an entry should be skipped. The callback function1081* _excluded_func will be invoked when an entry is skipped by the result1082* of archive_match.1083*/1084__LA_DECL int archive_read_disk_set_matching(struct archive *,1085struct archive *_matching, void (*_excluded_func)1086(struct archive *, void *, struct archive_entry *),1087void *_client_data);1088__LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *,1089int (*_metadata_filter_func)(struct archive *, void *,1090struct archive_entry *), void *_client_data);10911092/* Simplified cleanup interface;1093* This calls archive_read_free() or archive_write_free() as needed. */1094__LA_DECL int archive_free(struct archive *);10951096/*1097* Accessor functions to read/set various information in1098* the struct archive object:1099*/11001101/* Number of filters in the current filter pipeline. */1102/* Filter #0 is the one closest to the format, -1 is a synonym for the1103* last filter, which is always the pseudo-filter that wraps the1104* client callbacks. */1105__LA_DECL int archive_filter_count(struct archive *);1106__LA_DECL la_int64_t archive_filter_bytes(struct archive *, int);1107__LA_DECL int archive_filter_code(struct archive *, int);1108__LA_DECL const char * archive_filter_name(struct archive *, int);11091110#if ARCHIVE_VERSION_NUMBER < 40000001111/* These don't properly handle multiple filters, so are deprecated and1112* will eventually be removed. */1113/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */1114__LA_DECL la_int64_t archive_position_compressed(struct archive *)1115__LA_DEPRECATED;1116/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */1117__LA_DECL la_int64_t archive_position_uncompressed(struct archive *)1118__LA_DEPRECATED;1119/* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */1120__LA_DECL const char *archive_compression_name(struct archive *)1121__LA_DEPRECATED;1122/* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */1123__LA_DECL int archive_compression(struct archive *)1124__LA_DEPRECATED;1125#endif11261127/* Parses a date string relative to the current time.1128* NOTE: This is not intended for general date parsing, and the resulting timestamp should only be used for libarchive. */1129__LA_DECL time_t archive_parse_date(time_t now, const char *datestr);11301131__LA_DECL int archive_errno(struct archive *);1132__LA_DECL const char *archive_error_string(struct archive *);1133__LA_DECL const char *archive_format_name(struct archive *);1134__LA_DECL int archive_format(struct archive *);1135__LA_DECL void archive_clear_error(struct archive *);1136__LA_DECL void archive_set_error(struct archive *, int _err,1137const char *fmt, ...) __LA_PRINTF(3, 4);1138__LA_DECL void archive_copy_error(struct archive *dest,1139struct archive *src);1140__LA_DECL int archive_file_count(struct archive *);11411142/*1143* ARCHIVE_MATCH API1144*/1145__LA_DECL struct archive *archive_match_new(void);1146__LA_DECL int archive_match_free(struct archive *);11471148/*1149* Test if archive_entry is excluded.1150* This is a convenience function. This is the same as calling all1151* archive_match_path_excluded, archive_match_time_excluded1152* and archive_match_owner_excluded.1153*/1154__LA_DECL int archive_match_excluded(struct archive *,1155struct archive_entry *);11561157/*1158* Test if pathname is excluded. The conditions are set by following functions.1159*/1160__LA_DECL int archive_match_path_excluded(struct archive *,1161struct archive_entry *);1162/* Control recursive inclusion of directory content when directory is included. Default on. */1163__LA_DECL int archive_match_set_inclusion_recursion(struct archive *, int);1164/* Add exclusion pathname pattern. */1165__LA_DECL int archive_match_exclude_pattern(struct archive *, const char *);1166__LA_DECL int archive_match_exclude_pattern_w(struct archive *,1167const wchar_t *);1168/* Add exclusion pathname pattern from file. */1169__LA_DECL int archive_match_exclude_pattern_from_file(struct archive *,1170const char *, int _nullSeparator);1171__LA_DECL int archive_match_exclude_pattern_from_file_w(struct archive *,1172const wchar_t *, int _nullSeparator);1173/* Add inclusion pathname pattern. */1174__LA_DECL int archive_match_include_pattern(struct archive *, const char *);1175__LA_DECL int archive_match_include_pattern_w(struct archive *,1176const wchar_t *);1177/* Add inclusion pathname pattern from file. */1178__LA_DECL int archive_match_include_pattern_from_file(struct archive *,1179const char *, int _nullSeparator);1180__LA_DECL int archive_match_include_pattern_from_file_w(struct archive *,1181const wchar_t *, int _nullSeparator);1182/*1183* How to get statistic information for inclusion patterns.1184*/1185/* Return the amount number of unmatched inclusion patterns. */1186__LA_DECL int archive_match_path_unmatched_inclusions(struct archive *);1187/* Return the pattern of unmatched inclusion with ARCHIVE_OK.1188* Return ARCHIVE_EOF if there is no inclusion pattern. */1189__LA_DECL int archive_match_path_unmatched_inclusions_next(1190struct archive *, const char **);1191__LA_DECL int archive_match_path_unmatched_inclusions_next_w(1192struct archive *, const wchar_t **);11931194/*1195* Test if a file is excluded by its time stamp.1196* The conditions are set by following functions.1197*/1198__LA_DECL int archive_match_time_excluded(struct archive *,1199struct archive_entry *);12001201/*1202* Flags to tell a matching type of time stamps. These are used for1203* following functions.1204*/1205/* Time flag: mtime to be tested. */1206#define ARCHIVE_MATCH_MTIME (0x0100)1207/* Time flag: ctime to be tested. */1208#define ARCHIVE_MATCH_CTIME (0x0200)1209/* Comparison flag: Match the time if it is newer than. */1210#define ARCHIVE_MATCH_NEWER (0x0001)1211/* Comparison flag: Match the time if it is older than. */1212#define ARCHIVE_MATCH_OLDER (0x0002)1213/* Comparison flag: Match the time if it is equal to. */1214#define ARCHIVE_MATCH_EQUAL (0x0010)1215/* Set inclusion time. */1216__LA_DECL int archive_match_include_time(struct archive *, int _flag,1217time_t _sec, long _nsec);1218/* Set inclusion time by a date string. */1219__LA_DECL int archive_match_include_date(struct archive *, int _flag,1220const char *_datestr);1221__LA_DECL int archive_match_include_date_w(struct archive *, int _flag,1222const wchar_t *_datestr);1223/* Set inclusion time by a particular file. */1224__LA_DECL int archive_match_include_file_time(struct archive *,1225int _flag, const char *_pathname);1226__LA_DECL int archive_match_include_file_time_w(struct archive *,1227int _flag, const wchar_t *_pathname);1228/* Add exclusion entry. */1229__LA_DECL int archive_match_exclude_entry(struct archive *,1230int _flag, struct archive_entry *);12311232/*1233* Test if a file is excluded by its uid ,gid, uname or gname.1234* The conditions are set by following functions.1235*/1236__LA_DECL int archive_match_owner_excluded(struct archive *,1237struct archive_entry *);1238/* Add inclusion uid, gid, uname and gname. */1239__LA_DECL int archive_match_include_uid(struct archive *, la_int64_t);1240__LA_DECL int archive_match_include_gid(struct archive *, la_int64_t);1241__LA_DECL int archive_match_include_uname(struct archive *, const char *);1242__LA_DECL int archive_match_include_uname_w(struct archive *,1243const wchar_t *);1244__LA_DECL int archive_match_include_gname(struct archive *, const char *);1245__LA_DECL int archive_match_include_gname_w(struct archive *,1246const wchar_t *);12471248/* Utility functions */1249#if ARCHIVE_VERSION_NUMBER < 40000001250/* Convenience function to sort a NULL terminated list of strings */1251__LA_DECL int archive_utility_string_sort(char **);1252#endif12531254#ifdef __cplusplus1255}1256#endif12571258/* These are meaningless outside of this header. */1259#undef __LA_DECL12601261#endif /* !ARCHIVE_H_INCLUDED */126212631264