TOKEN

The TOKEN structure contains information about a token.

typedef struct _TOKEN {
    INT tokenType;
    char  szName[BUFF_SIZE];
    char  szValue[BUFF_SIZE];
    DWORD dwOp;
    char  szArchitecture[BUFF_SIZE];
    char  szGroupClass[BUFF_SIZE];
    char  szAttributeName[BUFF_SIZE];
    char  szTokenString[TOKEN_STRING_SIZE];
    BOOL  bIndent;
} TOKEN;

The TOKEN structure is used to add and read tokens in filters and inventory rules folders.

Members

tokenType
Specifies the type of the token. See token types.
szName
Specifies the name of the attribute to evaluate with the expression token.

Note that szName is used by all filter types except machine filters (MACHINE_FILTER) and attribute filters (ATTRIBUTE_FILTER). Machine and attribute filters use the szAttributeName to specify the name of the attribute to use for the expression. For these two filters, szName is NULL.

szValue
Specifies the comparison value used for the expression. The comparison value is used to evaluate the attribute specified by szName (or szAttributeName) using the operator specified by dwOp.

See Expression Token Values.

dwOp
Specifies a relational operator (such as "is equal to" or "is like") that defines how the comparison value specified by szValue should be compared with the actual value stored for the attribute specified by szAttributeName.

See Expression Token Operators.

szArchitecture
Specifies the architecture of the objects to find with the expression. This member is used only for machine filters and attribute filters.

An architecture is a standard structure used for inventorying a set of related objects. An architecture labels and groups together all objects of a specific type. For example, all personal computers use the Personal Computer architecture, and all SMS system events use the SMSEvents architecture.

szGroupClass
Specifies the class of the group that the attribute used for the expression is part of. This member is used only for machine filters and attribute filters.

A group defines the structure for inventorying an item within an object. A group is a set of attributes that describe a specific type of item. For example, SMS inventories disk drives by using the Disk group. The Disk group has attributes (such as Disk Index, Serial Number, Storage Size, and so on) used to identify and describe a disk drive. When SMS inventories a hard disk drive on a computer, the hard disk drive's inventory is stored as a set of attribute values (for example, Disk Index is C, Serial Number is 10F10470, Storage Size is 59 MB, and so on). A group also has a class name that is used by the SMS system to uniquely identify a group (for example, two groups both have the name Monitor, but have different class names—the different class names make them different groups). A class name is composed of the organization name (usually, the organization that defined the group), a name for the group, and the version number. For example, MICROSOFT|DISK|1.0 is the class name of the group used by the SMS system to inventory disks.

szAttributeName
Specifies the attribute to use in the expression. This member is used only for machine filters and attribute filters.

Note that szName is used by all filter types except machine filters (MACHINE_FILTER) and attribute filters (ATTRIBUTE_FILTER). For all other filters except machine and attribute filters, szAttributeName is NULL.

szTokenString
Specifies the string equivalent of the token. For example, a machine filter could have the following string equivalent: "Personal Computer:MICROSOFT|MOUSE|1.0 Number of Buttons is equal to 2".

For inventory rules folders, the szTokenString member specifies the attributes that identify the file. For example, "file "winword.exe" CHECKSUM 20 200 7232". For inventory rules folders, an expression token uses only the szTokenString member of the TOKEN structure. For information about the format of the expression string for szTokenString, see Inventory Rules Folder Tokens.

bIndent
Specifies whether the szTokenString string should be indented by using prepended space characters to represent groupings. TRUE specifies that the szTokenString should contain spaces to represent a grouping level. FALSE specifies that no spaces are added for indentation.

Remarks

For filters, each token represents a criterion for selecting an object or an operator that defines the relationship of the adjacent tokens.

For inventory rules folders, each token represents the criteria used to identify a file or an operator that defines the relationship of the adjacent tokens. For inventory rules folders, an expression token uses only the szTokenString member of the TOKEN structure.

There are two types of tokens:

Expression token
For filters, an expression token defines how to search for objects that have a specified relationship to a specified value for a specified attribute. An expression token is made up of an attribute, a relational operator, and a comparison value. A relational operator (such as "is equal to" or "is like") defines how the specified value should be compared with the actual value stored for the specified attribute. Depending on the type of filter that contains the token, an expression token's TOKEN structure uses the szName, szArchitecture, szGroupClass, and szAttributeName members to define the attribute. For example, job filters (and most other filters) use the szName member to specify the attribute, whereas machine filters use the szArchitecture, szGroupClass, and szAttributeName members.

For inventory rules folders, expression tokens represent the rule for collecting inventory on a package. An expression token uses only the szTokenString member of the TOKEN structure. The szTokenString member specifies the attributes that identify the file.

Control token
For both filters and inventory rules folders, a control token can be a logical operator or parentheses. A logical operator connects two expression tokens, two subclauses, or a combination of an expression and a subclause. A logical operator defines the relationship between two adjacent expressions or subclauses. Parentheses enable expressions to be grouped together.