Complete Contents
Getting Started
Chapter 1 Understanding Server Plug-Ins
Chapter 2 Writing and Compiling Plug-Ins
Chapter 3 Calling the Front-End API Functions
Chapter 4 Quick Start
Chapter 5 Writing Database Plug-Ins
Chapter 6 Writing Pre/Post-Operation Plug-Ins
Chapter 7 Defining Functions for LDAP Operations
Chapter 8 Defining Functions for Database Operations
Chapter 9 Defining Functions for Authentication
Chapter 10 Writing Entry Store/Fetch Plug-Ins
Chapter 11 Writing Extended Operation Plug-Ins
Chapter 12 Writing Matching Rule Plug-Ins
Chapter 13 Data Type and Structure Reference
Chapter 14 Function Reference
Chapter 15 Parameter Reference
Glossary
Previous Next Contents Bookshelf


Chapter 1 Understanding Server Plug-Ins

This chapter introduces the concept of a server plug-in and discusses the different types of plug-ins that you can write.


What Are Server Plug-Ins?
If you want to extend the capabilities of the Netscape Directory Server, you can write your own server plug-in. A server plug-in is a shared object or library (or a dynamic link library on Windows NT) containing your own functions.

You can write your own plug-in functions to extend the functionality of the directory server in the following ways:

On startup, the directory server loads your library and calls your functions during the course of processing various LDAP requests.


How Server Plug-Ins Work
Internally, the directory server has hooks that allow you to register your own functions to be called when specific events occur. For example, the directory server calls a registered plug-in function:

When you register your plug-in, you specify the type of function and the type of plug-in, which both indicate when the function is called (see "Types of Server Plug-Ins" on page  23 for a listing).

How the Server Calls Plug-In Functions

At specific events (such as before an LDAP add operation is peformed), the server calls any plug-in functions registered for that event. For example, before performing an LDAP add operation, the server calls any functions registered as pre-operation add functions.

In most cases, when the server calls your function, it passes a parameter block to your function. This parameter block contains data relevant to the operation. In your server plug-in function, you can access and modify data in this parameter block.

For example, when the directory server receives an LDAP add request, the server does the following:

  1. Parses the request and retrieves the new DN and the entry to be added.
  2. Places pointers to the DN and entry in the parameter block.
  3. Calls any registered pre-operation add functions, passing the parameter block to these functions.
  4. Calls the registered database add function (which is responsible for adding the entry to the directory database), passing it the parameter block.
  5. Calls any registered post-operation add functions, passing the parameter block to these functions.
What Plug-Ins Return to the Server

If you are writing a function that is invoked before an LDAP operation is performed, you can also prevent the operation from being performed. For example, you can write a function that validates data before a new entry is added to the directory. If the data is not valid, you can prevent the LDAP add operation from occurring and return an error message to the LDAP client.

In some situations, you can also set the data that is used by the server to perform an operation. For example, in a pre-operation add function, you can change an entry before it is added to the directory.

How Database Plug-Ins Work

Internally, the Netscape Directory Server consists of two major subsections:

If you want to integrate the directory server with your own database, you just need to add your own back-end to the directory server, configure the back-end to handle the suffix for your directory data, and register your own functions for reading and writing data in the back-end.

Figure 1.1 illustrates the directory server architecture.

Figure 1.1 Directory server architecture


Types of Server Plug-Ins
You can write the following types of server plug-ins for the directory server:

Figure 1.2 illustrates how some of these different plug-in types fit into the directory server architecture.

Figure 1.2 Architecture of the directory server and Server Plug-Ins

Figure 1.3 illustrates how you can replace the standard database.

Figure 1.3 Using a Plug-In to Replace the Standard Database

 

© Copyright 1998 Netscape Communications Corporation