| | |
| | | #ifndef DATATYPES_H_ |
| | | #define DATATYPES_H_ |
| | | |
| | | /* |
| | | * This include file is the public api di License++ |
| | | * You should include this file if your software don't plan to use |
| | | * the part of the library dealing with features. |
| | | * Otherwise licensepp-features.h should be included. |
| | | */ |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | //definition of size_t |
| | | #include <stdlib.h> |
| | | #ifndef _MSC_VER |
| | | #include <stdbool.h> |
| | | #endif |
| | | |
| | | #ifdef __unix__ |
| | | #define DllExport |
| | | #ifndef MAX_PATH |
| | | #define MAX_PATH 1024 |
| | | #endif |
| | | #else |
| | | #include <windows.h> |
| | | #define DllExport __declspec( dllexport ) |
| | | #endif |
| | | |
| | | #define ENVIRONMENT_VAR_NAME_MAX 64 |
| | | |
| | | #define PC_IDENTIFIER_SIZE 18 |
| | | #define PROPRIETARY_DATA_SIZE 16 |
| | | #define AUDIT_EVENT_NUM 5 |
| | | |
| | | #define LICENESE_INT_VERSION 100 |
| | | #define LICENSEPP_VERSION "1.0.0" |
| | | #define LICENESE_INT_VERSION 110 |
| | | #define LICENSEPP_VERSION "1.1.0" |
| | | |
| | | typedef enum { |
| | | LICENSE_OK = 0, //OK |
| | | LICENSE_OK = 0, //OK |
| | | LICENSE_FILE_NOT_FOUND = 1, //license file not found |
| | | LICENSE_SERVER_NOT_FOUND = 2, //license server can't be contacted |
| | | ENVIRONMENT_VARIABLE_NOT_DEFINED = 3, //environment variable not defined |
| | | FILE_FORMAT_NOT_RECOGNIZED = 4, //license file has invalid format (not .ini file) |
| | | LICENSE_MALFORMED = 5, //some mandatory field are missing, or data can't be fully read. |
| | | FILE_FORMAT_NOT_RECOGNIZED = 4, //license file has invalid format (not .ini file) |
| | | LICENSE_MALFORMED = 5, //some mandatory field are missing, or data can't be fully read. |
| | | PRODUCT_NOT_LICENSED = 6, //this product was not licensed |
| | | PRODUCT_EXPIRED = 7, |
| | | LICENSE_CORRUPTED = 8,//License signature didn't match with current license |
| | | IDENTIFIERS_MISMATCH = 9, //Calculated identifier and the one provided in license didn't match |
| | | LICENSE_CORRUPTED = 8, //License signature didn't match with current license |
| | | IDENTIFIERS_MISMATCH = 9, //Calculated identifier and the one provided in license didn't match |
| | | |
| | | LICENSE_FILE_FOUND = 100, |
| | | LICENSE_VERIFIED = 101 |
| | | LICENSE_SPECIFIED = 100, //license location was specified |
| | | LICENSE_FOUND = 101, //License file has been found or license data has been located |
| | | PRODUCT_FOUND = 102, //License has been loaded and the declared product has been found |
| | | SIGNATURE_VERIFIED = 103 |
| | | |
| | | } EVENT_TYPE; |
| | | |
| | |
| | | } LICENSE_TYPE; |
| | | |
| | | typedef enum { |
| | | INFO, SEVERITY_WARN, SEVERITY_ERROR |
| | | SVRT_INFO, SVRT_WARN, SVRT_ERROR |
| | | } SEVERITY; |
| | | |
| | | typedef struct { |
| | | SEVERITY severity; |
| | | EVENT_TYPE event_type; |
| | | char param1[256]; |
| | | /** |
| | | * License file name or location where the license is stored. |
| | | */ |
| | | char license_reference[MAX_PATH]; |
| | | char param2[256]; |
| | | } AuditEvent; |
| | | |
| | | /** |
| | | * This structure contains informations on the raw license data. Software authors |
| | | * can specify the location of the license file or its full content. |
| | | * |
| | | * Can be NULL, in this case OpenLicenseManager will try to figure out the |
| | | * 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; |
| | | const char *environmentVariableName;bool openFileNearModule; |
| | | /** |
| | | * 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; |
| | | } LicenseLocation; |
| | | |
| | | 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 5 are reported. |
| | | * Only the last AUDIT_EVENT_NUM are reported. |
| | | */ |
| | | AuditEvent status[5]; |
| | | AuditEvent status[AUDIT_EVENT_NUM]; |
| | | /** |
| | | * Eventual expiration date of the software, |
| | | * can be '\0' if the software don't expire |