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.