1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 * Gui Policy Editor for TOMOYO Linux
6 * Copyright (C) Yoshihiro Kusuno 2010 <yocto@users.sourceforge.jp>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program 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
16 * GNU Library General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
27 #include "editpolicy.h"
29 typedef struct _generic_list_t {
31 struct ccs_generic_acl *list;
35 typedef struct _task_list_t {
37 struct ccs_task_entry *task;
41 typedef struct _transition_t {
47 enum ccs_screen_type current_page;
48 GtkActionGroup *actions;
50 GtkContainer *container;
52 struct ccs_domain_policy *dp;
54 generic_list_t acl; // ACL
55 generic_list_t exp; // exception
56 generic_list_t prf; // profile
57 task_list_t tsk; // Process
58 int task_flag; // 1:process
66 #define DEBUG_PRINT(format, ...) \
67 g_print("%s:%d (%s) " format, __FILE__, __LINE__, G_STRFUNC, ##__VA_ARGS__)
69 #define DEBUG_PRINT(...)
73 // ccstools editpolicy.c
74 int ccs_main(int argc, char *argv[]);
77 int get_domain_policy(struct ccs_domain_policy *dp, int *count);
78 int add_domain(char *input, char **err_buff);
79 int set_profile(struct ccs_domain_policy *dp,
80 char *profile, char **err_buff);
81 int get_task_list(struct ccs_task_entry **tsk, int *count);
82 int get_acl_list(struct ccs_domain_policy *dp, int current,
83 struct ccs_generic_acl **ga, int *count);
84 int get_process_acl_list(int current,
85 struct ccs_generic_acl **ga, int *count);
86 int add_acl_list(struct ccs_domain_policy *dp, int current,
87 char *input, char **err_buff);
88 const char *get_transition_name(enum ccs_transition_type type);
89 int get_exception_policy(struct ccs_generic_acl **ga, int *count);
90 int add_exception_policy(char *input, char **err_buff);
91 int get_profile(struct ccs_generic_acl **ga, int *count);
92 int add_profile(char *input, char **err_buff);
93 int set_profile_level(int index, const char *input, char **err_buff);
94 int get_manager(struct ccs_generic_acl **ga, int *count);
95 int add_manager(char *input, char **err_buff);
96 int get_memory(struct ccs_generic_acl **ga, int *count);
97 int set_memory(struct ccs_generic_acl *ga, int count, char **err_buff);
98 int delete_domain_policy(struct ccs_domain_policy *dp, char **err_buff);
99 int delete_acl_policy(struct ccs_domain_policy *dp, char **err_buff,
100 struct ccs_generic_acl *ga, int count);
101 int delete_exp_policy(struct ccs_domain_policy *dp, char **err_buff,
102 struct ccs_generic_acl *ga, int count);
103 int delete_manager_policy(
104 struct ccs_generic_acl *ga, int count, char **err_buff);
105 int is_offline(void);
108 void add_tree_data(GtkTreeView *treeview, struct ccs_domain_policy *dp);
109 void add_list_data(generic_list_t *generic, gboolean alias_flag);
110 gint get_current_domain_index(transition_t *transition);
111 void set_sensitive(GtkActionGroup *actions, int task_flag,
112 enum ccs_screen_type current_page);
113 gint delete_domain(transition_t *transition,
114 GtkTreeSelection *selection, gint count);
115 void view_setting(GtkWidget *treeview, gint search_column);
116 gint set_domain_profile(transition_t *transition,
117 GtkTreeSelection *selection, guint profile);
118 gint select_profile_line(generic_list_t *prf);
119 gint delete_acl(transition_t *transition,
120 GtkTreeSelection *selection, gint count);
121 gint delete_exp(transition_t *transition,
122 GtkTreeSelection *selection, gint count);
126 GtkWidget *create_menu(GtkWidget *parent, transition_t *transition,
127 GtkWidget **toolbar);
128 void disp_statusbar(transition_t *transition, int scr);
129 void view_cursor_set(GtkWidget *view,
130 GtkTreePath *path, GtkTreeViewColumn *column);
131 void refresh_transition(GtkAction *action, transition_t *transition);
132 GdkPixbuf *get_png_file(void);
135 void read_config(transition_t *tran);
136 void write_config(transition_t *tran);
139 void manager_main(transition_t *transition);
140 void memory_main(transition_t *transition);
143 void add_task_tree_data(GtkTreeView *treeview, task_list_t *tsk);
144 void set_select_flag_process(gpointer data, task_list_t *tsk);
145 GtkWidget *create_task_tree_model(transition_t *transition);
148 #endif /* __GPET_H__ */