| LicenseSpring C++ SDK 7.32.0 Easily add Software Licensing to your application

Loading...
Searching...
No Matches
ExtendedOptions.h
Go to the documentation of this file.
1#ifndef LS_EXTENDED_OPTIONS_H
2#define LS_EXTENDED_OPTIONS_H
3
4#ifdef _MSC_VER
5#pragma once
6#pragma warning( push )
7#pragma warning( disable : 4251 )
8#endif
9
10#include <vector>
11#include "APIDef.h"
12#include "CryptoProvider.h"
13#include "PODTypes.h"
14
15 namespace LicenseSpring
16{
19 class LS_API NetworkInfo
20 {
21 public:
23 NetworkInfo() = default;
24
26 ~NetworkInfo();
27
30 void setIp( const std::string& ip );
31
34 const std::string& ip() const;
35
38 void setMac( const std::string& mac );
39
42 const std::string& mac() const;
43
46 void setHostName( const std::string& hostName );
47
50 const std::string& hostName() const;
51
52 private:
53 std::string m_localIP;
54 std::string m_hostName;
55 std::string m_macAddress;
56 };
57
59 class LS_API ProxySettings
60 {
61 public:
62
64 ProxySettings() = default;
65
70 ProxySettings( const std::string& proxy, const std::string& user, const std::string& password );
71
73 ~ProxySettings();
74
85 bool fetchProxySettings( const std::string& serviceURL, const std::string& credentialTarget, bool throwExceptions = false );
86
89 void setProxyUri( const std::string& uri );
90
93 const std::string& getProxyUri() const;
94
97 void setUser( const std::string& user );
98
101 const std::string& getUser() const;
102
105 void setPassword( const std::string& password );
106
109 const std::string& getPassword() const;
110
113 bool isValid() const;
114
115 private:
116 std::string m_proxyUri; // e.g. "http://local.example.com:1080"
117 std::string m_user;
118 std::string m_password;
119 };
120
122 class LS_API ExtendedOptions
123 {
124 public:
125
127 ExtendedOptions();
128
131 ExtendedOptions( const std::wstring& licenseFilePath );
132
137 ExtendedOptions( const std::wstring& licenseFilePath,
138 const std::string& hardwareID,
139 const ProxySettings& proxy = ProxySettings() );
140
142 ~ExtendedOptions();
143
147 void setLicenseFilePath( const std::wstring& filePath );
148
152 const std::wstring& getLicenseFilePath() const;
153
156 void setHardwareID( const std::string& ID );
157
160 const std::string& getHardwareID() const;
161
164 DeviceIDAlgorithm getDeviceIdAlgorithm() const;
165
169 void setDeviceIdAlgorithm( DeviceIDAlgorithm algorithm );
170
175 void collectNetworkInfo( bool collect );
176
179 bool isCollectNetworkInfoEnabled() const;
180
187 void enableLogging( bool enable );
188
191 bool isLoggingEnabled() const;
192
197 void enableGuardFile( bool enable );
198
201 bool isGuardFileEnabled() const;
202
207 void enableVMDetection( bool enable );
208
211 bool isVMDetectionEnabled() const;
212
217 void enableSSLCheck( bool enable );
218
221 bool isSSLCheckEnabled() const;
222
229 void setUseNativeTLS( bool value );
230
234 bool isNativeTLSEnabled() const;
235
240 void setGracePeriod( uint32_t value );
241
244 uint32_t getGracePeriod() const;
245
249 void setNetworkTimeout( long timeout );
250
253 long getNetworkTimeout() const;
254
258 void setProxySettings( const ProxySettings& settings );
259
262 const ProxySettings& getProxySettings() const;
263
266 void overrideNetworkInfo( const NetworkInfo& networkInfo );
267
270 const NetworkInfo& getNetworkInfo() const;
271
275 void overrideCryptoProvider( CryptoProvider::ptr_t cryptoProvider );
276
279 CryptoProvider::ptr_t getCryptoProvider();
280
285 void setAlternateServiceURL( const std::string& URL );
286
289 const std::string& getAlternateServiceURL() const;
290
294 void setAlternateKey( const std::string& key );
295
299 void setAlternateKey( const std::vector<int32_t>& key );
300
305 void setAlternateKey( const int32_t* key, std::size_t size );
306
309 const std::string& getAlternateKey() const;
310
311 private:
312 std::wstring m_licenseFilePath;
313 std::string m_hardwareID;
314 std::string m_serviceURL;
315 std::string m_key;
316 bool m_collectNetworkInfo; // false by default
317 bool m_enableVMDetection; // false by default
318 bool m_enableGuardFile; // true by default
319 bool m_enableSSLCheck; // false by default
320 bool m_useNativeTLS; // see isNativeTLSEnabled
321 uint32_t m_gracePeriod; // in hours, default value is 48
322 long m_networkTimeout; // in seconds, default is 5 seconds
323 ProxySettings m_proxySettings; // by default doesn't use any proxy
324 NetworkInfo m_networkInfo;
325 DeviceIDAlgorithm m_deviceIDAlgorithm;
326 CryptoProvider::ptr_t m_cryptoProvider;
327 };
328
329} // namespace LicenseSpring
330
331#ifdef _MSC_VER
332#pragma warning( pop )
333#endif
334
335#endif // LS_EXTENDED_OPTIONS_H
APIDef.h
LS_API
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition APIDef.h:22
CryptoProvider.h
PODTypes.h
DeviceIDAlgorithm
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
Definition PODTypes.h:104
LicenseSpring::CryptoProvider::ptr_t
std::shared_ptr< CryptoProvider > ptr_t
Definition CryptoProvider.h:22
LicenseSpring::ExtendedOptions
Class for storing useful settings that the Configuration object will inherit.
Definition ExtendedOptions.h:123
LicenseSpring::ExtendedOptions::getGracePeriod
uint32_t getGracePeriod() const
Getter for grace period.
LicenseSpring::ExtendedOptions::getHardwareID
const std::string & getHardwareID() const
Get hardware ID.
LicenseSpring::ExtendedOptions::~ExtendedOptions
~ExtendedOptions()
Destructor for ExtendedOptions.
LicenseSpring::ExtendedOptions::setUseNativeTLS
void setUseNativeTLS(bool value)
Enable or disable native TLS for curl.
LicenseSpring::ExtendedOptions::isGuardFileEnabled
bool isGuardFileEnabled() const
Checker for whether enableGuardFile() is enabled.
LicenseSpring::ExtendedOptions::overrideCryptoProvider
void overrideCryptoProvider(CryptoProvider::ptr_t cryptoProvider)
Setter for CryptoProvider.
LicenseSpring::ExtendedOptions::collectNetworkInfo
void collectNetworkInfo(bool collect)
Collect network information.
LicenseSpring::ExtendedOptions::getDeviceIdAlgorithm
DeviceIDAlgorithm getDeviceIdAlgorithm() const
Get device (hardware) id calculation algorithm.
LicenseSpring::ExtendedOptions::getLicenseFilePath
const std::wstring & getLicenseFilePath() const
Get license file path.
LicenseSpring::ExtendedOptions::setGracePeriod
void setGracePeriod(uint32_t value)
Setter for grace period.
LicenseSpring::ExtendedOptions::overrideNetworkInfo
void overrideNetworkInfo(const NetworkInfo &networkInfo)
Setter for NetworkInfo.
LicenseSpring::ExtendedOptions::getCryptoProvider
CryptoProvider::ptr_t getCryptoProvider()
Getter for CryptoProvider.
LicenseSpring::ExtendedOptions::setProxySettings
void setProxySettings(const ProxySettings &settings)
Setter for proxy settings.
LicenseSpring::ExtendedOptions::isLoggingEnabled
bool isLoggingEnabled() const
Checker for whether enableLogging() is enabled.
LicenseSpring::ExtendedOptions::setLicenseFilePath
void setLicenseFilePath(const std::wstring &filePath)
Set license file path.
LicenseSpring::ExtendedOptions::isNativeTLSEnabled
bool isNativeTLSEnabled() const
Checker for whether native TLS for curl enabled or not.
LicenseSpring::ExtendedOptions::setHardwareID
void setHardwareID(const std::string &ID)
Setter for hardware ID.
LicenseSpring::ExtendedOptions::isVMDetectionEnabled
bool isVMDetectionEnabled() const
Checker for whether enableVMDetection() is enabled.
LicenseSpring::ExtendedOptions::enableGuardFile
void enableGuardFile(bool enable)
Enable guard file.
LicenseSpring::ExtendedOptions::setAlternateKey
void setAlternateKey(const std::vector< int32_t > &key)
Set alternate public key.
LicenseSpring::ExtendedOptions::enableVMDetection
void enableVMDetection(bool enable)
Enable VM detection.
LicenseSpring::ExtendedOptions::getNetworkTimeout
long getNetworkTimeout() const
Getter for network timeout.
LicenseSpring::ExtendedOptions::getNetworkInfo
const NetworkInfo & getNetworkInfo() const
Getter for network info.
LicenseSpring::ExtendedOptions::enableSSLCheck
void enableSSLCheck(bool enable)
Enable or disable SSL certificate verification.
LicenseSpring::ExtendedOptions::getAlternateKey
const std::string & getAlternateKey() const
Getter for alternate License API URL.
LicenseSpring::ExtendedOptions::getProxySettings
const ProxySettings & getProxySettings() const
Getter for proxy settings.
LicenseSpring::ExtendedOptions::setAlternateServiceURL
void setAlternateServiceURL(const std::string &URL)
This method can be used if you are planning to deploy self-hosted server.
LicenseSpring::ExtendedOptions::ExtendedOptions
ExtendedOptions(const std::wstring &licenseFilePath, const std::string &hardwareID, const ProxySettings &proxy=ProxySettings())
Constructor for ExtendedOptions.
LicenseSpring::ExtendedOptions::setDeviceIdAlgorithm
void setDeviceIdAlgorithm(DeviceIDAlgorithm algorithm)
Allows to choose device (hardware) id calculation algorithm.
LicenseSpring::ExtendedOptions::ExtendedOptions
ExtendedOptions(const std::wstring &licenseFilePath)
Constructor for ExtendedOptions.
LicenseSpring::ExtendedOptions::isCollectNetworkInfoEnabled
bool isCollectNetworkInfoEnabled() const
Checker for whether collectNetworkInfo() is enabled.
LicenseSpring::ExtendedOptions::enableLogging
void enableLogging(bool enable)
Enable logging.
LicenseSpring::ExtendedOptions::ExtendedOptions
ExtendedOptions()
Default constructor for ExtendedOptions.
LicenseSpring::ExtendedOptions::getAlternateServiceURL
const std::string & getAlternateServiceURL() const
Getter for alternate License API URL.
LicenseSpring::ExtendedOptions::setNetworkTimeout
void setNetworkTimeout(long timeout)
Setter for network timeout.
LicenseSpring::ExtendedOptions::setAlternateKey
void setAlternateKey(const int32_t *key, std::size_t size)
Set alternate public key.
LicenseSpring::ExtendedOptions::isSSLCheckEnabled
bool isSSLCheckEnabled() const
Checker for whether SSL certificate verification is enabled.
LicenseSpring::ExtendedOptions::setAlternateKey
void setAlternateKey(const std::string &key)
Set alternate public key. This method can be used if you are planning to deploy self-hosted server.
LicenseSpring::NetworkInfo
Class for storing a device's network information.
Definition ExtendedOptions.h:20
LicenseSpring::NetworkInfo::mac
const std::string & mac() const
Getter for MAC address.
LicenseSpring::NetworkInfo::setIp
void setIp(const std::string &ip)
Setter for IP address.
LicenseSpring::NetworkInfo::setHostName
void setHostName(const std::string &hostName)
Setter for host name.
LicenseSpring::NetworkInfo::NetworkInfo
NetworkInfo()=default
Constructor for networkInfo.
LicenseSpring::NetworkInfo::ip
const std::string & ip() const
Getter for IP address.
LicenseSpring::NetworkInfo::hostName
const std::string & hostName() const
Getter for host name.
LicenseSpring::NetworkInfo::setMac
void setMac(const std::string &mac)
Setter for MAC address.
LicenseSpring::NetworkInfo::~NetworkInfo
~NetworkInfo()
Destructor for networkInfo.
LicenseSpring::ProxySettings
Class for storing settings when using a proxy server.
Definition ExtendedOptions.h:60
LicenseSpring::ProxySettings::setUser
void setUser(const std::string &user)
Setter for proxy user.
LicenseSpring::ProxySettings::fetchProxySettings
bool fetchProxySettings(const std::string &serviceURL, const std::string &credentialTarget, bool throwExceptions=false)
Automatically fetch proxy URI and credentials.
LicenseSpring::ProxySettings::~ProxySettings
~ProxySettings()
Destructor for proxy settings.
LicenseSpring::ProxySettings::getProxyUri
const std::string & getProxyUri() const
Getter for proxy URI.
LicenseSpring::ProxySettings::getPassword
const std::string & getPassword() const
Getter for password.
LicenseSpring::ProxySettings::getUser
const std::string & getUser() const
Getter for proxy user.
LicenseSpring::ProxySettings::isValid
bool isValid() const
Checker for if proxy URI is specified (i.e. not empty).
LicenseSpring::ProxySettings::setProxyUri
void setProxyUri(const std::string &uri)
Setter for proxy URI.
LicenseSpring::ProxySettings::setPassword
void setPassword(const std::string &password)
Setter for password.
LicenseSpring::ProxySettings::ProxySettings
ProxySettings(const std::string &proxy, const std::string &user, const std::string &password)
Constructor for proxy settings.
LicenseSpring::ProxySettings::ProxySettings
ProxySettings()=default
Default constructor for proxy settings.
LicenseSpring
Definition BaseManager.h:16