/* Author: Stephen Smalley, <stephen.smalley.work@gmail.com>
 * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
 * 
 *      Support for enhanced MLS infrastructure.
 *
 * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef _SEPOL_MLS_INTERNAL_H_
#define _SEPOL_MLS_INTERNAL_H_

#include "policydb_internal.h"
#include <sepol/policydb/context.h>
#include <sepol/policydb/policydb.h>
#include "handle.h"

extern int mls_from_string(sepol_handle_t * handle,
			   const policydb_t * policydb,
			   const char *str, context_struct_t * mls);

extern int mls_to_string(sepol_handle_t * handle,
			 const policydb_t * policydb,
			 const context_struct_t * mls, char **str);

/* Deprecated */
extern int mls_compute_context_len(const policydb_t * policydb,
				   const context_struct_t * context);

/* Deprecated */
extern void mls_sid_to_context(const policydb_t * policydb,
			       const context_struct_t * context,
			       char **scontext);

/* Deprecated */
extern int mls_context_to_sid(const policydb_t * policydb,
			      char oldc,
			      char **scontext, context_struct_t * context);

extern int mls_context_isvalid(const policydb_t * p,
			       const context_struct_t * c);

extern int mls_convert_context(policydb_t * oldp,
			       policydb_t * newp, context_struct_t * context);

extern int mls_compute_sid(policydb_t * policydb,
			   const context_struct_t * scontext,
			   const context_struct_t * tcontext,
			   sepol_security_class_t tclass,
			   uint32_t specified, context_struct_t * newcontext);

extern int mls_setup_user_range(context_struct_t * fromcon, user_datum_t * user,
				context_struct_t * usercon, int mls);

#endif
