OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
#define evt_vn_bank_server_acct_close 0xC1000001
/* event number for the 3rd code point, acct_withdraw() */
#define evt_vn_bank_server_acct_withdraw 0xC1000002
/* event number for the 4th code point, acct_deposit() */
#define evt_vn_bank_server_acct_deposit 0xC1000003
/* event number for the 5th code point, acct_transfer() */
#define evt_vn_bank_server_acct_transfer 0xC1000004
3. The programmer now starts adding audit API functions to the bank server program.
In the initialization part of the server, the application programmer uses the
dce_aud_open( ) API to open an audit trail file for writing the audit records. This
function uses the lowest-numbered event as one of its parameters; in this case,
0xC1000000 (evt_vn_bank_server_acct_open). Using the lowest-numbered
event enhances the performance of the filter search.
/* open an audit trail file for writing */
dce_aud_open(aud_c_trl_open_write, description,
evt_vn_bank_server_acct_open,
5, &audit_trail, &status);
4. The programmer invokes the following DCE audit APIs at each code point:
The dce_aud_start( ) API, to initialize an audit record. This function assigns
the event number to the event represented by the code point. Thus, it uses the
event number corresponding to that code point as one of its parameters.
The dce_aud_put_ev_info( ) API, to add event-specific information to the
audit record.
The dce_aud_commit( ) API, to commit the audit record in the audit trail file.
The use of these three APIs is illustrated in the following example of the bank
server program:
acct_open() /* first code point */
/* Uses the event number for acct_open(),
evt_vn_bank_server_acct_open */
dce_aud_start(evt_vn_bank_server_acct_open,
binding,options,outcome,&ard, &status);
/* If events need to be logged,
add trailer info (optional) */
if (ard)
dce_aud_put_ev_info(ard,info,&status);
/* If events need to be logged,
add header and trailer info */
if (ard)
338 Tandem Computers Incorporated 124245