AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agx::Runtime Class Reference

The Runtime class will read a license file upon creation and check what configuration is allowed to run. More...

#include <Runtime.h>

+ Inheritance diagram for agx::Runtime:

Public Types

enum  HardwareTypes { NIC = 1 , USB = 2 , HDD = 3 }
 
typedef agx::Vector< UniqueIdStructUniqueIdVector
 
- Public Types inherited from agx::Singleton
enum  Priority { HIGHEST_PRIORITY = 2147483647 , LOWEST_PRIORITY = 10000 , DEFAULT_PRIORITY = 1073741824 }
 Specifies the ranges of the priority which can be assigned to a singleton at the time of creation. More...
 

Public Member Functions

bool checkVersion (const agx::String &versionString, int generation, int major=-1, int minor=-1, int patch=-1)
 Version string can be one of two variants:
 
void clear ()
 Clear any previously loaded license.
 
virtual void shutdown () override
 Singleton cleanup method.
 
Online License System
bool activateAgxLicense (int licenseId, const agx::String &activationPassword)
 Perform online activation of AGX.
 
bool activateAgxLicense (int licenseId, const agx::String &activationPassword, const agx::String &outputLicenseFile)
 Perform online activation of AGX.
 
bool deactivateAgxLicense ()
 Deactivate the currently loaded license if the license type allows it.
 
agx::String readEncryptedLicense ()
 Read the encrypted license, normally the contents from the license file.
 
bool loadLicenseFile (const agx::String &licPath, bool forceRefresh=false)
 Load a License file that was created by activating AGX.
 
bool loadLicenseString (const agx::String &licenseContents, bool forceRefresh=false)
 Load a license but provided as a string instead of read from a file.
 
bool isLicenseRefreshed ()
 Check if license was refreshed upon loading.
 
LicenseInfo queryLicenseInformation (const agx::String &licenseContents)
 Retrieves information from a license.
 
agx::String generateOfflineActivationRequest (int licenseId, const agx::String &activationPassword)
 Generates an activation request for a machine that does not have Internet access.
 
bool processOfflineActivationRequest (const agx::String &activationResponse)
 Processes the response from a manual activation request.
 
bool openNetworkSession (const agx::String &licenseFile="floating.lfx")
 Try to open a network session using the specified floating license.
 
bool closeNetworkSession ()
 Close the active network session.
 
bool isFloatingLicense () const
 Query licensetype.
 
agx::String encryptRuntimeActivation (int runtimeLicenseId, const agx::String &runtimeLicensePassword, const agx::String &applicationFilename) const
 Encrypt license id and password for runtime activation.
 
bool activateEncryptedRuntime (const agx::String &encryptedRuntimeData, const agx::String &outputLicenseFile)
 Perform online activation of an encrypted runtime license.
 
Legacy License functions
const UniqueIdVectorgetUniqueIds () const
 
bool hasKey (const char *key) const
 
const agx::StringreadValue (const char *key) const
 
bool unlock (const char *licenseString)
 Will try to unlock AGX with the license provided in licenseString.
 
bool unlock (const agx::String &licenseString)
 
bool verifyAndUnlock (const char *licenseStr)
 Unlock AGX Dynamics using obfuscated license string.
 
Status functions
bool isValid () const
 
const agx::StringgetStatus () const
 Provides status information if license validation failed.
 
const agx::StringgetExtendedStatus () const
 Provides optional extended status information about why license validation failed.
 
bool isModuleEnabled (const char *name) const
 Check if a named AGX module is enabled.
 
const agx::StringVectorgetEnabledModules () const
 
- Public Member Functions inherited from agx::Singleton
 Singleton (int priority=DEFAULT_PRIORITY)
 Default constructor.
 
virtual std::string getClassName () const =0
 
int getPriority () const
 Return the shutdown priority of the singleton instance.
 
virtual void shutdown ()=0
 Implement this method to cleanup your Singleton class.
 

Static Public Member Functions

static agx::String generateMD5 (const agx::String &deviceID)
 Utility method using agxStream::MD5Checksum::getMD5.
 
static Runtimeinstance ()
 Singleton instance method.
 
static bool isInitialized ()
 

Protected Member Functions

 Runtime ()
 
virtual ~Runtime ()
 
- Protected Member Functions inherited from agx::Singleton
virtual ~Singleton ()
 Destructor.
 
void _shutdown ()
 

Detailed Description

