Returns TSA-specific open mode option strings.
#include <smsutapi.h> #include <smstsapi.h> CCODE NWSMTSGetOpenModeOptionString ( UINT32 connection, UINT8 optionNumber, STRING optionString);
(IN) Specifies the connection information returned by NWSMTSConnectToTargetService or NWSMTSConnectToTargetServicEx.
(IN) Specifies the open mode option number (0- 23) to return.
(OUT) Specifies the string that describes the option specified by optionNumber (must be NWSM_MAX_STRING_LEN bytes).
See Section 9.3, Target Service Return Values for more information.
The following table lists the return values associated with the function.
Before NWSMTSGetOpenModeOptionString is called, the engine must be connected to a TSA and Target Service.
The options returned by NWSMTSGetOpenModeOptionString allow the engine to open different parts of the data set on a per data set basis (see Backup Open Mode Options List). For example, the data set's attributes or trustee information. The engine applies the open mode options on an individual basis when NWSMTSWriteDataSet is called.
optionNumber represents the bit position within the TSA-specific open mode option bit map. This value is used by NWSMTSOpenDataSetForBackup and NWSMTSOpenDataSetForRestore.
The following table lists the open mode options.
If a TSA does not support a TSA-specific open mode option, optionString returns NULL and NWSMTSGetOpenModeOptionString returns successfully (see Backup Open Mode Options List).
The order of the returned strings corresponds to the order of the following bit map starting from bit 8-string one represents bit zero while string two represents bit one, etc.:
Call NWSMTSGetOpenModeOptionString repeatedly until all TSA-specific open mode strings are returned. optionNumber is converted to a bit mask and is used to index a string table.
#include <smsutapi.h> #include <smstsapi.h> typedef struct TSA_SPECIFIC_OPEN_MODE { NWBOOLEAN selected; UINT32 openMode; char openModeString[NWSM_MAX_STRING_LEN]; struct TSA_SPECIFIC_OPEN_MODE *next; } TSA_SPECIFIC_OPEN_MODE; UINT8 optionNumber = 0; char optionString[NWSM_MAX_STRING_LEN]; TSA_SPECIFIC_OPEN_MODE *TSAOpenModes = NULL, *last, *tmp; UINT32 openMode, chosenOpenModes; for (optionNumber = 0, openMode = 0x100; optionNumber <= 23; optionNumber++, openMode <<= 1) { if (NWSMTSGetOpenModeOptionString(connection, optionNumber, (STRING)optionString) != 0) break; if (!*optionString) continue; TMp = (TSA_SPECIFIC_OPEN_MODE *)calloc(1, sizeof(TSA_SPECIFIC_OPEN_MODE)); TMp->openMode = openMode; strcpy(tmp->openModeString, optionString); if (TSAOpenModes) { last->next = TMp; last = TMp; } else TSAOpenModes = last = TMp; } /* Create the strings for the generic open modes-see "Backup Open Mode Options List" and the “Remarks” for more information */ /* Display the open mode options to the user, get the user's selections and set it into chosenOpenModes, then pass chosenOpenModes to NWSMTSOpenDataSetForBackup or NWSMTSOpenDataSetForRestore. */
The following is a simplified example of returning the TSA-specific open mode strings.
/* optionNumber is initialized to zero to indicate to start from the first open mode option string. It is then incremented from 0 through 23 to get all the strings. openMode contains the open mode bit mask that represents the open mode option. It is initialized to 0x1000 because the first TSA-specific option starts at bit 8 of the open mode bit map. */ for (optionNumber = 0, openMode = 0x100; optionNumber <= 23; optionNumber++, openMode <<= 1) { if (NWSMTSGetOpenModeOptionString(connection, optionNumber, (STRING)optionString) != 0) break; if (!*optionString) continue; /* Continue takes care of any TSA-specific open mode options that may not be supported. */ /* Copy openMode and optionString to a link list used to build the remaining portion of the open modes option list. */ ... }