Path: blob/master/Utilities/cmlibarchive/libarchive/archive.h
3153 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 30070093738#include <sys/stat.h>39#include <stddef.h> /* for wchar_t */40#include <stdio.h> /* For FILE * */41#include <time.h> /* For time_t */4243/*44* Note: archive.h is for use outside of libarchive; the configuration45* headers (config.h, archive_platform.h, etc.) are purely internal.46* Do NOT use HAVE_XXX configuration macros to control the behavior of47* this header! If you must conditionalize, use predefined compiler and/or48* platform macros.49*/50#if defined(__BORLANDC__) && __BORLANDC__ >= 0x56051# include <stdint.h>52#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H)53# include <inttypes.h>54#endif5556/* Get appropriate definitions of 64-bit integer */57#if !defined(__LA_INT64_T_DEFINED)58/* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */59# if ARCHIVE_VERSION_NUMBER < 400000060#define __LA_INT64_T la_int64_t61# endif62#define __LA_INT64_T_DEFINED63# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)64typedef __int64 la_int64_t;65# else66# include <unistd.h> /* ssize_t */67# if defined(_SCO_DS) || defined(__osf__)68typedef long long la_int64_t;69# else70typedef int64_t la_int64_t;71# endif72# endif73#endif7475/* The la_ssize_t should match the type used in 'struct stat' */76#if !defined(__LA_SSIZE_T_DEFINED)77/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */78# if ARCHIVE_VERSION_NUMBER < 400000079#define __LA_SSIZE_T la_ssize_t80# endif81#define __LA_SSIZE_T_DEFINED82# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)83# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)84typedef ssize_t la_ssize_t;85# elif defined(_WIN64)86typedef __int64 la_ssize_t;87# else88typedef long la_ssize_t;89# endif90# else91# include <unistd.h> /* ssize_t */92typedef ssize_t la_ssize_t;93# endif94#endif9596/* Large file support for Android */97#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__)98#include "android_lf.h"99#endif100101/*102* On Windows, define LIBARCHIVE_STATIC if you're building or using a103* .lib. The default here assumes you're building a DLL. Only104* libarchive source should ever define __LIBARCHIVE_BUILD.105*/106#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)107# ifdef __LIBARCHIVE_BUILD108# ifdef __GNUC__109# define __LA_DECL __attribute__((dllexport)) extern110# else111# define __LA_DECL __declspec(dllexport)112# endif113# else114# ifdef __GNUC__115# define __LA_DECL116# else117# define __LA_DECL __declspec(dllimport)118# endif119# endif120#elif defined __LIBARCHIVE_ENABLE_VISIBILITY121# define __LA_DECL __attribute__((visibility("default")))122#else123/* Static libraries or non-Windows needs no special declaration. */124# define __LA_DECL125#endif126127#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__)128#define __LA_PRINTF(fmtarg, firstvararg) \129__attribute__((__format__ (__printf__, fmtarg, firstvararg)))130#else131#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */132#endif133134/* CMake uses some deprecated APIs to build with old libarchive versions. */135#define __LA_DEPRECATED136137#ifdef __cplusplus138extern "C" {139#endif140141/*142* The version number is provided as both a macro and a function.143* The macro identifies the installed header; the function identifies144* the library version (which may not be the same if you're using a145* dynamically-linked version of the library). Of course, if the146* header and library are very different, you should expect some147* strangeness. Don't do that.148*/149__LA_DECL int archive_version_number(void);150151/*152* Textual name/version of the library, useful for version displays.153*/154#define ARCHIVE_VERSION_ONLY_STRING "3.7.9"155#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING156__LA_DECL const char * archive_version_string(void);157158/*159* Detailed textual name/version of the library and its dependencies.160* This has the form:161* "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..."162* the list of libraries described here will vary depending on how163* libarchive was compiled.164*/165__LA_DECL const char * archive_version_details(void);166167/*168* Returns NULL if libarchive was compiled without the associated library.169* Otherwise, returns the version number that libarchive was compiled170* against.171*/172__LA_DECL const char * archive_zlib_version(void);173__LA_DECL const char * archive_liblzma_version(void);174__LA_DECL const char * archive_bzlib_version(void);175__LA_DECL const char * archive_liblz4_version(void);176__LA_DECL const char * archive_libzstd_version(void);177178/* Declare our basic types. */179struct archive;180struct archive_entry;181182/*183* Error codes: Use archive_errno() and archive_error_string()184* to retrieve details. Unless specified otherwise, all functions185* that return 'int' use these codes.186*/187#define ARCHIVE_EOF 1 /* Found end of archive. */188#define ARCHIVE_OK 0 /* Operation was successful. */189#define ARCHIVE_RETRY (-10) /* Retry might succeed. */190#define ARCHIVE_WARN (-20) /* Partial success. */191/* For example, if write_header "fails", then you can't push data. */192#define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */193/* But if write_header is "fatal," then this archive is dead and useless. */194#define ARCHIVE_FATAL (-30) /* No more operations are possible. */195196/*197* As far as possible, archive_errno returns standard platform errno codes.198* Of course, the details vary by platform, so the actual definitions199* here are stored in "archive_platform.h". The symbols are listed here200* for reference; as a rule, clients should not need to know the exact201* platform-dependent error code.202*/203/* Unrecognized or invalid file format. */204/* #define ARCHIVE_ERRNO_FILE_FORMAT */205/* Illegal usage of the library. */206/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */207/* Unknown or unclassified error. */208/* #define ARCHIVE_ERRNO_MISC */209210/*211* Callbacks are invoked to automatically read/skip/write/open/close the212* archive. You can provide your own for complex tasks (like breaking213* archives across multiple tapes) or use standard ones built into the214* library.215*/216217/* Returns pointer and size of next block of data from archive. */218typedef la_ssize_t archive_read_callback(struct archive *,219void *_client_data, const void **_buffer);220221/* Skips at most request bytes from archive and returns the skipped amount.222* This may skip fewer bytes than requested; it may even skip zero bytes.223* If you do skip fewer bytes than requested, libarchive will invoke your224* read callback and discard data as necessary to make up the full skip.225*/226typedef la_int64_t archive_skip_callback(struct archive *,227void *_client_data, la_int64_t request);228229/* Seeks to specified location in the file and returns the position.230* Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h.231* Return ARCHIVE_FATAL if the seek fails for any reason.232*/233typedef la_int64_t archive_seek_callback(struct archive *,234void *_client_data, la_int64_t offset, int whence);235236/* Returns size actually written, zero on EOF, -1 on error. */237typedef la_ssize_t archive_write_callback(struct archive *,238void *_client_data,239const void *_buffer, size_t _length);240241typedef int archive_open_callback(struct archive *, void *_client_data);242243typedef int archive_close_callback(struct archive *, void *_client_data);244245typedef int archive_free_callback(struct archive *, void *_client_data);246247/* Switches from one client data object to the next/prev client data object.248* This is useful for reading from different data blocks such as a set of files249* that make up one large file.250*/251typedef int archive_switch_callback(struct archive *, void *_client_data1,252void *_client_data2);253254/*255* Returns a passphrase used for encryption or decryption, NULL on nothing256* to do and give it up.257*/258typedef const char *archive_passphrase_callback(struct archive *,259void *_client_data);260261/*262* Codes to identify various stream filters.263*/264#define ARCHIVE_FILTER_NONE 0265#define ARCHIVE_FILTER_GZIP 1266#define ARCHIVE_FILTER_BZIP2 2267#define ARCHIVE_FILTER_COMPRESS 3268#define ARCHIVE_FILTER_PROGRAM 4269#define ARCHIVE_FILTER_LZMA 5270#define ARCHIVE_FILTER_XZ 6271#define ARCHIVE_FILTER_UU 7272#define ARCHIVE_FILTER_RPM 8273#define ARCHIVE_FILTER_LZIP 9274#define ARCHIVE_FILTER_LRZIP 10275#define ARCHIVE_FILTER_LZOP 11276#define ARCHIVE_FILTER_GRZIP 12277#define ARCHIVE_FILTER_LZ4 13278#define ARCHIVE_FILTER_ZSTD 14279280#if ARCHIVE_VERSION_NUMBER < 4000000281#define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE282#define ARCHIVE_COMPRESSION_GZIP ARCHIVE_FILTER_GZIP283#define ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_FILTER_BZIP2284#define ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_FILTER_COMPRESS285#define ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_FILTER_PROGRAM286#define ARCHIVE_COMPRESSION_LZMA ARCHIVE_FILTER_LZMA287#define ARCHIVE_COMPRESSION_XZ ARCHIVE_FILTER_XZ288#define ARCHIVE_COMPRESSION_UU ARCHIVE_FILTER_UU289#define ARCHIVE_COMPRESSION_RPM ARCHIVE_FILTER_RPM290#define ARCHIVE_COMPRESSION_LZIP ARCHIVE_FILTER_LZIP291#define ARCHIVE_COMPRESSION_LRZIP ARCHIVE_FILTER_LRZIP292#endif293294/*295* Codes returned by archive_format.296*297* Top 16 bits identifies the format family (e.g., "tar"); lower298* 16 bits indicate the variant. This is updated by read_next_header.299* Note that the lower 16 bits will often vary from entry to entry.300* In some cases, this variation occurs as libarchive learns more about301* the archive (for example, later entries might utilize extensions that302* weren't necessary earlier in the archive; in this case, libarchive303* will change the format code to indicate the extended format that304* was used). In other cases, it's because different tools have305* modified the archive and so different parts of the archive306* actually have slightly different formats. (Both tar and cpio store307* format codes in each entry, so it is quite possible for each308* entry to be in a different format.)309*/310#define ARCHIVE_FORMAT_BASE_MASK 0xff0000311#define ARCHIVE_FORMAT_CPIO 0x10000312#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1)313#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2)314#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3)315#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4)316#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5)317#define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6)318#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7)319#define ARCHIVE_FORMAT_SHAR 0x20000320#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1)321#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2)322#define ARCHIVE_FORMAT_TAR 0x30000323#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1)324#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2)325#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3)326#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4)327#define ARCHIVE_FORMAT_ISO9660 0x40000328#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1)329#define ARCHIVE_FORMAT_ZIP 0x50000330#define ARCHIVE_FORMAT_EMPTY 0x60000331#define ARCHIVE_FORMAT_AR 0x70000332#define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1)333#define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2)334#define ARCHIVE_FORMAT_MTREE 0x80000335#define ARCHIVE_FORMAT_RAW 0x90000336#define ARCHIVE_FORMAT_XAR 0xA0000337#define ARCHIVE_FORMAT_LHA 0xB0000338#define ARCHIVE_FORMAT_CAB 0xC0000339#define ARCHIVE_FORMAT_RAR 0xD0000340#define ARCHIVE_FORMAT_7ZIP 0xE0000341#define ARCHIVE_FORMAT_WARC 0xF0000342#define ARCHIVE_FORMAT_RAR_V5 0x100000343344/*345* Codes returned by archive_read_format_capabilities().346*347* This list can be extended with values between 0 and 0xffff.348* The original purpose of this list was to let different archive349* format readers expose their general capabilities in terms of350* encryption.351*/352#define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */353#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0) /* reader can detect encrypted data */354#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1) /* reader can detect encryptable metadata (pathname, mtime, etc.) */355356/*357* Codes returned by archive_read_has_encrypted_entries().358*359* In case the archive does not support encryption detection at all360* ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader361* for some other reason (e.g. not enough bytes read) cannot say if362* there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW363* is returned.364*/365#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2366#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1367368/*-369* Basic outline for reading an archive:370* 1) Ask archive_read_new for an archive reader object.371* 2) Update any global properties as appropriate.372* In particular, you'll certainly want to call appropriate373* archive_read_support_XXX functions.374* 3) Call archive_read_open_XXX to open the archive375* 4) Repeatedly call archive_read_next_header to get information about376* successive archive entries. Call archive_read_data to extract377* data for entries of interest.378* 5) Call archive_read_free to end processing.379*/380__LA_DECL struct archive *archive_read_new(void);381382/*383* The archive_read_support_XXX calls enable auto-detect for this384* archive handle. They also link in the necessary support code.385* For example, if you don't want bzlib linked in, don't invoke386* support_compression_bzip2(). The "all" functions provide the387* obvious shorthand.388*/389390#if ARCHIVE_VERSION_NUMBER < 4000000391__LA_DECL int archive_read_support_compression_all(struct archive *)392__LA_DEPRECATED;393__LA_DECL int archive_read_support_compression_bzip2(struct archive *)394__LA_DEPRECATED;395__LA_DECL int archive_read_support_compression_compress(struct archive *)396__LA_DEPRECATED;397__LA_DECL int archive_read_support_compression_gzip(struct archive *)398__LA_DEPRECATED;399__LA_DECL int archive_read_support_compression_lzip(struct archive *)400__LA_DEPRECATED;401__LA_DECL int archive_read_support_compression_lzma(struct archive *)402__LA_DEPRECATED;403__LA_DECL int archive_read_support_compression_none(struct archive *)404__LA_DEPRECATED;405__LA_DECL int archive_read_support_compression_program(struct archive *,406const char *command) __LA_DEPRECATED;407__LA_DECL int archive_read_support_compression_program_signature408(struct archive *, const char *,409const void * /* match */, size_t) __LA_DEPRECATED;410411__LA_DECL int archive_read_support_compression_rpm(struct archive *)412__LA_DEPRECATED;413__LA_DECL int archive_read_support_compression_uu(struct archive *)414__LA_DEPRECATED;415__LA_DECL int archive_read_support_compression_xz(struct archive *)416__LA_DEPRECATED;417#endif418419__LA_DECL int archive_read_support_filter_all(struct archive *);420__LA_DECL int archive_read_support_filter_by_code(struct archive *, int);421__LA_DECL int archive_read_support_filter_bzip2(struct archive *);422__LA_DECL int archive_read_support_filter_compress(struct archive *);423__LA_DECL int archive_read_support_filter_gzip(struct archive *);424__LA_DECL int archive_read_support_filter_grzip(struct archive *);425__LA_DECL int archive_read_support_filter_lrzip(struct archive *);426__LA_DECL int archive_read_support_filter_lz4(struct archive *);427__LA_DECL int archive_read_support_filter_lzip(struct archive *);428__LA_DECL int archive_read_support_filter_lzma(struct archive *);429__LA_DECL int archive_read_support_filter_lzop(struct archive *);430__LA_DECL int archive_read_support_filter_none(struct archive *);431__LA_DECL int archive_read_support_filter_program(struct archive *,432const char *command);433__LA_DECL int archive_read_support_filter_program_signature434(struct archive *, const char * /* cmd */,435const void * /* match */, size_t);436__LA_DECL int archive_read_support_filter_rpm(struct archive *);437__LA_DECL int archive_read_support_filter_uu(struct archive *);438__LA_DECL int archive_read_support_filter_xz(struct archive *);439__LA_DECL int archive_read_support_filter_zstd(struct archive *);440441__LA_DECL int archive_read_support_format_7zip(struct archive *);442__LA_DECL int archive_read_support_format_all(struct archive *);443__LA_DECL int archive_read_support_format_ar(struct archive *);444__LA_DECL int archive_read_support_format_by_code(struct archive *, int);445__LA_DECL int archive_read_support_format_cab(struct archive *);446__LA_DECL int archive_read_support_format_cpio(struct archive *);447__LA_DECL int archive_read_support_format_empty(struct archive *);448__LA_DECL int archive_read_support_format_gnutar(struct archive *);449__LA_DECL int archive_read_support_format_iso9660(struct archive *);450__LA_DECL int archive_read_support_format_lha(struct archive *);451__LA_DECL int archive_read_support_format_mtree(struct archive *);452__LA_DECL int archive_read_support_format_rar(struct archive *);453__LA_DECL int archive_read_support_format_rar5(struct archive *);454__LA_DECL int archive_read_support_format_raw(struct archive *);455__LA_DECL int archive_read_support_format_tar(struct archive *);456__LA_DECL int archive_read_support_format_warc(struct archive *);457__LA_DECL int archive_read_support_format_xar(struct archive *);458/* archive_read_support_format_zip() enables both streamable and seekable459* zip readers. */460__LA_DECL int archive_read_support_format_zip(struct archive *);461/* Reads Zip archives as stream from beginning to end. Doesn't462* correctly handle SFX ZIP files or ZIP archives that have been modified463* in-place. */464__LA_DECL int archive_read_support_format_zip_streamable(struct archive *);465/* Reads starting from central directory; requires seekable input. */466__LA_DECL int archive_read_support_format_zip_seekable(struct archive *);467468/* Functions to manually set the format and filters to be used. This is469* useful to bypass the bidding process when the format and filters to use470* is known in advance.471*/472__LA_DECL int archive_read_set_format(struct archive *, int);473__LA_DECL int archive_read_append_filter(struct archive *, int);474__LA_DECL int archive_read_append_filter_program(struct archive *,475const char *);476__LA_DECL int archive_read_append_filter_program_signature477(struct archive *, const char *, const void * /* match */, size_t);478479/* Set various callbacks. */480__LA_DECL int archive_read_set_open_callback(struct archive *,481archive_open_callback *);482__LA_DECL int archive_read_set_read_callback(struct archive *,483archive_read_callback *);484__LA_DECL int archive_read_set_seek_callback(struct archive *,485archive_seek_callback *);486__LA_DECL int archive_read_set_skip_callback(struct archive *,487archive_skip_callback *);488__LA_DECL int archive_read_set_close_callback(struct archive *,489archive_close_callback *);490/* Callback used to switch between one data object to the next */491__LA_DECL int archive_read_set_switch_callback(struct archive *,492archive_switch_callback *);493494/* This sets the first data object. */495__LA_DECL int archive_read_set_callback_data(struct archive *, void *);496/* This sets data object at specified index */497__LA_DECL int archive_read_set_callback_data2(struct archive *, void *,498unsigned int);499/* This adds a data object at the specified index. */500__LA_DECL int archive_read_add_callback_data(struct archive *, void *,501unsigned int);502/* This appends a data object to the end of list */503__LA_DECL int archive_read_append_callback_data(struct archive *, void *);504/* This prepends a data object to the beginning of list */505__LA_DECL int archive_read_prepend_callback_data(struct archive *, void *);506507/* Opening freezes the callbacks. */508__LA_DECL int archive_read_open1(struct archive *);509510/* Convenience wrappers around the above. */511__LA_DECL int archive_read_open(struct archive *, void *_client_data,512archive_open_callback *, archive_read_callback *,513archive_close_callback *);514__LA_DECL int archive_read_open2(struct archive *, void *_client_data,515archive_open_callback *, archive_read_callback *,516archive_skip_callback *, archive_close_callback *);517518/*519* A variety of shortcuts that invoke archive_read_open() with520* canned callbacks suitable for common situations. The ones that521* accept a block size handle tape blocking correctly.522*/523/* Use this if you know the filename. Note: NULL indicates stdin. */524__LA_DECL int archive_read_open_filename(struct archive *,525const char *_filename, size_t _block_size);526/* Use this for reading multivolume files by filenames.527* NOTE: Must be NULL terminated. Sorting is NOT done. */528__LA_DECL int archive_read_open_filenames(struct archive *,529const char **_filenames, size_t _block_size);530__LA_DECL int archive_read_open_filename_w(struct archive *,531const wchar_t *_filename, size_t _block_size);532#if defined(_WIN32) && !defined(__CYGWIN__)533__LA_DECL int archive_read_open_filenames_w(struct archive *,534const wchar_t **_filenames, size_t _block_size);535#endif536/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */537__LA_DECL int archive_read_open_file(struct archive *,538const char *_filename, size_t _block_size) __LA_DEPRECATED;539/* Read an archive that's stored in memory. */540__LA_DECL int archive_read_open_memory(struct archive *,541const void * buff, size_t size);542/* A more involved version that is only used for internal testing. */543__LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff,544size_t size, size_t read_size);545/* Read an archive that's already open, using the file descriptor. */546__LA_DECL int archive_read_open_fd(struct archive *, int _fd,547size_t _block_size);548/* Read an archive that's already open, using a FILE *. */549/* Note: DO NOT use this with tape drives. */550__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);551552/* Parses and returns next entry header. */553__LA_DECL int archive_read_next_header(struct archive *,554struct archive_entry **);555556/* Parses and returns next entry header using the archive_entry passed in */557__LA_DECL int archive_read_next_header2(struct archive *,558struct archive_entry *);559560/*561* Retrieve the byte offset in UNCOMPRESSED data where last-read562* header started.563*/564__LA_DECL la_int64_t archive_read_header_position(struct archive *);565566/*567* Returns 1 if the archive contains at least one encrypted entry.568* If the archive format not support encryption at all569* ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned.570* If for any other reason (e.g. not enough data read so far)571* we cannot say whether there are encrypted entries, then572* ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned.573* In general, this function will return values below zero when the574* reader is uncertain or totally incapable of encryption support.575* When this function returns 0 you can be sure that the reader576* supports encryption detection but no encrypted entries have577* been found yet.578*579* NOTE: If the metadata/header of an archive is also encrypted, you580* cannot rely on the number of encrypted entries. That is why this581* function does not return the number of encrypted entries but#582* just shows that there are some.583*/584__LA_DECL int archive_read_has_encrypted_entries(struct archive *);585586/*587* Returns a bitmask of capabilities that are supported by the archive format reader.588* If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned.589*/590__LA_DECL int archive_read_format_capabilities(struct archive *);591592/* Read data from the body of an entry. Similar to read(2). */593__LA_DECL la_ssize_t archive_read_data(struct archive *,594void *, size_t);595596/* Seek within the body of an entry. Similar to lseek(2). */597__LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int);598599/*600* A zero-copy version of archive_read_data that also exposes the file offset601* of each returned block. Note that the client has no way to specify602* the desired size of the block. The API does guarantee that offsets will603* be strictly increasing and that returned blocks will not overlap.604*/605__LA_DECL int archive_read_data_block(struct archive *a,606const void **buff, size_t *size, la_int64_t *offset);607608/*-609* Some convenience functions that are built on archive_read_data:610* 'skip': skips entire entry611* 'into_buffer': writes data into memory buffer that you provide612* 'into_fd': writes data to specified filedes613*/614__LA_DECL int archive_read_data_skip(struct archive *);615__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);616617/*618* Set read options.619*/620/* Apply option to the format only. */621__LA_DECL int archive_read_set_format_option(struct archive *_a,622const char *m, const char *o,623const char *v);624/* Apply option to the filter only. */625__LA_DECL int archive_read_set_filter_option(struct archive *_a,626const char *m, const char *o,627const char *v);628/* Apply option to both the format and the filter. */629__LA_DECL int archive_read_set_option(struct archive *_a,630const char *m, const char *o,631const char *v);632/* Apply option string to both the format and the filter. */633__LA_DECL int archive_read_set_options(struct archive *_a,634const char *opts);635636/*637* Add a decryption passphrase.638*/639__LA_DECL int archive_read_add_passphrase(struct archive *, const char *);640__LA_DECL int archive_read_set_passphrase_callback(struct archive *,641void *client_data, archive_passphrase_callback *);642643644/*-645* Convenience function to recreate the current entry (whose header646* has just been read) on disk.647*648* This does quite a bit more than just copy data to disk. It also:649* - Creates intermediate directories as required.650* - Manages directory permissions: non-writable directories will651* be initially created with write permission enabled; when the652* archive is closed, dir permissions are edited to the values specified653* in the archive.654* - Checks hardlinks: hardlinks will not be extracted unless the655* linked-to file was also extracted within the same session. (TODO)656*/657658/* The "flags" argument selects optional behavior, 'OR' the flags you want. */659660/* Default: Do not try to set owner/group. */661#define ARCHIVE_EXTRACT_OWNER (0x0001)662/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */663#define ARCHIVE_EXTRACT_PERM (0x0002)664/* Default: Do not restore mtime/atime. */665#define ARCHIVE_EXTRACT_TIME (0x0004)666/* Default: Replace existing files. */667#define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008)668/* Default: Try create first, unlink only if create fails with EEXIST. */669#define ARCHIVE_EXTRACT_UNLINK (0x0010)670/* Default: Do not restore ACLs. */671#define ARCHIVE_EXTRACT_ACL (0x0020)672/* Default: Do not restore fflags. */673#define ARCHIVE_EXTRACT_FFLAGS (0x0040)674/* Default: Do not restore xattrs. */675#define ARCHIVE_EXTRACT_XATTR (0x0080)676/* Default: Do not try to guard against extracts redirected by symlinks. */677/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */678#define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100)679/* Default: Do not reject entries with '..' as path elements. */680#define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200)681/* Default: Create parent directories as needed. */682#define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400)683/* Default: Overwrite files, even if one on disk is newer. */684#define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800)685/* Detect blocks of 0 and write holes instead. */686#define ARCHIVE_EXTRACT_SPARSE (0x1000)687/* Default: Do not restore Mac extended metadata. */688/* This has no effect except on Mac OS. */689#define ARCHIVE_EXTRACT_MAC_METADATA (0x2000)690/* Default: Use HFS+ compression if it was compressed. */691/* This has no effect except on Mac OS v10.6 or later. */692#define ARCHIVE_EXTRACT_NO_HFS_COMPRESSION (0x4000)693/* Default: Do not use HFS+ compression if it was not compressed. */694/* This has no effect except on Mac OS v10.6 or later. */695#define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000)696/* Default: Do not reject entries with absolute paths */697#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)698/* Default: Do not clear no-change flags when unlinking object */699#define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000)700/* Default: Do not extract atomically (using rename) */701#define ARCHIVE_EXTRACT_SAFE_WRITES (0x40000)702703__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,704int flags);705__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,706struct archive * /* dest */);707__LA_DECL void archive_read_extract_set_progress_callback(struct archive *,708void (*_progress_func)(void *), void *_user_data);709710/* Record the dev/ino of a file that will not be written. This is711* generally set to the dev/ino of the archive being read. */712__LA_DECL void archive_read_extract_set_skip_file(struct archive *,713la_int64_t, la_int64_t);714715/* Close the file and release most resources. */716__LA_DECL int archive_read_close(struct archive *);717/* Release all resources and destroy the object. */718/* Note that archive_read_free will call archive_read_close for you. */719__LA_DECL int archive_read_free(struct archive *);720#if ARCHIVE_VERSION_NUMBER < 4000000721/* Synonym for archive_read_free() for backwards compatibility. */722__LA_DECL int archive_read_finish(struct archive *) __LA_DEPRECATED;723#endif724725/*-726* To create an archive:727* 1) Ask archive_write_new for an archive writer object.728* 2) Set any global properties. In particular, you should set729* the compression and format to use.730* 3) Call archive_write_open to open the file (most people731* will use archive_write_open_file or archive_write_open_fd,732* which provide convenient canned I/O callbacks for you).733* 4) For each entry:734* - construct an appropriate struct archive_entry structure735* - archive_write_header to write the header736* - archive_write_data to write the entry data737* 5) archive_write_close to close the output738* 6) archive_write_free to cleanup the writer and release resources739*/740__LA_DECL struct archive *archive_write_new(void);741__LA_DECL int archive_write_set_bytes_per_block(struct archive *,742int bytes_per_block);743__LA_DECL int archive_write_get_bytes_per_block(struct archive *);744/* XXX This is badly misnamed; suggestions appreciated. XXX */745__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,746int bytes_in_last_block);747__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);748749/* The dev/ino of a file that won't be archived. This is used750* to avoid recursively adding an archive to itself. */751__LA_DECL int archive_write_set_skip_file(struct archive *,752la_int64_t, la_int64_t);753754#if ARCHIVE_VERSION_NUMBER < 4000000755__LA_DECL int archive_write_set_compression_bzip2(struct archive *)756__LA_DEPRECATED;757__LA_DECL int archive_write_set_compression_compress(struct archive *)758__LA_DEPRECATED;759__LA_DECL int archive_write_set_compression_gzip(struct archive *)760__LA_DEPRECATED;761__LA_DECL int archive_write_set_compression_lzip(struct archive *)762__LA_DEPRECATED;763__LA_DECL int archive_write_set_compression_lzma(struct archive *)764__LA_DEPRECATED;765__LA_DECL int archive_write_set_compression_none(struct archive *)766__LA_DEPRECATED;767__LA_DECL int archive_write_set_compression_program(struct archive *,768const char *cmd) __LA_DEPRECATED;769__LA_DECL int archive_write_set_compression_xz(struct archive *)770__LA_DEPRECATED;771#endif772773/* A convenience function to set the filter based on the code. */774__LA_DECL int archive_write_add_filter(struct archive *, int filter_code);775__LA_DECL int archive_write_add_filter_by_name(struct archive *,776const char *name);777__LA_DECL int archive_write_add_filter_b64encode(struct archive *);778__LA_DECL int archive_write_add_filter_bzip2(struct archive *);779__LA_DECL int archive_write_add_filter_compress(struct archive *);780__LA_DECL int archive_write_add_filter_grzip(struct archive *);781__LA_DECL int archive_write_add_filter_gzip(struct archive *);782__LA_DECL int archive_write_add_filter_lrzip(struct archive *);783__LA_DECL int archive_write_add_filter_lz4(struct archive *);784__LA_DECL int archive_write_add_filter_lzip(struct archive *);785__LA_DECL int archive_write_add_filter_lzma(struct archive *);786__LA_DECL int archive_write_add_filter_lzop(struct archive *);787__LA_DECL int archive_write_add_filter_none(struct archive *);788__LA_DECL int archive_write_add_filter_program(struct archive *,789const char *cmd);790__LA_DECL int archive_write_add_filter_uuencode(struct archive *);791__LA_DECL int archive_write_add_filter_xz(struct archive *);792__LA_DECL int archive_write_add_filter_zstd(struct archive *);793794795/* A convenience function to set the format based on the code or name. */796__LA_DECL int archive_write_set_format(struct archive *, int format_code);797__LA_DECL int archive_write_set_format_by_name(struct archive *,798const char *name);799/* To minimize link pollution, use one or more of the following. */800__LA_DECL int archive_write_set_format_7zip(struct archive *);801__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);802__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);803__LA_DECL int archive_write_set_format_cpio(struct archive *);804__LA_DECL int archive_write_set_format_cpio_bin(struct archive *);805__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);806__LA_DECL int archive_write_set_format_cpio_odc(struct archive *);807__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *);808__LA_DECL int archive_write_set_format_gnutar(struct archive *);809__LA_DECL int archive_write_set_format_iso9660(struct archive *);810__LA_DECL int archive_write_set_format_mtree(struct archive *);811__LA_DECL int archive_write_set_format_mtree_classic(struct archive *);812/* TODO: int archive_write_set_format_old_tar(struct archive *); */813__LA_DECL int archive_write_set_format_pax(struct archive *);814__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);815__LA_DECL int archive_write_set_format_raw(struct archive *);816__LA_DECL int archive_write_set_format_shar(struct archive *);817__LA_DECL int archive_write_set_format_shar_dump(struct archive *);818__LA_DECL int archive_write_set_format_ustar(struct archive *);819__LA_DECL int archive_write_set_format_v7tar(struct archive *);820__LA_DECL int archive_write_set_format_warc(struct archive *);821__LA_DECL int archive_write_set_format_xar(struct archive *);822__LA_DECL int archive_write_set_format_zip(struct archive *);823__LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename);824__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext);825__LA_DECL int archive_write_zip_set_compression_deflate(struct archive *);826__LA_DECL int archive_write_zip_set_compression_store(struct archive *);827/* Deprecated; use archive_write_open2 instead */828__LA_DECL int archive_write_open(struct archive *, void *,829archive_open_callback *, archive_write_callback *,830archive_close_callback *);831__LA_DECL int archive_write_open2(struct archive *, void *,832archive_open_callback *, archive_write_callback *,833archive_close_callback *, archive_free_callback *);834__LA_DECL int archive_write_open_fd(struct archive *, int _fd);835__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);836__LA_DECL int archive_write_open_filename_w(struct archive *,837const wchar_t *_file);838/* A deprecated synonym for archive_write_open_filename() */839__LA_DECL int archive_write_open_file(struct archive *, const char *_file)840__LA_DEPRECATED;841__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);842/* _buffSize is the size of the buffer, _used refers to a variable that843* will be updated after each write into the buffer. */844__LA_DECL int archive_write_open_memory(struct archive *,845void *_buffer, size_t _buffSize, size_t *_used);846847/*848* Note that the library will truncate writes beyond the size provided849* to archive_write_header or pad if the provided data is short.850*/851__LA_DECL int archive_write_header(struct archive *,852struct archive_entry *);853__LA_DECL la_ssize_t archive_write_data(struct archive *,854const void *, size_t);855856/* This interface is currently only available for archive_write_disk handles. */857__LA_DECL la_ssize_t archive_write_data_block(struct archive *,858const void *, size_t, la_int64_t);859860__LA_DECL int archive_write_finish_entry(struct archive *);861__LA_DECL int archive_write_close(struct archive *);862/* Marks the archive as FATAL so that a subsequent free() operation863* won't try to close() cleanly. Provides a fast abort capability864* when the client discovers that things have gone wrong. */865__LA_DECL int archive_write_fail(struct archive *);866/* This can fail if the archive wasn't already closed, in which case867* archive_write_free() will implicitly call archive_write_close(). */868__LA_DECL int archive_write_free(struct archive *);869#if ARCHIVE_VERSION_NUMBER < 4000000870/* Synonym for archive_write_free() for backwards compatibility. */871__LA_DECL int archive_write_finish(struct archive *) __LA_DEPRECATED;872#endif873874/*875* Set write options.876*/877/* Apply option to the format only. */878__LA_DECL int archive_write_set_format_option(struct archive *_a,879const char *m, const char *o,880const char *v);881/* Apply option to the filter only. */882__LA_DECL int archive_write_set_filter_option(struct archive *_a,883const char *m, const char *o,884const char *v);885/* Apply option to both the format and the filter. */886__LA_DECL int archive_write_set_option(struct archive *_a,887const char *m, const char *o,888const char *v);889/* Apply option string to both the format and the filter. */890__LA_DECL int archive_write_set_options(struct archive *_a,891const char *opts);892893/*894* Set an encryption passphrase.895*/896__LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p);897__LA_DECL int archive_write_set_passphrase_callback(struct archive *,898void *client_data, archive_passphrase_callback *);899900/*-901* ARCHIVE_WRITE_DISK API902*903* To create objects on disk:904* 1) Ask archive_write_disk_new for a new archive_write_disk object.905* 2) Set any global properties. In particular, you probably906* want to set the options.907* 3) For each entry:908* - construct an appropriate struct archive_entry structure909* - archive_write_header to create the file/dir/etc on disk910* - archive_write_data to write the entry data911* 4) archive_write_free to cleanup the writer and release resources912*913* In particular, you can use this in conjunction with archive_read()914* to pull entries out of an archive and create them on disk.915*/916__LA_DECL struct archive *archive_write_disk_new(void);917/* This file will not be overwritten. */918__LA_DECL int archive_write_disk_set_skip_file(struct archive *,919la_int64_t, la_int64_t);920/* Set flags to control how the next item gets created.921* This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */922__LA_DECL int archive_write_disk_set_options(struct archive *,923int flags);924/*925* The lookup functions are given uname/uid (or gname/gid) pairs and926* return a uid (gid) suitable for this system. These are used for927* restoring ownership and for setting ACLs. The default functions928* are naive, they just return the uid/gid. These are small, so reasonable929* for applications that don't need to preserve ownership; they930* are probably also appropriate for applications that are doing931* same-system backup and restore.932*/933/*934* The "standard" lookup functions use common system calls to lookup935* the uname/gname, falling back to the uid/gid if the names can't be936* found. They cache lookups and are reasonably fast, but can be very937* large, so they are not used unless you ask for them. In938* particular, these match the specifications of POSIX "pax" and old939* POSIX "tar".940*/941__LA_DECL int archive_write_disk_set_standard_lookup(struct archive *);942/*943* If neither the default (naive) nor the standard (big) functions suit944* your needs, you can write your own and register them. Be sure to945* include a cleanup function if you have allocated private data.946*/947__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,948void * /* private_data */,949la_int64_t (*)(void *, const char *, la_int64_t),950void (* /* cleanup */)(void *));951__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,952void * /* private_data */,953la_int64_t (*)(void *, const char *, la_int64_t),954void (* /* cleanup */)(void *));955__LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t);956__LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t);957958/*959* ARCHIVE_READ_DISK API960*961* This is still evolving and somewhat experimental.962*/963__LA_DECL struct archive *archive_read_disk_new(void);964/* The names for symlink modes here correspond to an old BSD965* command-line argument convention: -L, -P, -H */966/* Follow all symlinks. */967__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);968/* Follow no symlinks. */969__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);970/* Follow symlink initially, then not. */971__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);972/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */973__LA_DECL int archive_read_disk_entry_from_file(struct archive *,974struct archive_entry *, int /* fd */, const struct stat *);975/* Look up gname for gid or uname for uid. */976/* Default implementations are very, very stupid. */977__LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t);978__LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t);979/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the980* results for performance. */981__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *);982/* You can install your own lookups if you like. */983__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *,984void * /* private_data */,985const char *(* /* lookup_fn */)(void *, la_int64_t),986void (* /* cleanup_fn */)(void *));987__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *,988void * /* private_data */,989const char *(* /* lookup_fn */)(void *, la_int64_t),990void (* /* cleanup_fn */)(void *));991/* Start traversal. */992__LA_DECL int archive_read_disk_open(struct archive *, const char *);993__LA_DECL int archive_read_disk_open_w(struct archive *, const wchar_t *);994/*995* Request that current entry be visited. If you invoke it on every996* directory, you'll get a physical traversal. This is ignored if the997* current entry isn't a directory or a link to a directory. So, if998* you invoke this on every returned path, you'll get a full logical999* traversal.1000*/1001__LA_DECL int archive_read_disk_descend(struct archive *);1002__LA_DECL int archive_read_disk_can_descend(struct archive *);1003__LA_DECL int archive_read_disk_current_filesystem(struct archive *);1004__LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *);1005__LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *);1006/* Request that the access time of the entry visited by traversal be restored. */1007__LA_DECL int archive_read_disk_set_atime_restored(struct archive *);1008/*1009* Set behavior. The "flags" argument selects optional behavior.1010*/1011/* Request that the access time of the entry visited by traversal be restored.1012* This is the same as archive_read_disk_set_atime_restored. */1013#define ARCHIVE_READDISK_RESTORE_ATIME (0x0001)1014/* Default: Do not skip an entry which has nodump flags. */1015#define ARCHIVE_READDISK_HONOR_NODUMP (0x0002)1016/* Default: Skip a mac resource fork file whose prefix is "._" because of1017* using copyfile. */1018#define ARCHIVE_READDISK_MAC_COPYFILE (0x0004)1019/* Default: Traverse mount points. */1020#define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008)1021/* Default: Xattrs are read from disk. */1022#define ARCHIVE_READDISK_NO_XATTR (0x0010)1023/* Default: ACLs are read from disk. */1024#define ARCHIVE_READDISK_NO_ACL (0x0020)1025/* Default: File flags are read from disk. */1026#define ARCHIVE_READDISK_NO_FFLAGS (0x0040)1027/* Default: Sparse file information is read from disk. */1028#define ARCHIVE_READDISK_NO_SPARSE (0x0080)10291030__LA_DECL int archive_read_disk_set_behavior(struct archive *,1031int flags);10321033/*1034* Set archive_match object that will be used in archive_read_disk to1035* know whether an entry should be skipped. The callback function1036* _excluded_func will be invoked when an entry is skipped by the result1037* of archive_match.1038*/1039__LA_DECL int archive_read_disk_set_matching(struct archive *,1040struct archive *_matching, void (*_excluded_func)1041(struct archive *, void *, struct archive_entry *),1042void *_client_data);1043__LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *,1044int (*_metadata_filter_func)(struct archive *, void *,1045struct archive_entry *), void *_client_data);10461047/* Simplified cleanup interface;1048* This calls archive_read_free() or archive_write_free() as needed. */1049__LA_DECL int archive_free(struct archive *);10501051/*1052* Accessor functions to read/set various information in1053* the struct archive object:1054*/10551056/* Number of filters in the current filter pipeline. */1057/* Filter #0 is the one closest to the format, -1 is a synonym for the1058* last filter, which is always the pseudo-filter that wraps the1059* client callbacks. */1060__LA_DECL int archive_filter_count(struct archive *);1061__LA_DECL la_int64_t archive_filter_bytes(struct archive *, int);1062__LA_DECL int archive_filter_code(struct archive *, int);1063__LA_DECL const char * archive_filter_name(struct archive *, int);10641065#if ARCHIVE_VERSION_NUMBER < 40000001066/* These don't properly handle multiple filters, so are deprecated and1067* will eventually be removed. */1068/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */1069__LA_DECL la_int64_t archive_position_compressed(struct archive *)1070__LA_DEPRECATED;1071/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */1072__LA_DECL la_int64_t archive_position_uncompressed(struct archive *)1073__LA_DEPRECATED;1074/* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */1075__LA_DECL const char *archive_compression_name(struct archive *)1076__LA_DEPRECATED;1077/* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */1078__LA_DECL int archive_compression(struct archive *)1079__LA_DEPRECATED;1080#endif10811082__LA_DECL int archive_errno(struct archive *);1083__LA_DECL const char *archive_error_string(struct archive *);1084__LA_DECL const char *archive_format_name(struct archive *);1085__LA_DECL int archive_format(struct archive *);1086__LA_DECL void archive_clear_error(struct archive *);1087__LA_DECL void archive_set_error(struct archive *, int _err,1088const char *fmt, ...) __LA_PRINTF(3, 4);1089__LA_DECL void archive_copy_error(struct archive *dest,1090struct archive *src);1091__LA_DECL int archive_file_count(struct archive *);10921093/*1094* ARCHIVE_MATCH API1095*/1096__LA_DECL struct archive *archive_match_new(void);1097__LA_DECL int archive_match_free(struct archive *);10981099/*1100* Test if archive_entry is excluded.1101* This is a convenience function. This is the same as calling all1102* archive_match_path_excluded, archive_match_time_excluded1103* and archive_match_owner_excluded.1104*/1105__LA_DECL int archive_match_excluded(struct archive *,1106struct archive_entry *);11071108/*1109* Test if pathname is excluded. The conditions are set by following functions.1110*/1111__LA_DECL int archive_match_path_excluded(struct archive *,1112struct archive_entry *);1113/* Control recursive inclusion of directory content when directory is included. Default on. */1114__LA_DECL int archive_match_set_inclusion_recursion(struct archive *, int);1115/* Add exclusion pathname pattern. */1116__LA_DECL int archive_match_exclude_pattern(struct archive *, const char *);1117__LA_DECL int archive_match_exclude_pattern_w(struct archive *,1118const wchar_t *);1119/* Add exclusion pathname pattern from file. */1120__LA_DECL int archive_match_exclude_pattern_from_file(struct archive *,1121const char *, int _nullSeparator);1122__LA_DECL int archive_match_exclude_pattern_from_file_w(struct archive *,1123const wchar_t *, int _nullSeparator);1124/* Add inclusion pathname pattern. */1125__LA_DECL int archive_match_include_pattern(struct archive *, const char *);1126__LA_DECL int archive_match_include_pattern_w(struct archive *,1127const wchar_t *);1128/* Add inclusion pathname pattern from file. */1129__LA_DECL int archive_match_include_pattern_from_file(struct archive *,1130const char *, int _nullSeparator);1131__LA_DECL int archive_match_include_pattern_from_file_w(struct archive *,1132const wchar_t *, int _nullSeparator);1133/*1134* How to get statistic information for inclusion patterns.1135*/1136/* Return the amount number of unmatched inclusion patterns. */1137__LA_DECL int archive_match_path_unmatched_inclusions(struct archive *);1138/* Return the pattern of unmatched inclusion with ARCHIVE_OK.1139* Return ARCHIVE_EOF if there is no inclusion pattern. */1140__LA_DECL int archive_match_path_unmatched_inclusions_next(1141struct archive *, const char **);1142__LA_DECL int archive_match_path_unmatched_inclusions_next_w(1143struct archive *, const wchar_t **);11441145/*1146* Test if a file is excluded by its time stamp.1147* The conditions are set by following functions.1148*/1149__LA_DECL int archive_match_time_excluded(struct archive *,1150struct archive_entry *);11511152/*1153* Flags to tell a matching type of time stamps. These are used for1154* following functions.1155*/1156/* Time flag: mtime to be tested. */1157#define ARCHIVE_MATCH_MTIME (0x0100)1158/* Time flag: ctime to be tested. */1159#define ARCHIVE_MATCH_CTIME (0x0200)1160/* Comparison flag: Match the time if it is newer than. */1161#define ARCHIVE_MATCH_NEWER (0x0001)1162/* Comparison flag: Match the time if it is older than. */1163#define ARCHIVE_MATCH_OLDER (0x0002)1164/* Comparison flag: Match the time if it is equal to. */1165#define ARCHIVE_MATCH_EQUAL (0x0010)1166/* Set inclusion time. */1167__LA_DECL int archive_match_include_time(struct archive *, int _flag,1168time_t _sec, long _nsec);1169/* Set inclusion time by a date string. */1170__LA_DECL int archive_match_include_date(struct archive *, int _flag,1171const char *_datestr);1172__LA_DECL int archive_match_include_date_w(struct archive *, int _flag,1173const wchar_t *_datestr);1174/* Set inclusion time by a particular file. */1175__LA_DECL int archive_match_include_file_time(struct archive *,1176int _flag, const char *_pathname);1177__LA_DECL int archive_match_include_file_time_w(struct archive *,1178int _flag, const wchar_t *_pathname);1179/* Add exclusion entry. */1180__LA_DECL int archive_match_exclude_entry(struct archive *,1181int _flag, struct archive_entry *);11821183/*1184* Test if a file is excluded by its uid ,gid, uname or gname.1185* The conditions are set by following functions.1186*/1187__LA_DECL int archive_match_owner_excluded(struct archive *,1188struct archive_entry *);1189/* Add inclusion uid, gid, uname and gname. */1190__LA_DECL int archive_match_include_uid(struct archive *, la_int64_t);1191__LA_DECL int archive_match_include_gid(struct archive *, la_int64_t);1192__LA_DECL int archive_match_include_uname(struct archive *, const char *);1193__LA_DECL int archive_match_include_uname_w(struct archive *,1194const wchar_t *);1195__LA_DECL int archive_match_include_gname(struct archive *, const char *);1196__LA_DECL int archive_match_include_gname_w(struct archive *,1197const wchar_t *);11981199/* Utility functions */1200/* Convenience function to sort a NULL terminated list of strings */1201__LA_DECL int archive_utility_string_sort(char **);12021203#ifdef __cplusplus1204}1205#endif12061207/* These are meaningless outside of this header. */1208#undef __LA_DECL12091210#endif /* !ARCHIVE_H_INCLUDED */121112121213