OSDN Git Service

gpet initial repository
[gpet/origin.git] / src / gpet.h
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Gui Policy Editor for TOMOYO Linux
4  *
5  * gpet.h
6  * Copyright (C) Yoshihiro Kusuno 2010 <yocto@users.sourceforge.jp>
7  * 
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.
12  * 
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.
17  * 
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
21  */
22
23 #ifndef __GPET_H__
24 #define __GPET_H__
25
26 #include "ccstools.h"
27 #include "editpolicy.h"
28
29 typedef struct _generic_list_t {
30         GtkWidget       *listview;
31         struct  ccs_generic_acl *list;
32         int     count;
33 } generic_list_t;
34
35 typedef struct _task_list_t {
36         GtkWidget       *treeview;
37         struct  ccs_task_entry  *task;
38         int     count;
39 } task_list_t;
40
41 typedef struct _transition_t {
42         GtkWidget               *window;
43         GtkWidget               *domainbar;
44         GtkWidget               *treeview;
45         GtkWidget               *statusbar;
46         gint                    contextid;
47         enum ccs_screen_type    current_page;
48         GtkActionGroup  *actions;
49
50         GtkContainer            *container;
51
52         struct ccs_domain_policy        *dp;
53         int                     domain_count;
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
59                                                         // 0:domain
60 } transition_t;
61
62
63 //#define DEBUG
64
65 #ifdef DEBUG
66         #define DEBUG_PRINT(format, ...) \
67         g_print("%s:%d (%s) " format, __FILE__, __LINE__, G_STRFUNC, ##__VA_ARGS__)
68 #else
69         #define DEBUG_PRINT(...)
70 #endif
71
72
73 // ccstools  editpolicy.c
74 int ccs_main(int argc, char *argv[]);
75
76 // interface.inc
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);
106
107 // gpet.c
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);
123 int gpet_main(void);
124
125 // menu.c
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);
133
134 // conf.c
135 void read_config(transition_t *tran);
136 void write_config(transition_t *tran);
137
138 // other.c
139 void manager_main(transition_t *transition);
140 void memory_main(transition_t *transition);
141
142 // process.c
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);
146
147
148 #endif /* __GPET_H__ */