1231200Smm/*-
2231200Smm * Copyright (c) 2003-2010 Tim Kientzle
3231200Smm * All rights reserved.
4231200Smm *
5231200Smm * Redistribution and use in source and binary forms, with or without
6231200Smm * modification, are permitted provided that the following conditions
7231200Smm * are met:
8231200Smm * 1. Redistributions of source code must retain the above copyright
9231200Smm *    notice, this list of conditions and the following disclaimer.
10231200Smm * 2. Redistributions in binary form must reproduce the above copyright
11231200Smm *    notice, this list of conditions and the following disclaimer in the
12231200Smm *    documentation and/or other materials provided with the distribution.
13231200Smm *
14231200Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15231200Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16231200Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17231200Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18231200Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19231200Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20231200Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21231200Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22231200Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23231200Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24231200Smm *
25231200Smm * $FreeBSD$
26231200Smm */
27231200Smm
28231200Smm#ifndef __LIBARCHIVE_BUILD
29231200Smm#error This header is only to be used internally to libarchive.
30231200Smm#endif
31231200Smm
32231200Smm#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
33231200Smm#define	ARCHIVE_ACL_PRIVATE_H_INCLUDED
34231200Smm
35231200Smm#include "archive_string.h"
36231200Smm
37231200Smmstruct archive_acl_entry {
38231200Smm	struct archive_acl_entry *next;
39231200Smm	int	type;			/* E.g., access or default */
40231200Smm	int	tag;			/* E.g., user/group/other/mask */
41231200Smm	int	permset;		/* r/w/x bits */
42231200Smm	int	id;			/* uid/gid for user/group */
43231200Smm	struct archive_mstring name;		/* uname/gname */
44231200Smm};
45231200Smm
46231200Smmstruct archive_acl {
47231200Smm	mode_t		mode;
48231200Smm	struct archive_acl_entry	*acl_head;
49231200Smm	struct archive_acl_entry	*acl_p;
50231200Smm	int		 acl_state;	/* See acl_next for details. */
51231200Smm	wchar_t		*acl_text_w;
52231200Smm	char		*acl_text;
53231200Smm	int		 acl_types;
54231200Smm};
55231200Smm
56231200Smmvoid archive_acl_clear(struct archive_acl *);
57231200Smmvoid archive_acl_copy(struct archive_acl *, struct archive_acl *);
58231200Smmint archive_acl_count(struct archive_acl *, int);
59231200Smmint archive_acl_reset(struct archive_acl *, int);
60231200Smmint archive_acl_next(struct archive *, struct archive_acl *, int,
61231200Smm    int *, int *, int *, int *, const char **);
62231200Smm
63231200Smmint archive_acl_add_entry(struct archive_acl *, int, int, int, int, const char *);
64231200Smmint archive_acl_add_entry_w_len(struct archive_acl *,
65231200Smm    int, int, int, int, const wchar_t *, size_t);
66231200Smmint archive_acl_add_entry_len(struct archive_acl *,
67231200Smm    int, int, int, int, const char *, size_t);
68231200Smm
69231200Smmconst wchar_t *archive_acl_text_w(struct archive *, struct archive_acl *, int);
70231200Smmint archive_acl_text_l(struct archive_acl *, int, const char **, size_t *,
71231200Smm    struct archive_string_conv *);
72231200Smm
73231200Smm/*
74231200Smm * Private ACL parser.  This is private because it handles some
75231200Smm * very weird formats that clients should not be messing with.
76231200Smm * Clients should only deal with their platform-native formats.
77231200Smm * Because of the need to support many formats cleanly, new arguments
78231200Smm * are likely to get added on a regular basis.  Clients who try to use
79231200Smm * this interface are likely to be surprised when it changes.
80231200Smm */
81231200Smmint archive_acl_parse_w(struct archive_acl *,
82231200Smm		    const wchar_t *, int /* type */);
83231200Smmint archive_acl_parse_l(struct archive_acl *,
84231200Smm		    const char *, int /* type */,
85231200Smm		    struct archive_string_conv *);
86231200Smm
87231200Smm#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
88