#### Extracting an Attribute Value

The last call yielded one separate DS_C_ATTRIBUTE subsubobject from the original returned result object:

DS_C_ATTRIBUTE

DS_ATTRIBUTE_TYPE: OID string

DS_ATTRIBUTE_VALUES: anything

The following figure illustrates what is left.

The DS_C_ATTRIBUTE Object Structure

A final call to om_get( ) returns the single object descriptor that contains the actual value of the single attribute you selected from the returned object:

omStatus = om_get(entry->value.object.object,

OM_EXCLUDE_ALL_BUT_THESE_TYPES,

I_want_attribute_value,

OM_FALSE,

OM_ALL_VALUES,

OM_ALL_VALUES,

&entry,

&number_of_descriptors);

At this point, the value of entry is the base address of an object descriptor whose entry\->type is DS_ATTRIBUTE_VALUES. Depending on the value found in entry\->syntax, the value of the attribute can be read from entry\->value.string, entry\->value.integer, entry\->value.boolean, or entry\->value.enumeration.

For example, suppose the value of entry\->syntax is OM_S_OCTET_STRING. The attribute value, represented as an octet string (not terminated by a NULL), is found in entry\->value.string.elements; its length is found in entry\->value.string.length.

You can check any attribute value against the value you get from the cdscp command by entering:

cdscp show object /.:/hosts/tamburlaine/self

For further information on cdscp, see the OSF DCE Command Reference.

Note that you can always call om_get( ) to get the entire returned object from an XDS call. This yields a full structure of object descriptors that you can manipulate like any other data structure. To do this with the ds_read( ) return object would have required the following call:

/* make a public copy of ENTIRE object... */

omStatus = om_get(readResultObject,

OM_NO_EXCLUSIONS,

((OM_type_list) 0),

OM_FALSE,

((OM_value_position) 0),

((OM_value_position) 0),

&entry,

&number_of_descriptors);

At the end of every XDS session you have to unbind from the GDS, and then deallocate the XDS and XOM structures and other storage. You must also explicitly deallocate any service-generated objects, whether public or private, with calls to om_delete(~), as follows:

/* delete service-generated public or private objects... */

omStatus = om_delete(readResultObject);

omStatus = om_delete(entry);

/* unbind from the GDS... */

dsStatus = ds_unbind(session);

/* close down the workspace... */

dsStatus = ds_shutdown(xdsWorkspace);

exit();

###