The Runtime class will read a license file upon creation and check what configuration is allowed to run.

The license file should be placed where it can be found by agxIO::Environment via the RESOURCE_PATH or in a per-user directory as described in the user manual.

Definition at line 94 of file Runtime.h.

Member Typedef Documentation

◆ UniqueIdVector

Definition at line 109 of file Runtime.h.

Member Enumeration Documentation

◆ HardwareTypes

Enumerator
NIC 
USB 
HDD 

Definition at line 99 of file Runtime.h.

Constructor & Destructor Documentation

◆ Runtime()

agx::Runtime::Runtime ( )
protected

◆ ~Runtime()

virtual agx::Runtime::~Runtime ( )
protectedvirtual

Member Function Documentation

◆ activateAgxLicense() [1/2]

bool agx::Runtime::activateAgxLicense ( int  licenseId,
const agx::String activationPassword 
)

Perform online activation of AGX.

On successful activation, the license will also be loaded.

Returns
true on successful activation.

◆ activateAgxLicense() [2/2]

bool agx::Runtime::activateAgxLicense ( int  licenseId,
const agx::String activationPassword,
const agx::String outputLicenseFile 
)

Perform online activation of AGX.

The received license will be stored to a file locally. Any previous parsed license information will be cleared. On successful activation, the license will also be loaded.

Returns
true on successful activation.

◆ activateEncryptedRuntime()

bool agx::Runtime::activateEncryptedRuntime ( const agx::String encryptedRuntimeData,
const agx::String outputLicenseFile 
)

Perform online activation of an encrypted runtime license.

If successful, the license will be written to outputLicenseFile.

Parameters
encryptedRuntimeData- Encrypted data generated from encryptRuntimeActivation.
outputLicenseFile- Resulting license file if the online activation is successful.
Returns
true if activation is successful, otherwise false (check getStatus()) for errors

◆ checkVersion()

bool agx::Runtime::checkVersion ( const agx::String versionString,
int  generation,
int  major = -1,
int  minor = -1,
int  patch = -1 
)

Version string can be one of two variants:

1) Version range: begin_range - end_range, 1.2-1.4, or 1-2, 1.2.3.4-1.3.4.5 2) Pure version: 1.2, 1, 1.2.3.4, Compare versionString with the version numbers. If generation.major.minor.patch <= versionString then this method returns true

generation always have to be supplied If you are only using three or fewer version numbers, start with generation then major etc.

Returns
true If generation.major.minor.patch <= versionString then this method returns true

◆ clear()

void agx::Runtime::clear ( )

Clear any previously loaded license.

◆ closeNetworkSession()

bool agx::Runtime::closeNetworkSession ( )

Close the active network session.

There will not be a valid license loaded after this call.

See also
openNetworkSession

◆ deactivateAgxLicense()

bool agx::Runtime::deactivateAgxLicense ( )

Deactivate the currently loaded license if the license type allows it.

On failure, getStatus() will contain information about the failure

Returns
True if successfully deactivated the license.

◆ encryptRuntimeActivation()

agx::String agx::Runtime::encryptRuntimeActivation ( int  runtimeLicenseId,
const agx::String runtimeLicensePassword,
const agx::String applicationFilename 
) const

Encrypt license id and password for runtime activation.

The encryption will fail if applicationFilename isn't found in agxIO::Environment::RESOURCE_PATH, returning an empty string.

Parameters
runtimeLicenseId- License id of the runtime license.
runtimeLicensePassword- License password of the runtime license.
applicationFilename- Filename (including relative path) to a file in the application that doesn't change (e.g., an executable or library).
Returns
encrypted runtime activation data

◆ generateMD5()

static agx::String agx::Runtime::generateMD5 ( const agx::String deviceID)
static

Utility method using agxStream::MD5Checksum::getMD5.

◆ generateOfflineActivationRequest()

agx::String agx::Runtime::generateOfflineActivationRequest ( int  licenseId,
const agx::String activationPassword 
)

Generates an activation request for a machine that does not have Internet access.

◆ getEnabledModules()

const agx::StringVector & agx::Runtime::getEnabledModules ( ) const
Returns
the full set of enabled modules

◆ getExtendedStatus()

const agx::String & agx::Runtime::getExtendedStatus ( ) const

Provides optional extended status information about why license validation failed.

◆ getStatus()

const agx::String & agx::Runtime::getStatus ( ) const

Provides status information if license validation failed.

