Table of Contents | Previous | Next | Index

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

ldap_create_filter()

The ldap_create_filter() routine constructs an LDAP search filter. For more information about filters, see "Creating Filters Programmatically" on page 165.

Syntax

#include <ldap.h>
int ldap_create_filter( char *buf, unsigned long buflen,
   char *pattern, char *prefix, char *suffix, char *attr,
   char *value, char **valwords );

Parameters

This function has the following parameters:

buf

Buffer to contain the constructed filter.

buflen

Size of the buffer.

pattern

Pattern for the filter.

prefix

Prefix to prepend to the filter (NULL if not used).

suffix

Suffix to append to the filter (NULL if not used).

attr

Replaces %a in the pattern.

value

Replaces %v in the pattern.

valwords

Replaces %vM through %vN in the pattern.

Returns

One of the following values:

Example

The following section of code builds the filter (mail=bjensen@airius.com).

char buf[LDAP_FILT_MAXSIZ];
char *pattern = "(%a=%v)";
char *attr = "mail";
char *value = "bjensen@airius.com";
...
ldap_create_filter( buf, LDAP_FILT_MAXSIZ, pattern, NULL, NULL, attr, 
         value, NULL );
...

See Also

ldap_init_getfilter(), ldap_init_getfilter_buf(), ldap_getfirstfilter(), ldap_getnextfilter(), ldap_set_filter_additions().


Table of Contents | Previous | Next | Index

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