/******************************* */
/* Rule Set Based Access Control */
/* Author and (c) 1999: Amon Ott */
/* API: Data structures          */
/* and functions for Access      */
/* Control Information / RC      */
/* Last modified: 15/Jan/99      */
/******************************* */

#ifndef __RSBAC_RC_H
#define __RSBAC_RC_H

#include <linux/init.h>
#include <rsbac/rc_types.h>

/***************************************************/
/*               General Prototypes                */
/***************************************************/

/* All functions return 0, if no error occurred, and a negative error code  */
/* otherwise. The error codes are defined in rsbac_error.h.                 */

/****************************************************************************/
/* Initialization, including ACI restoration for all mounted devices from   */
/* disk. After this call, all ACI is kept in memory for performance reasons.*/

extern int rsbac_init_rc(void) __init;

/* Some information about the current status is also available              */

extern int rsbac_stats_rc(void);

/* RSBAC attribute saving to disk can be triggered from outside
 * param: call lock_kernel() before writing?
 */

#if defined(CONFIG_RSBAC_AUTO_WRITE) || defined(CONFIG_RSBAC_RC_MAINT)
extern int rsbac_write_rc(boolean);
#endif /* CONFIG_RSBAC_AUTO_WRITE */

/************************************************* */
/*               Access functions                  */
/************************************************* */

/* All these procedures handle the spinlocks to protect the targets during  */
/* access.                                                                  */

/* All roles are always there, so instead of creation, we supply a copy for */
/* initialization. There is always the well-defined role general to copy    */
extern int rsbac_rc_copy_role (rsbac_rc_role_id_t from_role,
                               rsbac_rc_role_id_t to_role);

/* Getting item values */
extern int rsbac_rc_get_item (enum  rsbac_rc_target_t       target,
                              union rsbac_rc_target_id_t    tid,
                              enum  rsbac_rc_item_t         item,
                              union rsbac_rc_item_value_t * value_p);

/* Setting item values */
extern int rsbac_rc_set_item (enum  rsbac_rc_target_t       target,
                              union rsbac_rc_target_id_t    tid,
                              enum  rsbac_rc_item_t         item,
                              union rsbac_rc_item_value_t   value);

#endif
