### Step 5: Create a Filter

The filter input parameter is used to eliminate entries from the search that are not wanted. Information is only returned on entries that satisfy the filter.

DS_C_FILTER inherits the attributes from its superclass OM_C_OBJECT, as do all OM classes. OM_C_OBJECT (as defined in XDS Class Definitions) has one OM attribute, OM_CLASS, which has the value of an object identifier string that identifies the numeric representation of the object's OM class. DS_C_FILTER, on the other hand, has several OM attributes.

The purpose of the DS_C_FILTER is to select or reject an object on the basis of information in its directory entry. It has the following OM attributes:

· DS_FILTER_ITEMS

· DS_FILTERS

· DS_FILTER_TYPE

Two of these OM attributes, DS_FILTER_ITEMS and DS_FILTERS, have values that are OM object classes themselves. The OM attribute DS_FILTER_ITEMS has the value OM class DS_C_FILTER_ITEM. DS_C_FILTER_ITEM is a component of a filter and defines the nature of the filter. The OM attribute DS_FILTERS has the value of OM class DS_C_FILTER and thus defines a collection of filters. The OM attribute DS_FILTER_TYPE has a value that is an enumerated type, which takes one of the values DS_AND, DS_OR, or DS_NOT.

The following figure shows the relationship of DS_C_FILTER to its superclass OM_C_OBJECT, and its attributes.

OM Class DS_C_FILTER

The DS_NO_FILTER constant can be used as the value of this parameter if all entries are searched and no entries are eliminated. This corresponds to a filter with a DS_FILTER_TYPE value of DS_AND, and no values of the DS_FILTERS or DS_FILTER_ITEMS OM attributes.

The following code fragment from acl.c shows the descriptor list for a filter:

/* The following descriptor list specifies a filter */

/* for search : */

/* (Present: objectClass) */

static OM_descriptor filter_item[] = {

OM_OID_DESC(OM_CLASS, DS_C_FILTER_ITEM),

{DS_FILTER_ITEM_TYPE, OM_S_ENUMERATION, {DS_PRESENT, 0} },

OM_OID_DESC(DS_ATTRIBUTE_TYPE, DS_A_OBJECT_CLASS),

OM_NULL_DESCRIPTOR

};

static OM_descriptor filter[] = {

OM_OID_DESC(OM_CLASS, DS_C_FILTER),

{DS_FILTER_ITEMS, OM_S_OBJECT, {0, filter_item} },

{DS_FILTER_TYPE, OM_S_ENUMERATION, {DS_AND, 0} },

OM_NULL_DESCRIPTOR

};

###