Remove old versions of libarchive.
[dragonfly.git] / contrib / libarchive-2 / libarchive / archive.h.in
1 /*-
2  * Copyright (c) 2003-2007 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.47 2007/12/30 04:58:21 kientzle Exp $
26  */
27
28 #ifndef ARCHIVE_H_INCLUDED
29 #define ARCHIVE_H_INCLUDED
30
31 /*
32  * This header file corresponds to:
33  *   Library version @ARCHIVE_VERSION@
34  *   Shared library version @SHLIB_MAJOR@
35  */
36
37 #include <sys/types.h>  /* Linux requires this for off_t */
38 @ARCHIVE_H_INCLUDE_INTTYPES_H@
39 #include <stdio.h> /* For FILE * */
40 #ifndef _WIN32
41 #include <unistd.h>  /* For ssize_t and size_t */
42 #else
43 typedef long ssize_t;
44 typedef unsigned int uid_t;
45 typedef unsigned int gid_t;
46 typedef unsigned short mode_t;
47 #endif
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 /*
54  * Each of the version identifiers comes as a macro and a function.
55  * The macro identifies the installed header; the function identifies
56  * the library version (which may not be the same if you're using a
57  * dynamically-linked version of the library).
58  */
59
60 /*
61  * Textual name/version of the library, useful for version displays.
62  */
63 #define ARCHIVE_LIBRARY_VERSION "libarchive @LIBARCHIVE_VERSION_STRING@"
64 const char *    archive_version(void);
65
66 /*
67  * The "version stamp" is a single integer that makes it easy to check
68  * the exact version: for version a.b.c, the version stamp is
69  * printf("%d%03d%03d",a,b,c).  For example, version 2.12.108 has
70  * version stamp 2012108.
71  *
72  * This was introduced with libarchive 1.9.0 in the libarchive 1.x family
73  * and libarchive 2.2.4 in the libarchive 2.x family.  The following
74  * may be useful if you really want to do feature detection for earlier
75  * libarchive versions (which defined API_VERSION and API_FEATURE):
76  *
77  * #ifndef ARCHIVE_VERSION_STAMP
78  * #define ARCHIVE_VERSION_STAMP        \
79  *             (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
80  * #endif
81  */
82 #define ARCHIVE_VERSION_STAMP   @LIBARCHIVE_VERSION@
83 int             archive_version_stamp(void);
84
85 /*
86  * Major version number: If ARCHIVE_API_VERSION !=
87  * archive_api_version(), then the library you were linked with is
88  * using an incompatible API to the one you were compiled with.  This
89  * is almost certainly a fatal problem.
90  * This is deprecated and will be removed; use ARCHIVE_VERSION_STAMP
91  * instead.
92  */
93 #define ARCHIVE_API_VERSION     (ARCHIVE_VERSION_STAMP / 1000000)
94 int             archive_api_version(void);
95
96 /*
97  * Minor version number.  This is deprecated and will be removed.
98  * Use ARCHIVE_VERSION_STAMP to adapt to libarchive API variations.
99  */
100 #define ARCHIVE_API_FEATURE     ((ARCHIVE_VERSION_STAMP / 1000) % 1000)
101 int             archive_api_feature(void);
102
103
104 #define ARCHIVE_BYTES_PER_RECORD          512
105 #define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240
106
107 /* Declare our basic types. */
108 struct archive;
109 struct archive_entry;
110
111 /*
112  * Error codes: Use archive_errno() and archive_error_string()
113  * to retrieve details.  Unless specified otherwise, all functions
114  * that return 'int' use these codes.
115  */
116 #define ARCHIVE_EOF       1     /* Found end of archive. */
117 #define ARCHIVE_OK        0     /* Operation was successful. */
118 #define ARCHIVE_RETRY   (-10)   /* Retry might succeed. */
119 #define ARCHIVE_WARN    (-20)   /* Partial success. */
120 /* For example, if write_header "fails", then you can't push data. */
121 #define ARCHIVE_FAILED  (-25)   /* Current operation cannot complete. */
122 #define ARCHIVE_FATAL   (-30)   /* No more operations are possible. */
123
124 /*
125  * As far as possible, archive_errno returns standard platform errno codes.
126  * Of course, the details vary by platform, so the actual definitions
127  * here are stored in "archive_platform.h".  The symbols are listed here
128  * for reference; as a rule, clients should not need to know the exact
129  * platform-dependent error code.
130  */
131 /* Unrecognized or invalid file format. */
132 /* #define      ARCHIVE_ERRNO_FILE_FORMAT */
133 /* Illegal usage of the library. */
134 /* #define      ARCHIVE_ERRNO_PROGRAMMER_ERROR */
135 /* Unknown or unclassified error. */
136 /* #define      ARCHIVE_ERRNO_MISC */
137
138 /*
139  * Callbacks are invoked to automatically read/skip/write/open/close the
140  * archive. You can provide your own for complex tasks (like breaking
141  * archives across multiple tapes) or use standard ones built into the
142  * library.
143  */
144
145 /* Returns pointer and size of next block of data from archive. */
146 typedef ssize_t archive_read_callback(struct archive *, void *_client_data,
147                     const void **_buffer);
148 /* Skips at most request bytes from archive and returns the skipped amount */
149 #if ARCHIVE_API_VERSION < 2
150 typedef ssize_t archive_skip_callback(struct archive *, void *_client_data,
151                     size_t request);
152 #else
153 typedef off_t   archive_skip_callback(struct archive *, void *_client_data,
154                     off_t request);
155 #endif
156 /* Returns size actually written, zero on EOF, -1 on error. */
157 typedef ssize_t archive_write_callback(struct archive *, void *_client_data,
158                     const void *_buffer, size_t _length);
159 typedef int     archive_open_callback(struct archive *, void *_client_data);
160 typedef int     archive_close_callback(struct archive *, void *_client_data);
161
162 /*
163  * Codes for archive_compression.
164  */
165 #define ARCHIVE_COMPRESSION_NONE        0
166 #define ARCHIVE_COMPRESSION_GZIP        1
167 #define ARCHIVE_COMPRESSION_BZIP2       2
168 #define ARCHIVE_COMPRESSION_COMPRESS    3
169 #define ARCHIVE_COMPRESSION_PROGRAM     4
170
171 /*
172  * Codes returned by archive_format.
173  *
174  * Top 16 bits identifies the format family (e.g., "tar"); lower
175  * 16 bits indicate the variant.  This is updated by read_next_header.
176  * Note that the lower 16 bits will often vary from entry to entry.
177  * In some cases, this variation occurs as libarchive learns more about
178  * the archive (for example, later entries might utilize extensions that
179  * weren't necessary earlier in the archive; in this case, libarchive
180  * will change the format code to indicate the extended format that
181  * was used).  In other cases, it's because different tools have
182  * modified the archive and so different parts of the archive
183  * actually have slightly different formts.  (Both tar and cpio store
184  * format codes in each entry, so it is quite possible for each
185  * entry to be in a different format.)
186  */
187 #define ARCHIVE_FORMAT_BASE_MASK                0xff0000
188 #define ARCHIVE_FORMAT_CPIO                     0x10000
189 #define ARCHIVE_FORMAT_CPIO_POSIX               (ARCHIVE_FORMAT_CPIO | 1)
190 #define ARCHIVE_FORMAT_CPIO_BIN_LE              (ARCHIVE_FORMAT_CPIO | 2)
191 #define ARCHIVE_FORMAT_CPIO_BIN_BE              (ARCHIVE_FORMAT_CPIO | 3)
192 #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC          (ARCHIVE_FORMAT_CPIO | 4)
193 #define ARCHIVE_FORMAT_CPIO_SVR4_CRC            (ARCHIVE_FORMAT_CPIO | 5)
194 #define ARCHIVE_FORMAT_SHAR                     0x20000
195 #define ARCHIVE_FORMAT_SHAR_BASE                (ARCHIVE_FORMAT_SHAR | 1)
196 #define ARCHIVE_FORMAT_SHAR_DUMP                (ARCHIVE_FORMAT_SHAR | 2)
197 #define ARCHIVE_FORMAT_TAR                      0x30000
198 #define ARCHIVE_FORMAT_TAR_USTAR                (ARCHIVE_FORMAT_TAR | 1)
199 #define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE      (ARCHIVE_FORMAT_TAR | 2)
200 #define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED       (ARCHIVE_FORMAT_TAR | 3)
201 #define ARCHIVE_FORMAT_TAR_GNUTAR               (ARCHIVE_FORMAT_TAR | 4)
202 #define ARCHIVE_FORMAT_ISO9660                  0x40000
203 #define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE        (ARCHIVE_FORMAT_ISO9660 | 1)
204 #define ARCHIVE_FORMAT_ZIP                      0x50000
205 #define ARCHIVE_FORMAT_EMPTY                    0x60000
206 #define ARCHIVE_FORMAT_AR                       0x70000
207 #define ARCHIVE_FORMAT_AR_GNU                   (ARCHIVE_FORMAT_AR | 1)
208 #define ARCHIVE_FORMAT_AR_BSD                   (ARCHIVE_FORMAT_AR | 2)
209 #define ARCHIVE_FORMAT_MTREE                    0x80000
210 #define ARCHIVE_FORMAT_MTREE_V1                 (ARCHIVE_FORMAT_MTREE | 1)
211 #define ARCHIVE_FORMAT_MTREE_V2                 (ARCHIVE_FORMAT_MTREE | 2)
212
213 /*-
214  * Basic outline for reading an archive:
215  *   1) Ask archive_read_new for an archive reader object.
216  *   2) Update any global properties as appropriate.
217  *      In particular, you'll certainly want to call appropriate
218  *      archive_read_support_XXX functions.
219  *   3) Call archive_read_open_XXX to open the archive
220  *   4) Repeatedly call archive_read_next_header to get information about
221  *      successive archive entries.  Call archive_read_data to extract
222  *      data for entries of interest.
223  *   5) Call archive_read_finish to end processing.
224  */
225 struct archive  *archive_read_new(void);
226
227 /*
228  * The archive_read_support_XXX calls enable auto-detect for this
229  * archive handle.  They also link in the necessary support code.
230  * For example, if you don't want bzlib linked in, don't invoke
231  * support_compression_bzip2().  The "all" functions provide the
232  * obvious shorthand.
233  */
234 int              archive_read_support_compression_all(struct archive *);
235 int              archive_read_support_compression_bzip2(struct archive *);
236 int              archive_read_support_compression_compress(struct archive *);
237 int              archive_read_support_compression_gzip(struct archive *);
238 int              archive_read_support_compression_none(struct archive *);
239 int              archive_read_support_compression_program(struct archive *,
240                      const char *command);
241
242 int              archive_read_support_format_all(struct archive *);
243 int              archive_read_support_format_ar(struct archive *);
244 int              archive_read_support_format_cpio(struct archive *);
245 int              archive_read_support_format_empty(struct archive *);
246 int              archive_read_support_format_gnutar(struct archive *);
247 int              archive_read_support_format_iso9660(struct archive *);
248 int              archive_read_support_format_mtree(struct archive *);
249 int              archive_read_support_format_tar(struct archive *);
250 int              archive_read_support_format_zip(struct archive *);
251
252
253 /* Open the archive using callbacks for archive I/O. */
254 int              archive_read_open(struct archive *, void *_client_data,
255                      archive_open_callback *, archive_read_callback *,
256                      archive_close_callback *);
257 int              archive_read_open2(struct archive *, void *_client_data,
258                      archive_open_callback *, archive_read_callback *,
259                      archive_skip_callback *, archive_close_callback *);
260
261 /*
262  * A variety of shortcuts that invoke archive_read_open() with
263  * canned callbacks suitable for common situations.  The ones that
264  * accept a block size handle tape blocking correctly.
265  */
266 /* Use this if you know the filename.  Note: NULL indicates stdin. */
267 int              archive_read_open_filename(struct archive *,
268                      const char *_filename, size_t _block_size);
269 /* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
270 int              archive_read_open_file(struct archive *,
271                      const char *_filename, size_t _block_size);
272 /* Read an archive that's stored in memory. */
273 int              archive_read_open_memory(struct archive *,
274                      void * buff, size_t size);
275 /* A more involved version that is only used for internal testing. */
276 int             archive_read_open_memory2(struct archive *a, void *buff,
277                      size_t size, size_t read_size);
278 /* Read an archive that's already open, using the file descriptor. */
279 int              archive_read_open_fd(struct archive *, int _fd,
280                      size_t _block_size);
281 /* Read an archive that's already open, using a FILE *. */
282 /* Note: DO NOT use this with tape drives. */
283 int              archive_read_open_FILE(struct archive *, FILE *_file);
284
285 /* Parses and returns next entry header. */
286 int              archive_read_next_header(struct archive *,
287                      struct archive_entry **);
288
289 /*
290  * Retrieve the byte offset in UNCOMPRESSED data where last-read
291  * header started.
292  */
293 int64_t          archive_read_header_position(struct archive *);
294
295 /* Read data from the body of an entry.  Similar to read(2). */
296 ssize_t          archive_read_data(struct archive *, void *, size_t);
297 /*
298  * A zero-copy version of archive_read_data that also exposes the file offset
299  * of each returned block.  Note that the client has no way to specify
300  * the desired size of the block.  The API does guarantee that offsets will
301  * be strictly increasing and that returned blocks will not overlap.
302  */
303 int              archive_read_data_block(struct archive *a,
304                     const void **buff, size_t *size, off_t *offset);
305
306 /*-
307  * Some convenience functions that are built on archive_read_data:
308  *  'skip': skips entire entry
309  *  'into_buffer': writes data into memory buffer that you provide
310  *  'into_fd': writes data to specified filedes
311  */
312 int              archive_read_data_skip(struct archive *);
313 int              archive_read_data_into_buffer(struct archive *, void *buffer,
314                      ssize_t len);
315 int              archive_read_data_into_fd(struct archive *, int fd);
316
317 /*-
318  * Convenience function to recreate the current entry (whose header
319  * has just been read) on disk.
320  *
321  * This does quite a bit more than just copy data to disk. It also:
322  *  - Creates intermediate directories as required.
323  *  - Manages directory permissions:  non-writable directories will
324  *    be initially created with write permission enabled; when the
325  *    archive is closed, dir permissions are edited to the values specified
326  *    in the archive.
327  *  - Checks hardlinks:  hardlinks will not be extracted unless the
328  *    linked-to file was also extracted within the same session. (TODO)
329  */
330
331 /* The "flags" argument selects optional behavior, 'OR' the flags you want. */
332
333 /* Default: Do not try to set owner/group. */
334 #define ARCHIVE_EXTRACT_OWNER   (1)
335 /* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
336 #define ARCHIVE_EXTRACT_PERM    (2)
337 /* Default: Do not restore mtime/atime. */
338 #define ARCHIVE_EXTRACT_TIME    (4)
339 /* Default: Replace existing files. */
340 #define ARCHIVE_EXTRACT_NO_OVERWRITE (8)
341 /* Default: Try create first, unlink only if create fails with EEXIST. */
342 #define ARCHIVE_EXTRACT_UNLINK  (16)
343 /* Default: Do not restore ACLs. */
344 #define ARCHIVE_EXTRACT_ACL     (32)
345 /* Default: Do not restore fflags. */
346 #define ARCHIVE_EXTRACT_FFLAGS  (64)
347 /* Default: Do not restore xattrs. */
348 #define ARCHIVE_EXTRACT_XATTR   (128)
349 /* Default: Do not try to guard against extracts redirected by symlinks. */
350 /* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
351 #define ARCHIVE_EXTRACT_SECURE_SYMLINKS (256)
352 /* Default: Do not reject entries with '..' as path elements. */
353 #define ARCHIVE_EXTRACT_SECURE_NODOTDOT (512)
354 /* Default: Create parent directories as needed. */
355 #define ARCHIVE_EXTRACT_NO_AUTODIR (1024)
356 /* Default: Overwrite files, even if one on disk is newer. */
357 #define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (2048)
358
359 int              archive_read_extract(struct archive *, struct archive_entry *,
360                      int flags);
361 void             archive_read_extract_set_progress_callback(struct archive *,
362                      void (*_progress_func)(void *), void *_user_data);
363
364 /* Record the dev/ino of a file that will not be written.  This is
365  * generally set to the dev/ino of the archive being read. */
366 void            archive_read_extract_set_skip_file(struct archive *,
367                      dev_t, ino_t);
368
369 /* Close the file and release most resources. */
370 int              archive_read_close(struct archive *);
371 /* Release all resources and destroy the object. */
372 /* Note that archive_read_finish will call archive_read_close for you. */
373 #if ARCHIVE_API_VERSION > 1
374 int              archive_read_finish(struct archive *);
375 #else
376 /* Temporarily allow library to compile with either 1.x or 2.0 API. */
377 /* Erroneously declared to return void in libarchive 1.x */
378 void             archive_read_finish(struct archive *);
379 #endif
380
381 /*-
382  * To create an archive:
383  *   1) Ask archive_write_new for a archive writer object.
384  *   2) Set any global properties.  In particular, you should set
385  *      the compression and format to use.
386  *   3) Call archive_write_open to open the file (most people
387  *       will use archive_write_open_file or archive_write_open_fd,
388  *       which provide convenient canned I/O callbacks for you).
389  *   4) For each entry:
390  *      - construct an appropriate struct archive_entry structure
391  *      - archive_write_header to write the header
392  *      - archive_write_data to write the entry data
393  *   5) archive_write_close to close the output
394  *   6) archive_write_finish to cleanup the writer and release resources
395  */
396 struct archive  *archive_write_new(void);
397 int              archive_write_set_bytes_per_block(struct archive *,
398                      int bytes_per_block);
399 int              archive_write_get_bytes_per_block(struct archive *);
400 /* XXX This is badly misnamed; suggestions appreciated. XXX */
401 int              archive_write_set_bytes_in_last_block(struct archive *,
402                      int bytes_in_last_block);
403 int              archive_write_get_bytes_in_last_block(struct archive *);
404
405 /* The dev/ino of a file that won't be archived.  This is used
406  * to avoid recursively adding an archive to itself. */
407 int              archive_write_set_skip_file(struct archive *, dev_t, ino_t);
408
409 int              archive_write_set_compression_bzip2(struct archive *);
410 int              archive_write_set_compression_gzip(struct archive *);
411 int              archive_write_set_compression_none(struct archive *);
412 int              archive_write_set_compression_program(struct archive *,
413                      const char *cmd);
414 /* A convenience function to set the format based on the code or name. */
415 int              archive_write_set_format(struct archive *, int format_code);
416 int              archive_write_set_format_by_name(struct archive *,
417                      const char *name);
418 /* To minimize link pollution, use one or more of the following. */
419 int              archive_write_set_format_ar_bsd(struct archive *);
420 int              archive_write_set_format_ar_svr4(struct archive *);
421 int              archive_write_set_format_cpio(struct archive *);
422 int              archive_write_set_format_cpio_newc(struct archive *);
423 /* TODO: int archive_write_set_format_old_tar(struct archive *); */
424 int              archive_write_set_format_pax(struct archive *);
425 int              archive_write_set_format_pax_restricted(struct archive *);
426 int              archive_write_set_format_shar(struct archive *);
427 int              archive_write_set_format_shar_dump(struct archive *);
428 int              archive_write_set_format_ustar(struct archive *);
429 int              archive_write_open(struct archive *, void *,
430                      archive_open_callback *, archive_write_callback *,
431                      archive_close_callback *);
432 int              archive_write_open_fd(struct archive *, int _fd);
433 int              archive_write_open_filename(struct archive *, const char *_file);
434 /* A deprecated synonym for archive_write_open_filename() */
435 int              archive_write_open_file(struct archive *, const char *_file);
436 int              archive_write_open_FILE(struct archive *, FILE *);
437 /* _buffSize is the size of the buffer, _used refers to a variable that
438  * will be updated after each write into the buffer. */
439 int              archive_write_open_memory(struct archive *,
440                         void *_buffer, size_t _buffSize, size_t *_used);
441
442 /*
443  * Note that the library will truncate writes beyond the size provided
444  * to archive_write_header or pad if the provided data is short.
445  */
446 int              archive_write_header(struct archive *,
447                      struct archive_entry *);
448 #if ARCHIVE_API_VERSION > 1
449 ssize_t          archive_write_data(struct archive *, const void *, size_t);
450 #else
451 /* Temporarily allow library to compile with either 1.x or 2.0 API. */
452 /* This was erroneously declared to return "int" in libarchive 1.x. */
453 int              archive_write_data(struct archive *, const void *, size_t);
454 #endif
455 ssize_t          archive_write_data_block(struct archive *, const void *, size_t, off_t);
456 int              archive_write_finish_entry(struct archive *);
457 int              archive_write_close(struct archive *);
458 #if ARCHIVE_API_VERSION > 1
459 int              archive_write_finish(struct archive *);
460 #else
461 /* Temporarily allow library to compile with either 1.x or 2.0 API. */
462 /* Return value was incorrect in libarchive 1.x. */
463 void             archive_write_finish(struct archive *);
464 #endif
465
466 /*-
467  * To create objects on disk:
468  *   1) Ask archive_write_disk_new for a new archive_write_disk object.
469  *   2) Set any global properties.  In particular, you should set
470  *      the compression and format to use.
471  *   3) For each entry:
472  *      - construct an appropriate struct archive_entry structure
473  *      - archive_write_header to create the file/dir/etc on disk
474  *      - archive_write_data to write the entry data
475  *   4) archive_write_finish to cleanup the writer and release resources
476  *
477  * In particular, you can use this in conjunction with archive_read()
478  * to pull entries out of an archive and create them on disk.
479  */
480 struct archive  *archive_write_disk_new(void);
481 /* This file will not be overwritten. */
482 int              archive_write_disk_set_skip_file(struct archive *,
483                      dev_t, ino_t);
484 /* Set flags to control how the next item gets created. */
485 int              archive_write_disk_set_options(struct archive *,
486                      int flags);
487 /*
488  * The lookup functions are given uname/uid (or gname/gid) pairs and
489  * return a uid (gid) suitable for this system.  These are used for
490  * restoring ownership and for setting ACLs.  The default functions
491  * are naive, they just return the uid/gid.  These are small, so reasonable
492  * for applications that don't need to preserve ownership; they
493  * are probably also appropriate for applications that are doing
494  * same-system backup and restore.
495  */
496 /*
497  * The "standard" lookup functions use common system calls to lookup
498  * the uname/gname, falling back to the uid/gid if the names can't be
499  * found.  They cache lookups and are reasonably fast, but can be very
500  * large, so they are not used unless you ask for them.  In
501  * particular, these match the specifications of POSIX "pax" and old
502  * POSIX "tar".
503  */
504 int              archive_write_disk_set_standard_lookup(struct archive *);
505 /*
506  * If neither the default (naive) nor the standard (big) functions suit
507  * your needs, you can write your own and register them.  Be sure to
508  * include a cleanup function if you have allocated private data.
509  */
510 int              archive_write_disk_set_group_lookup(struct archive *,
511                      void *private_data,
512                      gid_t (*loookup)(void *, const char *gname, gid_t gid),
513                      void (*cleanup)(void *));
514 int              archive_write_disk_set_user_lookup(struct archive *,
515                      void *private_data,
516                      uid_t (*)(void *, const char *uname, uid_t uid),
517                      void (*cleanup)(void *));
518
519 /*
520  * Accessor functions to read/set various information in
521  * the struct archive object:
522  */
523 /* Bytes written after compression or read before decompression. */
524 int64_t          archive_position_compressed(struct archive *);
525 /* Bytes written to compressor or read from decompressor. */
526 int64_t          archive_position_uncompressed(struct archive *);
527
528 const char      *archive_compression_name(struct archive *);
529 int              archive_compression(struct archive *);
530 int              archive_errno(struct archive *);
531 const char      *archive_error_string(struct archive *);
532 const char      *archive_format_name(struct archive *);
533 int              archive_format(struct archive *);
534 void             archive_clear_error(struct archive *);
535 void             archive_set_error(struct archive *, int _err, const char *fmt, ...);
536 void             archive_copy_error(struct archive *dest, struct archive *src);
537
538 #ifdef __cplusplus
539 }
540 #endif
541
542 #endif /* !ARCHIVE_H_INCLUDED */