Subject: LDAP Client API in C with Notification of the end of a request

From: FOREST Laurent <[email-masked]>
Date: Thu, 24 May 2001 17:47:06 -0400

Hello,

I have to implement an LDAP client in C, which has to submit several LDAP
requests in parallel and consequently to process their responses
asynchronously.
Given the specific requirements of my application, the ideal situation for
this LDAP client would be to be notified when a request is completed (e.g.
when all searchResultEntries, searchResultReferences and searchResultDone of
a given search request are received). The notification could be the call of
a callback function with the messageId of the request as a parameter.

I looked at different LDAP Client APIs (OpenLDAP, Netscape SDK 4.1), but
there is no notion of "end-of-request" notifications. The only way to check
if a request is completed is to call the "ldap_result()" function for the
messageId of each outstanding request, in a waiting or polling mode.

Did I miss something in the LDAP client APIs above?
Does someone know another LDAP client API in C that would meet the
"end-of-request" notification requirement?
All remarks and suggestions are very welcome.

Thank you

Laurent

---

From: "James P. Salsman" <[email-masked]>
Date: Thu, 24 May 2001 20:16:45 -0700 (PDT)

>... The only way to check
> messageId of each outstanding request, in a waiting or polling mode....

If you are compiling in an envionment that supports threads, make a 
new thread to call ldap_result() in waiting (blocking) mode, and then 
notify your main thread when it returns.  If you are unable or 
unwilling to use threads (perfectly sensible) then concurrent 
process(es) can be used.

By the way, the only non-threadsafe function in the C standard library 
these days is strtok(); don't use that (or any function saving global 
state in static variables; meant to be called from more than one place) 
if you want your code to be threadsafe.

Cheers,
James