Rhino C++ API  8.13
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
CRhinoLicenseValidator Class Referenceabstract

#include <rhinoSdkPlugIn.h>

Public Types

enum  product_build_type {
  unspecified_build = 0, release_build = 100, evaluation_build = 200, beta_build = 300,
  build_type_force_32bit = 0xFFFFFFFF
}
 
enum  result { error_hide_message = -1, error_show_message = 0, success = 1, result_force_32bit = 0xFFFFFFFF }
 

Public Member Functions

 CRhinoLicenseValidator ()
 
virtual ~CRhinoLicenseValidator ()
 
virtual void OnLeaseChanged (CRhinoLeaseChangedEventArgs &)=0
 
CRhinoPlugInPlugIn ()
 
virtual product_build_type ProductBuildType ()=0
 
void SetLease (const CRhinoLicenseLease *)
 
virtual CRhinoLicenseValidator::result ValidateProductKey (const wchar_t *product_key)=0
 
virtual CRhinoLicenseValidator::result VerifyLicenseKey (const wchar_t *licenseKey, const wchar_t *validationCode, const double validationCodeInstalledDate, bool gracePeriodExpired)=0
 
virtual bool VerifyPreviousVersionLicense (const wchar_t *license, const wchar_t *previousVersionLicense)=0
 

Public Attributes

product_build_type m_build_type
 
DATE m_date_to_expire
 
ON_wString m_error_message
 
CRhinoLicenseLeasem_lease = nullptr
 
int m_license_count
 
ON_wString m_license_title
 
HICON m_product_icon
 
ON_wString m_product_license
 
bool m_requires_online_validation = false
 Set to true if the licenseKey passed to VerifyLicenseKey requires online validation. More...
 
bool m_requires_previous_version_license_verification = false
 
ON_wString m_serial_number
 

Friends

class CRhPlugInLicenseManager
 

Detailed Description

class CRhinoLicenseValidator

Description: Class for validating licenses for the Rhino license manager. For each plug-in, there can only be a single CRhinoLicenseValidator derived class and a single static instance that exists in the .CPP file where the class is defined. No other declarations or instances of a class derived from CRhinoLicenseValidator should ever be defined or created.

For details on how the licensing system in Rhino works, see http://developer.rhino3d.com/guides/cpp/creating-zoo-plugins/

Member Enumeration Documentation

◆ product_build_type

Enumerator
unspecified_build 

Unspecified.

release_build 

Release license (e.g. commercial, educational, etc.)

evaluation_build 

Evaluation license.

beta_build 

Beta or work-in-progress license.

build_type_force_32bit 

For internal use only.

◆ result

Enumerator
error_hide_message 

There was an error validating the product key or license, do not allow the license manager show an error message - you will display your own error message.

error_show_message 

There was an error validating the product key or license, allow the license manager show an error message.

success 

The product key or license is validated successfully.

result_force_32bit 

For internal use only.

Constructor & Destructor Documentation

◆ CRhinoLicenseValidator()

CRhinoLicenseValidator::CRhinoLicenseValidator ( )

◆ ~CRhinoLicenseValidator()

virtual CRhinoLicenseValidator::~CRhinoLicenseValidator ( )
virtual

Member Function Documentation

◆ OnLeaseChanged()

virtual void CRhinoLicenseValidator::OnLeaseChanged ( CRhinoLeaseChangedEventArgs )
pure virtual

Description: When Rhino Accounts gets a new lease, this function is called. If the Rhino Accounts server determines that this lease is no longer valid, it will signal Rhino, and OnLeaseChanged will be called with a null CRhinoLeaseChangedEventArgs.Lease

◆ PlugIn()

CRhinoPlugIn* CRhinoLicenseValidator::PlugIn ( )

Description: Returns a pointer to the plug-in that this validator is associated with.

◆ ProductBuildType()

virtual product_build_type CRhinoLicenseValidator::ProductBuildType ( )
pure virtual

Description: This member is called by Rhino, from CRhinoPlugIn::GetLicense(), when it needs to know what the build type of your plug-in is. This value is used when looking for licenses for your product.

◆ SetLease()

void CRhinoLicenseValidator::SetLease ( const CRhinoLicenseLease )

◆ ValidateProductKey()

virtual CRhinoLicenseValidator::result CRhinoLicenseValidator::ValidateProductKey ( const wchar_t *  product_key)
pure virtual

Description: Oops. This pure virtual should have been removed from the Rhino SDK. It won't ever be called because VerifyLicenseKey will be called instead.

Please override this function in your class and return CRhinoLicenseValidator::result::error_show_message.

◆ VerifyLicenseKey()

