PreviousNext

Reading and Writing Existing CDS Entry Attributes Using XDS

Suppose that you want to use XDS to read some information from the following CDS entry:

/.../C=US/O=OSF/OU=DCE/hosts/tamburlaine/self

As explained in the OSF DCE Administration Guide, the /.:/hosts/hostname/self entry, which is created at the time of cell configuration, contains binding information for the machine hostname. Since this is a simple RPC NSI entry, there is not very much in the entry that is interesting to read, but this entry is used as an example anyway as a simple demonstration.

Following are the header inclusions and general data declarations:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <xom.h>

#include <xds.h>

#include <xdsbdcp.h>

#include <xdscds.h>

Note that the xom.h and xds.h header files must be included in the order shown in the preceding example. Also note that the xdscds.h header file is brought in for the sake of DSX_TYPELESS_RDN. This file is where the CDS-significant OIDs are defined. The xdsbdcp.h file contains information necessary to the Basic Directory Contents Package, which is the basic version of the XDS interface you can use in this program.

The XDS/XOM interface defines numerous object identifier string constants, which are used to identify the many object classes, parts, and pieces (among other things) that it needs to know about. In order to make sure that these OID constants do not collide with any other constants, the interface refers to them with the string OMP_O_ prefixed to the user-visible form; for example, DS_C_DS_DN becomes OMP_O_DS_C_DS_DN internally. In order to make application instances consistent with the internal form, use OM_EXPORT to import all XDS-defined or XOM-defined OID constants used in your application.

OM_EXPORT( DS_A_COUNTRY_NAME )

OM_EXPORT( DS_A_OBJECT_CLASS )

OM_EXPORT( DS_A_ORG_UNIT_NAME )

OM_EXPORT( DS_A_ORG_NAME )


OM_EXPORT( DS_C_ATTRIBUTE )

OM_EXPORT( DS_C_ATTRIBUTE_LIST )

OM_EXPORT( DS_C_AVA )

OM_EXPORT( DS_C_DS_DN )

OM_EXPORT( DS_C_DS_RDN )

OM_EXPORT( DS_C_ENTRY_INFO_SELECTION )

OM_EXPORT( DSX_TYPELESS_RDN )

/* ... Special OID for an untyped (that is, nonX.500) */

/* relative distinguished name. Defined in xdscds.h header. */

A further important effect of OM_EXPORT is that it builds an OM_string structure to hold the exported OID hexadecimal string. As explained in the previous topic, OIDs are not numeric values, but strings. Comparisons and similar operations on OIDs must access them as strings. Once an OID has been exported, you can access it using its declared name. For example, the hexadecimal string representation of DS_C_ATTRIBUTE is contained in DS_C_ATTRIBUTE.elements, and the length of this string is contained in DS_C_ATTRIBUTE.length.

More:

Significance of Typed and Untyped Entry Names

Static Declarations

Other Necessary Objects for ds_read( )

Miscellaneous Declarations

The Main Program

Reading a CDS Attribute

Handling the Result Object

Representation of Object Values

Extracting an Attribute Value