Implementing CPD for License Managers

This section highlights the required steps for enabling custom persistence device feature for a License Manager. This feature is available for isolated License Managers only. Developers need to implement custom persistent device feature as a part of the isolated License Manager library API VLSenableVendorIsolation. Refer to the "Chapter - Vendor Isolation of the Sentinel RMS SDK Developer Guide to learn more about the isolated License Managers.

The flowchart below represents the order of steps for implementing CPD for License Managers:

  Code Snippet

The code snippet below illustrates the CPD Implementation workflow.

/*Implementation of VLSenableVendorIsolation (Isolated Server)*/

VDLL32 LSERV_STATUS VMSWINAPI VLSenableVendorIsolation(
   VLSvendorIsolation *pVendorIdentifier,        /* OUT */
   char LSFAR **reservedBuffer,     /* OUT */
   unsigned long *reserved          
)
{
   int rc = 0;
   VLScpdIfImpl cpdImpl;

 /* Copy ISV selected identifier string. Max supported length of the identifier is VENDOR_IDENTIFIER_LEN (from lserv.h) header file*/

   if(pVendorIdentifier != NULL)
      strncpy(pVendorIdentifier->vendor_identifier, "ISV_IDENTIFIER", VENDOR_IDENTIFIER_LEN);

/*Register the callback API function pointers*/ 
#if defined(_ENABLE_CPD_)
   cpdImpl.szStruct			= sizeof(VLScpdIfImpl);
   cpdImpl.implInitDevice 		= &VLScpdInitializeDevice;		
   cpdImpl.implExitDevice 		= &VLScpdExitDevice; 		
   cpdImpl.implCreateObject 		= &VLScpdCreateObject;		
   cpdImpl.implWriteRecord 		= &VLScpdWriteRecord;		
   cpdImpl.implReadRecord 		= &VLScpdReadRecord;		
   cpdImpl.implReadNextRecord 	= &VLScpdReadNextRecord;	
   cpdImpl.implDeleteRecord 		= &VLScpdDeleteRecord;

   /* Call configures the Sentinel RMS libraries in Custom Persistence Device mode*/
   /* If persistence device is not configured pass 1st argument as VLS_CPD_NO_DEVICE */

   rc = VLSsetPersistenceDevice(VLS_CPD_CUSTOM_DEVICE, &cpdImpl, NULL, NULL);
   if (rc)	

  /* Don't execute further if an error while configuring CPD */
   {
      printf("\nRMS Error: Failed to configure the custom device, returned %d ", rc);
      printf("Stopping the RMS LM server!\n");
      exit(rc);	  
   }
#endif
   return(LSERV_STATUS_SUCCESS);
}