Adds a node to the search filter expression tree.
#include <nwnet.h> or #include <nwdsfilt.h> N_EXTERN_LIBRARY (NWDSCCODE) NWDSAddFilterToken ( pFilter_Cursor_T cur, nuint16 tok, nptr val, nuint32 syntax);
uses netwin32 Function NWDSAddFilterToken (cur : pFilter_Cursor_T; tok : nuint16; val : nptr; syntax : nuint32 ) : NWDSCCODE;
(IN) Points to a Filter_Cursor_T, which defines the current insertion point in the filter expression tree.
(IN) Specifies the token to be added to the filter expression tree (see Section 5.13, Filter Tokens).
(IN) Points to either the attribute name or the attribute value, according to the token being added.
(IN) Specifies the attribute syntax associated with the val parameter (see Section 5.26, Syntax IDs).
0x0000 0000 |
SUCCESSFUL |
nonzero value |
Nonzero values indicate errors. See |
Each node contains a token and a syntax with an associated value. The relationship between the tok, val, and syntax parameters is as follows:
If the tok parameter is FTOK_ANAME (meaning attribute name), the val parameter must point to a copy of the attribute name, and the syntax parameter must be set to the appropriate attribute syntax ID.
If the tok parameter is FTOK_AVAL (meaning attribute value), the val parameter must point to a copy of the attribute value, and the syntax parameter must be set to the appropriate attribute syntax ID.
If the tok parameter is neither FTOK_ANAME or FTOK_AVAL, the val and syntax parameters are ignored and can be set to NULL.
The val parameter must point to a dynamically allocated memory buffer that can be freed by calling either the NWDSPutFilter or NWDSAddFilterToken function.
The NWDSPutFilter function frees up the memory associated with the expression tree. However, if NWDSAddFilterToken returns an error while you are creating an expression tree, you should not call the NWDSPutFilter function, but call the NWDSFreeFilter function to free up the memory associated with the expression tree.
The expect field of the cur parameter contains a bit-map representation of the valid token at the current position in the tree. The tok parameter must correspond to one of these tokens. If NWDSAddFilterToken returns SUCCESSFUL, the expect field is updated according to the next position in the tree (the insertion point of the next token).
Parsing of the token expression list is performed by NWDSAddFilterToken.
For information about how to create a search filter and for more details about eDirectory searches, see Section 1.4, Search Requests. For step-by-step instructions, see Searching eDirectory. For sample code, see ndssearc.c.
NWDSAllocFilter, NWDSDelFilterToken, NWDSFreeFilter, NWDSPutFilter