DiCE API nvidia_logo_transpbg.gif Up
mi::neuraylib::ILibrary_authenticator Class Referenceabstract

This interface is used for authenticating the application against the library. More...

#include <ilibrary_authentication.h>

Inheritance diagram for mi::neuraylib::ILibrary_authenticator:

Public Member Functions

virtual bool is_trial_license () const =0
 Indicates whether the license provided for authentication is a time-limited license. More...
 
virtual Uint64 get_trial_seconds_left () const =0
 Returns the number of seconds left for time-limited licenses. More...
 
virtual const IStringget_host_id () const =0
 Returns the host ID of the machine the program is running on. More...
 
virtual const IStringget_last_error_message () const =0
 Returns the last error message related to authentication. More...
 
virtual bool set_flexnet_default_license_path (const char *path)=0
 Sets the expected FlexNet license file location. More...
 
virtual void set_flexnet_trial_license_data (const Uint8 *data, Size size)=0
 Sets the content of the FlexNet trial license. More...
 
virtual bool is_flexnet_license_available () const =0
 Indicates whether a valid FlexNet license for the submitted response is available. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Static Public Member Functions

static Sint32 authenticate (const INeuray *library, const char *vendor_key, Size vendor_key_length, const char *secret_key, Size secret_key_length, Sint32 count=1)
 Convenience function implementing the full library authentication. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x5a7d010a, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x5a7d010a, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 

Detailed Description

This interface is used for authenticating the application against the library.

Different variants of the DiCE library use different mechanisms to prevent unauthorized use of the library.

The application needs to prove against the library that it has a valid secret key which enables it to start the DiCE library.

Member Function Documentation

 authenticate()

Sint32 mi::neuraylib::ILibrary_authenticator::authenticate ( const INeuray library,
const char *  vendor_key,
Size  vendor_key_length,
const char *  secret_key,
Size  secret_key_length,
Sint32  count = 1 
)
inlinestatic

Convenience function implementing the full library authentication.

The embedding application needs to pass in a pointer to the mi::neuraylib::INeuray interface, the vendor key and the secret key. The function will then perform the authentication towards the library.

The function is inline to avoid passing the secret key to the DiCE library which would enable eavesdroppers to get the key. Keys are supposed to be entered as delivered to the application writer (which are hex encoded byte arrays).

Parameters
libraryA pointer to an instance of mi::neuraylib::INeuray. The method attempts to authenticate this instance of the library.
vendor_keyThe vendor key assigned to the application writer.
vendor_key_lengthThe size of the vendor key.
secret_keyThe secret key provided to the application writer.
secret_key_lengthThe size of the secret key.
countThe number of licenses to retrieve.
Returns
Indicates errors in the authentication attempt. Returns 0 if there was no error, or negative values in case of errors. Note that a value of 0 does not imply that the key is valid. Key validity is checked during startup, i.e., in mi::neuraylib::INeuray::start().

 get_host_id()

virtual const IString * mi::neuraylib::ILibrary_authenticator::get_host_id ( ) const
pure virtual

Returns the host ID of the machine the program is running on.

The host ID is a unique identifier of the machine which can be used to lock a license to a machine.

 get_last_error_message()

virtual const IString * mi::neuraylib::ILibrary_authenticator::get_last_error_message ( ) const
pure virtual

Returns the last error message related to authentication.

For example, if authentication via FlexNet failed, i.e., mi::neuraylib::INeuray::start() returns -6, then there might be a message providing a more detailed error description, originating from the FlexNet utilities.

Returns
The last error message, or NULL if there is no such error message available.

 get_trial_seconds_left()

virtual Uint64 mi::neuraylib::ILibrary_authenticator::get_trial_seconds_left ( ) const
pure virtual

Returns the number of seconds left for time-limited licenses.

This method returns sensible data only when called after DiCE has been started or after mi::neuraylib::ILibrary_authenticator::is_flexnet_license_available().

Note
A time-limited license might be either a trial license or a long-running license.
Returns
The number of seconds left before a time-limited license expires, or mi::base::numeric_traits<mi::base::Uint64>::max() for permanent licenses (or DiCE has not yet been started).

 is_flexnet_license_available()

virtual bool mi::neuraylib::ILibrary_authenticator::is_flexnet_license_available ( ) const
pure virtual

Indicates whether a valid FlexNet license for the submitted response is available.

Please note that this function can only be used after the response was submitted with the call mi::neuraylib::ILibrary_authenticator::authenticate().

Returns
true if a valid FlexNet license is available, false if no valid FlexNet license is available, no response has been submitted yet, or the license has already been checked out.

 is_trial_license()

virtual bool mi::neuraylib::ILibrary_authenticator::is_trial_license ( ) const
pure virtual

Indicates whether the license provided for authentication is a time-limited license.

This method can only be called after DiCE has been started or after mi::neuraylib::ILibrary_authenticator::is_flexnet_license_available().

Note
A time-limited license might be either a trial license or a long-running license.
Returns
true if license is a time-limited license, false otherwise (including DiCE has not yet been started)

 set_flexnet_default_license_path()

virtual bool mi::neuraylib::ILibrary_authenticator::set_flexnet_default_license_path ( const char *  path)
pure virtual

Sets the expected FlexNet license file location.

To check out a feature, a FlexNet enabled application must first locate the license file. This function sets the default location where to start looking for the license file. The @ symbol cannot be used for file paths, as it is used for specifying FlexNet server addresses. Please note that this function should only be used after the response was submitted using mi::neuraylib::ILibrary_authenticator::authenticate(), otherwise the return value is meaningless.

Returns
true if a valid FlexNet (non-trial) license was found in this path or eventually configured environment variables.

 set_flexnet_trial_license_data()

virtual void mi::neuraylib::ILibrary_authenticator::set_flexnet_trial_license_data ( const Uint8 data,
Size  size 
)
pure virtual

Sets the content of the FlexNet trial license.

Similar to set_flexnet_default_license_path(), except that for trial licenses the license data is passed in memory.