#ifndef __TLC_BASEDEF_H__
#define __TLC_BASEDEF_H__
#ifdef __cplusplus
extern "C"
{
#endif


#define CHECK_BLOB_POINTER(x, y)     if(x == NULL || x->data == NULL){  printE("%s or %s->Data is NULL", #x, #x);  return y;  }

//type
#ifndef _UINT64_DEFINED
typedef  unsigned long long  uint64;     /* Unsigned 64 bit value */
#define _UINT64_DEFINED
#endif

#ifndef _UINT32_DEFINED
typedef  unsigned int        uint32;      /* Unsigned 32 bit value */
#define _UINT32_DEFINED
#endif

#ifndef _UINT16_DEFINED
typedef  unsigned short     uint16;      /* Unsigned 16 bit value */
#define _UINT16_DEFINED
#endif

#ifndef _UINT8_DEFINED
typedef  unsigned char      uint8;       /* Unsigned 8  bit value */
#define _UINT8_DEFINED
#endif

#ifndef _INT32_DEFINED
typedef signed int          int32;       /* signed 32 bit value */
#define _INT32_DEFINED
#endif

#ifndef TRUE 
#define TRUE    1
#endif
#ifndef FALSE
#define FALSE   0
#endif
#ifndef NULL
#define NULL    0
#endif

#define TRUE_STRING     "true"
#define FALSE_STRING    "false"


typedef struct {
    uint32 length;
    uint8* data;
    uint32 dataSize;
} BlobData;


#define TAG_SIZE sizeof(uint32) //4bytes
#define LENGTH_SIZE sizeof(uint32) //4bytes
#define MAX_BLOB_DATA_SIZE (950*1024)   //950K

typedef struct
{
    uint32 tag;
    uint32 length;
    uint32 offset;
} TlvDecodeData;


typedef struct
{
    uint32 tag;
    uint32 length;
    uint32 dataSize;
    uint8* data;
} TlvEncodeData;


 //Authenticator return value
typedef enum {
    AUTHNR_SUCCESS = 0,
    AUTHNR_ERROR_UNKNOWN,
    AUTHNR_ERROR_NOT_SUPPORTED,
    AUTHNR_ERROR_ACCESS_DENIED,
    AUTHNR_ERROR_PARAM,
    AUTHNR_ERROR_PARSING,
    AUTHNR_ERROR_MALLOC,
    AUTHNR_ERROR_BUF_TOO_SMALL,
    AUTHNR_ERROR_ENCODE,
    AUTHNR_ERROR_HASH,
    AUTHNR_ERROR_SIGN,//10
    AUTHNR_ERROR_VERIFY,
    AUTHNR_ERROR_WRAP,
    AUTHNR_ERROR_UNWRAP,
    AUTHNR_ERROR_ENCAPSULATE,
    AUTHNR_ERROR_DECAPSULATE,
    AUTHNR_ERROR_TZ_OPERATION,
    AUTHNR_ERROR_NOT_PREPARED,
    AUTHNR_ERROR_ENCRYPT,
    AUTHNR_ERROR_DECRYPT,
    AUTHNR_ERROR_HMAC, //20
    AUTHNR_ERROR_ALLOC_KEY,
    AUTHNR_ERROR_GET_RANDOM,
    AUTHNR_ERROR_TZAPP_LOADING,
    AUTHNR_ERROR_TERMINATE_FAIL,
} AuthnrResult;


#ifdef __cplusplus
}
#endif
#endif

