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

Re: LDAP C++ SDK



Hello,

> I started to develop a C++-API for LDAP. I am doing this as the final
> project (diploma thesis) for my computer science studies.

I like the idea. I had a look at this myself, but I'm lacking the
spare time right now for such a project.

> First of all, there is no really useable piece of software at
> the moment (just a few class that wrap the C-API calls)
> 
> Here are some points I'd like to hear your thoughts about:
> 
> - The basic design will be similar to that of Netscapes Java-SDK.

You know the internet drafts regarding LDAP under

http://www.ietf.org/ids.by.wg/ldapext.html

especially

draft-ietf-ldapext-ldap-java-api-11.txt and
draft-ietf-ldapext-ldap-java-api-asynch-ext-05.txt?

I'd take them as a reference. I haven't used these APIs extensively,
but from reading the drafts I liked the design presented there. It
looked quite intuitive to me, but also complete and extensible. I'm
not a master in OO methodology, so others might find some problems at
first glance. Other problems might show up, while you're developing
your class hierarchy for C++. But it will surely serve as a good start
and discussion point.

I would of course use features like operator overloading to avoid some
of the Java specifics, that I personally find clumsy.

> - Which features of C++ should be used?  
>   Exceptions for error handling
>   Standard Library for some dynamic containers (e.g. list or vector)
> 
>   I would prefer to asume a ISO-Standard C++ Compiler so I can use these 
>   features. I think error handling with exception is a quite useful
>   thing.

Yes, I'd do so, too. Both the STL and exceptions are very useful. But
expect some problems even with modern compilers. It's a pity that
these problems still exist.

Regarding the STL you could of course avoid it in your specification
and make this an implementation specific detail.

But I'd find it hard to work without exceptions. Some of your
constructors might do some very difficult things, that can easily fail
(open up a connection, bind, do authorization etc.). Working without
exceptions is very difficult in this case and might be a pain for a
potential user of your library, when he'd have to check for errors in
other ways.

> - I plan to use some parts of the C-API inside of my C++ API (e.g. the
>   Network I/O and BER-encoding/decoding). I think this would reduce possible 
>   bugs (and work :) ) a lot. The thing is that I didn't find docs for the
>   network I/O stuff. Is there any, or do I have to look into the sources?

What exactly do you mean by network I/O stuff? I think it's not a
problem to start wrapping the C-API calls. One could still extend this
by "pure" C++ functions and methods later if problems of any kind
arise. For a diploma thesis it could of course be a good idea to dig
deeper, just for the effects of learning. But this is up to you, of
course. And the C-API calls are documented quite good, I think.

Regards and good luck,

Stephan