1 /* Author: Stephen Smalley, <sds@epoch.ncsc.mil>
2  * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
3  *
4  *      Support for enhanced MLS infrastructure.
5  *
6  * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
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_MLS_INTERNAL_H_
24 #define _SEPOL_MLS_INTERNAL_H_
25 
26 #include "policydb_internal.h"
27 #include <sepol/policydb/context.h>
28 #include "handle.h"
29 
30 extern int mls_from_string(sepol_handle_t * handle,
31 			   const policydb_t * policydb,
32 			   const char *str, context_struct_t * mls);
33 
34 extern int mls_to_string(sepol_handle_t * handle,
35 			 const policydb_t * policydb,
36 			 const context_struct_t * mls, char **str);
37 
38 /* Deprecated */
39 extern int mls_compute_context_len(const policydb_t * policydb,
40 				   const context_struct_t * context);
41 
42 /* Deprecated */
43 extern void mls_sid_to_context(const policydb_t * policydb,
44 			       const context_struct_t * context,
45 			       char **scontext);
46 
47 /* Deprecated */
48 extern int mls_context_to_sid(const policydb_t * policydb,
49 			      char oldc,
50 			      char **scontext, context_struct_t * context);
51 
52 extern int mls_context_isvalid(const policydb_t * p,
53 			       const context_struct_t * c);
54 
55 extern int mls_convert_context(policydb_t * oldp,
56 			       policydb_t * newp, context_struct_t * context);
57 
58 extern int mls_compute_sid(policydb_t * policydb,
59 			   context_struct_t * scontext,
60 			   context_struct_t * tcontext,
61 			   sepol_security_class_t tclass,
62 			   uint32_t specified, context_struct_t * newcontext);
63 
64 extern int mls_setup_user_range(context_struct_t * fromcon, user_datum_t * user,
65 				context_struct_t * usercon, int mls);
66 
67 #endif
68