OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
You can opt not to use the dce_aud_put_ev_info( ) function if the information provided
by the audit record header is already sufficient for your auditing purposes.
If you elect to use this function, it can be called one or more times, the order of which is
preserved in the audit record.
The dce_aud_put_ev_info() function has two parameters: the ard parameter, which is
the pointer to the audit record descriptor, and the info parameter, which is a
dce_aud_ev_info_t type data containing the event-specific information. The programmer
can specify the dce_aud_ev_info_t data type to include all the audit information that
needs to be collected. For more information on the formats of the audit record, see the
OSF DCE Application Development Reference.
In the acct_transfer() code point of the bank server example, if you want to record the
account numbers of the parties involved in the transfer and the amount of each
transaction, the data type declarations and the function calls can be made as follows:
dce_aud_ev_info_t info;
/* account numbers and transfer amounts are all unsigned
32-bit integers */
info.format = aud_c_evt_info_ulong_int;
info.data = acct_from;
dce_aud_put_ev_info(ard, info, &status);
info.data = acct_to;
dce_aud_put_ev_info(ard, info, &status);
info.data = amount;
dce_aud_put_ev_info(ard, info, &status);
34.1.4 Committing an Audit Record
After the header and the optional tail information has been included in the audit record,
the dce_aud_commit( ) function call is used to write the audit record in the audit trail
file. This function uses the audit trail file previously opened by the dce_aud_open( )
function.
You can specify one of two options in the way the function writes the audit record in the
audit trail file:
Return an error status if the storage or logging service is not available when an
attempt is made to write the audit record. This option can be used if the application
program can handle write failures in the stable storage.
If the storage or logging service is not available, keep on trying until the function is
able to write to it. This option can be used if the audit record must be written to
stable storage before the routine can proceed safely to another task.
In the bank server example, the function call can be made as follows:
dce_aud_commit(audit_trail, ard, options, format, outcome, & status);
344 Tandem Computers Incorporated 124245