Public api
The public api of the library can be found in include/licensecc/licensecc.h that is the only file you should
include when you want to use the library.
Print hardware identifier
-
bool license::LicenseFacade::identify_pc(LCC_API_HW_IDENTIFICATION_STRATEGY hw_id_method, char *identifier_out, size_t *buf_size, ExecutionEnvironmentInfo *execution_environment_info) noexcept
Calculate the hardware identifier for the current PC.
This method generates a unique hardware identifier based on the specified identification strategy.
- Parameters:
hw_id_method – Strategy to use for identification
identifier_out – Buffer to receive the identifier string
buf_size – Size of the output buffer (input/output parameter)
execution_environment_info – Optional output for execution environment info
- Returns:
true if successful, false otherwise
-
enum LCC_API_HW_IDENTIFICATION_STRATEGY
This enum list all the possible pc identification strategy. It is to be used as a parameter of identify_pc
STRATEGY_DEFAULT Should be used in most cases.
Values:
-
enumerator STRATEGY_NONE
-
enumerator STRATEGY_DEFAULT
Default strategy.
This strategy first checks the content of the environment variable
IDENTIFICATION_STRATEGY. If the variable is defined it will use the strategy specified in there, if not defined it will try to detect which virtual environment the software is running in.If no virtual environment is detected it will try the strategies defined in LCC_BARE_TO_METAL_STRATEGIES
If it detects the software is running in a virtual machine it will use LCC_VM_STRATEGIES
If it detects the software is running in a docker or in an LXC it will use ::LCC_DOCKER_STRATEGIES or ::LCC_DOCKER_STRATEGIES
If it detects the software is running in a virtual machine in the cloud it will use LCC_CLOUD_STRATEGIES
-
enumerator STRATEGY_ETHERNET
Uses mac address to generate hardware id.
This strategy use the mac address of one of the network adapters to generate the hardware identifier. Network adapters are scored using their names, trying to avoid vpn adapters and virtual devices. Mac address should be unique in the subnetwork, so this strategy poses some limitation on the number of licenses that can be in use in the same subnet.
-
enumerator STRATEGY_IP_ADDRESS
-
enumerator STRATEGY_DISK
-
enumerator STRATEGY_CPU_MODEL
-
enumerator STRATEGY_SYSTEM_ID
Uses OS-specific identifier to generate hardware id.
This strategy uses the OS-specific machine identifier (e.g., /etc/machine-id on Linux, ProductId on Windows) to generate the hardware identifier.
-
enumerator STRATEGY_NONE
-
LCC_BARE_TO_METAL_STRATEGIES
List the strategies used when no virtual envrionment is detected
-
LCC_VM_STRATEGIES
List the strategies used when the software is executing in a virtual machine
-
LCC_CLOUD_STRATEGIES
List the strategies used when it’s detected a VM executed execution in the cloud. CPU_MODEL is not very restrictive. Need to debug with Inspector.
-
LCC_LXC_STRATEGIES
-
LCC_DOCKER_STRATEGIES
Verify a license
-
LCC_EVENT_TYPE license::LicenseFacade::acquire_license(const CallerInformations *callerInformation, const LicenseLocation *licenseLocation, LicenseInfo *license_out) noexcept
Acquire a license for the specified product.
This method coordinates the license acquisition process by:
Reading licenses from various locations
Verifying signatures and limits
Selecting the best valid license
- Parameters:
callerInformation – Optional caller information
licenseLocation – Optional license location hint
license_out – Optional output for license information
- Returns:
LCC_EVENT_TYPE indicating success or failure
-
struct CallerInformations
Informations about the software requesting the license verification (eg, software version, feature to verify).
Public Members
-
char version[LCC_API_VERSION_LENGTH + 1]
software version in format xxxx[.xxxx.xxxx] NOT IMPLEMENTED pass ‘\0’
-
char feature_name[LCC_API_FEATURE_NAME_SIZE + 1]
Name of the feature you want to verify. If empty (‘\0’) the ‘default’ feature will be verified. (every project has a default feature that is equal to the project name). Every feature has a separate section in the license file:
-
unsigned int magic
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
-
char version[LCC_API_VERSION_LENGTH + 1]
-
struct LicenseLocation
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.
-
struct LicenseInfo
Public Members
-
AuditEvent status[LCC_API_AUDIT_EVENT_NUM]
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.
-
char expiry_date[LCC_API_EXPIRY_DATE_SIZE + 1]
Eventual expiration date of the software, can be ‘\0’ if the software don’t expire
-
AuditEvent status[LCC_API_AUDIT_EVENT_NUM]