Sun logo      Copyright      Index      Next     

Sun Java System LDAP SDK for C Programming Guide

Contents


List of Figures

List of Tables

List of Code Examples

Preface
Audience for This Guide
Directory Server Resource Kit Documentation Set
Tools Reference
LDAP SDK for C Programming Guide
LDAP SDK for Java Programming Guide
Documentation Conventions Used in This Guide
Typographical Conventions
Terminology
Related Sources of Information
Directory Server Documentation
Sources of Information
Third-Party Sources of Information
The Mozilla Project
LDAP and Associated Information
Acknowledgements
Documentation Feedback

Part 1 Getting Started

Chapter 1   Introduction
Overview
The LDAP API
Synchronous and Asynchronous Operations
Installation Instructions
Provided Directories and Files
Header Files
ldap.h
lber.h
ldap_ssl.h
ldappr.h
Miscellaneous Files
Libraries
Library Naming Conventions
Installed Shared Libraries
Dependencies
LDAP Tools
Compiling Applications
Compiling on UNIX Platforms
Compiling on Windows Systems
Using the DLL
Definitions
Linking To NSPR Libraries
Linking Dependencies
The Example Programs
Synchronous Examples
Asynchronous Examples

Chapter 2   Sample Client
The Source Code
Compiling the Client
Compiling on Solaris
Compiling on Windows NT
Running the Client
Running on UNIX
Running on Windows NT

Part 2 Working with the LDAP SDK for C

Chapter 3   Writing an LDAP Client
Designing an LDAP Client
Initializing an LDAP Session
Specifying a Single LDAP Server
Specifying a List of LDAP Servers
Session Initialization Sample Code
Setting Session Preferences
Setting the Restart Preference
Specifying the LDAP Version of Your Client
Binding and Authenticating to an LDAP Server
Methods of Authentication
Simple Authentication
Certificate-based Client Authentication
Simple Authentication and Security Layer (SASL)
Using Simple Authentication
Performing a Synchronous Authentication Operation
Performing an Asynchronous Authentication Operation
Binding Anonymously
Performing LDAP Operations
Closing the Connection to the Server

Chapter 4   Using the LDAP API
Synchronous and Asynchronous Functions
Calling Synchronous Functions
Calling Asynchronous Functions
To Verify That an LDAP Request Was Sent
To Retrieve the Server Response
To Get Information from a Server Response
To Free LDAPMessage Structure
To Cancel an Operation in Progress
Sample Code to Call an Asynchronous Function
Retrieving SDK Information
Managing Memory
Reporting Errors
Setting Error Codes
Getting Information About an Error
To Get Information from an LDAPMessage Structure
To Get Information from an LDAP Structure
Getting the Error Message from an Error Code
Receiving the Matching Portion of a DN
Printing Out Error Messages
Handling Referrals
Search References and Referrals
Enabling or Disabling Referral Handling
Limiting Referral Hops
Binding For Referrals
How Referral Binding Works
Defining the Rebind Function
Registering the Rebind Function
Setting Up an In-Memory Cache
Handling Failover
Creating a New Connection Handle
Using the Reconnect Option

Chapter 5   Searching a LDAP Directory
Overview
Sending a Search Request
Search Parameters
Specifying the Base DN and Scope
Defining a Search Filter
Specifying Attributes to Retrieve
Sorting Attributes
Operational Attributes
Setting Search Preferences
Getting Search Results
Getting Results Synchronously
Getting Results Asynchronously
Determing Search Result Types
Getting Distinguished Names for Each Entry
Getting the Distinguished Name of an Entry
Getting the Components of a Distinguished Name
Getting Attribute Names from an Entry
Getting the Values of an Attribute
Getting Referrals from Search References
Sorting the Search Results
Server-Side Sorting
Client-Side Sorting
Sorting Entries by an Attribute
Sorting Entries by Multiple Attributes
Sorting the Values of an Attribute
Freeing the Search Results
Search Examples
Reading an Entry with a Search
Listing Subentries with a Search
Sending A Search Request

Chapter 6   Using Filter Configuration Files
Filter Configuration Files
The Filter Configuration File Syntax
Tag
Patterns
Delimiters
Filters
Descriptions
Filter Parameters
Loading a Filter Configuration File
Retrieving Filters
Filter Prefixes and Suffixes
Freeing Filters from Memory
Creating Filters Programmatically

