xref: /aosp_15_r20/external/selinux/libsepol/include/sepol/policydb/util.h (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1 /* Authors: Karl MacMillan <[email protected]>
2  *
3  * A set of utility functions that aid policy decision when dealing
4  * with hierarchal namespaces.
5  *
6  * Copyright (C) 2006 Tresys Technology, LLC
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2.1 of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 
23 #ifndef __SEPOL_UTIL_H__
24 #define __SEPOL_UTIL_H__
25 
26 #include <sepol/policydb/policydb.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 extern int add_i_to_a(uint32_t i, uint32_t * cnt, uint32_t ** a);
33 
34 extern char *sepol_av_to_string(const policydb_t *policydbp, sepol_security_class_t tclass,
35 				sepol_access_vector_t av);
36 
37 char *sepol_extended_perms_to_string(const avtab_extended_perms_t *xperms);
38 
39 /*
40  * The tokenize function may be used to
41  * replace sscanf
42  */
43 extern int tokenize(const char *line_buf, char delim, int num_args, ...);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif
50