Gabriele Contini
2020-01-11 2695752f624aa7dc3f91672c6fbeb894c22eaa47
include/licensecc/datatypes.h
@@ -22,16 +22,17 @@
#define DllExport __declspec(dllexport)
#endif
// define api structure sizes
#define PC_IDENTIFIER_SIZE 19
#define PROPRIETARY_DATA_SIZE 16
#define AUDIT_EVENT_NUM 5
#define AUDIT_EVENT_PARAM2 255
#define VERSION_SIZE 15
#define PROJECT_NAME_SIZE 15
#define EXPIRY_DATE_SIZE 10
#define API_LICENSE_DATA_LENGTH 1024 * 4
#define ERROR_BUFFER_SIZE 256
// define api structure sizes
#define API_PC_IDENTIFIER_SIZE 19
#define API_PROPRIETARY_DATA_SIZE 16
#define API_AUDIT_EVENT_NUM 5
#define API_AUDIT_EVENT_PARAM2 255
#define API_VERSION_LENGTH 15
#define API_PROJECT_NAME_SIZE 15
#define API_EXPIRY_DATE_SIZE 10
#define API_ERROR_BUFFER_SIZE 256
typedef enum {
   LICENSE_OK = 0,  // OK
@@ -65,8 +66,24 @@
    * License file name or location where the license is stored.
    */
   char license_reference[MAX_PATH];
   char param2[AUDIT_EVENT_PARAM2 + 1];
   char param2[API_AUDIT_EVENT_PARAM2 + 1];
} AuditEvent;
typedef enum {
   /**
    * A list of absolute path separated by ';' containing the eventual location
    * of the license files. Can be NULL.
    */
   LICENSE_PATH,
   /**
    * The license is provided as plain data
    */
   LICENSE_PLAIN_DATA,
   /**
    * The license is encoded
    */
   LICENSE_ENCODED
} LICENSE_DATA_TYPE;
/**
 * This structure contains informations on the raw license data. Software authors
@@ -76,37 +93,35 @@
 * license file location on its own.
 */
typedef struct {
   /**
    * A list of absolute path separated by ';' containing the eventual location
    * of the license files. Can be NULL.
    */
   const char *licenseFileLocation;
   /**
    * The application can provide the full license content through this string.
    * It can be both in encoded form (base64) or in plain. It's optional.
    */
   const char *licenseData;
   LICENSE_DATA_TYPE license_data_type;
   char licenseData[API_LICENSE_DATA_LENGTH];
} LicenseLocation;
/**
 * Informations on the software requiring the license
 */
typedef struct {
   char version[VERSION_SIZE + 1];  // software version in format xxxx.xxxx.xxxx
   char project_name[PROJECT_NAME_SIZE + 1];  // name of the project (must correspond to the name in the license)
   uint32_t magic;  // reserved
   char version[API_VERSION_LENGTH + 1];  // software version in format xxxx[.xxxx.xxxx] //TODO
   char project_name[API_PROJECT_NAME_SIZE + 1];  // name of the project (must correspond to the name in the license)
   /**
    * this number passed in by the application must correspond to the magic number used when compiling the library.
    * See cmake parameter -DLCC_PROJECT_MAGIC_NUM and licensecc_properties.h macro VERIFY_MAGIC
    */
   unsigned int magic;
} CallerInformations;
typedef struct {
   /**
    * Detailed reason of success/failure. Reasons for a failure can be
    * multiple (for instance, license expired and signature not verified).
    * Only the last AUDIT_EVENT_NUM are reported.
    */
   AuditEvent status[AUDIT_EVENT_NUM];
   AuditEvent status[API_AUDIT_EVENT_NUM];
   /**
    * Eventual expiration date of the software,
    * can be '\0' if the software don't expire
    * */
   char expiry_date[EXPIRY_DATE_SIZE + 1];
   char expiry_date[API_EXPIRY_DATE_SIZE + 1];
   unsigned int days_left;
   bool has_expiry;
   bool linked_to_pc;
@@ -114,7 +129,7 @@
   /* A string of character inserted into the license understood
    * by the calling application.
    * '\0' if the application didn't specify one */
   char proprietary_data[PROPRIETARY_DATA_SIZE + 1];
   char proprietary_data[API_PROPRIETARY_DATA_SIZE + 1];
   int license_version;  // license file version
} LicenseInfo;
@@ -123,13 +138,13 @@
 * in most cases.
 */
typedef enum {
   STRATEGY_DEFAULT,
   STRATEGY_ETHERNET,
   STRATEGY_IP_ADDRESS,
   STRATEGY_DISK_NUM,
   STRATEGY_DISK_LABEL,
   STRATEGY_PLATFORM_SPECIFIC,
   STRATEGY_UNKNOWN
   STRATEGY_DEFAULT = -1,
   STRATEGY_ETHERNET = 0,
   STRATEGY_IP_ADDRESS = 1,
   STRATEGY_DISK_NUM = 1,
   STRATEGY_DISK_LABEL = 2,
   STRATEGY_PLATFORM_SPECIFIC = 3,
   STRATEGY_UNKNOWN = -2
} IDENTIFICATION_STRATEGY;
#ifdef __cplusplus