PreviousNext

Managing Individual dced Entries

The following figure shows examples of individual dced entries and the locations of associated data. The data item name or its UUID is used to find an entry, and then the storage tag is used to find the data.


Accessing Hostdata

The data for each hostdata item is stored in a file on disk. The dced program uses the UUID to find the entry in the hostdata entry list. The entry's storage tag is then used to find the data. For hostdata, the tag contains a filename in OSF's reference implementation. The data returned for one entry is an array of strings in a sec_attr_t structure.

The server management data is stored in memory. The dced program uses UUIDs (maintained in the entry lists by dced) to find an entry. The location of the data in memory is indicated by the storage tag. The data returned for one entry is a structure of server data (server_t). All data for the srvrconf and srvrexec entries are accessed from memory for fast retrieval, but the srvrconf data is also stored on disk for use when a host needs to reboot.

Each keytab entry stores its data in a file on disk. However, like the server management entries, the keytab entries use server names and corresponding UUIDs (maintained by dced) to identify each entry. The storage tag contains the name of the key table file. The data returned for one entry is a list of keys of type dced_key_list_t.

The following example shows how to obtain and manage individual entries for the hostdata, srvrconf, srvrexec, or keytab services:

handle_t rpc_bh;

dced_binding_handle_t dced_bh;

dced_entry_list_t entries;

unsigned32 i;

dced_service_type_t service_type;

void *data;

error_status_t status;

.

.

.

dced_binding_from_rpc_binding(service_type, rpc_bh, &dced_bh, &status);

if(status != error_status_ok)

return;

dced_list_get(dced_bh, &entries, &status);

if(status == error_status_ok) {

for(i=0; i<entries.count; i++) {

if( select_entry(entries.list[i].name) ) {/* application specific */

dced_object_read(dced_bh, &(entries.list[i].id), &data, &status);

if(status == error_status_ok) {

display(service_type, 1, &data); /* application specific */

dced_objects_release(dced_bh, 1, data, &status);

}

}

}

dced_list_release(dced_bh, &entries, &status);

}

dced_binding_free(dced_bh, &status);

Each routine is described as follows:

dced_binding_from_rpc_binding( )
The dced_binding_from_rpc_binding( ) routine returns a dced binding handle whose data type is dced_binding_handle_t. This binding handle is used in all subsequent dced API routines to access the service. The host is determined from the RPC binding handle, rpc_bh, and the service_type is selected from the following list:

· dced_e_service_type_hostdata

· dced_e_service_type_srvrconf

· dced_e_service_type_srvrexec

· dced_e_service_type_keytab

dced_list_get( )
Applications use the dced_list_get( ) routine to get a service's entire list of names. Using the dced_list_get( ) routine gives your application great flexibility when manipulating entries in an entry list. If you prefer, your application can use the dced_entry_cursor_initialize( ), dced_entry_get_next( ), and dced_entry_cursor_release( ) set of routines to obtain individual entries, one at a time.

select_entry( )
This is an application-specific routine that selects which entry to use based on the entry name.

dced_object_read( )
The default attribute for dced_object_read( ) is to return an array of strings. The hostdata and keytab services have other read routines that allow you to specify binary data.

display( )
This is an example of an application-specific routine that simply displays the server configuration data read. Depending on the service, a different data structure is used. For the hostdata service, a sec_attr_t is used. For the srvrconf and srvrexec services server_t structures are used. For the keytab service, a dced_key_list_t structure is used.

dced_objects_release( )
After your application is finished with the data read with the dced_object_read( ) routine, free the buffer of allocated data by using the dced_objects_release( ) routine.

dced_list_release( )
Each call to the dced_list_get( ) routine requires a corresponding call to dced_list_release( ) to release the resources allocated for the entry list.

dced_binding_free( )
Each call to the dced_binding_from_rpc_binding( ) routine requires a corresponding call to dced_binding_free( ) to release the resources of the allocated binding.