virtual CRhinoLicenseValidator::result CRhinoLicenseValidator::VerifyLicenseKey ( const wchar_t *  licenseKey,
const wchar_t *  validationCode,
const double  validationCodeInstalledDate,
bool  gracePeriodExpired 
)
pure virtual

Description: This member is called by Rhino, from CRhinoPlugIn::GetLicense(), when it needs your plug-in to validate your product key or license. If your plug-in determines that product_key represents a valid product key or license, then the function should fill out the class members (see below), which describe the license, before returning success.

See http://developer.rhino3d.com/guides/cpp/creating-zoo-plugins/ for details Parameters: licenseKey - [in] The product key or license as saved in a license file or returned by a Zoo server. validationCode - [in] A validation code returned by your validation server validationCodeInstalledDate - [in] The date your validation code was associated with this license key. gracePeriodExpired - [in] True if the license validation grace period is expired Returns: success error_hide_message error_show_message

◆ VerifyPreviousVersionLicense()

virtual bool CRhinoLicenseValidator::VerifyPreviousVersionLicense ( const wchar_t *  license,
const wchar_t *  previousVersionLicense 
)
pure virtual

Description: Called by Rhino, from CRhinoPlugIn::GetLicense(), after a call to VerifyLicenseKey that sets m_requires_previous_version_license_verification to true. Parameters: license - [in] your license key previousVersionLicenseKey - [in] a license key from a previous version of your product. This is used for upgrade eligibility. Returns: true when previousVersionLicense is a valid previous version license for license. false otherwise

Friends And Related Function Documentation

◆ CRhPlugInLicenseManager

friend class CRhPlugInLicenseManager
friend

Member Data Documentation

◆ m_build_type

product_build_type CRhinoLicenseValidator::m_build_type

The build of the product that this license work with. When your product requests a license from Rhino, it will specify one of these build types.

◆ m_date_to_expire

DATE CRhinoLicenseValidator::m_date_to_expire

Licenses can be made to expire. If your licensing scheme is sophisticated enough to support this, then specify the expiration date here. Note, this value must be specified in Coordinated Universal Time (UTC). If your license does not expire, then just this value to null.

◆ m_error_message

ON_wString CRhinoLicenseValidator::m_error_message

If VerifyLicenseKey returns error_show_message and m_error_message is set, Rhino will show this error message. Otherwise, it will show a generic error message.

◆ m_lease

CRhinoLicenseLease* CRhinoLicenseValidator::m_lease = nullptr

The lease set by the Cloud Zoo. Data on this lease may change at any time from a different thread. OnLeaseChanged() will be called when this data changes. If OnLeaseChanged() is called and m_lease == nullptr, then your product no longer has a valid lease from the CloudZoo. Disable your product's functionality in a reasonable way.

◆ m_license_count

int CRhinoLicenseValidator::m_license_count

Licenses can be used by more than one instance of any application. For example, a single Rhino Education Lab license can be used by up to 30 systems simultaneously. If your license supports multiple instance, then specify the number of supported instances here. Otherwise just specify a value of 1 for single instance use.

◆ m_license_title

ON_wString CRhinoLicenseValidator::m_license_title

This value will display in user interface items, such as in the Zoo console and in About dialog boxes. (e.g. "Rhinoceros 5.0", "Rhinoceros 5.0 Commercial", etc.)

◆ m_product_icon

HICON CRhinoLicenseValidator::m_product_icon

This icon will displayed in the "Licenses" page in the Options dialog. Note, Rhino will make a copy of this icon..

◆ m_product_license

ON_wString CRhinoLicenseValidator::m_product_license

This value will never be display in any user interface. When your plug-in's ValidateProductKey member is called, it is passed a a product, or CD, key that was entered into the Zoo administrator console. Your ValidateProductKey will validate the product key and decode it into a product license. This is where you can store this license. This value will be passed to your application at runtime when it requests a license.

◆ m_requires_online_validation

bool CRhinoLicenseValidator::m_requires_online_validation = false

Set to true if the licenseKey passed to VerifyLicenseKey requires online validation.

◆ m_requires_previous_version_license_verification

bool CRhinoLicenseValidator::m_requires_previous_version_license_verification = false

Set to true if the licenseKey passed to VerifyLicenseKey requires verification. A separate call will be made, if necessary, to VerifyPreviousVersionLicense will be made with the previous version license.

◆ m_serial_number

ON_wString CRhinoLicenseValidator::m_serial_number

This value will display in user interface items, such as in the Zoo console and in About dialog boxes. Also, this value is used to uniquely identify this license. Thus, it is critical that this value be unique per product key, entered by the administrator. No other license of this product, as validated by this plug-in, should return this value.