Chapter 7   Adding, Modifying and Deleting Entries
Specifying Entry Information
Adding an Entry
Specifying Values for Attributes
Specifying a Single Value in an Attribute
Specifying Multiple Values in an Attribute
Specifying Binary Data as the Value of an Attribute
Specifying Attributes in the Entry
Adding the Entry to the Directory
Synchronous Add Operation
Asynchronous Add Operation
Modifying an Entry
Types of Modifications
Replacing the Values of an Attribute
Removing Values from an Attribute
Adding Values to an Attribute
Removing an Attribute
Adding an Attribute
Creating an Array of Changes
Modifying the Entry in the Directory
Synchronous Modify Operation
Asynchronous Modify Operation
Deleting an Entry
Synchronous Delete Operation
Asynchronous Delete Operation
Changing the DN of an Entry
Synchronous Renaming Operation
Asynchronous Renaming Operation
Deleting the Attribute from the Old RDN
Changing the Location of the Entry
Synchronous Relocation of an Entry
Asynchronous Relocation of an Entry

Chapter 8   Comparing Entries
Overview
Synchronous Comparison Operations
Asynchronous Comparison Operations

Chapter 9   Working with LDAP URLs
Understanding LDAP URLs
Escaping Characters
Delimiting Fields
Examples of LDAP URLs
Specifying a Base Search
Retrieving One Attribute
Retrieving Multiple Attributes
Retrieving Entries from Multiple Levels
Retrieving Entries from One Level
Determining an LDAP URL
Getting the Components of an LDAP URL
Freeing the Components of an LDAP URL
Processing an LDAP URL

Part 3 Advanced Topics

Chapter 10   Retrieving Server Information
Understanding DSEs
Getting the Root DSE
Determining LDAPv3 Support
Getting Schema Information

Chapter 11   Connecting Over SSL
SSL and the LDAP SDK for C
Connecting to an LDAP Server Over SSL
Alternative to ldapssl_init()
Handling Errors
Installing Your Own SSL I/O Functions
Using Certificate-Based Client Authentication

Chapter 12   Using SASL Authentication
Understanding SASL
Determining Supported SASL Mechanisms
Authenticating Using SASL
Synchronous SASL Bind Operation
Asynchronous SASL Bind Operation

Chapter 13   Working with LDAP Controls
How LDAP Controls Work
Using Controls in the LDAP API
Determining Supported Controls
Using the Server-Side Sorting Control
Specifying the Sort Order
Creating the Control
Performing the Search
Interpreting the Results
Server-Sorting Control Sample Program
Using the Persistent Search Control
Using the Entry Change Notification Control
Using the Virtual List View Control
Using the Manage DSA IT Control
Using Password Policy Controls
Using the Proxied Authorization Control
The Proxy Right
The Proxied Authorization Control
Proxy Authorization Sample Program

Chapter 14   Writing Multithreaded Clients
Specifying Thread Functions
Setting Up the ldap_thread_fns Structure
Setting Up the ldap_extra_thread_fns Structure
Setting Session Options
Pthreads Client Application

Chapter 15   Extended Operations
How Extended Operations Work
Determining Supported Extended Operations
Performing an Extended Operation
Synchronous Extended Operation
Asynchronous Extended Operation
Sample Code to Perform an Extended Operation

Part 4 Reference Guide

Chapter 16   Data Type Reference
Conventions
Typrographical
Deprecated Structures
Structure Summary by Task
BER Structures
Structures for the Core API
Structures for API Extensions
Referral Binding Callback
Client-Side Sorting Callbacks
Extended I/O Control
Memory Management Control
Thread Signaling Controls
Deprecated and Outdated Types
Structures Alphabetically

Chapter 17   Function Reference
Typographic Conventions
Function Summary by Task
Working with Basic Encoding Rules
Managing LDAP Sessions
Performing LDAP Operations
Processing Search Results
Reading the Contents of an Entry
Sorting Search Results
Working with Search Filters
Using LDAPv3 Controls
Using Sun Java System Extensions
Working with LDAP URLs
Working with UTF-8 Encoding
Handling Errors
Managing Memory
Working with Netscape Portable Runtime
Deprecated and Outdated Functions
Outdated Standard Functions and Equivalents
Functions Alphabetically

Chapter 18   Result Codes
Overview
Result Codes Summary in Numerical Order
Result Codes Summary By Server/Client
Result Codes Reference in Alphabetical Order

Glossary

Appendix A   An Introduction to LDAP
Overview
How Directory Services Work
Defining Information Using LDAP
The LDAP Schema
The LDIF File Format
Organizing LDAP Within a Directory Server
Distinguished Names
Data Distribution
Additional Information

Index


Copyright      Index      Next     


Copyright 2004 Sun Microsystems, Inc. All rights reserved.