licensecc_properties.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**
  2. * \file
  3. * This file contains all the properties that are customizable on on a per-project basis eg:
  4. * 1) api parameter sizes
  5. * 2)
  6. *
  7. * It is safe to place the values that your project need to customize here, since each project get its own copy of this
  8. * file.
  9. */
  10. /**
  11. * \addtogroup api
  12. * @{
  13. */
  14. #ifndef BUILD_PROPERTIES_H_
  15. #define BUILD_PROPERTIES_H_
  16. /**
  17. * This file contains all the properties that are customizable on on a per-project basis eg:
  18. * 1) api parameter sizes
  19. * 2)
  20. *
  21. * It is safe to place the values that your project need to customize here, since each project get its own copy of this
  22. * file.
  23. */
  24. #define LCC_PROJECT_NAME "GJDM"
  25. //License retrieval configuration
  26. #define FIND_LICENSE_NEAR_MODULE true
  27. #define FIND_LICENSE_WITH_ENV_VAR false
  28. /**
  29. * License file name extension
  30. */
  31. #define LCC_LICENSE_FILE_EXTENSION ".lic"
  32. #define LCC_LICENSE_LOCATION_ENV_VAR "LICENSE_LOCATION"
  33. #define LCC_LICENSE_DATA_ENV_VAR "LICENSE_DATA"
  34. // Api structure limits
  35. /**
  36. * Maximum size of a license file or base64 data
  37. */
  38. #define LCC_API_MAX_LICENSE_DATA_LENGTH 1024 * 4
  39. // define api structure sizes
  40. #define LCC_API_PC_IDENTIFIER_SIZE 19
  41. #define LCC_API_PROPRIETARY_DATA_SIZE 16
  42. #define LCC_API_AUDIT_EVENT_NUM 5
  43. #define LCC_API_AUDIT_EVENT_PARAM2 255
  44. #define LCC_API_VERSION_LENGTH 15
  45. #define LCC_API_FEATURE_NAME_SIZE 15
  46. #define LCC_API_EXPIRY_DATE_SIZE 10
  47. #define LCC_API_ERROR_BUFFER_SIZE 256
  48. /**
  49. This definition allows to specify a custom expression to verify the magic number passed in by the api.
  50. */
  51. #define LCC_VERIFY_MAGIC (lic_info.m_magic == 0)
  52. /**
  53. *
  54. * Environment variable name that if defined will change the identification strategy used to generate the hardware
  55. * identifier. If a client has an unstable pc-identifier use this variable to generate one. Valid values are integers
  56. * defined in `LCC_IDENTIFICATION_STRATEGY` enum.
  57. */
  58. #define LCC_IDENTIFICATION_STRATEGY_ENV_VAR "IDENTIFICATION_STRATEGY"
  59. /**
  60. * \enum LCC_API_HW_IDENTIFICATION_STRATEGY
  61. *
  62. * This enum list all the possible pc identification strategy. It is to be used as a parameter of ::identify_pc
  63. *
  64. * ::STRATEGY_DEFAULT Should be used in most cases.
  65. */
  66. enum LCC_API_HW_IDENTIFICATION_STRATEGY {
  67. /**
  68. * \brief Default strategy.
  69. *
  70. * This strategy first checks the content of the environment variable `IDENTIFICATION_STRATEGY`. If the variable is defined it will use the
  71. * strategy specified in there, if not defined it will try to detect which virtual environment the software is running in.
  72. * - If no virtual environment is detected it will try the strategies defined in ::LCC_BARE_TO_METAL_STRATEGIES
  73. * - If it detects the software is running in a virtual machine it will use ::LCC_VM_STRATEGIES
  74. * - If it detects the software is running in a docker or in an LXC it will use ::LCC_DOCKER_STRATEGIES or
  75. * ::LCC_DOCKER_STRATEGIES
  76. * - If it detects the software is running in a virtual machine in the cloud it will use ::LCC_CLOUD_STRATEGIES
  77. */
  78. STRATEGY_DEFAULT = -1,
  79. /**
  80. * \brief Uses mac address to generate hardware id.
  81. *
  82. * This strategy use the mac address of one of the network adapters to generate the hardware identifier.
  83. * Network adapters are scored using their names, trying to avoid vpn adapters and virtual devices.
  84. * Mac address should be unique in the subnetwork, so this strategy poses some limitation on the number of licenses
  85. * that can be in use in the same subnet.
  86. */
  87. STRATEGY_ETHERNET = 0,
  88. STRATEGY_IP_ADDRESS = 1,
  89. STRATEGY_DISK = 2,
  90. /**
  91. * Not yet implemented
  92. */
  93. STRATEGY_CPU_SIZE = 3,
  94. /**
  95. * Not yet implemented
  96. */
  97. STRATEGY_HOST_NAME = 4,
  98. STRATEGY_NONE = -2
  99. };
  100. /**
  101. * @addtogroup strategies
  102. * @{
  103. */
  104. /**
  105. * List the strategies used when no virtual envrionment is detected
  106. */
  107. #define LCC_BARE_TO_METAL_STRATEGIES { STRATEGY_DISK, STRATEGY_HOST_NAME, STRATEGY_NONE }
  108. /**
  109. * List the strategies used when the software is executing in a virtual machine
  110. */
  111. #define LCC_VM_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
  112. #define LCC_LXC_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
  113. #define LCC_DOCKER_STRATEGIES { STRATEGY_NONE }
  114. /**
  115. * List the strategies used when it's detected an execution in the cloud
  116. */
  117. #define LCC_CLOUD_STRATEGIES { STRATEGY_NONE }
  118. /**
  119. * @}
  120. */
  121. #endif
  122. /**
  123. * @}
  124. */