1 /*
2  * Copyright 2011 Tresys Technology, LLC. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *    1. Redistributions of source code must retain the above copyright notice,
8  *       this list of conditions and the following disclaimer.
9  *
10  *    2. Redistributions in binary form must reproduce the above copyright notice,
11  *       this list of conditions and the following disclaimer in the documentation
12  *       and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17  * EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * The views and conclusions contained in the software and documentation are those
26  * of the authors and should not be interpreted as representing official policies,
27  * either expressed or implied, of Tresys Technology, LLC.
28  */
29 
30 #ifndef CIL_COPY_H_
31 #define CIL_COPY_H_
32 
33 #include "cil_internal.h"
34 #include "cil_tree.h"
35 #include "cil_symtab.h"
36 
37 void cil_copy_list(struct cil_list *orig, struct cil_list **copy);
38 int cil_copy_expr(struct cil_db *db, struct cil_list *orig, struct cil_list **new);
39 
40 int cil_copy_block(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
41 int cil_copy_blockabstract(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
42 int cil_copy_blockinherit(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
43 int cil_copy_perm(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
44 int cil_copy_class(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
45 int cil_copy_classorder(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
46 int cil_copy_classmapping(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
47 int cil_copy_permset(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
48 
49 void cil_copy_classperms(struct cil_classperms *orig, struct cil_classperms **new);
50 void cil_copy_classperms_set(struct cil_classperms_set *orig, struct cil_classperms_set **new);
51 void cil_copy_classperms_list(struct cil_list *orig, struct cil_list **new);
52 int cil_copy_classpermission(__attribute__((unused)) struct cil_db *db, void *data, void **copy, symtab_t *symtab);
53 int cil_copy_classpermissionset(__attribute__((unused)) struct cil_db *db, void *data, void **copy,  __attribute__((unused)) symtab_t *symtab);
54 int cil_copy_common(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
55 int cil_copy_classcommon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
56 int cil_copy_sid(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
57 int cil_copy_sidcontext(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
58 int cil_copy_sidorder(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
59 int cil_copy_user(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
60 int cil_copy_userrole(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
61 int cil_copy_userlevel(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
62 int cil_copy_userrange(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
63 int cil_copy_userbounds(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
64 int cil_copy_userprefix(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
65 int cil_copy_role(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
66 int cil_copy_roletype(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
67 int cil_copy_rolebounds(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
68 int cil_copy_roleattribute(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
69 int cil_copy_roleattributeset(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
70 int cil_copy_roleallow(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
71 int cil_copy_type(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
72 int cil_copy_typebounds(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
73 int cil_copy_typepermissive(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
74 int cil_copy_typeattribute(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
75 int cil_copy_typeattributeset(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
76 int cil_copy_typealias(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
77 int cil_copy_nametypetransition(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
78 int cil_copy_rangetransition(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
79 int cil_copy_bool(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
80 int cil_copy_avrule(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
81 int cil_copy_type_rule(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
82 int cil_copy_sens(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
83 int cil_copy_sensalias(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
84 int cil_copy_cat(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
85 int cil_copy_catalias(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
86 int cil_copy_catset(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
87 int cil_copy_senscat(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
88 int cil_copy_catorder(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
89 int cil_copy_sensitivityorder(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
90 void cil_copy_fill_level(struct cil_db *db, struct cil_level *orig, struct cil_level **new);
91 int cil_copy_level(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
92 void cil_copy_fill_levelrange(struct cil_db *db, struct cil_levelrange *orig, struct cil_levelrange *new);
93 int cil_copy_levelrange(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
94 void cil_copy_fill_context(struct cil_db *db, struct cil_context *orig, struct cil_context *new);
95 int cil_copy_context(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
96 int cil_copy_netifcon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
97 int cil_copy_genfscon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
98 int cil_copy_filecon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
99 int cil_copy_nodecon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
100 int cil_copy_portcon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
101 int cil_copy_pirqcon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
102 int cil_copy_iomemcon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
103 int cil_copy_ioportcon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
104 int cil_copy_pcidevicecon(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
105 int cil_copy_fsuse(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
106 int cil_copy_exrp(struct cil_db *db, struct cil_list *orig, struct cil_list **new);
107 int cil_copy_constrain(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
108 int cil_copy_validatetrans(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
109 int cil_copy_call(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
110 int cil_copy_optional(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
111 void cil_copy_fill_ipaddr(struct cil_ipaddr *orig, struct cil_ipaddr *new);
112 int cil_copy_ipaddr(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
113 int cil_copy_boolif(struct cil_db *db, void *data, void **copy, symtab_t *symtab);
114 
115 int cil_copy_ast(struct cil_db *db, struct cil_tree_node *orig, struct cil_tree_node *dest);
116 
117 #endif
118