LicenseSpring C++ SDK  7.27.0
Easily add Software Licensing to your application
Configuration.h
Go to the documentation of this file.
1 #ifndef LS_CONFIGURATION_H
2 #define LS_CONFIGURATION_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning( push )
7 #pragma warning( disable : 4251 )
8 #endif
9 
10 #include <memory>
11 #include "ExtendedOptions.h"
12 
13 namespace LicenseSpring
14 {
18  {
19  public:
20  using ptr_t = std::shared_ptr<Configuration>;
21 
23  Configuration() = default;
24 
35  static ptr_t Create( const std::string& apiKey,
36  const std::string& sharedKey,
37  const std::string& productCode,
38  const std::string& appName,
39  const std::string& appVersion,
40  const ExtendedOptions& extendedOptions = ExtendedOptions() );
41 
44  const std::string& getApiKey() const;
45 
48  const std::string& getSharedKey() const;
49 
52  const std::string& getProductCode() const;
53 
56  const std::string& getAppName() const;
57 
60  const std::string& getAppVersion() const;
61 
65  const std::string& getCustomerAccount() const;
66 
70  void setCustomerAccount( const std::string& accountCode );
71 
74  const std::string& getAirGapPublicKey() const;
75 
78  void setAirGapPublicKey( const std::string& key );
79 
83  const std::wstring& getLicenseFilePath() const;
84 
91  const std::string& getHardwareID();
92 
96  void setHardwareID( const std::string& deviceId );
97 
101 
105 
108  bool isLoggingEnabled() const;
109 
112  bool isGuardFileEnabled() const;
113 
117  bool isSSLCheckEnabled() const;
118 
122  bool isNativeTLSEnabled() const;
123 
126  uint32_t getGracePeriod() const;
127 
131  long getNetworkTimeout() const;
132 
135  void setNetworkTimeout( long timeoutValue );
136 
140 
143  uint32_t getLicenseSpringAPIVersion() const;
144 
147  const std::string& getSdkVersion() const;
148 
151  const std::string& getOsVersion() const;
152 
155  const std::string& getHostName() const; // note: string is UTF-8 encoded
156 
159  const std::string& getIP() const;
160 
163  const std::string& getMAC() const;
164 
167  const NetworkInfo& getNetworkInfo() const;
168 
171  bool isVMDetectionEnabled() const;
172 
177  bool isVM() const;
178 
183  const std::string& getDetectedVMName() const;
184 
188 
191  const std::string& getAlternateServiceUrl() const;
192 
195  const std::string& getAlternateKey() const;
196 
200  const std::string& getUserInfo() const;
201 
204  void setUserInfo( const std::string& customInfo );
205 
206  private:
207  std::string m_apiKey;
208  std::string m_sharedKey;
209  std::string m_productCode;
210  std::string m_customerAccount;
211  std::string m_appName;
212  std::string m_appVersion;
213  std::string m_userInfo;
214  std::string m_airGapPublicKey;
215  ExtendedOptions m_extOptions;
216  };
217 }
218 
219 #ifdef _MSC_VER
220 #pragma warning( pop )
221 #endif
222 
223 #endif // LS_CONFIGURATION_H
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
Definition: PODTypes.h:101
Class for configuring application.
Definition: Configuration.h:18
const std::string & getHostName() const
Getter for Host Name.
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:20
bool isVM() const
Checker for whether the user is on a virtual machine.
const std::string & getIP() const
Getter for IP Address.
void setDeviceIdAlgorithm(DeviceIDAlgorithm algorithm)
Setter for DeviceIDAlgorithm.
const std::string & getMAC() const
Getter for MAC Address.
bool isCollectNetworkInfoEnabled() const
Checker for if collection of network information is enabled in ExtendedOptions.
long getNetworkTimeout() const
Getter for network timeout.
const std::string & getOsVersion() const
Getter for Operating System version.
uint32_t getGracePeriod() const
Getter for grace period.
CryptoProvider::ptr_t getCryptoProvider()
Getter for crypto provider.
const NetworkInfo & getNetworkInfo() const
Getter for Network Information.
const std::string & getUserInfo() const
Returns custom information to be passed along with all API requests.
bool isLoggingEnabled() const
Checker for if logging is enabled in ExtendedOptions.
const std::string & getApiKey() const
Getter for API key (UUID).
Configuration()=default
Constructor for internal needs, use Create instead.
void setUserInfo(const std::string &customInfo)
Set custom information to be passed to the backend with all API requests.
bool isGuardFileEnabled() const
Checker for whether guard file usage is enabled in ExtendedOptions.
void setHardwareID(const std::string &deviceId)
Setter for device id.
void setCustomerAccount(const std::string &accountCode)
Set customer group (account) code that is required for SSO.
const std::string & getHardwareID()
Getter for device id.
const std::string & getAlternateKey() const
Getter for alternate public key.
bool isNativeTLSEnabled() const
Checker for whether native TLS for curl enabled or not.
bool isSSLCheckEnabled() const
Checker for whether SSL certificate verification is enabled.
const std::string & getSharedKey() const
Getter for shared key.
bool isVMDetectionEnabled() const
Checker for whether Virtual Machine Detection is enabled.
const std::string & getSdkVersion() const
Getter for LicenseSpring SDK version.
const std::string & getAirGapPublicKey() const
Getter for air gap public key.
void setAirGapPublicKey(const std::string &key)
Setter for air gap public key.
const ProxySettings & getProxySettings() const
Getter for ProxySettings object.
const std::string & getAlternateServiceUrl() const
Getter for alternate service URL.
const std::string & getAppName() const
Getter for application name.
const std::wstring & getLicenseFilePath() const
This method is obsolete! Return license file path that was set through ExtendedOptions or empty strin...
const std::string & getProductCode() const
Getter for product code.
static ptr_t Create(const std::string &apiKey, const std::string &sharedKey, const std::string &productCode, const std::string &appName, const std::string &appVersion, const ExtendedOptions &extendedOptions=ExtendedOptions())
Creates shared pointer for configuration object.
void setNetworkTimeout(long timeoutValue)
Setter for network timeout.
uint32_t getLicenseSpringAPIVersion() const
Getter for LicenseSpring API version.
const std::string & getCustomerAccount() const
Returns customer group (account) code that is required for SSO.
const std::string & getAppVersion() const
Getter for application version.
const std::string & getDetectedVMName() const
Getter for hypervisor name, calls isVM first if not yet called.
std::shared_ptr< CryptoProvider > ptr_t
Class for storing useful settings that the Configuration object will inherit.
Class for storing a device's network information.
Class for storing settings when using a proxy server.