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
#include <rsbac/types.h>
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,
boolean no_write);
00214
00215
int rsbac_list_lol_no_write
00216 (
rsbac_list_handle_t handle,
rsbac_list_key_t key,
boolean 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
00231
00232
int rsbac_list_add(rsbac_list_handle_t handle,
void * desc,
void * data);
00233
00234
00235
int rsbac_list_add_u32(rsbac_list_handle_t handle, __u32 desc,
void * data);
00236
00237
00238
00239
int rsbac_list_add_ttl(
00240 rsbac_list_handle_t handle,
00241
rsbac_time_t ttl,
00242
void * desc,
00243
void * data);
00244
00245
int rsbac_list_add_ttl_u32(rsbac_list_handle_t handle,
00246
rsbac_time_t ttl,
00247 __u32 desc,
00248
void * data);
00249
00250
00251
int rsbac_list_lol_subadd(
00252 rsbac_list_handle_t handle,
00253
void * desc,
00254
void * subdesc,
00255
void * subdata);
00256
00257
int rsbac_list_lol_subadd_u32(rsbac_list_handle_t handle,
00258 __u32 desc,
00259 __u32 subdesc,
00260
void * subdata);
00261
00262
00263
int rsbac_list_lol_subadd_ttl(
00264 rsbac_list_handle_t handle,
00265
rsbac_time_t ttl,
00266
void * desc,
00267
void * subdesc,
00268
void * subdata);
00269
00270
int rsbac_list_lol_subadd_ttl_u32(rsbac_list_handle_t handle,
00271
rsbac_time_t ttl,
00272 __u32 desc,
00273 __u32 subdesc,
00274
void * subdata);
00275
00276
00277
int rsbac_list_lol_add(
00278 rsbac_list_handle_t handle,
00279
void * desc,
00280
void * data);
00281
00282
int rsbac_list_lol_add_u32(rsbac_list_handle_t handle, __u32 desc,
void * data);
00283
00284
00285
int rsbac_list_lol_add_ttl(
00286 rsbac_list_handle_t handle,
00287
rsbac_time_t ttl,
00288
void * desc,
00289
void * data);
00290
00291
int rsbac_list_lol_add_ttl_u32(rsbac_list_handle_t handle,
00292
rsbac_time_t ttl,
00293 __u32 desc,
00294
void * data);
00295
00296
00297
00298
int rsbac_list_remove(rsbac_list_handle_t handle,
void * desc);
00299
00300
00301
int rsbac_list_remove_u32(rsbac_list_handle_t handle, __u32 desc);
00302
00303
00304
00305
int rsbac_list_remove_all(rsbac_list_handle_t handle);
00306
00307
00308
int rsbac_list_lol_subremove(
00309 rsbac_list_handle_t handle,
00310
void * desc,
00311
void * subdesc);
00312
00313
int rsbac_list_lol_subremove_u32(rsbac_list_handle_t handle, __u32 desc, __u32 subdesc);
00314
00315
00316
int rsbac_list_lol_subremove_from_all(
00317 rsbac_list_handle_t handle,
00318
void * subdesc);
00319
00320
int rsbac_list_lol_subremove_from_all_u32(rsbac_list_handle_t handle, __u32 subdesc);
00321
00322
00323
int rsbac_list_lol_subremove_all(rsbac_list_handle_t handle,
void * desc);
00324
00325
int rsbac_list_lol_subremove_all_u32(rsbac_list_handle_t handle, __u32 desc);
00326
00327
int rsbac_list_lol_remove(
00328 rsbac_list_handle_t handle,
00329
void * desc);
00330
00331
int rsbac_list_lol_remove_u32(rsbac_list_handle_t handle, __u32 desc);
00332
00333
int rsbac_list_lol_remove_all(rsbac_list_handle_t handle);
00334
00335
00336
00337
00338
00339
int rsbac_list_get_data(rsbac_list_handle_t handle,
void * desc,
void * data);
00340
00341
00342
int rsbac_list_get_data_u32(rsbac_list_handle_t handle, __u32 desc,
void * data);
00343
00344
00345
00346
int rsbac_list_get_data_ttl(rsbac_list_handle_t handle,
00347
rsbac_time_t * ttl_p,
00348
void * desc,
00349
void * data);
00350
00351
int rsbac_list_get_data_ttl_u32(rsbac_list_handle_t handle,
00352
rsbac_time_t * ttl_p,
00353 __u32 desc,
00354
void * data);
00355
00356
00357
int rsbac_list_lol_get_subdata(
00358 rsbac_list_handle_t handle,
00359
void * desc,
00360
void * subdesc,
00361
void * subdata);
00362
00363
int rsbac_list_lol_get_subdata_u32(
00364 rsbac_list_handle_t handle,
00365 __u32 desc,
00366 __u32 subdesc,
00367
void * data);
00368
00369
00370
00371
int rsbac_list_lol_get_subdata_ttl(
00372 rsbac_list_handle_t handle,
00373
rsbac_time_t * ttl_p,
00374
void * desc,
00375
void * subdesc,
00376
void * subdata);
00377
00378
int rsbac_list_lol_get_subdata_ttl_u32(rsbac_list_handle_t handle,
00379
rsbac_time_t * ttl_p,
00380 __u32 desc,
00381 __u32 subdesc,
00382
void * data);
00383
00384
00385
int rsbac_list_lol_get_data(rsbac_list_handle_t handle,
void * desc,
void * data);
00386
00387
int rsbac_list_lol_get_data_u32(rsbac_list_handle_t handle, __u32 desc,
void * data);
00388
00389
00390
00391
int rsbac_list_lol_get_data_ttl(rsbac_list_handle_t handle,
00392
rsbac_time_t * ttl_p,
00393
void * desc,
00394
void * data);
00395
00396
int rsbac_list_lol_get_data_ttl_u32(rsbac_list_handle_t handle,
00397
rsbac_time_t * ttl_p,
00398 __u32 desc,
00399
void * data);
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
int rsbac_list_get_desc(rsbac_list_handle_t handle,
00411
void * desc,
00412
void * data,
00413
rsbac_list_data_compare_function_t compare);
00414
00415
00416
int rsbac_list_get_desc_u32(rsbac_list_handle_t handle,
void * desc, __u32 data);
00417
00418
00419
int rsbac_list_get_max_desc(rsbac_list_handle_t handle,
void * desc);
00420
00421
00422
00423
int rsbac_list_exist(rsbac_list_handle_t handle,
void * desc);
00424
00425
00426
int rsbac_list_exist_u32(rsbac_list_handle_t handle, __u32 desc);
00427
00428
int rsbac_list_lol_subexist(
00429 rsbac_list_handle_t handle,
00430
void * desc,
00431
void * subdesc);
00432
00433
int rsbac_list_lol_subexist_u32(rsbac_list_handle_t handle, __u32 desc, __u32 subdesc);
00434
00435
int rsbac_list_lol_exist(
00436 rsbac_list_handle_t handle,
00437
void * desc);
00438
00439
int rsbac_list_lol_exist_u32(rsbac_list_handle_t handle, __u32 desc);
00440
00441
00442
00443
00444
00445
00446
00447
int rsbac_list_lol_subexist_compare(
00448 rsbac_list_handle_t handle,
00449
void * desc,
00450
void * subdesc,
00451
rsbac_list_compare_function_t compare);
00452
00453
int rsbac_list_lol_subexist_compare_u32(rsbac_list_handle_t handle,
00454 __u32 desc,
00455 __u32 subdesc,
00456
rsbac_list_compare_function_t compare);
00457
00458
00459
00460
00461
long rsbac_list_count(rsbac_list_handle_t handle);
00462
00463
long rsbac_list_lol_subcount(rsbac_list_handle_t handle,
void * desc);
00464
00465
long rsbac_list_lol_all_subcount(rsbac_list_handle_t handle);
00466
00467
long rsbac_list_lol_count(rsbac_list_handle_t handle);
00468
00469
00470
00471
00472
00473
00474
00475
00476
long rsbac_list_get_all_desc(rsbac_list_handle_t handle,
void ** array_p);
00477
00478
long rsbac_list_lol_get_all_subdesc(rsbac_list_handle_t handle,
void * desc,
void ** array_p);
00479
00480
long rsbac_list_lol_get_all_subdesc_ttl(rsbac_list_handle_t handle,
00481
void * desc,
00482
void ** array_p,
00483
rsbac_time_t ** ttl_array_p);
00484
00485
long rsbac_list_lol_get_all_desc(rsbac_list_handle_t handle,
void ** array_p);
00486
00487
00488
00489
00490
00491
00492
00493
00494
long rsbac_list_get_all_data(rsbac_list_handle_t handle,
void ** array_p);
00495
00496
long rsbac_list_lol_get_all_subdata(rsbac_list_handle_t handle,
void * desc,
void ** array_p);
00497
00498
long rsbac_list_lol_get_all_data(rsbac_list_handle_t handle,
void ** array_p);
00499
00500
00501
00502
00503
int rsbac_list_get_item_size(rsbac_list_handle_t handle);
00504
00505
int rsbac_list_lol_get_subitem_size(rsbac_list_handle_t handle);
00506
00507
int rsbac_list_lol_get_item_size(rsbac_list_handle_t handle);
00508
00509
00510
00511
00512
00513
00514
00515
long rsbac_list_get_all_items(rsbac_list_handle_t handle,
void ** array_p);
00516
00517
long rsbac_list_get_all_items_ttl(rsbac_list_handle_t handle,
00518
void ** array_p,
00519
rsbac_time_t ** ttl_array_p);
00520
00521
long rsbac_list_lol_get_all_subitems(rsbac_list_handle_t handle,
void * desc,
void ** array_p);
00522
00523
long rsbac_list_lol_get_all_subitems_ttl(rsbac_list_handle_t handle,
00524
void * desc,
00525
void ** array_p,
00526
rsbac_time_t ** ttl_array_p);
00527
00528
long rsbac_list_lol_get_all_items(rsbac_list_handle_t handle,
void ** array_p);
00529
00530
00531
#endif
00532