Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_search_ext_s()

Searches the directory synchronously.

Syntax

#include <ldap.h>
int ldap_search_ext_s( LDAP *ld, const char *base, int scope,
   const char *filter, char **attrs, int attrsonly,
   LDAPControl **serverctrls, LDAPControl **clientctrls,
   struct timeval *timeoutp, int sizelimit, LDAPMessage **res );

Parameters

This function has the following parameters:

ld

Connection handle, which is a pointer to an LDAP structure containing information about the connection to the LDAP server.

base

Distinguished name (DN) of the entry that serves as the starting point for the search. For example, setting base to "o=Airius.com" restricts the search to entries at Airius.com.

scope

Scope of the search, which can be one of the following values:

filter

String representation of the filter to apply in the search. You can specify simple filters with the following syntax:

For details on the syntax for filters, see "Specifying a Search Filter" on page 113.

attrs

A NULL-terminated array of attribute types to return from entries that match filter. If you specify a NULL, all attributes will be returned.

attrsonly

Specifies whether or not attribute values are returned along with the attribute types. This parameter can have the following values:

serverctrls

Pointer to an array of LDAPControl structures representing LDAP server controls that apply to this LDAP operation. If you do not want to pass any server controls, specify NULL for this argument.

clientctrls

Pointer to an array of LDAPControl structures representing LDAP client controls that apply to this LDAP operation. If you do not want to pass any client controls, specify NULL for this argument.

timeoutp

Pointer to a timeval structure specifying the maximum time to wait for the results of the search.

sizelimit

Maximum number of results to return in the search.

res

Results of the search (when the call is completed).

Returns

One of the following values:

The following result codes can be returned by the Netscape Directory Server when processing an LDAP search request. Other LDAP servers may send these result codes under different circumstances or may send different result codes back to your LDAP client.

Note that the Netscape Directory Server may send other result codes in addition to the codes described here (for example, the server may have loaded a custom plug-in that returns other result codes).

Description

The ldap_search_ext_s() searches the directory for matching entries synchronously.

You can use this function to pass LDAP server controls to the server if you want the server to sort the results or if you want to request a persistent search. (See ldap_create_sort_control() and ldap_create_persistentsearch_control() for more information on these controls.)

This function is a new version of the ldap_search_s() function. If you are writing a new LDAP client, you should call this function instead of ldap_search_s().

ldap_search_ext_s() is a synchronous function, which directly returns the results of the operation. If you want to perform other operations while waiting for the results of this operation, call the asynchronous function ldap_search_ext() instead. (For more information on asynchronous and synchronous functions, see "Calling Synchronous and Asynchronous Functions" on page 80.)

For more information on searching the directory, see Chapter 6, "Searching the Directory".

Example

See the example under "Example: Searching the Directory (Synchronous)" on page 146.

See Also

ldap_search_ext().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23