Returns the strings that describe a supported scan type.
#include <smsutapi.h> #include <smstsapi.h> CCODE NWSMTSGetTargetScanTypeString ( UINT32 connection, UINT8 typeNumber, STRING scanTypeString, UINT32 *required, UINT32 *disallowed);
(IN) Specifies the connection information returned by NWSMTSConnectToTargetService or NWSMTSConnectToTargetServicEx.
(IN) Specifies the scan bit, or scan type number, (0- 31) to query the TSA about.
(OUT) Specifies the name of the scan type (maximum length is NWSM_MAX_STRING_LEN).
(OUT) Points to the bit map of all scan type bits that must be set if typeNumber is used.
(OUT) Points to the bit map of all scan type bits that must be cleared if typeNumber is used.
See Section 9.3, Target Service Return Values for more information.
The following table lists the return values associated with the function.
Before NWSMTSGetTargetScanTypeString is called, the engine must be connected to a TSA and Target Service.
NWSMTSGetTargetScanTypeString returns two bit maps that indicate the other scan type options that must be used if scan type typeNumber is used. If a TSA does not support a scan type, NWSMTSGetTargetScanTypeString returns a NULL string and a zero completion code. To get every scan type, the engine must call NWSMTSGetTargetScanTypeString repeatedly until NWSMTS_SCAN_TYPE_NOT_USED is returned.
NWSMTSGetTargetScanTypeString is given a sequence number, or typeNumber, which it uses as an index into a table of strings. This sequence number is not used to indicate the selected scan types. The sequence number must be converted to a bit map or mask before being used.
The following table lists the masks used by SMS for predefined scan types that are used to set the bits in the scan type bit map.
The following table lists the masks used for scan types that are returned by the file system TSAs:
To indicate the selected scan types to a TSA, set and clear the appropriate bits of scanType in the NWSM_SCAN_CONTROL structure when calling NWSMTSScanDataSetBegin (see Connecting to the Target Service).
The order of scan type strings corresponds to the order of the scan type bit map in the scanType field of NWSM_SCAN_CONTROL-string one represents bit zero while string two represents bit one, etc.
#include <smsutapi.h> #include <smstsapi.h> typedef struct TSA_SCAN_TYPE { UINT32 scanType; UINT32 required; UINT32 disallowed; struct TSA_SCAN_TYPE *next; UINT8 scanTypeString[1]; } TSA_SCAN_TYPE; char scanTypeString[NWSM_MAX_STRING_LEN]; UINT8 typeNumber = 0; UINT32 required, disallowed, chosenScanTypes, scanType; TSA_SCAN_TYPE *scanTypes = NULL, *last, *st; NWSM_SCAN_CONTROL scanControl = {0}; CCODE ccode; /* Build a list of the scan types that a TSA has. */ for(typeNumber = 0, scanType = 1; typeNumber < 32; typeNumber++, scanType <<= 1) { if ((ccode = NWSMTSGetTargetScanTypeString(connection, typeNumber, (STRING)scanTypeString, &required, &disallowed)) == NWSMTS_SCAN_TYPE_NOT_USED) continue; if (ccode) break; st = (TSA_SCAN_TYPE *)calloc(1, sizeof(TSA_SCAN_TYPE) + strlen(scanTypeString)); st->scanType = scanType; st->required = required; st->disallowed = disallowed; strcpy(st->scanTypeString, scanTypeString); if(scanTypes) { last->next = st; last = st; } else scanTypes = last = st; } /* Build a display from the information retrieved from NWSMTSGetTargetScanTypeString, and get the user's selection. The display will list the scanning type options available to the user. The display routine will also check for invalid scan type combinations by comparing the required and disallowed bits of a just chosen scan type against already chosen scan types. The valid chosen scan types will be set into chosenScanTypes. */ scanControl.scanType = chosenScanTypes;
This is a simplified example of retrieving all the scan type strings from the TSA.
/* typeNumber is initialized to zero to indicate to start from the first scan type string. It is then incremented from 0 to 31 to get all the strings. scanType contains the scan type bit mask that represents the scan type option. scanType is also initialized to one since the first scan type option starts at bit 0. */ for (typeNumber = 0, scanType = 1; typeNumber < 32; typeNumber++, scanType <<= 1) { if ((ccode = NWSMTSGetTargetScanTypeString(connection, typeNumber, (STRING)scanTypeString, &required, &disallowed)) == NWSMTS_SCAN_TYPE_NOT_USED) continue; /* The continue code takes care of cases where the TSA might not allow specific options. scanType, scanTypeString, required, and disallowed are copied into linked list that is used to build the scan type option list. */ ... }