Optim Data Privacy Providers  11.3.0
 All Data Structures Files Functions Variables Macros Groups Pages
Structure Members
DP_FIELD_DATA_DEF Struct Reference

#include <ODPPCmnAPI.h>

Collaboration diagram for DP_FIELD_DATA_DEF:
Collaboration graph

Structure Members

struct DP_FIELD_DATA_DEFpNext
 
unsigned char cEyeCatcher [4]
 
short sStructVer
 
short sStructLen
 
char bSrcNull
 
char bDstNull
 
int iSrcBufLen
 
int iDstBufLen
 
int iOutBufLen
 
int iErrorCode
 
unsigned char * pSrcBuf
 
unsigned char * pDstBuf
 

Structure Description

Structure Member Documentation

struct DP_FIELD_DATA_DEF* pNext
  • Use:
    This member is used to point to the next data field in this row.
  • Description:
    This is a pointer to the next element in the chain of DP_FIELD_DATA_DEF structures. A column's data field is represented by a DP_FIELD_DATA_DEF structure instance and multiple data fields must be chained together using this member.

    Example:
    DP_ROW_DEF RowDef; //Row Definition structure
    DP_FIELD_DATA_DEF *pData = NULL; //Pointer to a data field
    memset(&RowDef, 0, sizeof(DP_ROW_DEF)); //Clear the Row Definition
    pData = (DP_FIELD_DATA_DEF *) malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
    if(NULL == pData) //Check if memory was allocated successfully
    {
    printf("Failed to allocate memory for pData");
    return ODPPFAILURE;
    }
    memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
    //Copy the string data which is present in the Line buffer and having length iLen
    pData->iSrcBufLen = iLen; //Set the length of the source buffer
    pData->pSrcBuf = (unsigned char *) malloc(pData->iSrcBufLen + 1); //Allocate memory for the source buffer
    if(NULL == pData->pSrcBuf)
    {
    printf("Failed to allocate memory for the source buffer");
    free(pData);
    return ODPPFAILURE;
    }
    memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
    strncpy((char *)pData->pSrcBuf, &Line[0], iLen); //Copy the source value to the source buffer
    RowDef.pFldDataDefine = pData; //Copy the pointer of the first data field
    pData = (DP_FIELD_DATA_DEF *) malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the next Field Data Define
    if(NULL == pData) //Check if memory was allocated successfully
    {
    printf("Failed to allocate memory for pData");
    free(RowDef.pFldDataDefine->pSrcBuf);
    free(RowDef.pFldDataDefine);
    return ODPPFAILURE;
    }
    memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the Field Data Define
    //Assume the source is NULL for the second data field
    pData->bSrcNull = 1; //Set the source NULL indicator to TRUE
    RowDef.pFldDataDefine->pNext = pData; //Set the pointer to the next data field
    RowDef.sCount = 2; //Set the data field count to 2 since two fields are being supplied.

    [Alternate method of sending multiple data fields]
    ODPP also provides an alternate method of sending multiple data fields as an ARRAY. The user can declare an array of DP_FIELD_DATA_DEF structures where each element will represent a single data field. When using this method it is mandatory to set member #sCount of parent structure DP_ROW_DEF equal to the number of elements in the DP_FIELD_DATA_DEF array.

    Example:
    DP_ROW_DEF RowDef; //Row Definition structure
    DP_FIELD_DATA_DEF FldDataDef[MAX_FIELDS]; //Array of DP_FIELD_DATA_DEF structures. Assume MAX_FIELDS is 2.
    memset(&RowDef, 0, sizeof(DP_ROW_DEF)); //Clear the Row Definition
    memset(FldDataDef, 0, MAX_FIELDS * sizeof(DP_FIELD_DATA_DEF)); //Clear the data field area
    //Copy the string data which is present in the Line buffer and having length iLen
    FldDataDef[0].iSrcBufLen = iLen; //Set the length of the source buffer
    FldDataDef[0].pSrcBuf = (unsigned char *) malloc(iLen + 1); //Allocate memory for the source buffer
    if(NULL == FldDataDef[0].pSrcBuf)
    {
    printf("Failed to allocate memory for the source buffer");
    return ODPPFAILURE;
    }
    memset(FldDataDef[0].pSrcBuf, 0, iLen + 1); //Clear the source buffer
    strncpy((char *)FldDataDef[0].pSrcBuf, &Line[0], iLen); //Copy the source value to the source buffer
    //Assume the source is NULL for the second data field
    FldDataDef[1].bSrcNull = 1; //Set the source NULL indicator to TRUE
    RowDef.pFldDataDefine = &FldDataDef[0]; //Copy pointer to the first DP_FIELD_DATA_DEF structure to the Row Definition
    RowDef.sCount = 2; //Set the data field count to 2 since two fields are being supplied.
  • Optional:
    N/A
