OSF DCE Application Development Guide--Core Components

DCE Host Services
instead of dced_hostdata_create().
dced_binding_free( )
Each call to the dced_binding_create( ) routine requires a
corresponding call to dced_binding_free() to release the binding
resources allocated.
Use the dced_hostdata_delete( ) routine to delete application-specific hostdata items
and their entries. For example, the printer installed in the example is easily removed with
this routine. If you are only taking the printer out of service for a short time, use the
dced_entry_remove( ) routine to remove the dced entry but not the data file itself.
When the printer is later ready again, use the dced_entry_add( ) routine to reinstall it.
Do not delete the well-known hostdata items or remove their entries.
2.5.3 Modifying Hostdata
Changing hostdata cannot only change the way the host works but it also affects other
files and processes on the host. Therefore, care should be taken when changing hostdata.
Deleting the well-known hostdata entries can cause even more serious operational
problems for the host.
The current as well as earlier versions of DCE provide configuration routines that use a
dce_cf.db file for data. When hostdata changes, dced also makes the appropriate changes
to this file so that the dce_cf* routines continue to work correctly. This is one reason the
hostdata items are established as well-known names with well-known UUIDs so that
dced knows which values to monitor.
Management applications use the dced_hostdata_read( ) routine to obtain the data for
an entry referred to by an entry UUID. To modify an entry’s actual data, applications use
the dced_hostdata_write() routine. This routine replaces the old data with the new data
for the hostdata entry represented by the entry UUID. The hostdata entry must already
exist because this routine will not create it. Use the dced_hostdata_create() routine to
create new hostdata entries.
2.5.4 Running Programs Automatically When Hostdata Changes
The following example shows how to use the post_processors feature of the well-known
hostdata to cause dced to automatically run a program if another hostdata entry changes.
In this example, the post_processors file is read, and data is added for the
NEWERprinter hostdata entry created in an earlier example. The data is placed in a
dced_attr_list_t structure and written back to the post_processors hostdata entry.
dced_binding_handle_t dced_bh;
uuid_t entry_uuid;
sec_attr_t *data_ptr;
error_status_t status;
int i, num_strings, str_size;
124245 Tandem Computers Incorporated 2 15