ct_ds_lookup

Description

Initiate or cancel a directory lookup operation.

Syntax

CS_RETCODE ct_ds_lookup(connection, 
              action, reqid, lookup_info,
              userdata)
 
 CS_CONNECTION           connection;
 CS_INT                              action;
 CS_INT                              *reqid;
 CS_DS_LOOKUP_INFO   *lookup_info;
 CS_VOID                            *userdata;

Parameters

connection

A pointer to a CS_CONNECTION structure. A CS_CONNECTION structure contains information about a particular connection.

action

One of the following symbolic values:

Action

Function performed

CS_CLEAR

Cancel the directory lookup operation specified by reqid. Supported for asynchronous connections only.

CS_SET

Initiate a directory lookup operation.

reqid

A pointer to a CS_INT variable.

When action is CS_SET, Client- Library returns the request identifier in *reqid.

When action is CS_CLEAR, *reqid specifies the request ID of the operation to cancel.

lookup_info

The address of a CS_DS_LOOKUP_INFO structure.

A CS_DS_LOOKUP_INFO structure is defined as follows:

typedef struct _cs_ds_lookup_info
 {
         CS_OID          *objclass;
         CS_CHAR         *path;
         CS_INT          pathlen;
         CS_DS_OBJECT    *attrfilter;
         CS_DS_OBJECT    *attrselect;
 } CS_DS_LOOKUP_INFO;

When action is CS_SET, set the fields of *lookup_info as follows:

Table 3-21: Contents of *lookup_info for a ct_ds_lookup(CS_SET) call

Field

Set to

objclass

The address of a CS_OID structure that specifies the class of directory objects to search for. objclass->oid_buffer contains the OID string for the object class and objclass->oid_length specifies the length of the OID string (not counting any null terminator).

ct_ds_lookup finds only those directory entries whose class matches the contents of lookup_info->objclass.

path

Reserved. Set to NULL to ensure compatibility with future versions of Client-Library.

pathlen

Reserved. Set to 0 to ensure compatibility with future versions of Client-Library.

attrfilter

Reserved. Set to NULL to ensure compatibility with future versions of Client-Library.

attrselect

Reserved. Set to NULL to ensure compatibility with future versions of Client-Library.

NoteIn asynchronous mode, the contents of *lookup_info and the pointers contained in it must remain valid until the connection’s completion callback or ct_poll indicates that the request has completed or was canceled.

When action is CS_CLEAR, lookup_info must be passed as NULL.

userdata

The address of user-allocated data to pass into the directory callback.

When action is CS_SET, userdata is optional and can be passed as NULL. If ct_ds_lookup finds matching directory entries, Client-Library invokes the connection’s directory callback. The directory callback receives the address specified as userdata. userdata provides a means for the callback to communicate the search results back to the mainline code where ct_ds_lookup was called.

When action is CS_CLEAR, userdata must be passed as (CS_VOID *) NULL.

Returns

ct_ds_lookup returns the following values:

Return value

Meaning

CS_SUCCEED

The routine completed successfully

CS_FAIL

The routine failed

CS_PENDING

Asynchronous network I/O is in effect. See “Asynchronous programming”.

NoteOn platforms where Client-Library does not use thread-driven I/O, applications must always poll for ct_ds_lookup completions even when the connection’s CS_NETIO setting is CS_ASYNC_IO.

CS_BUSY

An asynchronous operation is already pending for this connection. See “Asynchronous programming”.

CS_CANCELED

The lookup request was canceled by the application. Lookup requests can be canceled only on asynchronous connections.

Examples

Example 1

For an explanation of the steps in this example, see Chapter 9, “Using Directory Services,” in the Open Client Client-Library/C Programmer's Guide.

Usage


Directory callbacks


Initiating directory lookups


Synchronous vs. asynchronous directory lookups


Canceling a directory lookup (asynchronous connections only)

See also

ct_ds_objinfo, ct_ds_dropobj, “Directory services”, “Server directory object”