unsigned char cEyeCatcher[4]
  • Use:
    For Internal use only.
  • Description:
    This is commonly used as structure identifier, specially helpful during debugging, and is set using INITIALIZE_ODPP_STRUCT_PTR to Initialize the structure instance.
  • Optional:
    N/A
short sStructVer
  • Use:
    For Internal use only.
  • Description:
    This is commonly used to hold structure version, specially helpful during debugging, and is set using INITIALIZE_ODPP_STRUCT_PTR to Initialize the structure instance.
  • Optional:
    N/A
short sStructLen
  • Use:
    [FOR FUTURE USE]
  • Description:
    [FOR FUTURE USE]
  • Optional:
    [FOR FUTURE USE]
char bSrcNull
  • Use:
    This member is used to indicate whether pSrcBuf is NULL or not.
  • Description:
    This member must be set to TRUE if the source value is NULL, otherwise it must be set to FALSE before the call to Provider_Service().

    If the resultant value is NULL and if the #bCopyToDest member of the DP_SVC_DEF structure is set to FALSE in Provider_Init():
    • bSrcNull is set to TRUE by the Service Provider, otherwise this member is set to FALSE.
  • Optional:
    No, must be set to TRUE/FALSE depending on whether pSrcBuf is NULL or not.
char bDstNull
  • Use:
    This member is used to indicate whether pDstBuf is NULL or not.
  • Description:
    If the resultant value is NULL and if the #bCopyToDest member of the DP_SVC_DEF structure is set to TRUE in Provider_Init():
    • bDstNull is set to TRUE by the Service Provider, otherwise this member is set to FALSE.
  • Optional:
    N/A
int iSrcBufLen
  • Use:
    This member is used to specify the maximum length of the source buffer, pSrcBuf, in bytes.
int iDstBufLen
  • Use:
    This member is used to specify the maximum length of the destination buffer, pDstBuf, in bytes and is required irrespective of the data type.
  • Description:
    This is an integer which represents the maximum length of the destination buffer, pDstBuf, in bytes.

    If the bCopyToDest member of the DP_SVC_DEF structure is set to TRUE during Provider_Init():
    • the caller must allocate sufficient memory for pDstBuf to hold the resultant value, and
    • iDstBufLen must be set to the number of bytes of memory allocated for pDstBuf.
    • The resultant value will be returned in pDstBuf, and
    • iDstBufLen will be set to the length, in bytes, of the resultant value.
  • Optional:
    No, iDstBufLen must be specified if bCopyToDest is set to TRUE.
int iOutBufLen
  • Use:
    This member is used to specify the maximum byte required to hold the resultant data.
  • Description:
    When resultant value is bigger in size than destination buffer size provided by the iDstBufLen member, This member is will return the maximum length required for the destination buffer, pDstBuf, in bytes.
  • Optional:
    N/A
int iErrorCode
  • Use:
    This member is used to hold the error code returned by the Service Provider, if any.
  • Description:
    If an error occurs while processing this DP_FIELD_DATA_DEF structure during the call to Provider_Service(), the Service Provider sets this member to a valid ODPP error code and the #bHasError member of the parent DP_ROW_DEF structure is set to TRUE. For warnings and informational messages an error code is returned in iErrorCode but the #bHasError member is set to FALSE. This member must be set to FALSE before the call to Provider_Service().
  • Optional:
    N/A
unsigned char* pSrcBuf
  • Use:
    This member is used to hold the source data.
  • Description:
    This is an unsigned character buffer which carries the source data in this DP_FIELD_DATA_DEF structure.

    If the bCopyToDest member of the DP_SVC_DEF structure is set to FALSE during Provider_Init():
    • the caller must allocate sufficient memory for pSrcBuf to hold the resultant value, and
    • iSrcBufLen must be set to the number of bytes of memory allocated for pSrcBuf.
    • The resultant value is returned in pSrcBuf, and
    • iSrcBufLen is set to the length, in bytes, of the resultant value.

    The memory referenced by pSrcBuf must remain valid for the duration of the call to Provider_Service().
  • Optional:
    No
unsigned char* pDstBuf
  • Use:
    This member is used to hold the resultant data.
  • Description:
    This is an unsigned character buffer which can be used to carry the resultant data.

    If the bCopyToDest member of the DP_SVC_DEF structure is set to TRUE during Provider_Init():
    • the caller must allocate sufficient memory for pDstBuf to hold the resultant value, and
    • iDstBufLen must be set to the number of bytes of memory allocated for pDstBuf.
    • The resultant value is returned in pDstBuf, and
    • iDstBufLen is set to the length, in bytes, of the resultant value.

    The memory referenced by pDstBuf must remain valid for the duration of the call to Provider_Service().
  • Optional:
    No, must be specified if bCopyToDest is set to TRUE, otherwise set pDstBuf to NULL.