00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00025 #ifndef MFAUDIT_H
00026 #define MFAUDIT_H
00027
00028 #include "mfctf.h"
00029
00030 struct audit_record;
00031 struct audit_record_t;
00032 struct audit_event;
00033 struct audit_event_t;
00034 struct audit_emitter_event;
00035
00036
00037
00038
00039 typedef cobrtncode_t (*PFI_COBAUD_EVENT)(cobuns32_t flags_p,
00040 const cobuns8_t *component_id_p,
00041 struct audit_event *audit_event_p);
00042
00043 typedef cobrtncode_t (*PFI_COBAUD_FILE_READ)(
00044 cobuns32_t flags_p,
00045 cbl_os_pointer_t auditfile_handle,
00046 struct audit_record *auditfile_record);
00047
00048 typedef cobrtncode_t (*PFI_AUD_CONFIG_PROPERTY_GET)(
00049 cobuns32_t flags_p,
00050 const cobuns8_t *property_name_p,
00051 cbl_x4_comp5_t *property_vallen_p,
00052 cobuns8_t *property_value_p);
00053
00054 typedef cobrtncode_t (*PFI_AUD_CONFIG_PROPERTY_SET)(
00055 cobuns32_t flags_p,
00056 const cobuns8_t *property_name_p,
00057 const cobuns8_t *property_value_p);
00058
00059 typedef cobrtncode_t (*PFI_AUD_EMITTER_PROPERTY_GET)(
00060 cobuns32_t flags_p,
00061 const cobuns8_t *emitter_name_p,
00062 const cobuns8_t *property_name_p,
00063 cbl_x4_comp5_t *property_vallen_p,
00064 cobuns8_t *property_value_p);
00065
00066 typedef cobrtncode_t (*PFI_AUD_EMITTER_PROPERTY_SET)(
00067 cobuns32_t flags_p,
00068 const cobuns8_t *emitter_name_p,
00069 const cobuns8_t *property_name_p,
00070 const cobuns8_t *property_value_p);
00071
00072 typedef cobrtncode_t (*PFI_AUD_EVENT)(cobuns32_t flags_p,
00073 const cobuns8_t *component_id_p,
00074 struct audit_event_t *audit_event_p);
00075
00076 typedef cobrtncode_t (*PFI_AUD_HANDLE_GET)(cobuns32_t flags_p,
00077 const cobuns8_t *component_name_p,
00078 cbl_x4_comp5_t *audit_handle_p);
00079
00080 typedef cobrtncode_t (*PFI_AUD_FILE_CLOSE)(cobuns32_t flags_p,
00081 cbl_os_pointer_t auditfile_handle);
00082
00083 typedef cobrtncode_t (*PFI_AUD_FILE_OPEN)(cobuns32_t flags_p,
00084 cbl_pointer_t *auditfile_handle_p,
00085 const cobuns8_t *auditfile_name_p);
00086
00087 typedef cobrtncode_t (*PFI_AUD_FILE_READ)(
00088 cobuns32_t flags_p,
00089 cbl_os_pointer_t auditfile_handle,
00090 struct audit_record_t *auditfile_record);
00091
00092
00093 typedef int (*PFI_AUD_EMITTER_DEINIT)(cobuns32_t flags,
00094 void *emitter_data);
00095
00096 typedef int (*PFI_AUD_EMITTER_INIT)(cobuns32_t flags,
00097 const cobuns8_t *emitter_name,
00098 struct audit_emitter_event *emitter_event,
00099 void **emitter_data);
00100
00101 typedef void (*PFV_AUD_EMITTER_NOTIFY)(cobuns32_t notif_type,
00102 void *notif_buf,
00103 void *emitter_data);
00104
00105 typedef int (*PFI_AUD_EMITTER_OUTPUT)
00106 (cobuns32_t flags,
00107 struct audit_emitter_event *emitter_event,
00108 void *emitter_data);
00109
00110 typedef int (*PFI_AUD_RESERVED)(void);
00111
00112
00113
00114
00115
00116
00117
00118
00119 typedef cobrtncode_t (*PFI_AUDITFILE_EMITTER_EXIT)(cobuns32_t function,
00120 cobuns8_t *emitter_name,
00121 ...);
00122
00123
00124
00125
00126 #define AUDITFILE_EXIT_NAME "AUDITFILE_EMITTER_EXIT"
00127
00128
00129
00130
00131 #define AUDITFILE_EXIT_FUNC_INIT 0
00132 #define AUDITFILE_EXIT_FUNC_DEINIT 1
00133 #define AUDITFILE_EXIT_FUNC_FILE_ACTIVE 2
00134 #define AUDITFILE_EXIT_FUNC_FILE_FULL 3
00135 #define AUDITFILE_EXIT_FUNC_NO_FILES 4
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 #define AUDIT_FLAG_PROP_STRING_VALUE 0x00000000
00150 #define AUDIT_FLAG_PROP_INT_VALUE 0x00000001
00151 #define AUDIT_FLAG_PROP_NULL_TERM 0x00000002
00152
00153
00154
00155
00156
00157
00158 #define AUDIT_FLAG_CLOSE_ALL 0x00000000
00159 #define AUDIT_FLAG_CLOSE_CURRENT 0x00000001
00160 #define AUDIT_FLAG_CLOSE_DUMPED 0x00000002
00161
00162
00163
00164
00165
00166
00167 #define AUDIT_FLAG_OPEN_FILE 0x00000000
00168 #define AUDIT_FLAG_OPEN_COLLECTION 0x00000001
00169 #define AUDIT_FLAG_OPEN_NAME_NULL_TERM 0x00000002
00170
00171
00172
00173
00174
00175
00176 #define AUDIT_FLAG_EVENT_ARRAY_DATA 0x00002000
00177
00178
00179
00180
00181
00182
00183
00184 #define AUDIT_FLAG_EMITTER_NAME_NULL_TERM 0x10000000
00185
00186
00187
00188
00189
00190
00191
00192 #define AUDIT_FLAG_PROP_NAME_NULL_TERM 0x20000000
00193
00194
00195
00196
00197
00198
00199
00200 #define AUDIT_FLAG_COMP_NAME_NULL_TERM 0x40000000
00201
00202
00203
00204
00205
00206
00207 #define AUDIT_FLAG_COMPID_STRING 0x80000000
00208
00209
00210
00211
00212 #define AUDIT_EVENT_CATEGORY_UNKNOWN 0
00213 #define AUDIT_EVENT_CATEGORY_AUDIT_FACILITY 1
00214 #define AUDIT_EVENT_CATEGORY_SYSTEM 2
00215 #define AUDIT_EVENT_CATEGORY_SEC_API_REQ_CHECK 3
00216 #define AUDIT_EVENT_CATEGORY_SEC_API_REQ_DEFINE 4
00217 #define AUDIT_EVENT_CATEGORY_SEC_API_REQ_OTHER 5
00218 #define AUDIT_EVENT_CATEGORY_SEC_API_RES_ALLOW 6
00219 #define AUDIT_EVENT_CATEGORY_SEC_API_RES_DENY 7
00220 #define AUDIT_EVENT_CATEGORY_SEC_API_RES_ERROR 8
00221 #define AUDIT_EVENT_CATEGORY_SEC_API_RES_SUCCESS 9
00222
00223
00224
00225
00226 #define AUDIT_RET_SUCCESS CTF_RET_SUCCESS
00227 #define AUDIT_RET_FAILURE CTF_RET_FAILURE
00228 #define AUDIT_RET_INVALID_HANDLE CTF_RET_INVALID_TRACE_HANDLE
00229 #define AUDIT_RET_INVALID_AUDIT_CATEGORY 4
00230 #define AUDIT_RET_NOT_ENOUGH_MEMORY CTF_RET_NOT_ENOUGH_MEMORY
00231 #define AUDIT_RET_OUTPUT_ERROR CTF_RET_OUTPUT_ERROR
00232 #define AUDIT_RET_PROPERTY_NOT_FOUND CTF_RET_PROPERTY_NOT_FOUND
00233 #define AUDIT_RET_BUFFER_TOO_SMALL CTF_RET_BUFFER_TOO_SMALL
00234 #define AUDIT_RET_VALUE_NOT_INTEGER CTF_RET_VALUE_NOT_INTEGER
00235 #define AUDIT_RET_EMITTER_NOT_FOUND CTF_RET_EMITTER_NOT_FOUND
00236 #define AUDIT_RET_ZERO_LENGTH_DATA CTF_RET_ZERO_LENGTH_DATA
00237 #define AUDIT_RET_INVALID_PROP_NAME CTF_RET_INVALID_PROPERTY_NAME
00238 #define AUDIT_RET_INVALID_COMP_NAME CTF_RET_INVALID_COMPONENT_NAME
00239 #define AUDIT_RET_INVALID_EMITTER_NAME CTF_RET_INVALID_EMITTER_NAME
00240 #define AUDIT_RET_NO_SERVER_PROCESS CTF_RET_NO_SERVER_PROCESS
00241 #define AUDIT_RET_ACCESS_DENIED CTF_RET_ACCESS_DENIED
00242
00243 #define AUDIT_RET_FILE_NOT_EXIST 1000
00244 #define AUDIT_RET_FILE_NOT_AVAILABLE 1001
00245 #define AUDIT_RET_FILE_INVALID_FORMAT 1002
00246 #define AUDIT_RET_FILE_EOF 1003
00247 #define AUDIT_RET_FILE_NO_MORE_RECORDS 1004
00248 #define AUDIT_RET_FILE_INVALID_NAME 1005
00249 #define AUDIT_RET_FILE_NOT_DUMPED 1006
00250
00251
00252
00253
00254
00255
00256
00257
00258 typedef struct audit_funcs
00259 {
00260 cobuns32_t version;
00261 cobuns32_t reserved;
00262 PFI_AUD_CONFIG_PROPERTY_GET fn_config_property_get;
00263 PFI_AUD_CONFIG_PROPERTY_SET fn_config_property_set;
00264 PFI_AUD_EMITTER_PROPERTY_GET fn_emitter_property_get;
00265 PFI_AUD_EMITTER_PROPERTY_SET fn_emitter_property_set;
00266 PFI_AUD_EVENT fn_audit_event;
00267 PFI_AUD_HANDLE_GET fn_audit_handle_get;
00268 PFI_AUD_FILE_CLOSE fn_audit_file_close;
00269 PFI_AUD_FILE_OPEN fn_audit_file_open;
00270 PFI_AUD_FILE_READ fn_audit_file_read;
00271 PFI_COBAUD_EVENT fn_cobaud_event;
00272 PFI_COBAUD_FILE_READ fn_cobaud_file_read;
00273 PFI_AUD_RESERVED fn_reserved[16];
00274 }AUDIT_FUNCS;
00275
00276
00277
00278
00279 typedef struct audit_emitter_funcs
00280 {
00281 cobuns32_t version;
00282 cobuns32_t reserved;
00283 PFI_AUD_EMITTER_INIT fn_init;
00284
00285 PFI_AUD_EMITTER_DEINIT fn_deinit;
00286
00287 PFI_AUD_EMITTER_OUTPUT fn_output;
00288
00289 PFV_AUD_EMITTER_NOTIFY fn_notify;
00290
00291 PFI fn_reserved[4];
00292 } AUDIT_EMITTER_FUNCS;
00293
00294
00295
00296
00297 #define AUDIT_EMITTER_FUNCS_VERSION 0
00298
00299
00300
00301
00302 typedef struct audit_event
00303 {
00304 cobuns32_t version;
00305 cobuns32_t flags;
00306 cobuns32_t event_id;
00307 cobuns32_t event_category;
00308 cobuns32_t data_count;
00309 cobuns32_t reserved1[7];
00310 cobuns32_t *event_len;
00311 cobuns32_t *event_type;
00312 void *event_data;
00313 void *reserved2[7];
00314 }AUDIT_EVENT;
00315
00316 typedef struct audit_event_t
00317 {
00318 cbl_x4_comp5_t version;
00319 cbl_x4_comp5_t flags;
00320 cbl_x4_comp5_t event_id;
00321 cbl_x4_comp5_t event_category;
00322 cbl_x4_comp5_t data_count;
00323 cbl_x4_comp5_t reserved1[7];
00324 cbl_pointer_t event_len;
00325 cbl_pointer_t event_type;
00326 cbl_pointer_t event_data;
00327 cbl_pointer_t reserved2[7];
00328 }AUDIT_EVENT_T;
00329
00330
00331
00332
00333 #define AUDIT_EVENT_VERSION 0
00334
00335
00336
00337
00338 #define AUDIT_EVENT_FLAGS_NONE 0x00000000
00339
00340
00341
00342
00343 #define AUDIT_EVENT_TYPE_BINARY TRACE_EVENT_TYPE_BINARY
00344 #define AUDIT_EVENT_TYPE_TEXT TRACE_EVENT_TYPE_TEXT
00345 #define AUDIT_EVENT_TYPE_ADDRESS TRACE_EVENT_TYPE_ADDRESS
00346 #define AUDIT_EVENT_TYPE_COMP5 TRACE_EVENT_TYPE_COMP5
00347 #define AUDIT_EVENT_TYPE_COMPX TRACE_EVENT_TYPE_COMPX
00348 #define AUDIT_EVENT_TYPE_UTF8 TRACE_EVENT_TYPE_UTF8
00349 #define AUDIT_EVENT_TYPE_COMP5S TRACE_EVENT_TYPE_COMP5S
00350 #define AUDIT_EVENT_TYPE_COMPXS TRACE_EVENT_TYPE_COMPXS
00351
00352 #define AUDIT_EVENT_TYPE_MASK 0x000000FF
00353
00354
00355
00356
00357 typedef struct audit_emitter_event
00358 {
00359 cobuns32_t version;
00360 cobuns32_t flags;
00361 cobuns32_t date;
00362 cobuns32_t time;
00363 cobuns32_t process_id_len;
00364 cobuns32_t thread_id_len;
00365 cobuns32_t comp_id;
00366 cobuns32_t event_id;
00367 cobuns32_t event_category;
00368 cobuns32_t data_count;
00369 cobuns32_t reserved1[6];
00370
00371 const cobuns8_t *process_id;
00372 const cobuns8_t *thread_id;
00373 const cobuns8_t *appname;
00374 const cobuns8_t *cmdline;
00375 const cobuns8_t *os_name;
00376 const cobuns8_t *mc_name;
00377 const cobuns8_t *sys_name;
00378 const cobuns8_t *comp_name;
00379 const cobuns8_t *auditmgr_name;
00380 const cobuns32_t *event_len;
00381 const cobuns32_t *event_type;
00382 const void **event_data;
00383 void *reserved2[7];
00384 }AUDIT_EMITTER_EVENT;
00385
00386
00387
00388
00389 #define AUDIT_EMITTER_VERSION 0
00390
00391
00392
00393
00394 #define AUDIT_EMITTER_FLAGS_NONE 0x00000000
00395 #define AUDIT_EMITTER_FLAGS_ARRAY_DATA 0x00000002
00396
00397
00398
00399
00400 #define AUDIT_EMITTER_DATA_TYPE_BINARY TRACER_EVENT_DATA_TYPE_BINARY
00401 #define AUDIT_EMITTER_DATA_TYPE_STRING TRACER_EVENT_DATA_TYPE_STRING
00402 #define AUDIT_EMITTER_DATA_TYPE_PTR TRACER_EVENT_DATA_TYPE_PTR
00403 #define AUDIT_EMITTER_DATA_TYPE_COMP5 TRACER_EVENT_DATA_TYPE_COMP5
00404 #define AUDIT_EMITTER_DATA_TYPE_COMPX TRACER_EVENT_DATA_TYPE_COMPX
00405 #define AUDIT_EMITTER_DATA_TYPE_UTF8 TRACER_EVENT_DATA_TYPE_UTF8
00406 #define AUDIT_EMITTER_DATA_TYPE_COMP5S TRACER_EVENT_DATA_TYPE_COMP5S
00407 #define AUDIT_EMITTER_DATA_TYPE_COMPXS TRACER_EVENT_DATA_TYPE_COMPXS
00408
00409
00410
00411
00412 typedef struct audit_record
00413 {
00414 cobuns32_t version;
00415 cobuns32_t flags;
00416
00417 cobuns32_t process_id_len;
00418 cobuns32_t thread_id_len;
00419
00420 union
00421 {
00422 cobuns32_t process_id_32;
00423 cobuns64_t process_id_64;
00424 }p;
00425
00426 union
00427 {
00428 cobuns32_t thread_id_32;
00429 cobuns64_t thread_id_64;
00430 }t;
00431
00432 cobuns32_t event_id;
00433 cobuns32_t event_category;
00434 cobuns32_t data_count;
00435 cobuns32_t appname_len;
00436 cobuns32_t cmdline_len;
00437 cobuns32_t os_name_len;
00438 cobuns32_t mc_name_len;
00439 cobuns32_t sys_name_len;
00440 cobuns32_t comp_name_len;
00441
00442 cobuns32_t time;
00443 cobuns32_t hour;
00444 cobuns32_t minute;
00445 cobuns32_t second;
00446 cobuns32_t millisecond;
00447 cobuns32_t date;
00448 cobuns32_t year;
00449 cobuns32_t month;
00450 cobuns32_t day;
00451
00452 cobuns32_t reserved1[7];
00453
00454 const cobuns8_t *appname;
00455 const cobuns8_t *cmdline;
00456 const cobuns8_t *os_name;
00457 const cobuns8_t *mc_name;
00458 const cobuns8_t *sys_name;
00459 const cobuns8_t *comp_name;
00460 cobuns32_t *event_len;
00461 cobuns32_t *event_type;
00462 void *event_data;
00463 void *reserved2[7];
00464 }AUDIT_RECORD;
00465
00466 typedef struct audit_record_t
00467 {
00468 cbl_x4_comp5_t version;
00469 cbl_x4_comp5_t flags;
00470
00471 cbl_x4_comp5_t process_id_len;
00472 cbl_x4_comp5_t thread_id_len;
00473
00474 union
00475 {
00476 cbl_x4_comp5_t process_id_32;
00477 cbl_x8_comp5_t process_id_64;
00478 }p;
00479
00480 union
00481 {
00482 cbl_x4_comp5_t thread_id_32;
00483 cbl_x8_comp5_t thread_id_64;
00484 }t;
00485
00486 cbl_x4_comp5_t event_id;
00487 cbl_x4_comp5_t event_category;
00488 cbl_x4_comp5_t data_count;
00489 cbl_x4_comp5_t appname_len;
00490 cbl_x4_comp5_t cmdline_len;
00491 cbl_x4_comp5_t os_name_len;
00492 cbl_x4_comp5_t mc_name_len;
00493 cbl_x4_comp5_t sys_name_len;
00494 cbl_x4_comp5_t comp_name_len;
00495
00496 cbl_x4_comp5_t time;
00497 cbl_x4_comp5_t hour;
00498 cbl_x4_comp5_t minute;
00499 cbl_x4_comp5_t second;
00500 cbl_x4_comp5_t millisecond;
00501 cbl_x4_comp5_t date;
00502 cbl_x4_comp5_t year;
00503 cbl_x4_comp5_t month;
00504 cbl_x4_comp5_t day;
00505
00506 cbl_x4_comp5_t reserved1[7];
00507
00508 cbl_pointer_t appname;
00509 cbl_pointer_t cmdline;
00510 cbl_pointer_t os_name;
00511 cbl_pointer_t mc_name;
00512 cbl_pointer_t sys_name;
00513 cbl_pointer_t comp_name;
00514 cbl_pointer_t event_len;
00515 cbl_pointer_t event_type;
00516 cbl_pointer_t event_data;
00517 cbl_pointer_t reserved2[7];
00518 }AUDIT_RECORD_T;
00519
00520
00521
00522
00523 #define AUDIT_RECORD_VERSION 0
00524
00525
00526
00527
00528 #define AUDIT_RECORD_FLAGS_NONE 0x00000000
00529
00530
00531
00532
00533 #define AUDIT_RECORD_DATA_TYPE_BINARY TRACER_EVENT_DATA_TYPE_BINARY
00534 #define AUDIT_RECORD_DATA_TYPE_STRING TRACER_EVENT_DATA_TYPE_STRING
00535 #define AUDIT_RECORD_DATA_TYPE_PTR TRACER_EVENT_DATA_TYPE_PTR
00536 #define AUDIT_RECORD_DATA_TYPE_COMP5 TRACER_EVENT_DATA_TYPE_COMP5
00537 #define AUDIT_RECORD_DATA_TYPE_COMPX TRACER_EVENT_DATA_TYPE_COMPX
00538 #define AUDIT_RECORD_DATA_TYPE_UTF8 TRACER_EVENT_DATA_TYPE_UTF8
00539 #define AUDIT_RECORD_DATA_TYPE_COMP5S TRACER_EVENT_DATA_TYPE_COMP5S
00540 #define AUDIT_RECORD_DATA_TYPE_COMPXS TRACER_EVENT_DATA_TYPE_COMPXS
00541
00542
00543
00544
00545 cobrtncode_t CBL_AUDIT_CONFIG_PROPERTY_GET(cobuns32_t flags_p,
00546 const cobuns8_t *property_name_p,
00547 cbl_x4_comp5_t *property_vallen_p,
00548 cobuns8_t *property_value_p);
00549
00550 cobrtncode_t CBL_AUDIT_CONFIG_PROPERTY_SET(cobuns32_t flags_p,
00551 const cobuns8_t *property_name_p,
00552 const cobuns8_t *property_value_p);
00553
00554 cobrtncode_t CBL_AUDIT_EMITTER_PROPERTY_GET(cobuns32_t flags_p,
00555 const cobuns8_t *emitter_name_p,
00556 const cobuns8_t *property_name_p,
00557 cbl_x4_comp5_t *property_vallen_p,
00558 cobuns8_t *property_value_p);
00559
00560 cobrtncode_t CBL_AUDIT_EMITTER_PROPERTY_SET(cobuns32_t flags_p,
00561 const cobuns8_t *emitter_name_p,
00562 const cobuns8_t *property_name_p,
00563 const cobuns8_t *property_value_p);
00564
00565 cobrtncode_t CBL_AUDIT_EVENT(cobuns32_t flags_p,
00566 const cobuns8_t *component_id_p,
00567 AUDIT_EVENT_T *audit_event_p);
00568
00569 cobrtncode_t CBL_AUDIT_HANDLE_GET(cobuns32_t flags_p,
00570 const cobuns8_t *component_name_p,
00571 cbl_x4_comp5_t *audit_handle_p);
00572
00573 cobrtncode_t CBL_AUDIT_FILE_CLOSE(cobuns32_t flags_p,
00574 cbl_os_pointer_t auditfile_handle);
00575
00576 cobrtncode_t CBL_AUDIT_FILE_OPEN(cobuns32_t flags_p,
00577 cbl_pointer_t *auditfile_handle_p,
00578 const cobuns8_t *auditfile_name_p);
00579
00580 cobrtncode_t CBL_AUDIT_FILE_READ(cobuns32_t flags_p,
00581 cbl_os_pointer_t auditfile_handle,
00582 AUDIT_RECORD_T *auditfile_record);
00583
00584 cobrtncode_t cobaudit_event(cobuns32_t flags_p,
00585 const cobuns8_t *component_id_p,
00586 AUDIT_EVENT *audit_event_p);
00587
00588 cobrtncode_t cobaudit_file_read(cobuns32_t flags_p,
00589 cbl_os_pointer_t auditfile_handle,
00590 AUDIT_RECORD *auditfile_record);
00591
00592
00593
00594
00595
00596 #endif
00597