SiteLimit Filters (SITELIMIT_FILTER)

A SiteLimit filter specifies the machine folders that are retrieved for a machine container. When a SiteLimit filter is set on a machine container, the machine folders in that container will be from the site (and optionally the domain) specified by the SiteLimit filter.

SiteLimit filters can be applied only to machine containers. If your application applies a SiteLimit filter to a site container, it will have no effect.

If no SiteLimit filter is set on a machine container, all machine folders in the site database (the current site and all sites below it in the site hierarchy) are retrieved for the container.

Using the SmsAddToken function, your application can add one token to a SiteLimit filter. If your application adds additional tokens to a SiteLimit filter, only the first token will be used—the other tokens will be ignored.

For SiteLimit filters, the tokens can only be connected using an OP_OR control token—this means that your application must pass OP_OR for the opAndOr parameter when calling the SmsAddToken function.

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

szName
A string that specifies the three-character site code of the site containing the machines to retrieve.

For example, "TIM".

Note that your application must specify a site code if it is specifying a domain for szValue.

SzValue
To specify only the site containing the machines to retrieve, set this value to NULL. To specify a domain within the site specified by szName, specify the domain name for this value.

For example, your application could create a SiteLimit filter with a token that specifies the site JS1 and the domain JSDOM and set this filter on a machine container. When your application populates the machine container, the container contains only machine folders from JSDOM domain within the JS1 site.

Example

// Function to add a token to a Site Limit filter so that
// the filter retrieves machine folders for the 
// JSDOM domain in the JS1 site.

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

// Set the expression token to 
// szName = "JS1"
// szValue = "JSDOM"

// Set the site code.
strcpy( Token.szName, "JS1");
// Set the domain to JSDOM.
strcpy( Token.szValue, "JSDOM"); 

// 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 a SiteLimit 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;
}