EMA C++ Developers Guide : 8 Troubleshooting and Debugging : 8.4 Creating a DACSLOCK for Publishing Permission Data
 
8.4 Creating a DACSLOCK for Publishing Permission Data
Provider applications can create a DACSLocks and publish it to permission data on the LSEG Real-Time Distribution System. A DACSLock controls access to data by users. For further details on the DACSLock API, refer to the Enterprise Transport API C Edition DACSLock Library.
The following example code illustrates how to create a DACSLock.
 
 
#include "dacs_lib.h"
 
typedef struct {
    char            _operator;
    unsigned short  pc_listLen;
    unsigned long   pc_list[256];
} PC_DATA;
 
PC_DATA pcData;
PRODUCT_CODE_TYPE* pcTypePtr = (PRODUCT_CODE_TYPE *)&pcData;
unsigned char* lockPtr = NULL;
int lockLen = 0;
DACS_ERROR_TYPE dacsError;
unsigned char dacsErrorBuffer[128];
 
printf("\nGenerates DACS lock \n");
pcData._operator = OR_PRODUCT_CODES;
pcData.pc_listLen = 1;
pcData.pc_list[0] = 1001;
int serviceId = 261;
 
if (DACS_GetLock(serviceId, pcTypePtr, &lockPtr, &lockLen, &dacsError) == DACS_FAILURE)
{
    if (DACS_perror(dacsErrorBuffer, sizeof(dacsErrorBuffer), (unsigned char *)"DACS_GetLock() failed
            with error", &dacsError) == DACS_SUCCESS)
    {
        printf("%s\n", dacsErrorBuffer);
    }
    else
    {
        printf("DACS_GetLock() failed\n");
    }
    return;
}
printf("DACS_GetLock() - Success\n");
 
EmaBuffer permissionData;
permissionData.setFrom((const char*)lockPtr, lockLen);