1228753Smm/*-
2228753Smm * Copyright (c) 2003-2009 Tim Kientzle
3228753Smm * All rights reserved.
4228753Smm *
5228753Smm * Redistribution and use in source and binary forms, with or without
6228753Smm * modification, are permitted provided that the following conditions
7228753Smm * are met:
8228753Smm * 1. Redistributions of source code must retain the above copyright
9228753Smm *    notice, this list of conditions and the following disclaimer
10228753Smm *    in this position and unchanged.
11228753Smm * 2. Redistributions in binary form must reproduce the above copyright
12228753Smm *    notice, this list of conditions and the following disclaimer in the
13228753Smm *    documentation and/or other materials provided with the distribution.
14228753Smm *
15228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16228753Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17228753Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18228753Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19228753Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20228753Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21228753Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22228753Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23228753Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24228753Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25228753Smm *
26228763Smm * $FreeBSD: stable/11/contrib/libarchive/libarchive/archive_read_disk_private.h 358088 2020-02-19 01:50:47Z mm $
27228753Smm */
28228753Smm
29358088Smm#ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
30358088Smm#define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
31358088Smm
32228753Smm#ifndef __LIBARCHIVE_BUILD
33228753Smm#error This header is only to be used internally to libarchive.
34228753Smm#endif
35228753Smm
36316337Smm#include "archive_platform_acl.h"
37316337Smm
38232153Smmstruct tree;
39238856Smmstruct archive_entry;
40232153Smm
41228753Smmstruct archive_read_disk {
42228753Smm	struct archive	archive;
43228753Smm
44299529Smm	/* Reused by archive_read_next_header() */
45299529Smm	struct archive_entry *entry;
46299529Smm
47228753Smm	/*
48228753Smm	 * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid,
49228753Smm	 * following an old BSD convention.  'L' follows all symlinks,
50228753Smm	 * 'P' follows none, 'H' follows symlinks only for the first
51228753Smm	 * item.
52228753Smm	 */
53228753Smm	char	symlink_mode;
54228753Smm
55228753Smm	/*
56228753Smm	 * Since symlink interaction changes, we need to track whether
57228753Smm	 * we're following symlinks for the current item.  'L' mode above
58228753Smm	 * sets this true, 'P' sets it false, 'H' changes it as we traverse.
59228753Smm	 */
60228753Smm	char	follow_symlinks;  /* Either 'L' or 'P'. */
61228753Smm
62232153Smm	/* Directory traversals. */
63232153Smm	struct tree *tree;
64238856Smm	int	(*open_on_current_dir)(struct tree*, const char *, int);
65238856Smm	int	(*tree_current_dir_fd)(struct tree*);
66238856Smm	int	(*tree_enter_working_dir)(struct tree*);
67232153Smm
68315432Smm	/* Bitfield with ARCHIVE_READDISK_* tunables */
69315432Smm	int	flags;
70232153Smm
71232153Smm	const char * (*lookup_gname)(void *private, int64_t gid);
72228753Smm	void	(*cleanup_gname)(void *private);
73228753Smm	void	 *lookup_gname_data;
74232153Smm	const char * (*lookup_uname)(void *private, int64_t uid);
75228753Smm	void	(*cleanup_uname)(void *private);
76228753Smm	void	 *lookup_uname_data;
77238856Smm
78238856Smm	int	(*metadata_filter_func)(struct archive *, void *,
79238856Smm			struct archive_entry *);
80238856Smm	void	*metadata_filter_data;
81238856Smm
82238856Smm	/* ARCHIVE_MATCH object. */
83238856Smm	struct archive	*matching;
84238856Smm	/* Callback function, this will be invoked when ARCHIVE_MATCH
85238856Smm	 * archive_match_*_excluded_ae return true. */
86238856Smm	void	(*excluded_cb_func)(struct archive *, void *,
87238856Smm			 struct archive_entry *);
88238856Smm	void	*excluded_cb_data;
89228753Smm};
90228753Smm
91316337Smmconst char *
92316337Smmarchive_read_disk_entry_setup_path(struct archive_read_disk *,
93316337Smm    struct archive_entry *, int *);
94316337Smm
95316337Smmint
96316337Smmarchive_read_disk_entry_setup_acls(struct archive_read_disk *,
97316337Smm    struct archive_entry *, int *);
98228753Smm#endif
99