Need information related to multi thread support in OpenLDAP c sdk client
venugopal chinnakotla <[email protected]> Fri, 5 Sep 2025 15:26:28 +0530
| Newsgroups | gmane.network.openldap.technical,gmane.network.openldap.devel |
|---|---|
| Message-ID | <CAJCMw6t1hMPiwBweZf4poTSLqL0rApO=UxA8zA237kGRYchW-A@mail.gmail.com> |
--000000000000c10adf063e0ada51
Content-Type: text/plain; charset="UTF-8"
Hi Team,
We are working on migration of nsldap C sdk to OpenLDAP c sdk for our
application client code. As part of this activity, replacing API one by one
and also looking for constant replacement.
In NSLDAP C SDK: /* * Thread function callbacks (an API extension -- *
LDAP_API_FEATURE_X_THREAD_FUNCTIONS). */ #define LDAP_OPT_THREAD_FN_PTRS
0x05 /* 5 - API extension */
/* * Thread callback functions: */ typedef void *(LDAP_C LDAP_CALLBACK
LDAP_TF_MUTEX_ALLOC_CALLBACK)( void ); typedef void (LDAP_C LDAP_CALLBACK
LDAP_TF_MUTEX_FREE_CALLBACK)( void *m ); typedef int (LDAP_C LDAP_CALLBACK
LDAP_TF_MUTEX_LOCK_CALLBACK)( void *m ); typedef int (LDAP_C LDAP_CALLBACK
LDAP_TF_MUTEX_UNLOCK_CALLBACK)( void *m ); typedef int (LDAP_C
LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)( void ); typedef void (LDAP_C
LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)( int e ); typedef int (LDAP_C
LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)( char **matchedp, char
**errmsgp, void *arg ); typedef void (LDAP_C LDAP_CALLBACK
LDAP_TF_SET_LDERRNO_CALLBACK)( int err, char *matched, char *errmsg, void
*arg );
/* * Structure to hold thread function pointers: */ struct ldap_thread_fns
{ LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc;
LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free; LDAP_TF_MUTEX_LOCK_CALLBACK
*ltf_mutex_lock; LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock;
LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno; LDAP_TF_SET_ERRNO_CALLBACK
*ltf_set_errno; LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno;
LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno; void *ltf_lderrno_arg; };
nsldap c sdk has thread function pointers option to support multi thread
functionality for client programs. In our existing code, we are using
'LDAP_OPT_THREAD_FN_PTRS' option with ldap_set_option API like "Client code
usage: ldap_set_option(hLDAP, LDAP_OPT_THREAD_FN_PTRS, &tfns);".
Now, we are looking for similar functionality within OpenLDAP to use it in
our client program. I Went through OpenLDAP documents and source code, but
to my knowledge, did not get any equivalent one.
Could you please provide more details on this to achieve equivalent
functionality of LDAP_OPT_THREAD_FN_PTRS with OpenLDAP?
Thank you
--000000000000c10adf063e0ada51
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br clear=3D"all"></div><div><p style=3D"box-sizing:b=
order-box;margin-top:0px;margin-bottom:1rem;color:rgb(33,37,41);font-family=
:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helveti=
ca Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoj=
i","Segoe UI Emoji","Segoe UI Symbol","Noto C=
olor Emoji";font-size:14px">Hi Team,</p><span style=3D"color:rgb(33,37=
,41);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Robo=
to,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"=
Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol&qu=
ot;,"Noto Color Emoji";font-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">We are work=
ing on migration of nsldap C sdk to OpenLDAP c sdk for our application clie=
nt code. As part of this activity, replacing API one by one and also lookin=
g for constant replacement.</p><span style=3D"color:rgb(33,37,41);font-fami=
ly:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helve=
tica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Em=
oji","Segoe UI Emoji","Segoe UI Symbol","Noto=
Color Emoji";font-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">In NSLDAP C=
SDK:
/*
* Thread function callbacks (an API extension --
* LDAP_API_FEATURE_X_THREAD_FUNCTIONS).
*/
#define LDAP_OPT_THREAD_FN_PTRS 0x05 /* 5 - API extension */</p>=
<span style=3D"color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystem=
Font,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Not=
o Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji&=
quot;,"Segoe UI Symbol","Noto Color Emoji";font-size:14=
px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">/*
* Thread callback functions:
*/
typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)( void );
typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)( void *m );
typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)( void *m );
typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)( void *m )=
;
typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)( void );
typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)( int e );
typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)(
char **matchedp, char **errmsgp, void *arg );
typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)( int er=
r,
char *matched, char *errmsg, void *arg );</p><span style=3D"color:r=
gb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI&qu=
ot;,Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-seri=
f,"Apple Color Emoji","Segoe UI Emoji","Segoe UI S=
ymbol","Noto Color Emoji";font-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">/*
* Structure to hold thread function pointers:
*/
struct ldap_thread_fns {
LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc;
LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free;
LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock;
LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock;
LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno;
LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno;
LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno;
LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno;
void *ltf_lderrno_arg;
};
nsldap c sdk has thread function pointers option to support multi thread fu=
nctionality for client programs. In our existing code, we are using 'LD=
AP_OPT_THREAD_FN_PTRS' option with ldap_set_option API like "Clien=
t code usage: ldap_set_option(hLDAP, LDAP_OPT_THREAD_FN_PTRS, &tfns);&q=
uot;.</p><span style=3D"color:rgb(33,37,41);font-family:-apple-system,Blink=
MacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,=
"Noto Sans",sans-serif,"Apple Color Emoji","Segoe =
UI Emoji","Segoe UI Symbol","Noto Color Emoji";fon=
t-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">Now, we are=
looking for similar functionality within OpenLDAP to use it in our client =
program. I Went through OpenLDAP documents and source code, but to my knowl=
edge, did not get any equivalent one.</p><span style=3D"color:rgb(33,37,41)=
;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,&=
quot;Helvetica Neue",Arial,"Noto Sans",sans-serif,"Appl=
e Color Emoji","Segoe UI Emoji","Segoe UI Symbol",=
"Noto Color Emoji";font-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">Could you p=
lease provide more details on this to achieve equivalent functionality of L=
DAP_OPT_THREAD_FN_PTRS with OpenLDAP?</p><span style=3D"color:rgb(33,37,41)=
;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,&=
quot;Helvetica Neue",Arial,"Noto Sans",sans-serif,"Appl=
e Color Emoji","Segoe UI Emoji","Segoe UI Symbol",=
"Noto Color Emoji";font-size:14px">
</span><p style=3D"box-sizing:border-box;margin-top:0px;margin-bottom:1rem;=
color:rgb(33,37,41);font-family:-apple-system,BlinkMacSystemFont,"Sego=
e UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sa=
ns-serif,"Apple Color Emoji","Segoe UI Emoji","Seg=
oe UI Symbol","Noto Color Emoji";font-size:14px">Thank you</=
p></div></div>
--000000000000c10adf063e0ada51--