> DNU home > code projects page 1
Searching for Attribute Values - Source Code Details 2
DeveloperNet University Article

An NDS search filter is really nothing more than a logical expression describing the attributes in the object being sought. In the case of this example, we are looking for all User objects with a particular last name. To do this we will need an expression composed of two subexpressions.

The first subexpression is used to qualify the type of object. We want User objects. We use the "Object Class" attribute to make sure that we are just searching for User objects. In our example, this expression looks like this:

 attribute name "Object Class"
 equal to
 Value "User"
 

The second expression is used to qualify the User object's Surname attribute. In our example, the search user may not know exactly what the last name of his target user, so we want NDS to make an approximation of equality. This expression looks like this:

 attribute name "Surname"
 approximately equal to
 Value theSurName
 

So, altogether the expression looks like this:

 attribute name "Object Class"
 equal to
 Value "User"
 
 AND
 
 attribute name "Surname"
 approximately equal to
 Value theSurName
 

Each one of the items in the expression shown above is called a filter token or FTOK. See Table 1 for a list of possible filter tokens.

Table 1: Filter Tokens

After we translate our expression to use filter tokens, it looks like this:

 FTOK_ANAME "Object Class"
 FTOK_EQ 
 FTOK_AVAL "User"
 
 FTOK_AND
 
 FTOK_ANAME "Surname"
 FTOK_APPROX 
 FTOK_AVAL theSurName
 

As you can see, some tokens contain values. For example, the FTOK in the first subexpression contains the value "Object Class" specifying the Object Class attribute. FTOK_AVAL of course, is a value.

Equals is a relational operator token. Relational operator tokens contain no values but express a relationship between two tokens that do. Another example of a relational token would be less than or equal to.

Two subexpressions can be joined together with a logical operator token like AND expressing a logical relationship between subexpressions or values. There are also tokens signifying parentheses, which can be used to group subexpressions or values.

Tokens are installed sequentially into a search filter with the NWDSAddFilterToken call.

The prototype for NWDSAddFilterToken is shown below:

 (NWDSCCODE) NWDSAddFilterToken (pFilterCursor_T cur, nuint16 tok,  nptr val, nuint32 syntax );

cur Specifies the NDS context for the request.

tok Specifies the token type (see Table 1).

val Points to the attribute name/or value associated with the token.

syntax Specifies the syntax associated with the val parameter (see Table 2).

Note: Non-zero return values from NWDSAddFilterToken indicate an error. To understand handling client side NDS errors, refer to handling_errors.

Name

C Value

Description

SYN_UNKNOWN

0

Stores values which are binary strings.

SYN_DIST_NAME

1

Stores values which are the names of objects in the NDS tree.

SYN_CE_STRING

2

Stores values which are Unicode strings, and these strings are case sensitive in comparison operations.

SYN_CI_STRING

3

Stores values which are Unicode strings, and these strings are case insensitive in comparison operations.

SYN_PR_STRING

4

Stores values which are printable strings as defined in CCITT X.208.

SYN_NU_STRING

5

Stores values which are numeric strings as defined in CCITT X.208.

SYN_CI_LIST

6

Stores values which are ordered sequences of Unicode strings, and these strings are case insensitive in comparison operations.

SYN_BOOLEAN

7

Stores values which are either TRUE or FALSE.

SYN_INTEGER

8

Stores values which are signed numeric integers.

SYN_OCTET_STRING

9

Stores values which are binary strings.

SYN_TEL_NUMBER

10

Stores values which are telephone numbers.

SYN_FAX_NUMBER

11

Stores values which are strings that comply with the format agreed upon for international telephone numbers (E.123) and optional bit strings (Recommendation T.30).

SYN_NET_ADDRESS

12

Stores values which represent network-layer addresses in binary format.

SYN_OCTET_LIST

13

Stores values which are ordered sequences of binary strings.

SYN_EMAIL_ADDRESS

14

Stores values which are strings of binary information.

SYN_PATH

15

Stores values which contain the file system path information for locating a file on a NetWare volume.

SYN_REPLICA_POINTER

16

Stores values which are used by Replica attributes.

SYN_OBJECT_ACL

17

Stores values which are ACL attributes.

SYN_PO_ADDRESS

18

Stores values which are Unicode strings of postal addresses.

SYN_TIMESTAMP

19

Stores values which mark the time when a particular event occurred.

SYN_CLASS_NAME

20

Stores values which are NDS object class names. These names are case sensitive in comparison operations.

SYN_STREAM

21

Stores values which are arbitrary binary information.

SYN_COUNTER

22

Stores values which are incrementally modified, signed integers. Modifications to the value are arithmetically added to, or subtracted from, the total.

SYN_BACK_LINK

23

Stores the identity of the object that requires an external reference and the server that stores the reference.

SYN_TIME

24

Stores values which are unsigned integers and which represent time in seconds.

SYN_TYPED_NAME

25

Stores values which have a level and an interval associated with an object name.

SYN_HOLD

26

Stores values which are signed integers, have a server associated with them, and are modified arithmetically with addition and subtraction.

SYN_INTERVAL

27

Stores values which are signed numeric integers and which also represent intervals of time.

SYNTAX_COUNT

28

Returns the number of syntax definitions

Table 2: Syntax IDs



PREVIOUSblankTop of PageblankNEXT