Returns
Information about the isValid result.

◆ getUniqueIds()

const UniqueIdVector & agx::Runtime::getUniqueIds ( ) const
Returns
Unique id for the platform where AGX is running.

◆ hasKey()

bool agx::Runtime::hasKey ( const char *  key) const
Returns
true if the key=value pair exists for key.
See also
readValue

◆ instance()

static Runtime * agx::Runtime::instance ( )
static

Singleton instance method.

◆ isFloatingLicense()

bool agx::Runtime::isFloatingLicense ( ) const

Query licensetype.

Returns
True if a floating license is in use.

◆ isInitialized()

static bool agx::Runtime::isInitialized ( )
static
Returns
true if this singleton is initialized (instance would then return != 0)

◆ isLicenseRefreshed()

bool agx::Runtime::isLicenseRefreshed ( )

Check if license was refreshed upon loading.

◆ isModuleEnabled()

bool agx::Runtime::isModuleEnabled ( const char *  name) const

Check if a named AGX module is enabled.

Returns
True if module name is enabled

◆ isValid()

bool agx::Runtime::isValid ( ) const
Returns
true if a valid license has been read and AGX is allowed to start. If false, getStatus() contains error information.

◆ loadLicenseFile()

bool agx::Runtime::loadLicenseFile ( const agx::String licPath,
bool  forceRefresh = false 
)

Load a License file that was created by activating AGX.

Some license types needs to be refreshed at a certain time interval and this file should be user writable to avoid the need for any manual handling or that the license must be refreshed every time AGX is initialized.

◆ loadLicenseString()

bool agx::Runtime::loadLicenseString ( const agx::String licenseContents,
bool  forceRefresh = false 
)

Load a license but provided as a string instead of read from a file.

This function is similar to loadLicenseFile, but takes the file contents as parameter instead of the filename.

Some license types are refreshed from online source when loading and to check if this has happened, isLicenseRefreshed should be used after this function and readEncryptedLicense if needed.

◆ openNetworkSession()

bool agx::Runtime::openNetworkSession ( const agx::String licenseFile = "floating.lfx")

Try to open a network session using the specified floating license.

Note
This usecase is for large scale installations e.g. on a cluster or some cloud setup. This is not compatible with a normal activated license.

Internet access is needed for the network session to stay valid via periodic background polling. If the polling and retries fail, the license status can change to invalid.

Returns
True if a network session could be started and a seat allocated.

◆ processOfflineActivationRequest()

bool agx::Runtime::processOfflineActivationRequest ( const agx::String activationResponse)

Processes the response from a manual activation request.

Returns
True if the activation response could be processed successfully and a valid license received

◆ queryLicenseInformation()

LicenseInfo agx::Runtime::queryLicenseInformation ( const agx::String licenseContents)

Retrieves information from a license.

If successful the licenseType field is non-negative.

◆ readEncryptedLicense()

agx::String agx::Runtime::readEncryptedLicense ( )

Read the encrypted license, normally the contents from the license file.

If no license is loaded, this will return the empty string

◆ readValue()

const agx::String & agx::Runtime::readValue ( const char *  key) const
Returns
the value associated with key. If key is not found, the empty string will be returned.

◆ shutdown()

virtual void agx::Runtime::shutdown ( )
overridevirtual

Singleton cleanup method.

Implements agx::Singleton.

References agx::shutdown().

◆ unlock() [1/2]

bool agx::Runtime::unlock ( const agx::String licenseString)

◆ unlock() [2/2]

bool agx::Runtime::unlock ( const char *  licenseString)

Will try to unlock AGX with the license provided in licenseString.

This string should contain the same information as the AGX license files normally used.

If Runtime already had parsed a license and the method isValid returns true, using this method will cause isValid to return false if licenseString is not considered valid.

Returns
true if the license is valid and AGX is allowed to start.

◆ verifyAndUnlock()

bool agx::Runtime::verifyAndUnlock ( const char *  licenseStr)

Unlock AGX Dynamics using obfuscated license string.

The input string is un-obfuscated to produce an agx.lic-type license string that is passed to unlock. The obfuscated string is produced by running RuntimeKeyGenerator –obfuscate agx.lic obfuscated.txt where RuntimeKeyGenerator is included in the AGX Dynamics installation.

See also
unlock
Parameters
licenseStrObfuscated license string.
Returns
true if the license is valid and AGX is allowed to start.

The documentation for this class was generated from the following file: