Please enter search query.
Search <book_title>...
Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0
Last Published:
2018-09-19
Product(s):
NetBackup (8.2, 8.1.2)
- Introduction to NetBackup XBSA
- How to set up the SDK
- Using the NetBackup XBSA interface
- Getting help with the API
- NetBackup XBSA data structures
- NetBackup XBSA environment
- XBSA sessions and transactions
- Creating a NetBackup XBSA application
- How to build an XBSA application
- How to run a NetBackup XBSA application
- API reference
- Error messages
- Function calls
- Function specifications
- BSABeginTxn
- BSACreateObject
- BSADeleteObject
- BSAEndData
- BSAEndTxn
- BSAGetData
- BSAGetEnvironment
- BSAGetLastError
- BSAGetNextQueryObject
- BSAGetObject
- BSAInit
- BSAQueryApiVersion
- BSAQueryObject
- BSAQueryServiceProvider
- BSASendData
- BSATerminate
- NBBSAAddToMultiObjectRestoreList
- NBBSADeleteImage
- NBBSAEndGetMultipleObjects
- NBBSAFreeJobInfo
- NBBSAGetEnv
- NBBSAGetErrorString
- NBBSAGetJobId
- NBBSAGetJobInfo
- NBBSAGetMediaIds
- NBBSAGetMultipleObjects
- NBBSAGetServerError
- NBBSALogMsg
- NBBSASetEnv
- NBBSAUpdateEnv
- NBBSAValidateFeatureId
- Type definitions
- Process flow and troubleshooting
- How to use the sample files
- Support and updates
- Appendix A. Register authorized locations
Session example
The following example sets up a session and begins a transaction. It sets up the XBSA environment, a BSA_ObjectOwner structure, and a BSA_SecurityToken. The security token is NULL because the NetBackup XBSA interface does not use this security method. The session is initiated by a BSAInit() call that returns a BSA_Handle. This handle is then used when a transaction begins and for all XBSA function calls within the session. Within the session, the XBSA environment is modified to change the NBBSA_CLIENT_HOST. Lastly a transaction is started.
BSA_Handle BsaHandle;
BSA_Obje ctOwner BsaObjectOwner;
BSA_SecurityToken *security_tokenPtr;
BSA_UInt32 Size;
char *envx[3];
char ErrorString[512];
char msg[1024];
int status;
/ * Allocate memory for the XBSA environment variable array. */
envx[0] = malloc(40);
envx[1] = malloc(40);
/ * Populate the XBSA environment variables for this session.
* Normally the BSA_SERVICE_HOST would not be hard coded like this but
* would be retrieved via a parameter or environment variable.
*/
strcpy(envx[0], "BSA_API_VERSION=1.1.0");
strcpy(envx[1], "BSA_SERVICE_HOST=server_host");
envx[2] = NULL;
/ * The NetBackup XBSA Interface does not use the security token. */
security_tokenPtr = NULL;
/ * Populate the object owner structure. */
strcpy(BsaObjectOwner.bsa_ObjectOwner,"XBSA Client");
strcpy(BsaObjectOwner.app_ObjectOwner,"XBSA App");
/ * Initialize an XBSA session. */
status = BSAInit(&BsaHandle,NULL,&BsaObjectOwner,envx);
if (status != BSA_RC_SUCCESS) {
Size = 512;
NBBSAGetErrorString(status, &Size, ErrString);
printf("ERROR: BSAInit failed with error: %s\n", ErrString);
exit(status);
}
/ * Set the hostname of the client for the next transaction. */
NBBSASetEnv(BsaHandle, "NBBSA_CLIENT_HOST", "client_host");
/ * Begin a transaction. If it fails, terminate the session. */
status = BSABeginTxn(BsaHandle);
if (status != BSA_RC_SUCCESS) {
Size = 512;
NBBSAGetErrorString(status, &Size, ErrorString);
sprintf(msg, "ERROR: BSABeginTxn failed with error: %s",
ErrorString);
NBBSALogMsg(BsaHandle, MSERROR, msg, "Backup");
BSATerminate(BsaHandle);
exit(status);
}