mfaudit.h

00001 /****************************************************************************
00002  *
00003  *      Copyright (C) 1984-2006 Micro Focus (IP) Limited.
00004  *      All rights reserved.
00005  *
00006  *      The software and information contained herein are
00007  *      proprietary to, and comprise valuable trade secrets of,
00008  *      Micro Focus (IP) Limited, which intends to preserve
00009  *      as trade secrets such software and information. This software
00010  *      is an unpublished copyright of Micro Focus and may not be
00011  *      used, copied, transmitted, or stored in any manner.  This
00012  *      software and information or any other copies thereof may not
00013  *      be provided or otherwise made available to any other person.
00014  *
00015  *      Genesis Run Time System (Studio/Server 5.0 Freeze)
00016  *
00017  *      @(#)mfaudit.h   11.3
00018  *
00019  *      Last Modified on 06/11/07 at 23:32:07
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 /*  Function pointer definitions                                              */
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 /*  AUDITFILE emitter user exit                                               */
00114 /******************************************************************************/
00115 
00116 /*
00117 **  User exit function prototype
00118 */
00119 typedef cobrtncode_t (*PFI_AUDITFILE_EMITTER_EXIT)(cobuns32_t function,
00120                                                    cobuns8_t  *emitter_name,
00121                                                    ...);
00122 
00123 /*
00124 **  User exit name
00125 */
00126 #define AUDITFILE_EXIT_NAME                 "AUDITFILE_EMITTER_EXIT"
00127 
00128 /*
00129 **  User exit functions
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 /*  CBL_AUDIT_ API control flags                                              */
00139 /******************************************************************************/
00140 
00141 /*
00142 **  Used by:
00143 **
00144 **      CBL_AUDIT_CONFIG_PROPERTY_GET
00145 **      CBL_AUDIT_CONFIG_PROPERTY_SET
00146 **      CBL_AUDIT_EMITTER_PROPERTY_GET
00147 **      CBL_AUDIT_EMITTER_PROPERTY_SET
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 **  Used by:
00155 **
00156 **      CBL_AUDIT_FILE_CLOSE
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 **  Used by:
00164 **
00165 **      CBL_AUDIT_FILE_OPEN
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 **  Used by:
00173 **
00174 **      CBL_AUDIT_EVENT
00175 */
00176 #define AUDIT_FLAG_EVENT_ARRAY_DATA         0x00002000
00177 
00178 /*
00179 **  Used by:
00180 **
00181 **      CBL_AUDIT_EMITTER_PROPERTY_GET
00182 **      CBL_AUDIT_EMITTER_PROPERTY_SET
00183 */
00184 #define AUDIT_FLAG_EMITTER_NAME_NULL_TERM   0x10000000
00185 
00186 /*
00187 **  Used by:
00188 **
00189 **      CBL_AUDIT_CONFIG_PROPERTY_GET
00190 **      CBL_AUDIT_CONFIG_PROPERTY_SET
00191 */
00192 #define AUDIT_FLAG_PROP_NAME_NULL_TERM      0x20000000
00193 
00194 /*
00195 **  Used by:
00196 **
00197 **      CBL_AUDIT_EVENT
00198 **      CBL_AUDIT_HANDLE_GET
00199 */
00200 #define AUDIT_FLAG_COMP_NAME_NULL_TERM      0x40000000
00201 
00202 /*
00203 **  Used by:
00204 **
00205 **      CBL_AUDIT_EVENT
00206 */
00207 #define AUDIT_FLAG_COMPID_STRING            0x80000000
00208 
00209 /******************************************************************************/
00210 /*  Audit categories                                                          */
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 /*  CBL_AUDIT_ API return codes                                               */
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 /*  Structures                                                                */
00253 /******************************************************************************/
00254 
00255 /*----------------------------------------------------------------------------*/
00256 /*  Audit Functions                                                           */
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 /*  Audit emitter function pointer table                                      */
00278 /*----------------------------------------------------------------------------*/
00279 typedef struct audit_emitter_funcs
00280 {
00281     cobuns32_t              version;        /* Version of structure format    */
00282     cobuns32_t              reserved;       /* Reserved for future use        */
00283     PFI_AUD_EMITTER_INIT    fn_init;        /* Function to initialise the     */
00284                                             /* emitter                        */
00285     PFI_AUD_EMITTER_DEINIT  fn_deinit;      /* Function to deinitialise the   */
00286                                             /* emitter                        */
00287     PFI_AUD_EMITTER_OUTPUT  fn_output;      /* Function to output a trace     */
00288                                             /* event                          */
00289     PFV_AUD_EMITTER_NOTIFY  fn_notify;      /* Function to handle notifcations*/
00290                                             /* of emitter config changes      */
00291     PFI                     fn_reserved[4]; /* Reserved for future use        */
00292 } AUDIT_EMITTER_FUNCS;
00293 
00294 /*
00295 **  Version types (version)
00296 */
00297 #define AUDIT_EMITTER_FUNCS_VERSION                 0
00298 
00299 /*----------------------------------------------------------------------------*/
00300 /*  Audit event details                                                       */
00301 /*----------------------------------------------------------------------------*/
00302 typedef struct audit_event
00303 {
00304     cobuns32_t          version;        /* Version of structure format        */
00305     cobuns32_t          flags;          /* Control flags                      */
00306     cobuns32_t          event_id;       /* Audit event identifier             */
00307     cobuns32_t          event_category; /* Audit event category               */
00308     cobuns32_t          data_count;     /* Number of audit data items         */
00309     cobuns32_t          reserved1[7];   /* Reserved for future use            */
00310     cobuns32_t          *event_len;     /* Audit data item lengths            */
00311     cobuns32_t          *event_type;    /* Audit data item types              */
00312     void                *event_data;    /* Audit data items                   */
00313     void                *reserved2[7];  /* Reserved for future use            */
00314 }AUDIT_EVENT;
00315 
00316 typedef struct audit_event_t
00317 {
00318     cbl_x4_comp5_t      version;        /* Version of structure format        */
00319     cbl_x4_comp5_t      flags;          /* Control flags                      */
00320     cbl_x4_comp5_t      event_id;       /* Audit event identifier             */
00321     cbl_x4_comp5_t      event_category; /* Audit event category               */
00322     cbl_x4_comp5_t      data_count;     /* Number of audit data items         */
00323     cbl_x4_comp5_t      reserved1[7];   /* Reserved for future use            */
00324     cbl_pointer_t       event_len;      /* Audit data item lengths            */
00325     cbl_pointer_t       event_type;     /* Audit data item types              */
00326     cbl_pointer_t       event_data;     /* Audit data items                   */
00327     cbl_pointer_t       reserved2[7];   /* Reserved for future use            */
00328 }AUDIT_EVENT_T;
00329 
00330 /*
00331 **  Version types (version):
00332 */
00333 #define AUDIT_EVENT_VERSION                 0
00334 
00335 /*
00336 **  Control flags (flags):
00337 */
00338 #define AUDIT_EVENT_FLAGS_NONE              0x00000000
00339 
00340 /*
00341 **  Audit data item types (event_type):
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 /*  Audit emitter event details                                               */
00356 /*----------------------------------------------------------------------------*/
00357 typedef struct audit_emitter_event
00358 {
00359     cobuns32_t          version;        /* Version of structure format        */
00360     cobuns32_t          flags;          /* Control flags                      */
00361     cobuns32_t          date;           /* Encoded date                       */
00362     cobuns32_t          time;           /* Encoded time                       */
00363     cobuns32_t          process_id_len; /* Length of process identifier       */
00364     cobuns32_t          thread_id_len;  /* Length of thread identifier        */
00365     cobuns32_t          comp_id;        /* Component identifier               */
00366     cobuns32_t          event_id;       /* Audit event identifier             */
00367     cobuns32_t          event_category; /* Audit event category               */
00368     cobuns32_t          data_count;     /* Number of audit data items         */
00369     cobuns32_t          reserved1[6];   /* Reserved for future use            */
00370 
00371     const cobuns8_t     *process_id;    /* Process identifier                 */
00372     const cobuns8_t     *thread_id;     /* Thread identifier                  */
00373     const cobuns8_t     *appname;       /* Null-terminated application name   */
00374     const cobuns8_t     *cmdline;       /* Null-terminated process cmd line   */
00375     const cobuns8_t     *os_name;       /* Operating system name              */
00376     const cobuns8_t     *mc_name;       /* Machine name                       */
00377     const cobuns8_t     *sys_name;      /* Null-terminated system name        */
00378     const cobuns8_t     *comp_name;     /* Null-terminated component name     */
00379     const cobuns8_t     *auditmgr_name; /* Null-terminated auditmgr name      */
00380     const cobuns32_t    *event_len;     /* Audit data item lengths            */
00381     const cobuns32_t    *event_type;    /* Audit data item types              */
00382     const void          **event_data;   /* Audit data items                   */
00383     void                *reserved2[7];  /* Reserved for future use            */
00384 }AUDIT_EMITTER_EVENT;
00385 
00386 /*
00387 **  Version types (version):
00388 */
00389 #define AUDIT_EMITTER_VERSION               0
00390 
00391 /*
00392 **  Control flags (flags)
00393 */
00394 #define AUDIT_EMITTER_FLAGS_NONE            0x00000000
00395 #define AUDIT_EMITTER_FLAGS_ARRAY_DATA      0x00000002
00396 
00397 /*
00398 **  Audit emiiter data types (data_type)
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 /*  Audit record details                                                      */
00411 /*----------------------------------------------------------------------------*/
00412 typedef struct audit_record
00413 {
00414     cobuns32_t          version;        /* Version of structure format        */
00415     cobuns32_t          flags;          /* Control flags                      */
00416 
00417     cobuns32_t          process_id_len; /* Process identifier length          */
00418     cobuns32_t          thread_id_len;  /* Thread identifier length           */
00419 
00420     union
00421     {
00422         cobuns32_t      process_id_32;  /* Process identifier (32-bit)        */
00423         cobuns64_t      process_id_64;  /* Process identifier (64-bit)        */
00424     }p;
00425 
00426     union
00427     {
00428         cobuns32_t      thread_id_32;   /* Thread identifier (32-bit)         */
00429         cobuns64_t      thread_id_64;   /* Thread identifier (64-bit)         */
00430     }t;
00431 
00432     cobuns32_t          event_id;       /* Audit event identifier             */
00433     cobuns32_t          event_category; /* Audit event category               */
00434     cobuns32_t          data_count;     /* Number of audit data items         */
00435     cobuns32_t          appname_len;    /* Application name length            */
00436     cobuns32_t          cmdline_len;    /* Process command line length        */
00437     cobuns32_t          os_name_len;    /* Operating system name length       */
00438     cobuns32_t          mc_name_len;    /* Machine name length                */
00439     cobuns32_t          sys_name_len;   /* System name length                 */
00440     cobuns32_t          comp_name_len;  /* Component name length              */
00441 
00442     cobuns32_t          time;           /* Encoded time                       */
00443     cobuns32_t          hour;           /* Decoded hour                       */
00444     cobuns32_t          minute;         /* Decoded minute                     */
00445     cobuns32_t          second;         /* Decoded second                     */
00446     cobuns32_t          millisecond;    /* Decoded millisecond                */
00447     cobuns32_t          date;           /* Encoded date                       */
00448     cobuns32_t          year;           /* Decoded year                       */
00449     cobuns32_t          month;          /* Decoded month                      */
00450     cobuns32_t          day;            /* Decoded day                        */
00451 
00452     cobuns32_t          reserved1[7];   /* Reserved for future use            */
00453 
00454     const cobuns8_t     *appname;       /* Null-terminated application name   */
00455     const cobuns8_t     *cmdline;       /* Null-terminated process cmd line   */
00456     const cobuns8_t     *os_name;       /* Operating system name              */
00457     const cobuns8_t     *mc_name;       /* Machine name                       */
00458     const cobuns8_t     *sys_name;      /* Null-terminated system name        */
00459     const cobuns8_t     *comp_name;     /* Null-terminated component name     */
00460     cobuns32_t          *event_len;     /* Audit data item lengths            */
00461     cobuns32_t          *event_type;    /* Audit data item types              */
00462     void                *event_data;    /* Audit data items                   */
00463     void                *reserved2[7];  /* Reserved for future use            */
00464 }AUDIT_RECORD;
00465 
00466 typedef struct audit_record_t
00467 {
00468     cbl_x4_comp5_t      version;        /* Version of structure format        */
00469     cbl_x4_comp5_t      flags;          /* Control flags                      */
00470 
00471     cbl_x4_comp5_t      process_id_len; /* Process identifier length          */
00472     cbl_x4_comp5_t      thread_id_len;  /* Thread identifier length           */
00473 
00474     union
00475     {
00476         cbl_x4_comp5_t  process_id_32;  /* Process identifier (32-bit)        */
00477         cbl_x8_comp5_t  process_id_64;  /* Process identifier (64-bit)        */
00478     }p;
00479 
00480     union
00481     {
00482         cbl_x4_comp5_t  thread_id_32;   /* Thread identifier (32-bit)         */
00483         cbl_x8_comp5_t  thread_id_64;   /* Thread identifier (64-bit)         */
00484     }t;
00485 
00486     cbl_x4_comp5_t      event_id;       /* Audit event identifier             */
00487     cbl_x4_comp5_t      event_category; /* Audit event category               */
00488     cbl_x4_comp5_t      data_count;     /* Number of audit data items         */
00489     cbl_x4_comp5_t      appname_len;    /* Application name length            */
00490     cbl_x4_comp5_t      cmdline_len;    /* Process command line length        */
00491     cbl_x4_comp5_t      os_name_len;    /* Operating system name length       */
00492     cbl_x4_comp5_t      mc_name_len;    /* Machine name length                */
00493     cbl_x4_comp5_t      sys_name_len;   /* System name length                 */
00494     cbl_x4_comp5_t      comp_name_len;  /* Component name length              */
00495 
00496     cbl_x4_comp5_t      time;           /* Encoded time                       */
00497     cbl_x4_comp5_t      hour;           /* Decoded hour                       */
00498     cbl_x4_comp5_t      minute;         /* Decoded minute                     */
00499     cbl_x4_comp5_t      second;         /* Decoded second                     */
00500     cbl_x4_comp5_t      millisecond;    /* Decoded millisecond                */
00501     cbl_x4_comp5_t      date;           /* Encoded date                       */
00502     cbl_x4_comp5_t      year;           /* Decoded year                       */
00503     cbl_x4_comp5_t      month;          /* Decoded month                      */
00504     cbl_x4_comp5_t      day;            /* Decoded day                        */
00505 
00506     cbl_x4_comp5_t      reserved1[7];   /* Reserved for future use            */
00507 
00508     cbl_pointer_t       appname;        /* Null-terminated application name   */
00509     cbl_pointer_t       cmdline;        /* Null-terminated process cmd line   */
00510     cbl_pointer_t       os_name;        /* Null-terminated OS name            */
00511     cbl_pointer_t       mc_name;        /* Null-terminated machine name       */
00512     cbl_pointer_t       sys_name;       /* Null-terminated system name        */
00513     cbl_pointer_t       comp_name;      /* Null-terminated component name     */
00514     cbl_pointer_t       event_len;      /* Audit data item lengths            */
00515     cbl_pointer_t       event_type;     /* Audit data item types              */
00516     cbl_pointer_t       event_data;     /* Audit data items                   */
00517     cbl_pointer_t       reserved2[7];   /* Reserved for future use            */
00518 }AUDIT_RECORD_T;
00519 
00520 /*
00521 **  Version types (version):
00522 */
00523 #define AUDIT_RECORD_VERSION                0
00524 
00525 /*
00526 **  Control flags (flags)
00527 */
00528 #define AUDIT_RECORD_FLAGS_NONE             0x00000000
00529 
00530 /*
00531 **  Audit record data types (data_type)
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 /*  APIs                                                                      */
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 /*  Externals                                                                 */
00594 /******************************************************************************/
00595 
00596 #endif  /* MFAUDIT_H */
00597