Hallvard B Furuseth | 27 Aug 11:40
Favicon

LDAP* which calls private functions for I/O?

I'd like to use libldap to generate and parse LDAP messages in
memory, without doing any I/O operations.  Presumably by using
a Sockbuf which calls my private functions to handle messages.
Is that possible today?  If not, could we add an API for it?

--

-- 
Hallvard

Howard Chu | 27 Aug 12:42

Re: LDAP* which calls private functions for I/O?

Hallvard B Furuseth wrote:
> I'd like to use libldap to generate and parse LDAP messages in
> memory, without doing any I/O operations.  Presumably by using
> a Sockbuf which calls my private functions to handle messages.
> Is that possible today?  If not, could we add an API for it?

Anybody can write a sockbuf driver, without needing any private APIs. See my 
attachment to this bug https://bugzilla.mozilla.org/show_bug.cgi?id=292127 for 
an example. (It interfaces libldap to Mozilla's Personal Security Manager 
(PSM) to let it handle SSL sessions. This lets you use OpenLDAP's libldap with 
Mozilla/Firefox/Thunderbird/Seamonkey instead of the Mozilla libldap. It only 
does the top half of the interface work that libldap/tls.c does, but that's 
all you need. If you wanted your private message handlers to feed back into 
the sockbuf stack, you'd have to implement the bottom half, like libldap/tls.c 
does.)

You just need to write your sockbuf handler and use ber_sockbuf_add_io to push 
it on.

--

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Hallvard B Furuseth | 27 Aug 15:31
Favicon

Re: LDAP* which calls private functions for I/O?

Howard Chu writes:
> Anybody can write a sockbuf driver, without needing any private
> APIs. See my attachment to this bug
> https://bugzilla.mozilla.org/show_bug.cgi?id=292127 for an example.

Thanks.  Where do I get the LDAP* from though?  I have no hostname or
file descriptor to associate with it.

--

-- 
Hallvard

Howard Chu | 27 Aug 20:22

Re: LDAP* which calls private functions for I/O?

Hallvard B Furuseth wrote:
> Howard Chu writes:
>> Anybody can write a sockbuf driver, without needing any private
>> APIs. See my attachment to this bug
>> https://bugzilla.mozilla.org/show_bug.cgi?id=292127 for an example.
>
> Thanks.  Where do I get the LDAP* from though?  I have no hostname or
> file descriptor to associate with it.
>
Use ldap_init_fd() with a fake fd, and proto LDAP_PROTO_EXT.

--

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/


Gmane