[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Writing my own backend



Is any parsing API exist or Operation data structure already content
parsed data?

-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org] On Behalf Of Michael
Margulis
Sent: Tuesday, September 28, 2004 3:30 PM
To: ando@sys-net.it
Cc: openldap-software@OpenLDAP.org
Subject: RE: Writing my own backend

Pierangelo,
First many thanks for your response. 
Regarding your suggestion I think I do need a custom backend to provide
LDAP access to our proprietary database, which is not LDAP and no SQL
accessible. I'll continue to ask you some questions about my custom
backend.

How front-end knows about backend presence (files to modify, etc.)?

Can you describe backend state machine, the order of function calls? As
I understand module_init() is called first. What it the sequence of
other calls?

Do you have any information about Operation and SlapReply structures or
about any helper APIs that can be helpful to access them?

Is front-end can provide any information to backend: API, ect. ?

Best Regards,
Michael




-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org] On Behalf Of Pierangelo
Masarati
Sent: Monday, September 27, 2004 11:53 PM
To: Michael Margulis
Cc: openldap-software@OpenLDAP.org
Subject: Re: Writing my own backend

> Hi OpenLDAP gurus,
> I'm thinking about development of custom OpenLDAP backend and looking
> for your advice where to start. Is there any document/case study that
> explains how new backend can be integrated to the system, any clues?

Copy from an existing backend; make it dynamic and load it via
moduleload,
so you won't even need to touch existing code.
The essential is the module_init() function that registers your backend
in
the backend list.  Essentially, you need to provide a BackendInfo
structure filled with all the hooks you backend is willing to provide; i
mean: the bi_init, bi_open, ..., bi_db_init, bi_db_config, bi_db_open,
...
bi_add, bi_delete, ... and so.  You can (safely?) leave NULL those that
you do not intend to implement (I guess if some are not defined your
backend is not going to be much useful ;).
The calling convention for the operation-related hooks is uniform, and
it
looks like (Operation *, SlapReply *).  The first structure contains
data
about the operation, the second brings back the results.  You need to
carefully read and understand the structures in slap.h to be able to use
the members of both structures.
A good example is provided by existing backends.  I would suggest
back-ldap because it's perhaps the one I'm most familiar with, and
because
its code is (or at least used to be) really straightforward.

One (humble) suggestion: do you really need your own backend?  If all
you
need is a proof of concept, perhaps back-perl (if you know perl) or
back-shell can be an option; if all you need is a small bit of
functionality on top of an existing backend, look at overlays
(servers/slapd/overlays/slapover.txt) or SLAPI (google).

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it


    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax:
+390382476497