[Previous] [Next] [TOC] [Index]

Chapter 9
Functions

his chapter lists all the public functions of the LDAP API in alphabetic order. Each description identifies the name of the function, its header file, its syntax, what it returns, its parameters, and an example of its use.

There are two ways you can look up a function. You can view the functions either:

Summary of Functions by Task

This section summarizes the functions that you can call to perform these tasks:

Initializing and Ending LDAP Sessions

Call the following functions to initialize a session, set session options, and end a session.
Functions for initializing and ending LDAP sessions
To do this: Call this function:
Initialize an LDAP session ldap_init()
Initialize an LDAP session over SSL ldapssl_init()
Set session preferences ldap_set_option()
Get session preferences ldap_get_option()
End an LDAP session ldap_unbind() or ldap_unbind_s()

Authenticating to an LDAP Server

Call the following functions to authenticate to an LDAP server.
Functions for authenticating to LDAP servers
To do this: Call this function:
Authenticate to an LDAP server ldap_simple_bind() or ldap_simple_bind_s()
Specify the function used when authenticating to servers during a referral` ldap_set_rebind_proc()

Performing LDAP Operations

Call the following functions to perform LDAP operations on a server.
Functions for performing LDAP operations
To do this: Call this function:
Add a new entry to the directory ldap_add() or ldap_add_s()
Modify an entry in the directory ldap_modify() or ldap_modify_s()
Delete an entry from the directory ldap_delete() or ldap_delete_s()
Rename an entry in the directory ldap_modrdn2() or ldap_modrdn2_s()
Search the directory ldap_search(), ldap_search_s(), or ldap_search_st()
Compare entries in the directory ldap_compare() or ldap_compare_s()
Check the results of an asynchronous operation ldap_result()
Free the results from memory ldap_msgfree()
Cancel an asynchronous operation ldap_abandon()

Getting Search Results

Call the following functions to retrieve search results.
Functions for getting search results
To do this: Call this function:
Get the distinguished name for an entry ldap_get_dn()
Get the first entry in a chain of search results ldap_first_entry()
Get the next entry in a chain of search results ldap_next_entry()
Count the number of entries in a chain of search results ldap_count_entries()
Get the name of the first attribute in an entry ldap_first_attribute()
Get the name of the next attribute in an entry ldap_next_attribute()
Get the string values of an attribute ldap_get_values()
Get the binary values of an attribute ldap_get_values_len()
Count the string values of an attribute ldap_count_values()
Count the binary values of an attribute ldap_count_values_len()
Free the memory allocated for the string values of an attribute ldap_value_free()
Free the memory allocated for the binary values of an attribute ldap_value_free_len()

Sorting Search Results

Call the following functions to sort search results.
Functions for sorting search results
To do this: Call this function:
Sort the entries by distinguished name or by a single attribute ldap_sort_entries()
Sort the entries by multiple attributes ldap_multisort_entries()
Sort the values of an attribute ldap_sort_values()
A case-insensitive comparison function that you can pass to ldap_sort_values() ldap_sort_strcasecmp()

Working with Search Filters

Call the following functions to initialize, retrieve, and build filters.
Functions for working with search filters
To do this: Call this function:
Read a filter configuration file into memory ldap_init_getfilter()
Read a filter configuration from a buffer ldap_init_getfilter_buf()
Specify the prefix and suffix to be added to all filters retrieved from the filter configuration ldap_set_filter_additions()
Retrieve the first matching filter from the filter configuration ldap_getfirstfilter()
Retrieve the next matching filter from the filter configuration ldap_getnextfilter()
Free the filter configuration from memory ldap_getfilter_free()
Build a filter ldap_create_filter()

Working with Distinguished Names

Call the following functions to retrieve a distinguished name from an entry and to split a distinguished name into its component parts.
Functions for working with distinguished names
To do this: Call this function:
Get the distinguished name for an entry ldap_get_dn()
Split up a distinguished name into its components ldap_explode_dn()
Split up a relative distinguished name into its components ldap_explode_rdn()

Working with LDAP URLs

Call the following functions to interpret LDAP URLs.
Functions for working with LDAP URLs
To do this: Call this function:
Determine if a URL is an LDAP URL ldap_is_ldap_url()
Split up an LDAP URL into its components ldap_url_parse()
Perform the search specified by an LDAP URL ldap_url_search(), ldap_url_search_s(), or ldap_url_search_st()
Free the memory allocated for a parsed URL ldap_free_urldesc()

Handling Errors

Call the following functions to handle errors returned by the LDAP API functions.
Functions for handling errors
To do this: Call this function:
Print out the error message for the last error that occurred ldap_perror()
Get information about the last error that occurred ldap_get_lderrno()
Set information about an error ldap_set_lderrno()
Get the error code resulting from an asynchronous LDAP operation ldap_result2error()
Get the error message for a specific error code ldap_err2string()

Freeing Memory

Call the following functions to free memory allocated by the LDAP API functions.
Functions for freeing memory
To do this: Call this function:
Free memory allocated by an LDAP API function call ldap_memfree()
Free the structures allocated for adding or modifying entries in the directory. ldap_mods_free()
Free the memory allocated for search results or other LDAP operation results ldap_msgfree()
Free the memory allocated for the string values of an attribute ldap_value_free()
Free the memory allocated for the binary values of an attribute ldap_value_free_len()
Free the filter configuration from memory ldap_getfilter_free()
Free the memory allocated for a parsed URL ldap_free_urldesc()
Free the memory allocated for a BerElement structure ldap_ber_free()

Functions (in alphabetical order)


[Previous] [Next] [TOC] [Index]

Last modified: March 31, 1997
Copyright © 1997 Netscape Communications Corporation