| | |
| | | #ifndef DATATYPES_H_ |
| | | #define DATATYPES_H_ |
| | | /** \addtogroup apistruct |
| | | * @{ |
| | | */ |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | |
| | | #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 API_LICENSE_DATA_LENGTH 1024 * 4 |
| | | #define API_VERSION_LENGTH 16 |
| | | #include <licensecc_properties.h> |
| | | |
| | | typedef enum { |
| | | LICENSE_OK = 0, // OK |
| | |
| | | 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, |
| | | PRODUCT_EXPIRED = 7, //!< PRODUCT_EXPIRED |
| | | 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_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; |
| | | SIGNATURE_VERIFIED = 103//!< SIGNATURE_VERIFIED |
| | | } LCC_EVENT_TYPE; |
| | | |
| | | typedef enum { |
| | | LOCAL, |
| | | REMOTE // remote licenses are not supported now. |
| | | } LICENSE_TYPE; |
| | | LCC_LOCAL, |
| | | LCC_REMOTE // remote licenses are not supported now. |
| | | } LCC_LICENSE_TYPE; |
| | | |
| | | typedef enum { SVRT_INFO, SVRT_WARN, SVRT_ERROR } SEVERITY; |
| | | typedef enum { SVRT_INFO, SVRT_WARN, SVRT_ERROR } LCC_SEVERITY; |
| | | |
| | | typedef struct { |
| | | SEVERITY severity; |
| | | EVENT_TYPE event_type; |
| | | LCC_SEVERITY severity; |
| | | LCC_EVENT_TYPE event_type; |
| | | /** |
| | | * License file name or location where the license is stored. |
| | | */ |
| | | char license_reference[MAX_PATH]; |
| | | char param2[256]; |
| | | char param2[LCC_API_AUDIT_EVENT_PARAM2 + 1]; |
| | | } AuditEvent; |
| | | |
| | | typedef enum { |
| | |
| | | * The license is encoded |
| | | */ |
| | | LICENSE_ENCODED |
| | | } LICENSE_DATA_TYPE; |
| | | } LCC_LICENSE_DATA_TYPE; |
| | | |
| | | /** |
| | | * This structure contains informations on the raw license data. Software authors |
| | |
| | | * license file location on its own. |
| | | */ |
| | | typedef struct { |
| | | LICENSE_DATA_TYPE license_data_type; |
| | | char licenseData[API_LICENSE_DATA_LENGTH]; |
| | | LCC_LICENSE_DATA_TYPE license_data_type; |
| | | char licenseData[LCC_API_MAX_LICENSE_DATA_LENGTH]; |
| | | } LicenseLocation; |
| | | |
| | | /** |
| | | * Informations on the software requiring the license |
| | | */ |
| | | typedef struct { |
| | | char version[API_VERSION_LENGTH]; // software version in format xxxx[.xxxx.xxxx] //TODO |
| | | char project_name[16]; // name of the project (must correspond to the name in the license) |
| | | char version[LCC_API_VERSION_LENGTH + 1]; // software version in format xxxx[.xxxx.xxxx] //TODO |
| | | /** |
| | | * Name of the feature you want to verify. If empty the default feature will be verified. |
| | | * Every project has a default feature that is equal to the project name. |
| | | * Every feature has a section in the license file: |
| | | * <pre> |
| | | * [feature_xx] |
| | | * sig=AAAA |
| | | * [another_feature] |
| | | * expiry-date=20201111 |
| | | * </pre> |
| | | */ |
| | | char feature_name[LCC_API_FEATURE_NAME_SIZE + |
| | | 1]; // name of the feature you' (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 |
| | |
| | | * multiple (for instance, license expired and signature not verified). |
| | | * Only the last AUDIT_EVENT_NUM are reported. |
| | | */ |
| | | AuditEvent status[AUDIT_EVENT_NUM]; |
| | | AuditEvent status[LCC_API_AUDIT_EVENT_NUM]; |
| | | /** |
| | | * Eventual expiration date of the software, |
| | | * can be '\0' if the software don't expire |
| | | * */ |
| | | char expiry_date[11]; |
| | | char expiry_date[LCC_API_EXPIRY_DATE_SIZE + 1]; |
| | | unsigned int days_left; |
| | | bool has_expiry; |
| | | bool linked_to_pc; |
| | | LICENSE_TYPE license_type; // Local or Remote |
| | | LCC_LICENSE_TYPE license_type; // Local or Remote |
| | | /* 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[LCC_API_PROPRIETARY_DATA_SIZE + 1]; |
| | | int license_version; // license file version |
| | | } LicenseInfo; |
| | | |
| | | /** |
| | | * Enum to select a specific pc identification_strategy. DEFAULT Should be used |
| | | * in most cases. |
| | | */ |
| | | typedef enum { BARE_TO_METAL, VMWARE, VIRTUALBOX, V_XEN, KVM, HV, V_OTHER } LCC_API_VIRTUALIZATION_DETAIL; |
| | | |
| | | typedef enum { |
| | | 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; |
| | | PROV_UNKNOWN = 0, |
| | | ON_PREMISE = 1, |
| | | GOOGLE_CLOUD = 2, |
| | | AZURE_CLOUD = 3, |
| | | AWS = 4, |
| | | /** |
| | | * "/sys/class/dmi/id/bios_vendor" SeaBIOS |
| | | * "/sys/class/dmi/id/sys_vendor" Alibaba Cloud |
| | | * modalias |
| | | * "dmi:bvnSeaBIOS:bvrrel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org:bd04/01/2014:svnAlibabaCloud:pnAlibabaCloudECS:pvrpc-i440fx-2.1:cvnAlibabaCloud:ct1:cvrpc-i440fx-2.1:" |
| | | */ |
| | | ALI_CLOUD = 5 |
| | | } LCC_API_CLOUD_PROVIDER; |
| | | |
| | | typedef enum { NONE, CONTAINER, VM } LCC_API_VIRTUALIZATION_SUMMARY; |
| | | |
| | | typedef struct { |
| | | LCC_API_CLOUD_PROVIDER cloud_provider; |
| | | LCC_API_VIRTUALIZATION_SUMMARY virtualization; |
| | | LCC_API_VIRTUALIZATION_DETAIL virtualization_detail; |
| | | } ExecutionEnvironmentInfo; |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | | |
| | | /** |
| | | * @} |
| | | */ |
| | | #endif |