How Directory Server Plug-Ins WorkChapter 1 An Overview of Directory Server Plug-Ins 21Calling Directory Server Plug-In FunctionsAt specific LDAP events, the Directory Server calls all plug-in functions that areregistered for that event. For example, before performing an LDAP add operation(an add event), the server calls all plug-in functions registered as pre-operation addfunctions. When the add operation is completed, the server will call all registeredpost-operation add functions.In most plug-in function calls, the server passes a parameter block to the function.The parameter block contains data relevant to the operation. In most DirectoryServer plug-in functions you write, you access and modify the data in theparameter block.For example, when the Directory Server receives an LDAP add request, the serverdoes the following:1. Parses the request and retrieves the new DN and the entry to be added.2. Places pointers to the DN and the entry in the parameter block.3. Calls any registered pre-operation add functions, passing the parameter blockto these functions.4. Calls the registered database add function (which is responsible for adding theentry to the directory database), and passes to it the parameter block.5. Calls any registered post-operation add functions, passing the parameter blockto these functions.If you are writing a function that is invoked before an LDAP operation isperformed, you can prevent the operation from being performed. For example, youcan write a function that validates data before a new entry is added to thedirectory. If the data is not valid, you can prevent the LDAP add operation fromoccurring 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 anoperation. For example, in a pre-operation add function, you can change an entrybefore it is added to the directory.The Directory Server ArchitectureInternally, the Directory Server consists of two major subsections: The front-endand the back-end.