Home | History | Annotate | Download | only in src
      1 /* Author: Joshua Brindle <jbrindle (at) tresys.com>
      2  *         Jason Tang     <jtang (at) tresys.com>
      3  *
      4  * Copyright (C) 2005 Tresys Technology, LLC
      5  * Copyright (C) 2005 Red Hat Inc.
      6  *
      7  *  This library is free software; you can redistribute it and/or
      8  *  modify it under the terms of the GNU Lesser General Public
      9  *  License as published by the Free Software Foundation; either
     10  *  version 2.1 of the License, or (at your option) any later version.
     11  *
     12  *  This library is distributed in the hope that it will be useful,
     13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  *  Lesser General Public License for more details.
     16  *
     17  *  You should have received a copy of the GNU Lesser General Public
     18  *  License along with this library; if not, write to the Free Software
     19  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20  */
     21 
     22 #ifndef _SEMANAGE_POLICY_INTERNAL_H_
     23 #define _SEMANAGE_POLICY_INTERNAL_H_
     24 
     25 #include "modules.h"
     26 
     27 /* Circular dependency */
     28 struct semanage_handle;
     29 
     30 /* Backend dependent portion */
     31 struct semanage_policy_table {
     32 
     33 	/* Returns the current policy serial/commit number
     34 	 * A negative number is returned in case of failre */
     35 	int (*get_serial) (struct semanage_handle *);
     36 
     37 	/* Destroy a connection */
     38 	void (*destroy) (struct semanage_handle *);
     39 
     40 	/* Disconnect from policy */
     41 	int (*disconnect) (struct semanage_handle *);
     42 
     43 	/* Begin a policy transaction */
     44 	int (*begin_trans) (struct semanage_handle *);
     45 
     46 	/* Commit a policy transaction */
     47 	int (*commit) (struct semanage_handle *);
     48 
     49 	/* Install a policy module */
     50 	int (*install) (struct semanage_handle *, char *, size_t, const char *, const char *);
     51 
     52 	/* Install a policy module */
     53 	int (*install_file) (struct semanage_handle *, const char *);
     54 
     55 	/* Extract a policy module */
     56 	int (*extract) (struct semanage_handle *,
     57 				 semanage_module_key_t *,
     58 				 int extract_cil,
     59 				 void **,
     60 				 size_t *,
     61 				 semanage_module_info_t **);
     62 
     63 	/* Remove a policy module */
     64 	int (*remove) (struct semanage_handle *, char *);
     65 
     66 	/* List policy modules */
     67 	int (*list) (struct semanage_handle *, semanage_module_info_t **,
     68 		     int *);
     69 
     70 	/* Get module enabled status */
     71 	int (*get_enabled) (struct semanage_handle *sh,
     72 			    const semanage_module_key_t *key,
     73 			    int *enabled);
     74 
     75 	/* Set module enabled status */
     76 	int (*set_enabled) (struct semanage_handle *sh,
     77 			    const semanage_module_key_t *key,
     78 			    int enabled);
     79 
     80 	/* Get a module info */
     81 	int (*get_module_info) (struct semanage_handle *,
     82 				const semanage_module_key_t *,
     83 				semanage_module_info_t **);
     84 
     85 	/* List all policy modules */
     86 	int (*list_all) (struct semanage_handle *,
     87 			 semanage_module_info_t **,
     88 			 int *);
     89 
     90 	/* Install via module info */
     91 	int (*install_info) (struct semanage_handle *,
     92 			     const semanage_module_info_t *,
     93 			     char *,
     94 			     size_t);
     95 
     96 	/* Remove via module key */
     97 	int (*remove_key) (struct semanage_handle *,
     98 			   const semanage_module_key_t *);
     99 };
    100 
    101 /* Should be backend independent */
    102 extern int semanage_base_merge_components(struct semanage_handle *handle);
    103 
    104 extern int semanage_commit_components(struct semanage_handle *handle);
    105 
    106 #endif
    107