Architecture Filters (ARCHITECTURE_FILTER)

An architecture filter specifies the machine folders within a container. When an architecture filter is set on a container, the machine folders in that container will be of the architecture specified by the architecture filter.

Architecture filters can be applied only to the following containers: site containers, site group containers, and machine containers.

Using the SmsAddToken function, your application can add tokens to an architecture filter. Each expression token represents an architecture. For architecture filters, the tokens can be connected only by using an OP_OR control token—this means that your application must pass OP_OR for the opAndOr parameter when calling the SmsAddToken function.

Note When an attribute filter or machine filter is applied to a container that also has an architecture filter set, the architectures specified in those filters are implicitly added to the list of architectures specified in the architecture filter.

The TOKEN structure that contains the expression token must have the following members:

szName
A string that specifies that the architecture name is used to evaluate the expression.

Currently, Architecture must be specified for this value.

DwOp
A DWORD value that specifies the operator used to evaluate the expression.

For architecture filters, this operator can only be QOP_STR_EQ.

SzValue
A string that specifies the architecture name of the machine folders to retrieve.

For example, most computers in the SMS system have architecture "Personal Computer".

Your application could create an architecture filter with a token for the Personal Computer architecture and set this filter as the only filter on a machine container. When your application populates the machine container, the container contains folders that represent all computers with the Personal Computer architecture.

Example

// Function to add a token to an architecture filter so that
// the filter retrieves the machine folders representing 
// computers with the Personal Computer architecture.

SMS_STATUS AddTokenToArchitectureFilter(HANDLE hFilter) 
                         //  Handle to architecture filter.
{
SMS_STATUS stat;
TOKEN Token;
// Clear the Token structure.
memset( &Token, 0, sizeof (TOKEN) );

// Set the expression token to 
// szName = "Architecture"
// dwOp = QOP_STR_EQ
// szValue = "Personal Computer"

// Set the szName to Architecture.
strcpy( Token.szName, "Architecture");
// Set the operator to string equals.
Token.dwOp = QOP_STR_EQ;
// Set the type of architecture.
strcpy( Token.szValue, "Personal Computer"); 

// Add the token to the filter.
stat = SmsAddToken( hFilter, // Specifies the handle to filter.
                    OP_OR,   // Must use the OR control token to 
                             // add a token to an Architecture filter.
                    &Token,  // Specifies the structure containing
                             // the expression token.
                    AT_END   // Add the token to the end of 
                             // the filter.
                  );


if (stat == SMS_OK)    
    printf("The token was successfully added to the filter.\n");
else 
    printf("SmsAddToken error: %d\n", stat);

return stat;
}