                  Directory SDK Examples
                  ----------------------

This directory contains some sample LDAP code to help you understand
how to use the Directory SDK.  These examples are designed to work against
the sample data contained in the Netscape Directory Server 4.x
distribution.  If you want to run these samples, you will need to have
a working LDAP server running, and the sample "example.com" data
loaded.

-------------------
Synchronous samples
-------------------
These samples use the synchronous LDAP calls.  These calls are more
straightforward to use, and it's suggested you look at these examples
first.  These calls will block the calling process until all results
have been returned, so they are probably not appropriate for use in a
client with a graphical user interface which relies an an event loop.
However, they're fine for command-line clients and CGI programs.

search.c
--------
Shows how to use ldap_search_s() to search for all entries which have
an attribute value which exactly matches what you're searching for.  In
this example, all entries with the surname (last name) "Jensen" are
retrieved and displayed.

csearch.c
---------
Like search.c, but enables an in-memory cache.

ssnoauth.c
----------
Like search.c, but the search is done over SSL.

ssearch.c
---------
Like ssnoauth.c, but with certificate based authentication thrown in.

srvrsort.c
----------
Shows how to use server side sorting in conjunction with the
ldap_search_ext_s() function.

rdentry.c
---------
Shows how to use ldap_search_s() to retrieve a particular entry from the
directory.  In this example, the entry:
	uid=bjensen,ou=People,dc=example,dc=com
is retrieved and displayed.

getattrs.c
----------
Just like read.c, but retrieves specific attributes from an entry.

compare.c
---------
Show how to use ldap_compare_s(), which allows you to test if a particular
value is contained in an attribute of an entry.

modattrs.c
----------
Shows how to use ldap_modify_s() to replace and add to values in an attribute.

modrdn.c
--------
Shows how to use ldap_modrdn2_s() to change the relative distinguished name
(rdn) of an entry.

getfilt.c
---------
Shows how to use the ldap_getfilter family of routines, which help generate
LDAP filters based on an arbitrary search string provided by a user.

crtfilt.c
---------
Shows how to use the ldap_create_filter() function to generate LDAP filters.



---------------------
Asynchronous examples
---------------------
These examples use the asynchronous LDAP calls.  The general idea is that
you begin an operation, and then periodically poll to see if any results
have been returned.

asearch.c
---------
Initiates a search for entries, and polls for results, printing them as
they arrive.

nsprio.c
--------
Like asearch.c but using the prldap routines to incorporate NSPR.

add.c
------
Add an entry to the directory.

del.c
------
Delete an entry from the directory.

psearch.c
---------
Shows how to use the Persistent Search LDAPv3 protocol extension to
monitor a directory server for changes.

ppolicy.c
---------
Attempt to bind to the directory, and report back any password expiration
information received.  This demonstrates how clients can process password
policy information that is optionally returned by Netscape Directory Server
3.0 and later.



-------------------
Additional examples
-------------------
The Macintosh or Windows versions of the Directory SDK also include
sample project files.  A sample CodeWarrior project file is included
in the macintosh directory.  

Sample Visual C++ makefiles for a Windows application (winldap) are 
included in the windows directory. The Win32 version of the makefile
is named winldap.mak; the Win16 version of the makefile is named LDAP16.MAK.

If you want to fix up the additional examples and recontribute them back
to mozilla they will gladly be accepted :-)
 
