Ransomware attackers specifically target and attempt to destroy backup systems to increase the probability of payment. Hardening your system is critical. Please ensure you have reviewed your platform security using the Security Hardening Checklist
Cohesity

COHESITY Documentation

Explore our documentation to get started, discover products & new features, access troubleshooting guides, register sources, platforms support.

Products
Data Security Alliance
Visit Cohesity.com
Demos
Support
Blogs
Developers
Partner Portals
Cohesity Community
© 2026 Cohesity, Inc. All Rights Reserved.
Terms of Use|
Privacy Policy|
Legal|
  1. Home
  2. Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0
  3. Using the NetBackup XBSA interface
  4. Creating a NetBackup XBSA application
  5. Media IDs - obtaining media IDs
  6. Media ID example
Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0

Media ID example

This Media ID example assumes that the copyId has been populated from a previous query or from information stored by the XBSA application.

BSA_Handle             BsaHandle;
BSA_ObjectOwner        BsaObjectOwner;
BSA_SecurityToken      *security_tokenPtr;
BSA_ObjectDescriptor   *object_desc;
BSA_QueryDescriptor    *query_desc;
BSA_UInt32             Size;
char                   *envx[3];
char                   ErrorString[512];
char                   msg[1024];
int                    status;
char                   buffer[100];
char                   *p;
BSA_UInt32             buffer_len;
.
.
BSAInit(&BsaHandle, security_tokenPtr, &BsaObjectOwner, envx);
.
.
BSABeginTxn(BsaHandle);

buffer_len = 100;
status = NBBSAGetMediaIds(BsaHandle, object_desc->copyId, &buffer_len, buffer);
if (status != BSA_RC_SUCCESS) {
    Size = 512;
				NBBSAGetErrorString(status, &Size, ErrorString);
				sprintf(msg, "ERROR: NBBSAGetMediaIds() failed with error: %s", ErrorString);
				NBBSALogMsg(BsaHandle, MSERROR, msg, "Media Ids");
				BSAEndTxn(BsaHandle, BSA_Vote_ABORT);
				BSATerminate(BsaHandle);
				exit(status);
}

p = buffer;
while (*p != '\0') {
				printf("Media Id = %s\n", p);
p = p + (strlen(p) + 1);
}
printf("Buffer size used = %d\n", str_len);

status = BSAEndTxn(BsaHandle, BSA_Vote_COMMIT);
if (status != BSA_RC_SUCCESS) {
				Size = 512;
				NBBSAGetErrorString(status, &Size, ErrorString);
				sprintf(msg, "ERROR: BSAEndTxn() failed with error: %s", ErrorString);
				NBBSALogMsg(BsaHandle, MSERROR, msg, "Media Ids");
				BSAEndTxn(BsaHandle, BSA_Vote_ABORT);
				BSATerminate(BsaHandle);
}

Feedback

Was this page helpful?
Previous

Media IDs - obtaining media IDs

Next

Logging and NetBackup

Feedback

Was this page helpful?