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

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.)?

You need to register a backend initialization functon somewhere, so the
only change you would need to apply to the frontend is calling this
function; however, by dynamically loading a module, you can call this from
inside module_init() without even touching the frontend code.  Look at
exising backends to see how it works.

>
> 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?

module_init() is called whenever a dynamic module is loaded and the function
exists in the module.  It doesn't necessarily have to be a backend, a
module can do whatever the programmer intended.  You want to use
module_init() to call the function that registers the backend structure,
which contains the hooks to the backend functions that implement the calls
for operations, database management and so.

Then the sequence is:
bi_config
bi_open

bi_db_init
bi_db_config
bi_db_open

bi_op_*

bi_db_close
bi_close
bi_db_destroy
bi_destroy

you don't need to provide all of them; i note that the backend calls
usually are empty, unless your backend needs to do somthing special only
once when more instances of the backend are used.

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

servers/slapd/slap.h, servers/slapd/proto-slap.h for frontend specific
data structures and calls; include/*.h for everything else.

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

from within the backend you will need to exploit many functionalities
provided by the frontend (schema management, access control, filtering and
so).  Again, look at existing backends as a guideline, it's not anything
that can be discussed in an email in such a general sense.  If you
question is "where can I find API documentation?" the answer is: "in the
source".

p.

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


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