00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __RSBAC_LISTS_H
00011 #define __RSBAC_LISTS_H
00012
00013 #include <linux/init.h>
00014 #include <linux/vmalloc.h>
00015
00016 #include <rsbac/rkmem.h>
00017
00018 #define RSBAC_LIST_VERSION 3
00019
00020 typedef void * rsbac_list_handle_t;
00021 typedef __u32 rsbac_list_key_t;
00022
00023
00024 #define RSBAC_LIST_MAX_FILENAME 15
00025
00026
00027 #define RSBAC_LIST_MAX_AGE_LIMIT (3600 * 24 * 366 * 10)
00028
00029
00030 #define RSBAC_LIST_MAX_ITEM_SIZE (RSBAC_MAX_KMALLOC - 64)
00031
00032
00033
00034
00035
00036 #define RSBAC_LIST_PERSIST 1
00037
00038
00039 #define RSBAC_LIST_IGNORE_OLD 2
00040
00041
00042
00043
00044
00045 #define RSBAC_LIST_IGNORE_UNSUPP_VERSION 4
00046
00047
00048 #define RSBAC_LIST_NO_WRITE 8
00049
00050
00051 #define RSBAC_LIST_BACKUP 16
00052
00053
00054
00055
00056
00057 #define RSBAC_LIST_DEF_DATA 32
00058
00059
00060
00061
00062 #define RSBAC_LIST_DEF_SUBDATA 64
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 typedef int rsbac_list_compare_function_t(void * desc1, void * desc2);
00074
00075
00076 int rsbac_list_compare_u32(void * desc1, void * desc2);
00077
00078
00079
00080
00081
00082
00083
00084 typedef int rsbac_list_data_compare_function_t(void * data1, void * data2);
00085
00086
00087
00088
00089 typedef int rsbac_list_conv_function_t(
00090 void * old_desc,
00091 void * old_data,
00092 void * new_desc,
00093 void * new_data);
00094
00095
00096
00097
00098 typedef rsbac_list_conv_function_t * rsbac_list_get_conv_t(rsbac_version_t old_version);
00099
00100
00101 rsbac_version_t rsbac_list_version(void);
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 struct rsbac_list_info_t
00122 {
00123 rsbac_version_t version;
00124 rsbac_list_key_t key;
00125 __u32 desc_size;
00126 __u32 data_size;
00127 rsbac_time_t max_age;
00128 };
00129
00130 struct rsbac_list_lol_info_t
00131 {
00132 rsbac_version_t version;
00133 rsbac_list_key_t key;
00134 __u32 desc_size;
00135 __u32 data_size;
00136 __u32 subdesc_size;
00137 __u32 subdata_size;
00138 rsbac_time_t max_age;
00139 };
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 int rsbac_list_register(
00173 rsbac_version_t ds_version,
00174 rsbac_list_handle_t *handle_p,
00175 struct rsbac_list_info_t * info_p,
00176 u_int flags,
00177 rsbac_list_compare_function_t * compare,
00178 rsbac_list_get_conv_t * get_conv,
00179 void * def_data,
00180 char * name,
00181 kdev_t device);
00182
00183 int rsbac_list_lol_register(
00184 rsbac_version_t ds_version,
00185 rsbac_list_handle_t *handle_p,
00186 struct rsbac_list_lol_info_t * info_p,
00187 u_int flags,
00188 rsbac_list_compare_function_t * compare,
00189 rsbac_list_compare_function_t * subcompare,
00190 rsbac_list_get_conv_t * get_conv,
00191 rsbac_list_get_conv_t * get_subconv,
00192 void * def_data,
00193 void * def_subdata,
00194 char * name,
00195 kdev_t device);
00196
00197
00198
00199
00200 int rsbac_list_destroy(rsbac_list_handle_t * handle_p, rsbac_list_key_t key);
00201
00202 int rsbac_list_lol_destroy(rsbac_list_handle_t * handle_p, rsbac_list_key_t key);
00203
00204
00205
00206 int rsbac_list_detach(rsbac_list_handle_t * handle_p, rsbac_list_key_t key);
00207
00208 int rsbac_list_lol_detach(rsbac_list_handle_t * handle_p, rsbac_list_key_t key);
00209
00210
00211
00212 int rsbac_list_no_write
00213 (rsbac_list_handle_t handle, rsbac_list_key_t key, rsbac_boolean_t no_write);
00214
00215 int rsbac_list_lol_no_write
00216 (rsbac_list_handle_t handle, rsbac_list_key_t key, rsbac_boolean_t no_write);
00217
00218
00219
00220
00221 int rsbac_list_check(
00222 rsbac_list_handle_t handle,
00223 int correct);
00224
00225 int rsbac_list_lol_check(
00226 rsbac_list_handle_t handle,
00227 int correct);
00228
00229
00230 #ifdef CONFIG_RSBAC_LIST_TRANS
00231 int rsbac_list_ta_begin(
00232 rsbac_time_t ttl,
00233 rsbac_list_ta_number_t * ta_number_p,
00234 rsbac_uid_t commit_uid,
00235 char * password);
00236
00237 int rsbac_list_ta_refresh(
00238 rsbac_time_t ttl,
00239 rsbac_list_ta_number_t ta_number,
00240 char * password);
00241
00242 int rsbac_list_ta_commit(rsbac_list_ta_number_t ta_number,
00243 char * password);
00244
00245 int rsbac_list_ta_forget(rsbac_list_ta_number_t ta_number,
00246 char * password);
00247 #endif
00248
00249
00250
00251
00252 int rsbac_list_add(rsbac_list_handle_t handle, void * desc, void * data);
00253
00254
00255
00256 int rsbac_ta_list_add_ttl(
00257 rsbac_list_ta_number_t ta_number,
00258 rsbac_list_handle_t handle,
00259 rsbac_time_t ttl,
00260 void * desc,
00261 void * data);
00262
00263 int rsbac_list_add_ttl(
00264 rsbac_list_handle_t handle,
00265 rsbac_time_t ttl,
00266 void * desc,
00267 void * data);
00268
00269
00270 int rsbac_ta_list_lol_subadd_ttl(
00271 rsbac_list_ta_number_t ta_number,
00272 rsbac_list_handle_t handle,
00273 rsbac_time_t ttl,
00274 void * desc,
00275 void * subdesc,
00276 void * subdata);
00277
00278 int rsbac_list_lol_subadd(
00279 rsbac_list_handle_t handle,
00280 void * desc,
00281 void * subdesc,
00282 void * subdata);
00283
00284
00285 int rsbac_list_lol_subadd_ttl(
00286 rsbac_list_handle_t handle,
00287 rsbac_time_t ttl,
00288 void * desc,
00289 void * subdesc,
00290 void * subdata);
00291
00292
00293 int rsbac_list_lol_add(
00294 rsbac_list_handle_t handle,
00295 void * desc,
00296 void * data);
00297
00298
00299 int rsbac_ta_list_lol_add_ttl(
00300 rsbac_list_ta_number_t ta_number,
00301 rsbac_list_handle_t handle,
00302 rsbac_time_t ttl,
00303 void * desc,
00304 void * data);
00305
00306 int rsbac_list_lol_add_ttl(
00307 rsbac_list_handle_t handle,
00308 rsbac_time_t ttl,
00309 void * desc,
00310 void * data);
00311
00312
00313 int rsbac_ta_list_remove(
00314 rsbac_list_ta_number_t ta_number,
00315 rsbac_list_handle_t handle,
00316 void * desc);
00317
00318 int rsbac_list_remove(rsbac_list_handle_t handle, void * desc);
00319
00320
00321 int rsbac_ta_list_remove_all(rsbac_list_ta_number_t ta_number, rsbac_list_handle_t handle);
00322
00323 int rsbac_list_remove_all(rsbac_list_handle_t handle);
00324
00325
00326 int rsbac_ta_list_lol_subremove(
00327 rsbac_list_ta_number_t ta_number,
00328 rsbac_list_handle_t handle,
00329 void * desc,
00330 void * subdesc);
00331
00332 int rsbac_list_lol_subremove(
00333 rsbac_list_handle_t handle,
00334 void * desc,
00335 void * subdesc);
00336
00337
00338 int rsbac_ta_list_lol_subremove_from_all(
00339 rsbac_list_ta_number_t ta_number,
00340 rsbac_list_handle_t handle,
00341 void * subdesc);
00342
00343 int rsbac_list_lol_subremove_from_all(
00344 rsbac_list_handle_t handle,
00345 void * subdesc);
00346
00347
00348 int rsbac_ta_list_lol_subremove_all(
00349 rsbac_list_ta_number_t ta_number,
00350 rsbac_list_handle_t handle,
00351 void * desc);
00352
00353 int rsbac_list_lol_subremove_all(rsbac_list_handle_t handle, void * desc);
00354
00355 int rsbac_ta_list_lol_remove(
00356 rsbac_list_ta_number_t ta_number,
00357 rsbac_list_handle_t handle,
00358 void * desc);
00359
00360 int rsbac_list_lol_remove(
00361 rsbac_list_handle_t handle,
00362 void * desc);
00363
00364 int rsbac_ta_list_lol_remove_all(
00365 rsbac_list_ta_number_t ta_number,
00366 rsbac_list_handle_t handle);
00367
00368 int rsbac_list_lol_remove_all(rsbac_list_handle_t handle);
00369
00370
00371
00372
00373
00374 int rsbac_list_get_data(rsbac_list_handle_t handle, void * desc, void * data);
00375
00376
00377
00378 int rsbac_ta_list_get_data_ttl(
00379 rsbac_list_ta_number_t ta_number,
00380 rsbac_list_handle_t handle,
00381 rsbac_time_t * ttl_p,
00382 void * desc,
00383 void * data);
00384
00385 int rsbac_list_get_data_ttl(rsbac_list_handle_t handle,
00386 rsbac_time_t * ttl_p,
00387 void * desc,
00388 void * data);
00389
00390
00391 int rsbac_list_lol_get_subdata(
00392 rsbac_list_handle_t handle,
00393 void * desc,
00394 void * subdesc,
00395 void * subdata);
00396
00397
00398
00399 int rsbac_ta_list_lol_get_subdata_ttl(
00400 rsbac_list_ta_number_t ta_number,
00401 rsbac_list_handle_t handle,
00402 rsbac_time_t * ttl_p,
00403 void * desc,
00404 void * subdesc,
00405 void * subdata);
00406
00407 int rsbac_list_lol_get_subdata_ttl(
00408 rsbac_list_handle_t handle,
00409 rsbac_time_t * ttl_p,
00410 void * desc,
00411 void * subdesc,
00412 void * subdata);
00413
00414 int rsbac_list_lol_get_data(rsbac_list_handle_t handle, void * desc, void * data);
00415
00416
00417
00418 int rsbac_ta_list_lol_get_data_ttl(
00419 rsbac_list_ta_number_t ta_number,
00420 rsbac_list_handle_t handle,
00421 rsbac_time_t * ttl_p,
00422 void * desc,
00423 void * data);
00424
00425 int rsbac_list_lol_get_data_ttl(rsbac_list_handle_t handle,
00426 rsbac_time_t * ttl_p,
00427 void * desc,
00428 void * data);
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438 int rsbac_ta_list_get_desc(
00439 rsbac_list_ta_number_t ta_number,
00440 rsbac_list_handle_t handle,
00441 void * desc,
00442 void * data,
00443 rsbac_list_data_compare_function_t compare);
00444
00445 int rsbac_list_get_desc(rsbac_list_handle_t handle,
00446 void * desc,
00447 void * data,
00448 rsbac_list_data_compare_function_t compare);
00449
00450 int rsbac_ta_list_lol_get_desc(
00451 rsbac_list_ta_number_t ta_number,
00452 rsbac_list_handle_t handle,
00453 void * desc,
00454 void * data,
00455 rsbac_list_data_compare_function_t compare);
00456
00457 int rsbac_list_lol_get_desc(rsbac_list_handle_t handle,
00458 void * desc,
00459 void * data,
00460 rsbac_list_data_compare_function_t compare);
00461
00462
00463 int rsbac_ta_list_get_max_desc(
00464 rsbac_list_ta_number_t ta_number,
00465 rsbac_list_handle_t handle,
00466 void * desc);
00467
00468 int rsbac_list_get_max_desc(rsbac_list_handle_t handle, void * desc);
00469
00470
00471 int rsbac_ta_list_get_next_desc(
00472 rsbac_list_ta_number_t ta_number,
00473 rsbac_list_handle_t handle,
00474 void * old_desc,
00475 void * next_desc);
00476
00477 int rsbac_list_get_next_desc(rsbac_list_handle_t handle, void * old_desc, void * next_desc);
00478
00479 int rsbac_ta_list_lol_get_next_desc(
00480 rsbac_list_ta_number_t ta_number,
00481 rsbac_list_handle_t handle,
00482 void * old_desc,
00483 void * next_desc);
00484
00485 int rsbac_list_lol_get_next_desc(rsbac_list_handle_t handle, void * old_desc, void * next_desc);
00486
00487
00488
00489 int rsbac_ta_list_exist(
00490 rsbac_list_ta_number_t ta_number,
00491 rsbac_list_handle_t handle,
00492 void * desc);
00493
00494 int rsbac_list_exist(rsbac_list_handle_t handle, void * desc);
00495
00496 int rsbac_ta_list_lol_subexist(
00497 rsbac_list_ta_number_t ta_number,
00498 rsbac_list_handle_t handle,
00499 void * desc,
00500 void * subdesc);
00501
00502 int rsbac_list_lol_subexist(
00503 rsbac_list_handle_t handle,
00504 void * desc,
00505 void * subdesc);
00506
00507 int rsbac_ta_list_lol_exist(
00508 rsbac_list_ta_number_t ta_number,
00509 rsbac_list_handle_t handle,
00510 void * desc);
00511
00512 int rsbac_list_lol_exist(
00513 rsbac_list_handle_t handle,
00514 void * desc);
00515
00516
00517
00518
00519
00520
00521
00522 int rsbac_ta_list_lol_subexist_compare(
00523 rsbac_list_ta_number_t ta_number,
00524 rsbac_list_handle_t handle,
00525 void * desc,
00526 void * subdesc,
00527 rsbac_list_compare_function_t compare);
00528
00529 int rsbac_list_lol_subexist_compare(
00530 rsbac_list_handle_t handle,
00531 void * desc,
00532 void * subdesc,
00533 rsbac_list_compare_function_t compare);
00534
00535
00536
00537 long rsbac_ta_list_count(
00538 rsbac_list_ta_number_t ta_number,
00539 rsbac_list_handle_t handle);
00540
00541 long rsbac_list_count(rsbac_list_handle_t handle);
00542
00543 long rsbac_ta_list_lol_subcount(
00544 rsbac_list_ta_number_t ta_number,
00545 rsbac_list_handle_t handle,
00546 void * desc);
00547
00548 long rsbac_list_lol_subcount(rsbac_list_handle_t handle, void * desc);
00549
00550 long rsbac_ta_list_lol_all_subcount(
00551 rsbac_list_ta_number_t ta_number,
00552 rsbac_list_handle_t handle);
00553
00554 long rsbac_list_lol_all_subcount(rsbac_list_handle_t handle);
00555
00556 long rsbac_ta_list_lol_count(
00557 rsbac_list_ta_number_t ta_number,
00558 rsbac_list_handle_t handle);
00559
00560 long rsbac_list_lol_count(rsbac_list_handle_t handle);
00561
00562
00563
00564
00565
00566
00567
00568
00569 long rsbac_ta_list_get_all_desc(
00570 rsbac_list_ta_number_t ta_number,
00571 rsbac_list_handle_t handle,
00572 void ** array_p);
00573
00574 long rsbac_list_get_all_desc(rsbac_list_handle_t handle, void ** array_p);
00575
00576 long rsbac_list_lol_get_all_subdesc(rsbac_list_handle_t handle, void * desc, void ** array_p);
00577
00578 long rsbac_ta_list_lol_get_all_subdesc_ttl(
00579 rsbac_list_ta_number_t ta_number,
00580 rsbac_list_handle_t handle,
00581 void * desc,
00582 void ** array_p,
00583 rsbac_time_t ** ttl_array_p);
00584
00585 long rsbac_list_lol_get_all_subdesc_ttl(rsbac_list_handle_t handle,
00586 void * desc,
00587 void ** array_p,
00588 rsbac_time_t ** ttl_array_p);
00589
00590 long rsbac_ta_list_lol_get_all_desc(
00591 rsbac_list_ta_number_t ta_number,
00592 rsbac_list_handle_t handle,
00593 void ** array_p);
00594
00595 long rsbac_list_lol_get_all_desc(rsbac_list_handle_t handle, void ** array_p);
00596
00597
00598
00599
00600
00601
00602
00603
00604 long rsbac_ta_list_get_all_data(
00605 rsbac_list_ta_number_t ta_number,
00606 rsbac_list_handle_t handle,
00607 void ** array_p);
00608
00609 long rsbac_list_get_all_data(rsbac_list_handle_t handle, void ** array_p);
00610
00611 long rsbac_ta_list_lol_get_all_subdata(
00612 rsbac_list_ta_number_t ta_number,
00613 rsbac_list_handle_t handle,
00614 void * desc,
00615 void ** array_p);
00616
00617 long rsbac_list_lol_get_all_subdata(rsbac_list_handle_t handle, void * desc, void ** array_p);
00618
00619 long rsbac_ta_list_lol_get_all_data(
00620 rsbac_list_ta_number_t ta_number,
00621 rsbac_list_handle_t handle,
00622 void ** array_p);
00623
00624 long rsbac_list_lol_get_all_data(rsbac_list_handle_t handle, void ** array_p);
00625
00626
00627
00628
00629 int rsbac_list_get_item_size(rsbac_list_handle_t handle);
00630
00631 int rsbac_list_lol_get_subitem_size(rsbac_list_handle_t handle);
00632
00633 int rsbac_list_lol_get_item_size(rsbac_list_handle_t handle);
00634
00635
00636
00637
00638
00639
00640
00641 long rsbac_list_get_all_items(rsbac_list_handle_t handle, void ** array_p);
00642
00643 long rsbac_ta_list_get_all_items_ttl(
00644 rsbac_list_ta_number_t ta_number,
00645 rsbac_list_handle_t handle,
00646 void ** array_p,
00647 rsbac_time_t ** ttl_array_p);
00648
00649 long rsbac_list_get_all_items_ttl(rsbac_list_handle_t handle,
00650 void ** array_p,
00651 rsbac_time_t ** ttl_array_p);
00652
00653 long rsbac_list_lol_get_all_subitems(rsbac_list_handle_t handle, void * desc, void ** array_p);
00654
00655 long rsbac_ta_list_lol_get_all_subitems_ttl(
00656 rsbac_list_ta_number_t ta_number,
00657 rsbac_list_handle_t handle,
00658 void * desc,
00659 void ** array_p,
00660 rsbac_time_t ** ttl_array_p);
00661
00662 long rsbac_list_lol_get_all_subitems_ttl(rsbac_list_handle_t handle,
00663 void * desc,
00664 void ** array_p,
00665 rsbac_time_t ** ttl_array_p);
00666
00667 long rsbac_ta_list_lol_get_all_items(
00668 rsbac_list_ta_number_t ta_number,
00669 rsbac_list_handle_t handle,
00670 void ** array_p);
00671
00672 long rsbac_list_lol_get_all_items(rsbac_list_handle_t handle, void ** array_p);
00673
00674
00675 #endif
00676