00001 /**************************************/ 00002 /* Rule Set Based Access Control */ 00003 /* Author and (c) 1999-2005: Amon Ott */ 00004 /* Data structures / PM */ 00005 /* Last modified: 09/Feb/2005 */ 00006 /**************************************/ 00007 00008 #ifndef __RSBAC_PM_DATA_STRUC_H 00009 #define __RSBAC_PM_DATA_STRUC_H 00010 00011 #include <linux/types.h> 00012 #include <rsbac/aci.h> 00013 #include <rsbac/types.h> 00014 #include <rsbac/pm_types.h> 00015 00016 #define RSBAC_PM_TASK_SET_LIST_NAME "pm_ta_s" 00017 #define RSBAC_PM_TASK_SET_LIST_PROC_NAME "task_set" 00018 00019 #define RSBAC_PM_TP_SET_LIST_NAME "pm_tp_s" 00020 #define RSBAC_PM_TP_SET_LIST_PROC_NAME "tp_set" 00021 00022 #define RSBAC_PM_RU_SET_LIST_NAME "pm_ru_s" 00023 #define RSBAC_PM_RU_SET_LIST_PROC_NAME "responsible_user_set" 00024 00025 #define RSBAC_PM_PP_SET_LIST_NAME "pm_pp_s" 00026 #define RSBAC_PM_PP_SET_LIST_PROC_NAME "purpose_set" 00027 00028 #define RSBAC_PM_IN_PP_SET_LIST_NAME "input_pp_set" 00029 #define RSBAC_PM_IN_PP_SET_LIST_PROC_NAME "input_purpose_set" 00030 00031 #define RSBAC_PM_OUT_PP_SET_LIST_NAME "output_pp_set" 00032 #define RSBAC_PM_OUT_PP_SET_LIST_PROC_NAME "output_purpose_set" 00033 00034 00035 #define RSBAC_PM_TASK_LIST_NAME "pm_task" 00036 #define RSBAC_PM_TASK_LIST_PROC_NAME "task" 00037 00038 #define RSBAC_PM_CLASS_LIST_NAME "pm_clas" 00039 #define RSBAC_PM_CLASS_LIST_PROC_NAME "object_class" 00040 00041 #define RSBAC_PM_NA_LIST_NAME "pm_na" 00042 #define RSBAC_PM_NA_LIST_PROC_NAME "necessary_accesses" 00043 00044 #define RSBAC_PM_CS_LIST_NAME "pm_cs" 00045 #define RSBAC_PM_CS_LIST_PROC_NAME "consent" 00046 00047 #define RSBAC_PM_TP_LIST_NAME "pm_tp" 00048 #define RSBAC_PM_TP_LIST_PROC_NAME "tp" 00049 00050 #define RSBAC_PM_PP_LIST_NAME "pm_pp" 00051 #define RSBAC_PM_PP_LIST_PROC_NAME "purpose" 00052 00053 #define RSBAC_PM_TKT_LIST_NAME "pm_tkt" 00054 #define RSBAC_PM_TKT_LIST_PROC_NAME "ticket" 00055 00056 00057 #define RSBAC_PM_NO_VERSION 1 00058 00059 #define RSBAC_PM_TASK_SET_LIST_VERSION 1 00060 #define RSBAC_PM_TP_SET_LIST_VERSION 1 00061 #define RSBAC_PM_RU_SET_LIST_VERSION 2 00062 #define RSBAC_PM_PP_SET_LIST_VERSION 1 00063 00064 #define RSBAC_PM_TASK_LIST_VERSION 1 00065 #define RSBAC_PM_CLASS_LIST_VERSION 1 00066 #define RSBAC_PM_NA_LIST_VERSION 1 00067 #define RSBAC_PM_CS_LIST_VERSION 1 00068 #define RSBAC_PM_TP_LIST_VERSION 1 00069 #define RSBAC_PM_PP_LIST_VERSION 1 00070 #define RSBAC_PM_TKT_LIST_VERSION 2 00071 00072 #define RSBAC_PM_LIST_KEY 19990820 00073 00074 #define RSBAC_PM_PROC_STATS_NAME "stats_pm" 00075 #define RSBAC_PM_PROC_DIR_NAME "pm" 00076 00077 /**********************************************/ 00078 /* Helper lists */ 00079 /**********************************************/ 00080 00081 /* This list represents sets of task-ids, using a set-id and a sublist each */ 00082 00083 struct rsbac_pm_task_set_sublist_item_t 00084 { 00085 rsbac_pm_task_id_t id; 00086 struct rsbac_pm_task_set_sublist_item_t * prev; 00087 struct rsbac_pm_task_set_sublist_item_t * next; 00088 }; 00089 00090 struct rsbac_pm_task_set_list_item_t 00091 { 00092 rsbac_pm_task_set_id_t id; 00093 int sublist_length; 00094 struct rsbac_pm_task_set_sublist_item_t * sublist_head; 00095 struct rsbac_pm_task_set_sublist_item_t * sublist_tail; 00096 struct rsbac_pm_task_set_list_item_t * prev; 00097 struct rsbac_pm_task_set_list_item_t * next; 00098 }; 00099 00100 struct rsbac_pm_task_set_list_head_t 00101 { 00102 struct rsbac_pm_task_set_list_item_t * head; 00103 struct rsbac_pm_task_set_list_item_t * tail; 00104 struct rsbac_pm_task_set_list_item_t * curr; 00105 rwlock_t lock; 00106 rsbac_boolean_t dirty; 00107 u_long count; 00108 rsbac_boolean_t no_write; 00109 }; 00110 00111 00112 /* This list represents sets of TP-ids, using a set-id and a sublist each */ 00113 00114 struct rsbac_pm_tp_set_sublist_item_t 00115 { 00116 rsbac_pm_tp_id_t id; 00117 struct rsbac_pm_tp_set_sublist_item_t * prev; 00118 struct rsbac_pm_tp_set_sublist_item_t * next; 00119 }; 00120 00121 struct rsbac_pm_tp_set_list_item_t 00122 { 00123 rsbac_pm_tp_set_id_t id; 00124 int sublist_length; 00125 struct rsbac_pm_tp_set_sublist_item_t * sublist_head; 00126 struct rsbac_pm_tp_set_sublist_item_t * sublist_tail; 00127 struct rsbac_pm_tp_set_list_item_t * prev; 00128 struct rsbac_pm_tp_set_list_item_t * next; 00129 }; 00130 00131 struct rsbac_pm_tp_set_list_head_t 00132 { 00133 struct rsbac_pm_tp_set_list_item_t * head; 00134 struct rsbac_pm_tp_set_list_item_t * tail; 00135 struct rsbac_pm_tp_set_list_item_t * curr; 00136 rwlock_t lock; 00137 rsbac_boolean_t dirty; 00138 u_int count; 00139 rsbac_boolean_t no_write; 00140 }; 00141 00142 00143 /* This list represents sets of Responsible-User-ids, using a set-id and a */ 00144 /* sublist each */ 00145 00146 struct rsbac_pm_ru_set_sublist_item_t 00147 { 00148 rsbac_uid_t id; 00149 struct rsbac_pm_ru_set_sublist_item_t * prev; 00150 struct rsbac_pm_ru_set_sublist_item_t * next; 00151 }; 00152 00153 struct rsbac_pm_ru_set_list_item_t 00154 { 00155 rsbac_pm_ru_set_id_t id; 00156 int sublist_length; 00157 struct rsbac_pm_ru_set_sublist_item_t * sublist_head; 00158 struct rsbac_pm_ru_set_sublist_item_t * sublist_tail; 00159 struct rsbac_pm_ru_set_list_item_t * prev; 00160 struct rsbac_pm_ru_set_list_item_t * next; 00161 }; 00162 00163 struct rsbac_pm_ru_set_list_head_t 00164 { 00165 struct rsbac_pm_ru_set_list_item_t * head; 00166 struct rsbac_pm_ru_set_list_item_t * tail; 00167 struct rsbac_pm_ru_set_list_item_t * curr; 00168 rwlock_t lock; 00169 rsbac_boolean_t dirty; 00170 u_int count; 00171 rsbac_boolean_t no_write; 00172 }; 00173 00174 /* This list represents sets of purpose-ids, using a set-id and a */ 00175 /* sublist each */ 00176 00177 struct rsbac_pm_pp_set_sublist_item_t 00178 { 00179 rsbac_pm_purpose_id_t id; 00180 struct rsbac_pm_pp_set_sublist_item_t * prev; 00181 struct rsbac_pm_pp_set_sublist_item_t * next; 00182 }; 00183 00184 struct rsbac_pm_pp_set_list_item_t 00185 { 00186 rsbac_pm_pp_set_id_t id; 00187 int sublist_length; 00188 struct rsbac_pm_pp_set_sublist_item_t * sublist_head; 00189 struct rsbac_pm_pp_set_sublist_item_t * sublist_tail; 00190 struct rsbac_pm_pp_set_list_item_t * prev; 00191 struct rsbac_pm_pp_set_list_item_t * next; 00192 }; 00193 00194 struct rsbac_pm_pp_set_list_head_t 00195 { 00196 struct rsbac_pm_pp_set_list_item_t * head; 00197 struct rsbac_pm_pp_set_list_item_t * tail; 00198 struct rsbac_pm_pp_set_list_item_t * curr; 00199 rwlock_t lock; 00200 rsbac_boolean_t dirty; 00201 u_long count; 00202 rsbac_boolean_t no_write; 00203 }; 00204 00205 /* This list also represents sets of purpose-ids, using a set-id and a */ 00206 /* sublist each */ 00207 00208 struct rsbac_pm_in_pp_set_sublist_item_t 00209 { 00210 rsbac_pm_purpose_id_t id; 00211 struct rsbac_pm_in_pp_set_sublist_item_t * prev; 00212 struct rsbac_pm_in_pp_set_sublist_item_t * next; 00213 }; 00214 00215 struct rsbac_pm_in_pp_set_list_item_t 00216 { 00217 rsbac_pm_in_pp_set_id_t id; 00218 int sublist_length; 00219 struct rsbac_pm_in_pp_set_sublist_item_t * sublist_head; 00220 struct rsbac_pm_in_pp_set_sublist_item_t * sublist_tail; 00221 struct rsbac_pm_in_pp_set_list_item_t * prev; 00222 struct rsbac_pm_in_pp_set_list_item_t * next; 00223 }; 00224 00225 struct rsbac_pm_in_pp_set_list_head_t 00226 { 00227 struct rsbac_pm_in_pp_set_list_item_t * head; 00228 struct rsbac_pm_in_pp_set_list_item_t * tail; 00229 struct rsbac_pm_in_pp_set_list_item_t * curr; 00230 rwlock_t lock; 00231 rsbac_boolean_t dirty; 00232 u_int count; 00233 }; 00234 00235 /* This list also represents sets of purpose-ids, using a set-id and a */ 00236 /* sublist each */ 00237 00238 struct rsbac_pm_out_pp_set_sublist_item_t 00239 { 00240 rsbac_pm_purpose_id_t id; 00241 struct rsbac_pm_out_pp_set_sublist_item_t * prev; 00242 struct rsbac_pm_out_pp_set_sublist_item_t * next; 00243 }; 00244 00245 struct rsbac_pm_out_pp_set_list_item_t 00246 { 00247 rsbac_pm_out_pp_set_id_t id; 00248 int sublist_length; 00249 struct rsbac_pm_out_pp_set_sublist_item_t * sublist_head; 00250 struct rsbac_pm_out_pp_set_sublist_item_t * sublist_tail; 00251 struct rsbac_pm_out_pp_set_list_item_t * prev; 00252 struct rsbac_pm_out_pp_set_list_item_t * next; 00253 }; 00254 00255 struct rsbac_pm_out_pp_set_list_head_t 00256 { 00257 struct rsbac_pm_out_pp_set_list_item_t * head; 00258 struct rsbac_pm_out_pp_set_list_item_t * tail; 00259 struct rsbac_pm_out_pp_set_list_item_t * curr; 00260 rwlock_t lock; 00261 rsbac_boolean_t dirty; 00262 u_int count; 00263 }; 00264 00265 00266 /**********************************************/ 00267 /* Main lists */ 00268 /**********************************************/ 00269 00270 /* List of defined tasks */ 00271 /* rsbac_pm_task_data_t is defined in pm_types.h! */ 00272 00273 struct rsbac_pm_task_list_item_t 00274 { 00275 struct rsbac_pm_task_data_t data; 00276 struct rsbac_pm_task_list_item_t * prev; 00277 struct rsbac_pm_task_list_item_t * next; 00278 }; 00279 00280 struct rsbac_pm_task_list_head_t 00281 { 00282 struct rsbac_pm_task_list_item_t * head; 00283 struct rsbac_pm_task_list_item_t * tail; 00284 struct rsbac_pm_task_list_item_t * curr; 00285 rwlock_t lock; 00286 rsbac_boolean_t dirty; 00287 u_int count; 00288 rsbac_boolean_t no_write; 00289 }; 00290 00291 /* List of defined classes */ 00292 /* rsbac_pm_class_data_t is defined in pm_types.h! */ 00293 00294 00295 struct rsbac_pm_class_list_item_t 00296 { 00297 struct rsbac_pm_class_data_t data; 00298 struct rsbac_pm_class_list_item_t * prev; 00299 struct rsbac_pm_class_list_item_t * next; 00300 }; 00301 00302 struct rsbac_pm_class_list_head_t 00303 { 00304 struct rsbac_pm_class_list_item_t * head; 00305 struct rsbac_pm_class_list_item_t * tail; 00306 struct rsbac_pm_class_list_item_t * curr; 00307 rwlock_t lock; 00308 rsbac_boolean_t dirty; 00309 u_int count; 00310 rsbac_boolean_t no_write; 00311 }; 00312 00313 /* List of defined necessary accesses */ 00314 /* rsbac_pm_na_data_t is defined in pm_types.h! */ 00315 00316 struct rsbac_pm_na_list_item_t 00317 { 00318 struct rsbac_pm_na_data_t data; 00319 struct rsbac_pm_na_list_item_t * prev; 00320 struct rsbac_pm_na_list_item_t * next; 00321 }; 00322 00323 struct rsbac_pm_na_list_head_t 00324 { 00325 struct rsbac_pm_na_list_item_t * head; 00326 struct rsbac_pm_na_list_item_t * tail; 00327 struct rsbac_pm_na_list_item_t * curr; 00328 rwlock_t lock; 00329 rsbac_boolean_t dirty; 00330 u_int count; 00331 rsbac_boolean_t no_write; 00332 }; 00333 00334 00335 /* List of consents */ 00336 /* rsbac_pm_cs_data_t is defined in pm_types.h! */ 00337 00338 struct rsbac_pm_cs_list_item_t 00339 { 00340 struct rsbac_pm_cs_data_t data; 00341 struct rsbac_pm_cs_list_item_t * prev; 00342 struct rsbac_pm_cs_list_item_t * next; 00343 }; 00344 00345 struct rsbac_pm_cs_list_head_t 00346 { 00347 struct rsbac_pm_cs_list_item_t * head; 00348 struct rsbac_pm_cs_list_item_t * tail; 00349 struct rsbac_pm_cs_list_item_t * curr; 00350 rwlock_t lock; 00351 rsbac_boolean_t dirty; 00352 u_int count; 00353 rsbac_boolean_t no_write; 00354 }; 00355 00356 00357 /* List of defined transformation procedures */ 00358 00359 struct rsbac_pm_tp_list_item_t 00360 { 00361 struct rsbac_pm_tp_data_t data; 00362 struct rsbac_pm_tp_list_item_t * prev; 00363 struct rsbac_pm_tp_list_item_t * next; 00364 }; 00365 00366 struct rsbac_pm_tp_list_head_t 00367 { 00368 struct rsbac_pm_tp_list_item_t * head; 00369 struct rsbac_pm_tp_list_item_t * tail; 00370 struct rsbac_pm_tp_list_item_t * curr; 00371 rwlock_t lock; 00372 rsbac_boolean_t dirty; 00373 u_int count; 00374 rsbac_boolean_t no_write; 00375 }; 00376 00377 00378 /* List of defined purposes */ 00379 00380 struct rsbac_pm_pp_list_item_t 00381 { 00382 struct rsbac_pm_pp_data_t data; 00383 struct rsbac_pm_pp_list_item_t * prev; 00384 struct rsbac_pm_pp_list_item_t * next; 00385 }; 00386 00387 struct rsbac_pm_pp_list_head_t 00388 { 00389 struct rsbac_pm_pp_list_item_t * head; 00390 struct rsbac_pm_pp_list_item_t * tail; 00391 struct rsbac_pm_pp_list_item_t * curr; 00392 rwlock_t lock; 00393 rsbac_boolean_t dirty; 00394 u_int count; 00395 rsbac_boolean_t no_write; 00396 }; 00397 00398 00399 /* List of valid tickets for PM administration calls */ 00400 /* rsbac_pm_tkt_data_t is defined in pm_types.h! */ 00401 00402 struct rsbac_pm_tkt_list_item_t 00403 { 00404 struct rsbac_pm_tkt_data_t data; 00405 struct rsbac_pm_tkt_list_item_t * prev; 00406 struct rsbac_pm_tkt_list_item_t * next; 00407 }; 00408 00409 struct rsbac_pm_tkt_list_head_t 00410 { 00411 struct rsbac_pm_tkt_list_item_t * head; 00412 struct rsbac_pm_tkt_list_item_t * tail; 00413 struct rsbac_pm_tkt_list_item_t * curr; 00414 rwlock_t lock; 00415 rsbac_boolean_t dirty; 00416 u_int count; 00417 rsbac_boolean_t no_write; 00418 }; 00419 00420 #endif