946 lines
41 KiB

  1. /*-
  2. * Copyright (c) 2003-2010 Tim Kientzle
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
  15. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  16. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $
  26. */
  27. #ifndef ARCHIVE_H_INCLUDED
  28. #define ARCHIVE_H_INCLUDED
  29. #include <sys/stat.h>
  30. #include <stddef.h> /* for wchar_t */
  31. #include <stdio.h> /* For FILE * */
  32. /*
  33. * Note: archive.h is for use outside of libarchive; the configuration
  34. * headers (config.h, archive_platform.h, etc.) are purely internal.
  35. * Do NOT use HAVE_XXX configuration macros to control the behavior of
  36. * this header! If you must conditionalize, use predefined compiler and/or
  37. * platform macros.
  38. */
  39. #if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
  40. # include <stdint.h>
  41. #elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS)
  42. # include <inttypes.h>
  43. #endif
  44. /* Get appropriate definitions of standard POSIX-style types. */
  45. /* These should match the types used in 'struct stat' */
  46. #if defined(_WIN32) && !defined(__CYGWIN__)
  47. # define __LA_INT64_T __int64
  48. # if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
  49. # define __LA_SSIZE_T ssize_t
  50. # elif defined(_WIN64)
  51. # define __LA_SSIZE_T __int64
  52. # else
  53. # define __LA_SSIZE_T long
  54. # endif
  55. #else
  56. # include <unistd.h> /* ssize_t */
  57. # if defined(_SCO_DS)
  58. # define __LA_INT64_T long long
  59. # else
  60. # define __LA_INT64_T int64_t
  61. # endif
  62. # define __LA_SSIZE_T ssize_t
  63. #endif
  64. /*
  65. * On Windows, define LIBARCHIVE_STATIC if you're building or using a
  66. * .lib. The default here assumes you're building a DLL. Only
  67. * libarchive source should ever define __LIBARCHIVE_BUILD.
  68. */
  69. #if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
  70. # ifdef __LIBARCHIVE_BUILD
  71. # ifdef __GNUC__
  72. # define __LA_DECL __attribute__((dllexport)) extern
  73. # else
  74. # define __LA_DECL __declspec(dllexport)
  75. # endif
  76. # else
  77. # ifdef __GNUC__
  78. # define __LA_DECL
  79. # else
  80. # define __LA_DECL __declspec(dllimport)
  81. # endif
  82. # endif
  83. #else
  84. /* Static libraries or non-Windows needs no special declaration. */
  85. # define __LA_DECL
  86. #endif
  87. #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__)
  88. #define __LA_PRINTF(fmtarg, firstvararg) \
  89. __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
  90. #else
  91. #define __LA_PRINTF(fmtarg, firstvararg) /* nothing */
  92. #endif
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96. /*
  97. * The version number is provided as both a macro and a function.
  98. * The macro identifies the installed header; the function identifies
  99. * the library version (which may not be the same if you're using a
  100. * dynamically-linked version of the library). Of course, if the
  101. * header and library are very different, you should expect some
  102. * strangeness. Don't do that.
  103. */
  104. /*
  105. * The version number is expressed as a single integer that makes it
  106. * easy to compare versions at build time: for version a.b.c, the
  107. * version number is printf("%d%03d%03d",a,b,c). For example, if you
  108. * know your application requires version 2.12.108 or later, you can
  109. * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  110. */
  111. /* Note: Compiler will complain if this does not match archive_entry.h! */
  112. #define ARCHIVE_VERSION_NUMBER 3000004
  113. __LA_DECL int archive_version_number(void);
  114. /*
  115. * Textual name/version of the library, useful for version displays.
  116. */
  117. #define ARCHIVE_VERSION_STRING "libarchive 3.0.4"
  118. __LA_DECL const char * archive_version_string(void);
  119. /* Declare our basic types. */
  120. struct archive;
  121. struct archive_entry;
  122. /*
  123. * Error codes: Use archive_errno() and archive_error_string()
  124. * to retrieve details. Unless specified otherwise, all functions
  125. * that return 'int' use these codes.
  126. */
  127. #define ARCHIVE_EOF 1 /* Found end of archive. */
  128. #define ARCHIVE_OK 0 /* Operation was successful. */
  129. #define ARCHIVE_RETRY (-10) /* Retry might succeed. */
  130. #define ARCHIVE_WARN (-20) /* Partial success. */
  131. /* For example, if write_header "fails", then you can't push data. */
  132. #define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */
  133. /* But if write_header is "fatal," then this archive is dead and useless. */
  134. #define ARCHIVE_FATAL (-30) /* No more operations are possible. */
  135. /*
  136. * As far as possible, archive_errno returns standard platform errno codes.
  137. * Of course, the details vary by platform, so the actual definitions
  138. * here are stored in "archive_platform.h". The symbols are listed here
  139. * for reference; as a rule, clients should not need to know the exact
  140. * platform-dependent error code.
  141. */
  142. /* Unrecognized or invalid file format. */
  143. /* #define ARCHIVE_ERRNO_FILE_FORMAT */
  144. /* Illegal usage of the library. */
  145. /* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */
  146. /* Unknown or unclassified error. */
  147. /* #define ARCHIVE_ERRNO_MISC */
  148. /*
  149. * Callbacks are invoked to automatically read/skip/write/open/close the
  150. * archive. You can provide your own for complex tasks (like breaking
  151. * archives across multiple tapes) or use standard ones built into the
  152. * library.
  153. */
  154. /* Returns pointer and size of next block of data from archive. */
  155. typedef __LA_SSIZE_T archive_read_callback(struct archive *,
  156. void *_client_data, const void **_buffer);
  157. /* Skips at most request bytes from archive and returns the skipped amount.
  158. * This may skip fewer bytes than requested; it may even skip zero bytes.
  159. * If you do skip fewer bytes than requested, libarchive will invoke your
  160. * read callback and discard data as necessary to make up the full skip.
  161. */
  162. typedef __LA_INT64_T archive_skip_callback(struct archive *,
  163. void *_client_data, __LA_INT64_T request);
  164. /* Seeks to specified location in the file and returns the position.
  165. * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h.
  166. * Return ARCHIVE_FATAL if the seek fails for any reason.
  167. */
  168. typedef __LA_INT64_T archive_seek_callback(struct archive *,
  169. void *_client_data, __LA_INT64_T offset, int whence);
  170. /* Returns size actually written, zero on EOF, -1 on error. */
  171. typedef __LA_SSIZE_T archive_write_callback(struct archive *,
  172. void *_client_data,
  173. const void *_buffer, size_t _length);
  174. typedef int archive_open_callback(struct archive *, void *_client_data);
  175. typedef int archive_close_callback(struct archive *, void *_client_data);
  176. /*
  177. * Codes to identify various stream filters.
  178. */
  179. #define ARCHIVE_FILTER_NONE 0
  180. #define ARCHIVE_FILTER_GZIP 1
  181. #define ARCHIVE_FILTER_BZIP2 2
  182. #define ARCHIVE_FILTER_COMPRESS 3
  183. #define ARCHIVE_FILTER_PROGRAM 4
  184. #define ARCHIVE_FILTER_LZMA 5
  185. #define ARCHIVE_FILTER_XZ 6
  186. #define ARCHIVE_FILTER_UU 7
  187. #define ARCHIVE_FILTER_RPM 8
  188. #define ARCHIVE_FILTER_LZIP 9
  189. #if ARCHIVE_VERSION_NUMBER < 4000000
  190. #define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE
  191. #define ARCHIVE_COMPRESSION_GZIP ARCHIVE_FILTER_GZIP
  192. #define ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_FILTER_BZIP2
  193. #define ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_FILTER_COMPRESS
  194. #define ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_FILTER_PROGRAM
  195. #define ARCHIVE_COMPRESSION_LZMA ARCHIVE_FILTER_LZMA
  196. #define ARCHIVE_COMPRESSION_XZ ARCHIVE_FILTER_XZ
  197. #define ARCHIVE_COMPRESSION_UU ARCHIVE_FILTER_UU
  198. #define ARCHIVE_COMPRESSION_RPM ARCHIVE_FILTER_RPM
  199. #define ARCHIVE_COMPRESSION_LZIP ARCHIVE_FILTER_LZIP
  200. #endif
  201. /*
  202. * Codes returned by archive_format.
  203. *
  204. * Top 16 bits identifies the format family (e.g., "tar"); lower
  205. * 16 bits indicate the variant. This is updated by read_next_header.
  206. * Note that the lower 16 bits will often vary from entry to entry.
  207. * In some cases, this variation occurs as libarchive learns more about
  208. * the archive (for example, later entries might utilize extensions that
  209. * weren't necessary earlier in the archive; in this case, libarchive
  210. * will change the format code to indicate the extended format that
  211. * was used). In other cases, it's because different tools have
  212. * modified the archive and so different parts of the archive
  213. * actually have slightly different formats. (Both tar and cpio store
  214. * format codes in each entry, so it is quite possible for each
  215. * entry to be in a different format.)
  216. */
  217. #define ARCHIVE_FORMAT_BASE_MASK 0xff0000
  218. #define ARCHIVE_FORMAT_CPIO 0x10000
  219. #define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1)
  220. #define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2)
  221. #define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3)
  222. #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4)
  223. #define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5)
  224. #define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6)
  225. #define ARCHIVE_FORMAT_SHAR 0x20000
  226. #define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1)
  227. #define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2)
  228. #define ARCHIVE_FORMAT_TAR 0x30000
  229. #define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1)
  230. #define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2)
  231. #define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3)
  232. #define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4)
  233. #define ARCHIVE_FORMAT_ISO9660 0x40000
  234. #define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1)
  235. #define ARCHIVE_FORMAT_ZIP 0x50000
  236. #define ARCHIVE_FORMAT_EMPTY 0x60000
  237. #define ARCHIVE_FORMAT_AR 0x70000
  238. #define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1)
  239. #define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2)
  240. #define ARCHIVE_FORMAT_MTREE 0x80000
  241. #define ARCHIVE_FORMAT_RAW 0x90000
  242. #define ARCHIVE_FORMAT_XAR 0xA0000
  243. #define ARCHIVE_FORMAT_LHA 0xB0000
  244. #define ARCHIVE_FORMAT_CAB 0xC0000
  245. #define ARCHIVE_FORMAT_RAR 0xD0000
  246. #define ARCHIVE_FORMAT_7ZIP 0xE0000
  247. /*-
  248. * Basic outline for reading an archive:
  249. * 1) Ask archive_read_new for an archive reader object.
  250. * 2) Update any global properties as appropriate.
  251. * In particular, you'll certainly want to call appropriate
  252. * archive_read_support_XXX functions.
  253. * 3) Call archive_read_open_XXX to open the archive
  254. * 4) Repeatedly call archive_read_next_header to get information about
  255. * successive archive entries. Call archive_read_data to extract
  256. * data for entries of interest.
  257. * 5) Call archive_read_finish to end processing.
  258. */
  259. __LA_DECL struct archive *archive_read_new(void);
  260. /*
  261. * The archive_read_support_XXX calls enable auto-detect for this
  262. * archive handle. They also link in the necessary support code.
  263. * For example, if you don't want bzlib linked in, don't invoke
  264. * support_compression_bzip2(). The "all" functions provide the
  265. * obvious shorthand.
  266. */
  267. #if ARCHIVE_VERSION_NUMBER < 4000000
  268. __LA_DECL int archive_read_support_compression_all(struct archive *);
  269. __LA_DECL int archive_read_support_compression_bzip2(struct archive *);
  270. __LA_DECL int archive_read_support_compression_compress(struct archive *);
  271. __LA_DECL int archive_read_support_compression_gzip(struct archive *);
  272. __LA_DECL int archive_read_support_compression_lzip(struct archive *);
  273. __LA_DECL int archive_read_support_compression_lzma(struct archive *);
  274. __LA_DECL int archive_read_support_compression_none(struct archive *);
  275. __LA_DECL int archive_read_support_compression_program(struct archive *,
  276. const char *command);
  277. __LA_DECL int archive_read_support_compression_program_signature
  278. (struct archive *, const char *,
  279. const void * /* match */, size_t);
  280. __LA_DECL int archive_read_support_compression_rpm(struct archive *);
  281. __LA_DECL int archive_read_support_compression_uu(struct archive *);
  282. __LA_DECL int archive_read_support_compression_xz(struct archive *);
  283. #endif
  284. __LA_DECL int archive_read_support_filter_all(struct archive *);
  285. __LA_DECL int archive_read_support_filter_bzip2(struct archive *);
  286. __LA_DECL int archive_read_support_filter_compress(struct archive *);
  287. __LA_DECL int archive_read_support_filter_gzip(struct archive *);
  288. __LA_DECL int archive_read_support_filter_lzip(struct archive *);
  289. __LA_DECL int archive_read_support_filter_lzma(struct archive *);
  290. __LA_DECL int archive_read_support_filter_none(struct archive *);
  291. __LA_DECL int archive_read_support_filter_program(struct archive *,
  292. const char *command);
  293. __LA_DECL int archive_read_support_filter_program_signature
  294. (struct archive *, const char *,
  295. const void * /* match */, size_t);
  296. __LA_DECL int archive_read_support_filter_rpm(struct archive *);
  297. __LA_DECL int archive_read_support_filter_uu(struct archive *);
  298. __LA_DECL int archive_read_support_filter_xz(struct archive *);
  299. __LA_DECL int archive_read_support_format_7zip(struct archive *);
  300. __LA_DECL int archive_read_support_format_all(struct archive *);
  301. __LA_DECL int archive_read_support_format_ar(struct archive *);
  302. __LA_DECL int archive_read_support_format_by_code(struct archive *, int);
  303. __LA_DECL int archive_read_support_format_cab(struct archive *);
  304. __LA_DECL int archive_read_support_format_cpio(struct archive *);
  305. __LA_DECL int archive_read_support_format_empty(struct archive *);
  306. __LA_DECL int archive_read_support_format_gnutar(struct archive *);
  307. __LA_DECL int archive_read_support_format_iso9660(struct archive *);
  308. __LA_DECL int archive_read_support_format_lha(struct archive *);
  309. __LA_DECL int archive_read_support_format_mtree(struct archive *);
  310. __LA_DECL int archive_read_support_format_rar(struct archive *);
  311. __LA_DECL int archive_read_support_format_raw(struct archive *);
  312. __LA_DECL int archive_read_support_format_tar(struct archive *);
  313. __LA_DECL int archive_read_support_format_xar(struct archive *);
  314. __LA_DECL int archive_read_support_format_zip(struct archive *);
  315. /* Set various callbacks. */
  316. __LA_DECL int archive_read_set_open_callback(struct archive *,
  317. archive_open_callback *);
  318. __LA_DECL int archive_read_set_read_callback(struct archive *,
  319. archive_read_callback *);
  320. __LA_DECL int archive_read_set_seek_callback(struct archive *,
  321. archive_seek_callback *);
  322. __LA_DECL int archive_read_set_skip_callback(struct archive *,
  323. archive_skip_callback *);
  324. __LA_DECL int archive_read_set_close_callback(struct archive *,
  325. archive_close_callback *);
  326. /* The callback data is provided to all of the callbacks above. */
  327. __LA_DECL int archive_read_set_callback_data(struct archive *, void *);
  328. /* Opening freezes the callbacks. */
  329. __LA_DECL int archive_read_open1(struct archive *);
  330. /* Convenience wrappers around the above. */
  331. __LA_DECL int archive_read_open(struct archive *, void *_client_data,
  332. archive_open_callback *, archive_read_callback *,
  333. archive_close_callback *);
  334. __LA_DECL int archive_read_open2(struct archive *, void *_client_data,
  335. archive_open_callback *, archive_read_callback *,
  336. archive_skip_callback *, archive_close_callback *);
  337. /*
  338. * A variety of shortcuts that invoke archive_read_open() with
  339. * canned callbacks suitable for common situations. The ones that
  340. * accept a block size handle tape blocking correctly.
  341. */
  342. /* Use this if you know the filename. Note: NULL indicates stdin. */
  343. __LA_DECL int archive_read_open_filename(struct archive *,
  344. const char *_filename, size_t _block_size);
  345. __LA_DECL int archive_read_open_filename_w(struct archive *,
  346. const wchar_t *_filename, size_t _block_size);
  347. /* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
  348. __LA_DECL int archive_read_open_file(struct archive *,
  349. const char *_filename, size_t _block_size);
  350. /* Read an archive that's stored in memory. */
  351. __LA_DECL int archive_read_open_memory(struct archive *,
  352. void * buff, size_t size);
  353. /* A more involved version that is only used for internal testing. */
  354. __LA_DECL int archive_read_open_memory2(struct archive *a, void *buff,
  355. size_t size, size_t read_size);
  356. /* Read an archive that's already open, using the file descriptor. */
  357. __LA_DECL int archive_read_open_fd(struct archive *, int _fd,
  358. size_t _block_size);
  359. /* Read an archive that's already open, using a FILE *. */
  360. /* Note: DO NOT use this with tape drives. */
  361. __LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);
  362. /* Parses and returns next entry header. */
  363. __LA_DECL int archive_read_next_header(struct archive *,
  364. struct archive_entry **);
  365. /* Parses and returns next entry header using the archive_entry passed in */
  366. __LA_DECL int archive_read_next_header2(struct archive *,
  367. struct archive_entry *);
  368. /*
  369. * Retrieve the byte offset in UNCOMPRESSED data where last-read
  370. * header started.
  371. */
  372. __LA_DECL __LA_INT64_T archive_read_header_position(struct archive *);
  373. /* Read data from the body of an entry. Similar to read(2). */
  374. __LA_DECL __LA_SSIZE_T archive_read_data(struct archive *,
  375. void *, size_t);
  376. /*
  377. * A zero-copy version of archive_read_data that also exposes the file offset
  378. * of each returned block. Note that the client has no way to specify
  379. * the desired size of the block. The API does guarantee that offsets will
  380. * be strictly increasing and that returned blocks will not overlap.
  381. */
  382. __LA_DECL int archive_read_data_block(struct archive *a,
  383. const void **buff, size_t *size, __LA_INT64_T *offset);
  384. /*-
  385. * Some convenience functions that are built on archive_read_data:
  386. * 'skip': skips entire entry
  387. * 'into_buffer': writes data into memory buffer that you provide
  388. * 'into_fd': writes data to specified filedes
  389. */
  390. __LA_DECL int archive_read_data_skip(struct archive *);
  391. __LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
  392. /*
  393. * Set read options.
  394. */
  395. /* Apply option to the format only. */
  396. __LA_DECL int archive_read_set_format_option(struct archive *_a,
  397. const char *m, const char *o,
  398. const char *v);
  399. /* Apply option to the filter only. */
  400. __LA_DECL int archive_read_set_filter_option(struct archive *_a,
  401. const char *m, const char *o,
  402. const char *v);
  403. /* Apply option to both the format and the filter. */
  404. __LA_DECL int archive_read_set_option(struct archive *_a,
  405. const char *m, const char *o,
  406. const char *v);
  407. /* Apply option string to both the format and the filter. */
  408. __LA_DECL int archive_read_set_options(struct archive *_a,
  409. const char *opts);
  410. /*-
  411. * Convenience function to recreate the current entry (whose header
  412. * has just been read) on disk.
  413. *
  414. * This does quite a bit more than just copy data to disk. It also:
  415. * - Creates intermediate directories as required.
  416. * - Manages directory permissions: non-writable directories will
  417. * be initially created with write permission enabled; when the
  418. * archive is closed, dir permissions are edited to the values specified
  419. * in the archive.
  420. * - Checks hardlinks: hardlinks will not be extracted unless the
  421. * linked-to file was also extracted within the same session. (TODO)
  422. */
  423. /* The "flags" argument selects optional behavior, 'OR' the flags you want. */
  424. /* Default: Do not try to set owner/group. */
  425. #define ARCHIVE_EXTRACT_OWNER (0x0001)
  426. /* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
  427. #define ARCHIVE_EXTRACT_PERM (0x0002)
  428. /* Default: Do not restore mtime/atime. */
  429. #define ARCHIVE_EXTRACT_TIME (0x0004)
  430. /* Default: Replace existing files. */
  431. #define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008)
  432. /* Default: Try create first, unlink only if create fails with EEXIST. */
  433. #define ARCHIVE_EXTRACT_UNLINK (0x0010)
  434. /* Default: Do not restore ACLs. */
  435. #define ARCHIVE_EXTRACT_ACL (0x0020)
  436. /* Default: Do not restore fflags. */
  437. #define ARCHIVE_EXTRACT_FFLAGS (0x0040)
  438. /* Default: Do not restore xattrs. */
  439. #define ARCHIVE_EXTRACT_XATTR (0x0080)
  440. /* Default: Do not try to guard against extracts redirected by symlinks. */
  441. /* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
  442. #define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100)
  443. /* Default: Do not reject entries with '..' as path elements. */
  444. #define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200)
  445. /* Default: Create parent directories as needed. */
  446. #define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400)
  447. /* Default: Overwrite files, even if one on disk is newer. */
  448. #define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800)
  449. /* Detect blocks of 0 and write holes instead. */
  450. #define ARCHIVE_EXTRACT_SPARSE (0x1000)
  451. /* Default: Do not restore Mac extended metadata. */
  452. /* This has no effect except on Mac OS. */
  453. #define ARCHIVE_EXTRACT_MAC_METADATA (0x2000)
  454. __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
  455. int flags);
  456. __LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,
  457. struct archive * /* dest */);
  458. __LA_DECL void archive_read_extract_set_progress_callback(struct archive *,
  459. void (*_progress_func)(void *), void *_user_data);
  460. /* Record the dev/ino of a file that will not be written. This is
  461. * generally set to the dev/ino of the archive being read. */
  462. __LA_DECL void archive_read_extract_set_skip_file(struct archive *,
  463. __LA_INT64_T, __LA_INT64_T);
  464. /* Close the file and release most resources. */
  465. __LA_DECL int archive_read_close(struct archive *);
  466. /* Release all resources and destroy the object. */
  467. /* Note that archive_read_free will call archive_read_close for you. */
  468. __LA_DECL int archive_read_free(struct archive *);
  469. #if ARCHIVE_VERSION_NUMBER < 4000000
  470. /* Synonym for archive_read_free() for backwards compatibility. */
  471. __LA_DECL int archive_read_finish(struct archive *);
  472. #endif
  473. /*-
  474. * To create an archive:
  475. * 1) Ask archive_write_new for an archive writer object.
  476. * 2) Set any global properties. In particular, you should set
  477. * the compression and format to use.
  478. * 3) Call archive_write_open to open the file (most people
  479. * will use archive_write_open_file or archive_write_open_fd,
  480. * which provide convenient canned I/O callbacks for you).
  481. * 4) For each entry:
  482. * - construct an appropriate struct archive_entry structure
  483. * - archive_write_header to write the header
  484. * - archive_write_data to write the entry data
  485. * 5) archive_write_close to close the output
  486. * 6) archive_write_free to cleanup the writer and release resources
  487. */
  488. __LA_DECL struct archive *archive_write_new(void);
  489. __LA_DECL int archive_write_set_bytes_per_block(struct archive *,
  490. int bytes_per_block);
  491. __LA_DECL int archive_write_get_bytes_per_block(struct archive *);
  492. /* XXX This is badly misnamed; suggestions appreciated. XXX */
  493. __LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,
  494. int bytes_in_last_block);
  495. __LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);
  496. /* The dev/ino of a file that won't be archived. This is used
  497. * to avoid recursively adding an archive to itself. */
  498. __LA_DECL int archive_write_set_skip_file(struct archive *,
  499. __LA_INT64_T, __LA_INT64_T);
  500. #if ARCHIVE_VERSION_NUMBER < 4000000
  501. __LA_DECL int archive_write_set_compression_bzip2(struct archive *);
  502. __LA_DECL int archive_write_set_compression_compress(struct archive *);
  503. __LA_DECL int archive_write_set_compression_gzip(struct archive *);
  504. __LA_DECL int archive_write_set_compression_lzip(struct archive *);
  505. __LA_DECL int archive_write_set_compression_lzma(struct archive *);
  506. __LA_DECL int archive_write_set_compression_none(struct archive *);
  507. __LA_DECL int archive_write_set_compression_program(struct archive *,
  508. const char *cmd);
  509. __LA_DECL int archive_write_set_compression_xz(struct archive *);
  510. #endif
  511. /* A convenience function to set the filter based on the code. */
  512. __LA_DECL int archive_write_add_filter(struct archive *, int filter_code);
  513. __LA_DECL int archive_write_add_filter_bzip2(struct archive *);
  514. __LA_DECL int archive_write_add_filter_compress(struct archive *);
  515. __LA_DECL int archive_write_add_filter_gzip(struct archive *);
  516. __LA_DECL int archive_write_add_filter_lzip(struct archive *);
  517. __LA_DECL int archive_write_add_filter_lzma(struct archive *);
  518. __LA_DECL int archive_write_add_filter_none(struct archive *);
  519. __LA_DECL int archive_write_add_filter_program(struct archive *,
  520. const char *cmd);
  521. __LA_DECL int archive_write_add_filter_xz(struct archive *);
  522. /* A convenience function to set the format based on the code or name. */
  523. __LA_DECL int archive_write_set_format(struct archive *, int format_code);
  524. __LA_DECL int archive_write_set_format_by_name(struct archive *,
  525. const char *name);
  526. /* To minimize link pollution, use one or more of the following. */
  527. __LA_DECL int archive_write_set_format_7zip(struct archive *);
  528. __LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
  529. __LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
  530. __LA_DECL int archive_write_set_format_cpio(struct archive *);
  531. __LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
  532. __LA_DECL int archive_write_set_format_gnutar(struct archive *);
  533. __LA_DECL int archive_write_set_format_iso9660(struct archive *);
  534. __LA_DECL int archive_write_set_format_mtree(struct archive *);
  535. /* TODO: int archive_write_set_format_old_tar(struct archive *); */
  536. __LA_DECL int archive_write_set_format_pax(struct archive *);
  537. __LA_DECL int archive_write_set_format_pax_restricted(struct archive *);
  538. __LA_DECL int archive_write_set_format_shar(struct archive *);
  539. __LA_DECL int archive_write_set_format_shar_dump(struct archive *);
  540. __LA_DECL int archive_write_set_format_ustar(struct archive *);
  541. __LA_DECL int archive_write_set_format_xar(struct archive *);
  542. __LA_DECL int archive_write_set_format_zip(struct archive *);
  543. __LA_DECL int archive_write_open(struct archive *, void *,
  544. archive_open_callback *, archive_write_callback *,
  545. archive_close_callback *);
  546. __LA_DECL int archive_write_open_fd(struct archive *, int _fd);
  547. __LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
  548. __LA_DECL int archive_write_open_filename_w(struct archive *,
  549. const wchar_t *_file);
  550. /* A deprecated synonym for archive_write_open_filename() */
  551. __LA_DECL int archive_write_open_file(struct archive *, const char *_file);
  552. __LA_DECL int archive_write_open_FILE(struct archive *, FILE *);
  553. /* _buffSize is the size of the buffer, _used refers to a variable that
  554. * will be updated after each write into the buffer. */
  555. __LA_DECL int archive_write_open_memory(struct archive *,
  556. void *_buffer, size_t _buffSize, size_t *_used);
  557. /*
  558. * Note that the library will truncate writes beyond the size provided
  559. * to archive_write_header or pad if the provided data is short.
  560. */
  561. __LA_DECL int archive_write_header(struct archive *,
  562. struct archive_entry *);
  563. __LA_DECL __LA_SSIZE_T archive_write_data(struct archive *,
  564. const void *, size_t);
  565. /* This interface is currently only available for archive_write_disk handles. */
  566. __LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
  567. const void *, size_t, __LA_INT64_T);
  568. __LA_DECL int archive_write_finish_entry(struct archive *);
  569. __LA_DECL int archive_write_close(struct archive *);
  570. /* This can fail if the archive wasn't already closed, in which case
  571. * archive_write_free() will implicitly call archive_write_close(). */
  572. __LA_DECL int archive_write_free(struct archive *);
  573. #if ARCHIVE_VERSION_NUMBER < 4000000
  574. /* Synonym for archive_write_free() for backwards compatibility. */
  575. __LA_DECL int archive_write_finish(struct archive *);
  576. #endif
  577. /*
  578. * Set write options.
  579. */
  580. /* Apply option to the format only. */
  581. __LA_DECL int archive_write_set_format_option(struct archive *_a,
  582. const char *m, const char *o,
  583. const char *v);
  584. /* Apply option to the filter only. */
  585. __LA_DECL int archive_write_set_filter_option(struct archive *_a,
  586. const char *m, const char *o,
  587. const char *v);
  588. /* Apply option to both the format and the filter. */
  589. __LA_DECL int archive_write_set_option(struct archive *_a,
  590. const char *m, const char *o,
  591. const char *v);
  592. /* Apply option string to both the format and the filter. */
  593. __LA_DECL int archive_write_set_options(struct archive *_a,
  594. const char *opts);
  595. /*-
  596. * ARCHIVE_WRITE_DISK API
  597. *
  598. * To create objects on disk:
  599. * 1) Ask archive_write_disk_new for a new archive_write_disk object.
  600. * 2) Set any global properties. In particular, you probably
  601. * want to set the options.
  602. * 3) For each entry:
  603. * - construct an appropriate struct archive_entry structure
  604. * - archive_write_header to create the file/dir/etc on disk
  605. * - archive_write_data to write the entry data
  606. * 4) archive_write_free to cleanup the writer and release resources
  607. *
  608. * In particular, you can use this in conjunction with archive_read()
  609. * to pull entries out of an archive and create them on disk.
  610. */
  611. __LA_DECL struct archive *archive_write_disk_new(void);
  612. /* This file will not be overwritten. */
  613. __LA_DECL int archive_write_disk_set_skip_file(struct archive *,
  614. __LA_INT64_T, __LA_INT64_T);
  615. /* Set flags to control how the next item gets created.
  616. * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
  617. __LA_DECL int archive_write_disk_set_options(struct archive *,
  618. int flags);
  619. /*
  620. * The lookup functions are given uname/uid (or gname/gid) pairs and
  621. * return a uid (gid) suitable for this system. These are used for
  622. * restoring ownership and for setting ACLs. The default functions
  623. * are naive, they just return the uid/gid. These are small, so reasonable
  624. * for applications that don't need to preserve ownership; they
  625. * are probably also appropriate for applications that are doing
  626. * same-system backup and restore.
  627. */
  628. /*
  629. * The "standard" lookup functions use common system calls to lookup
  630. * the uname/gname, falling back to the uid/gid if the names can't be
  631. * found. They cache lookups and are reasonably fast, but can be very
  632. * large, so they are not used unless you ask for them. In
  633. * particular, these match the specifications of POSIX "pax" and old
  634. * POSIX "tar".
  635. */
  636. __LA_DECL int archive_write_disk_set_standard_lookup(struct archive *);
  637. /*
  638. * If neither the default (naive) nor the standard (big) functions suit
  639. * your needs, you can write your own and register them. Be sure to
  640. * include a cleanup function if you have allocated private data.
  641. */
  642. __LA_DECL int archive_write_disk_set_group_lookup(struct archive *,
  643. void * /* private_data */,
  644. __LA_INT64_T (*)(void *, const char *, __LA_INT64_T),
  645. void (* /* cleanup */)(void *));
  646. __LA_DECL int archive_write_disk_set_user_lookup(struct archive *,
  647. void * /* private_data */,
  648. __LA_INT64_T (*)(void *, const char *, __LA_INT64_T),
  649. void (* /* cleanup */)(void *));
  650. __LA_DECL __LA_INT64_T archive_write_disk_gid(struct archive *, const char *, __LA_INT64_T);
  651. __LA_DECL __LA_INT64_T archive_write_disk_uid(struct archive *, const char *, __LA_INT64_T);
  652. /*
  653. * ARCHIVE_READ_DISK API
  654. *
  655. * This is still evolving and somewhat experimental.
  656. */
  657. __LA_DECL struct archive *archive_read_disk_new(void);
  658. /* The names for symlink modes here correspond to an old BSD
  659. * command-line argument convention: -L, -P, -H */
  660. /* Follow all symlinks. */
  661. __LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
  662. /* Follow no symlinks. */
  663. __LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
  664. /* Follow symlink initially, then not. */
  665. __LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
  666. /* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
  667. __LA_DECL int archive_read_disk_entry_from_file(struct archive *,
  668. struct archive_entry *, int /* fd */, const struct stat *);
  669. /* Look up gname for gid or uname for uid. */
  670. /* Default implementations are very, very stupid. */
  671. __LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_INT64_T);
  672. __LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_INT64_T);
  673. /* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
  674. * results for performance. */
  675. __LA_DECL int archive_read_disk_set_standard_lookup(struct archive *);
  676. /* You can install your own lookups if you like. */
  677. __LA_DECL int archive_read_disk_set_gname_lookup(struct archive *,
  678. void * /* private_data */,
  679. const char *(* /* lookup_fn */)(void *, __LA_INT64_T),
  680. void (* /* cleanup_fn */)(void *));
  681. __LA_DECL int archive_read_disk_set_uname_lookup(struct archive *,
  682. void * /* private_data */,
  683. const char *(* /* lookup_fn */)(void *, __LA_INT64_T),
  684. void (* /* cleanup_fn */)(void *));
  685. /* Start traversal. */
  686. __LA_DECL int archive_read_disk_open(struct archive *, const char *);
  687. __LA_DECL int archive_read_disk_open_w(struct archive *, const wchar_t *);
  688. /*
  689. * Request that current entry be visited. If you invoke it on every
  690. * directory, you'll get a physical traversal. This is ignored if the
  691. * current entry isn't a directory or a link to a directory. So, if
  692. * you invoke this on every returned path, you'll get a full logical
  693. * traversal.
  694. */
  695. __LA_DECL int archive_read_disk_descend(struct archive *);
  696. __LA_DECL int archive_read_disk_can_descend(struct archive *);
  697. __LA_DECL int archive_read_disk_current_filesystem(struct archive *);
  698. __LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *);
  699. __LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *);
  700. /* Request that the access time of the entry visited by travesal be restored. */
  701. __LA_DECL int archive_read_disk_set_atime_restored(struct archive *);
  702. /*
  703. * Set behavior. The "flags" argument selects optional behavior.
  704. */
  705. /* Request that the access time of the entry visited by travesal be restored.
  706. * This is the same as archive_read_disk_set_atime_restored. */
  707. #define ARCHIVE_READDISK_RESTORE_ATIME (0x0001)
  708. /* Default: Do not skip an entry which has nodump flags. */
  709. #define ARCHIVE_READDISK_HONOR_NODUMP (0x0002)
  710. /* Default: Skip a mac resource fork file whose prefix is "._" because of
  711. * using copyfile. */
  712. #define ARCHIVE_READDISK_MAC_COPYFILE (0x0004)
  713. /* Default: Do not traverse mount points. */
  714. #define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008)
  715. __LA_DECL int archive_read_disk_set_behavior(struct archive *,
  716. int flags);
  717. /*
  718. * Set archive_match object that will be used in archive_read_disk to
  719. * know whether an entry should be skipped. The callback function
  720. * _excluded_func will be invoked when an entry is skipped by the result
  721. * of archive_match.
  722. */
  723. __LA_DECL int archive_read_disk_set_matching(struct archive *,
  724. struct archive *_matching, void (*_excluded_func)
  725. (struct archive *, void *, struct archive_entry *),
  726. void *_client_data);
  727. __LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *,
  728. int (*_metadata_filter_func)(struct archive *, void *,
  729. struct archive_entry *), void *_client_data);
  730. /*
  731. * Accessor functions to read/set various information in
  732. * the struct archive object:
  733. */
  734. /* Number of filters in the current filter pipeline. */
  735. /* Filter #0 is the one closest to the format, -1 is a synonym for the
  736. * last filter, which is always the pseudo-filter that wraps the
  737. * client callbacks. */
  738. __LA_DECL int archive_filter_count(struct archive *);
  739. __LA_DECL __LA_INT64_T archive_filter_bytes(struct archive *, int);
  740. __LA_DECL int archive_filter_code(struct archive *, int);
  741. __LA_DECL const char * archive_filter_name(struct archive *, int);
  742. #if ARCHIVE_VERSION_NUMBER < 4000000
  743. /* These don't properly handle multiple filters, so are deprecated and
  744. * will eventually be removed. */
  745. /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */
  746. __LA_DECL __LA_INT64_T archive_position_compressed(struct archive *);
  747. /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */
  748. __LA_DECL __LA_INT64_T archive_position_uncompressed(struct archive *);
  749. /* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */
  750. __LA_DECL const char *archive_compression_name(struct archive *);
  751. /* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */
  752. __LA_DECL int archive_compression(struct archive *);
  753. #endif
  754. __LA_DECL int archive_errno(struct archive *);
  755. __LA_DECL const char *archive_error_string(struct archive *);
  756. __LA_DECL const char *archive_format_name(struct archive *);
  757. __LA_DECL int archive_format(struct archive *);
  758. __LA_DECL void archive_clear_error(struct archive *);
  759. __LA_DECL void archive_set_error(struct archive *, int _err,
  760. const char *fmt, ...) __LA_PRINTF(3, 4);
  761. __LA_DECL void archive_copy_error(struct archive *dest,
  762. struct archive *src);
  763. __LA_DECL int archive_file_count(struct archive *);
  764. /*
  765. * ARCHIVE_MATCH API
  766. */
  767. __LA_DECL struct archive *archive_match_new(void);
  768. __LA_DECL int archive_match_free(struct archive *);
  769. /*
  770. * Test if archive_entry is excluded.
  771. * This is a convenience function. This is the same as calling all
  772. * archive_match_path_excluded, archive_match_time_excluded
  773. * and archive_match_owner_excluded.
  774. */
  775. __LA_DECL int archive_match_excluded(struct archive *,
  776. struct archive_entry *);
  777. /*
  778. * Test if pathname is excluded. The conditions are set by following functions.
  779. */
  780. __LA_DECL int archive_match_path_excluded(struct archive *,
  781. struct archive_entry *);
  782. /* Add exclusion pathname pattern. */
  783. __LA_DECL int archive_match_exclude_pattern(struct archive *, const char *);
  784. __LA_DECL int archive_match_exclude_pattern_w(struct archive *,
  785. const wchar_t *);
  786. /* Add exclusion pathname pattern from file. */
  787. __LA_DECL int archive_match_exclude_pattern_from_file(struct archive *,
  788. const char *, int _nullSeparator);
  789. __LA_DECL int archive_match_exclude_pattern_from_file_w(struct archive *,
  790. const wchar_t *, int _nullSeparator);
  791. /* Add inclusion pathname pattern. */
  792. __LA_DECL int archive_match_include_pattern(struct archive *, const char *);
  793. __LA_DECL int archive_match_include_pattern_w(struct archive *,
  794. const wchar_t *);
  795. /* Add inclusion pathname pattern from file. */
  796. __LA_DECL int archive_match_include_pattern_from_file(struct archive *,
  797. const char *, int _nullSeparator);
  798. __LA_DECL int archive_match_include_pattern_from_file_w(struct archive *,
  799. const wchar_t *, int _nullSeparator);
  800. /*
  801. * How to get statistic information for inclusion patterns.
  802. */
  803. /* Return the amount number of unmatched inclusion patterns. */
  804. __LA_DECL int archive_match_path_unmatched_inclusions(struct archive *);
  805. /* Return the pattern of unmatched inclusion with ARCHIVE_OK.
  806. * Return ARCHIVE_EOF if there is no inclusion pattern. */
  807. __LA_DECL int archive_match_path_unmatched_inclusions_next(
  808. struct archive *, const char **);
  809. __LA_DECL int archive_match_path_unmatched_inclusions_next_w(
  810. struct archive *, const wchar_t **);
  811. /*
  812. * Test if a file is excluded by its time stamp.
  813. * The conditions are set by following functions.
  814. */
  815. __LA_DECL int archive_match_time_excluded(struct archive *,
  816. struct archive_entry *);
  817. /*
  818. * Flags to tell a matching type of time stamps. These are used for
  819. * following functinos.
  820. */
  821. /* Time flag: mtime to be tested. */
  822. #define ARCHIVE_MATCH_MTIME (0x0100)
  823. /* Time flag: ctime to be tested. */
  824. #define ARCHIVE_MATCH_CTIME (0x0200)
  825. /* Comparison flag: Match the time if it is newer than. */
  826. #define ARCHIVE_MATCH_NEWER (0x0001)
  827. /* Comparison flag: Match the time if it is older than. */
  828. #define ARCHIVE_MATCH_OLDER (0x0002)
  829. /* Comparison flag: Match the time if it is equal to. */
  830. #define ARCHIVE_MATCH_EQUAL (0x0010)
  831. /* Set inclusion time. */
  832. __LA_DECL int archive_match_include_time(struct archive *, int _flag,
  833. time_t _sec, long _nsec);
  834. /* Set inclusion time by a date string. */
  835. __LA_DECL int archive_match_include_date(struct archive *, int _flag,
  836. const char *_datestr);
  837. __LA_DECL int archive_match_include_date_w(struct archive *, int _flag,
  838. const wchar_t *_datestr);
  839. /* Set inclusion time by a particluar file. */
  840. __LA_DECL int archive_match_include_file_time(struct archive *,
  841. int _flag, const char *_pathname);
  842. __LA_DECL int archive_match_include_file_time_w(struct archive *,
  843. int _flag, const wchar_t *_pathname);
  844. /* Add exclusion entry. */
  845. __LA_DECL int archive_match_exclude_entry(struct archive *,
  846. int _flag, struct archive_entry *);
  847. /*
  848. * Test if a file is excluded by its uid ,gid, uname or gname.
  849. * The conditions are set by following functions.
  850. */
  851. __LA_DECL int archive_match_owner_excluded(struct archive *,
  852. struct archive_entry *);
  853. /* Add inclusion uid, gid, uname and gname. */
  854. __LA_DECL int archive_match_include_uid(struct archive *, __LA_INT64_T);
  855. __LA_DECL int archive_match_include_gid(struct archive *, __LA_INT64_T);
  856. __LA_DECL int archive_match_include_uname(struct archive *, const char *);
  857. __LA_DECL int archive_match_include_uname_w(struct archive *,
  858. const wchar_t *);
  859. __LA_DECL int archive_match_include_gname(struct archive *, const char *);
  860. __LA_DECL int archive_match_include_gname_w(struct archive *,
  861. const wchar_t *);
  862. #ifdef __cplusplus
  863. }
  864. #endif
  865. /* These are meaningless outside of this header. */
  866. #undef __LA_DECL
  867. /* These need to remain defined because they're used in the
  868. * callback type definitions. XXX Fix this. This is ugly. XXX */
  869. /* #undef __LA_INT64_T */
  870. /* #undef __LA_SSIZE_T */
  871. #endif /* !ARCHIVE_H_INCLUDED */