LicenseSpring C++ SDK
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 {
19 {
20 public:
21  using ptr_t = std::shared_ptr<Configuration>;
22 
24  Configuration() = default;
25 
38  static ptr_t Create(const std::string &apiKey, const std::string &sharedKey,
39  const std::string &productCode, const std::string &appName, const std::string &appVersion,
40  const ExtendedOptions &extendedOptions = ExtendedOptions());
41 
53  static ptr_t CreateOAuth(const std::string &clientId, const std::string &clientSecret,
54  const std::string &productCode, const std::string &appName, const std::string &appVersion,
55  const ExtendedOptions &extendedOptions = ExtendedOptions());
56 
59  bool isOAuth() const;
60 
63  const std::string &getApiKey() const;
64 
67  const std::string &getSharedKey() const;
68 
71  const std::string &getClientId() const;
72 
75  const std::string &getClientSecret() const;
76 
79  const std::string &getProductCode() const;
80 
83  const std::string &getAppName() const;
84 
87  const std::string &getAppVersion() const;
88 
92  const std::string &getCustomerAccount() const;
93 
98  void setCustomerAccount(const std::string &accountCode);
99 
102  const std::string &getAirGapPublicKey() const;
103 
106  void setAirGapPublicKey(const std::string &key);
107 
113  const std::wstring &getLicenseFilePath() const;
114 
124  const std::string &getHardwareID();
125 
129  void setHardwareID(const std::string &deviceId);
130 
133  void setDeviceIdAlgorithm(DeviceIDAlgorithm algorithm);
134 
137  bool isCollectNetworkInfoEnabled() const;
138 
141  bool isLoggingEnabled() const;
142 
145  bool isGuardFileEnabled() const;
146 
150  bool isSSLCheckEnabled() const;
151 
155  bool isNativeTLSEnabled() const;
156 
160  bool isLicenseCorruptionCheckEnabled() const;
161 
164  uint32_t getGracePeriod() const;
165 
169  long getNetworkTimeout() const;
170 
173  void setNetworkTimeout(long timeoutValue);
174 
178  long getConnectTimeout() const;
179 
182  void setConnectTimeout(long timeoutValue);
183 
186  const ProxySettings &getProxySettings() const;
187 
190  uint32_t getLicenseSpringAPIVersion() const;
191 
194  const std::string &getSdkVersion() const;
195 
198  const std::string &getOsVersion() const;
199 
202  const std::string &getHostName() const; // note: string is UTF-8 encoded
203 
206  const std::string &getIP() const;
207 
210  const std::string &getMAC() const;
211 
214  const NetworkInfo &getNetworkInfo() const;
215 
218  bool isVMDetectionEnabled() const;
219 
226  bool isVM() const;
227 
233  const std::string &getDetectedVMName() const;
234 
238  CryptoProvider::ptr_t getCryptoProvider();
239 
242  const std::string &getAlternateServiceUrl() const;
243 
246  const std::string &getAlternateKey() const;
247 
251  const std::string &getUserInfo() const;
252 
255  void setUserInfo(const std::string &customInfo);
256 
257 private:
258  bool m_isOAuth;
259  std::string m_apiKey;
260  std::string m_sharedKey;
261  std::string m_clientId;
262  std::string m_clientSecret;
263  std::string m_productCode;
264  std::string m_customerAccount;
265  std::string m_appName;
266  std::string m_appVersion;
267  std::string m_userInfo;
268  std::string m_airGapPublicKey;
269  ExtendedOptions m_extOptions;
270 };
271 } // namespace LicenseSpring
272 
273 #ifdef _MSC_VER
274 #pragma warning(pop)
275 #endif
276 
277 #endif // LS_CONFIGURATION_H
LicenseSpring::Configuration::ptr_t
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:21
LicenseSpring::CryptoProvider::ptr_t
std::shared_ptr< CryptoProvider > ptr_t
Definition: CryptoProvider.h:23
LicenseSpring
Definition: BaseManager.h:16
ExtendedOptions.h
DeviceIDAlgorithm
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
Definition: PODTypes.h:114
LicenseSpring::NetworkInfo
Class for storing a device's network information.
Definition: ExtendedOptions.h:20
LS_API
#define LS_API
Definition: APIDef.h:23
LicenseSpring::Configuration
Class for configuring application.
Definition: Configuration.h:18
LicenseSpring::ExtendedOptions
Class for storing useful settings that the Configuration object will inherit.
Definition: ExtendedOptions.h:123
LicenseSpring::ProxySettings
Class for storing settings when using a proxy server.
Definition: ExtendedOptions.h:60