Program structure

To perform directory search, code your application to follow the steps below:

  1. Begin the search.

    • ct_con_props to set directory service properties

    • ct_callback to install a pointer to the application’s directory callback in the connection structure

    Execute application code to initialize a list or array that will collect directory objects

    • ct_ds_lookup to begin the search

    Note that instead of calling ct_callback here, the application could have installed the callback in the connection’s parent context structure before allocating the connection. Then it would become the default directory callback for all connections allocated from the context.

  2. Collect search results in the directory callback.

    • (Optional) ct_ds_objinfo to inspect the object

    • (Optional) ct_ds_dropobj to drop unwanted objects

    Execute application code to collect directory objects with an application defined list or array.

    During the directory search, ct_ds_lookup invokes the directory callback once for each entry that is found in the search.

  3. Inspect the directory objects. For each directory object:

    • ct_ds_objinfo to get the object’s fully qualified name

    • ct_ds_objinfo to get the number of attributes

    • ct_ds_objinfo to get each attribute’s metadata and values

  4. Clean up.

    For each object, ct_ds_dropobj to deallocate the directory object