If a search is successful, Client-Library invokes the directory callback with numentries as the total number of entries to be examined. If the search finds no entries, numentries is 0. If the search finds one or more entries, numentries gives the number of unexamined entries including the current entry.
The application examines all the entries simply by returning CS_CONTINUE from the callback each time Client-Library invokes the callback. ct_ds_lookup invokes the callback repeatedly until one of the following conditions is satisfied:
The callback returns CS_SUCCEED.
The callback has received every directory object in the search results. If the callback returns CS_CONTINUE when numentries is 0 or 1, it is not invoked again before ct_ds_lookup completes.
If the callback returns a value other than CS_CONTINUE or CS_SUCCEED, the current Client-Library response is the same as for CS_SUCCEED. However, this behavior may change in future versions. To ensure compatibility with future versions, applications should return only CS_CONTINUE or CS_SUCCEED from directory callbacks.
If asynchronous network I/O is in effect for the connection, all invocations of the directory callback occur before Client-Library invokes the application’s completion callback.
If synchronous network I/O is in effect for the connection, all invocations of the directory callback occur before ct_ds_lookup returns.