licensecc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /** \addtogroup api
  2. * @{
  3. */
  4. #ifndef LICENSEPP_H_
  5. #define LICENSEPP_H_
  6. /*
  7. * This include file is the public api di Licensecc
  8. */
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include "datatypes.h"
  13. /**
  14. * Method used to convert the LicenseInfo into a human readable
  15. * representation.
  16. */
  17. void print_error(char out_buffer[LCC_API_ERROR_BUFFER_SIZE], LicenseInfo* licenseInfo);
  18. /**
  19. * \brief Calculates the hardware identifier associated with a specific pc.
  20. * \details
  21. * The caller, when it doesn't find a valid license (see `acquire_license` below) should show to the user the calculated identifier.
  22. * The user should report the pc_identifier to the software editor that will in turn use it to issue a license.
  23. *
  24. * pc_id_method = ::STRATEGY_DEFAULT is usually the best choice.
  25. *
  26. * First call this method with `identifier_out` = nullptr and `buf_size` = 0 , it will return the requested buffer size
  27. * in `buf_size` parameter.
  28. *
  29. * Then allocate the necessary memory, and call the method again.
  30. *
  31. * @return true if successful, false if failure (because it is not possible to identify or buffer too small).
  32. * @param hw_id_method[in] specifies a preferred identification method. Usually #STRATEGY_DEFAULT works well. See the
  33. * wiki for more informations.
  34. * @param identifier_out[out] buffer where the identification string will be placed.
  35. * @param buf_size[in-out] size of the buffer where the identification string will be placed.
  36. * @param execution_environment_info[out] if not null will contain the informations about the execution environment.
  37. */
  38. bool identify_pc(LCC_API_HW_IDENTIFICATION_STRATEGY hw_id_method, char* identifier_out, size_t* buf_size,
  39. ExecutionEnvironmentInfo* execution_environment_info);
  40. /**
  41. * This method is used to request the use of one license for a product.
  42. * In case of local license it's used to check if the product is licensed.
  43. *
  44. * @return LCC_EVENT_TYPE::LICENSE_OK(0) if successful. Other values if there are errors.
  45. *
  46. * @param callerInformation[in] optional, can be NULL.
  47. * contains informations on the software that is requesting the license verification. Let the software
  48. * specify its version or request verification for features that need to be enabled separately.
  49. * @param licenseLocation[in] optional, can be NULL.
  50. * licenseLocation, either the name of the file
  51. * or the name of the environment variable should be !='\0'
  52. * @param license_out[out] optional, can be NULL, if set it will return extra informations about the license.
  53. */
  54. LCC_EVENT_TYPE acquire_license(const CallerInformations* callerInformation, const LicenseLocation* licenseLocation,
  55. LicenseInfo* license_out);
  56. /**
  57. * Not implemented yet, useful (later) for network licenses.
  58. * Should be called from time to time to confirm we're still using the
  59. * license.
  60. */
  61. LCC_EVENT_TYPE confirm_license(char* featureName, LicenseLocation* licenseLocation);
  62. /**
  63. * Not implemented yet, useful (later) for network licenses.
  64. */
  65. LCC_EVENT_TYPE release_license(char* featureName, LicenseLocation licenseLocation);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif
  70. /**
  71. * @}
  72. */