PGSLIC.lib  3.0
Macros | Enumerations | Functions
pgslic.h File Reference

The PGSLIC API header. More...

#include <cstddef>

Go to the source code of this file.

Enumerations

enum  LicenseStatus {
  LICENSE_OK , LICENSE_WARNING , LICENSE_ERROR , LICENSE_EXPIRED ,
  LICENSE_STALE
}
 

Functions

PGSLIC_API LicenseStatus checkLicense (const char *licPath, const char *pwd, const char *key, const char *appName, const char *appInfo="", const char *cxnOpts="")
 
PGSLIC_API LicenseStatus release (const char *pwd)
 
PGSLIC_API const char * getAppName ()
 
PGSLIC_API const char * getExpiryDate ()
 
PGSLIC_API int isPerpetual ()
 
PGSLIC_API int getDaysUntilExpiry ()
 
PGSLIC_API const char * getClientName ()
 
PGSLIC_API const char * getSettings ()
 
PGSLIC_API const char * getSetting (const char *settingName)
 
PGSLIC_API const char * getLastError ()
 
PGSLIC_API int getStaleTime ()
 

Detailed Description

The PGSLIC API header.

Enumeration Type Documentation

◆ LicenseStatus

The return code returned by the checkLicense and release functions indicating success or one of five error types.

Enumerator
LICENSE_OK 

License checked out or released ok. For checkLicense: the license information was read successfully, any license locks are in order, the application name matches and the license has not expired. For release: the license was successfully released back to the license activation cloud service.

LICENSE_WARNING 

The call was successful and a warning message was received. To view the warning you can call the getLastError function.

LICENSE_ERROR 

The license was not valid for some reason or it failed to release. For more detail you can call the getLastError function.

LICENSE_EXPIRED 

The license has expired. For more detail you can call the getLastError function or get the expiry date by calling the getExpiryDate function.

LICENSE_STALE 

The license may be valid but is stale and needs refreshing by connecting to the Nuvovis cloud service (only applies to Live licenses). You can find out how long it's been since the license was refeshed successfully from the cloud by calling the getStaleTime function. It is recommended that if the license is quite stale the application should alert the end user and if the license is very stale the application should consider the license to be invalid. Using license settings you can control the permitted stale period from Salesforce and update it in real time.

Function Documentation

◆ checkLicense()

PGSLIC_API LicenseStatus checkLicense ( const char *  licPath,
const char *  pwd,
const char *  key,
const char *  appName,
const char *  appInfo = "",
const char *  cxnOpts = "" 
)

Verifies that the current machine and/or user is licensed to run the application. The checkLicense function can be called multiple times by the licensed applicaiton. It will check to see if it has a valid license in memory. If not it will look for a license file in the specified path and check that the file contains a valid license. If not it will request a valid license from the Nuvovis cloud service and cache the license in a file and in memory. If the license is a Live license it will become stale after a number of minutes.

Parameters
licPathThe path of a writable directory where license files are cached.
pwdYour development password provided to you by Nuvovis.
keyThe license key stored in Salesforce and sent to the end user to be stored by the application.
appNameThe name of the calling application.
appInfoAn optional information string e.g. application version to be viewed in Salesforce. Must be alphanumerics, underscores, spaces, dots and dashes only.
cxnOptsConnection options string. A list of '&' separated name=value pairs. e.g. PXSP=10.0.0.113:3128&PXAT=BASIC&PXUN=fred&PXPW=password

The following option names are supported:

URL          - Nuvovis cloud URL or offline switch
PXSP         - Proxy server and port
PXUN         - Proxy server username
PXPW         - Proxy server password
PXAT         - Proxy server authentication type
HAUP         - HTTP username and password
HAAT         - HTTP authentication type

To switch to offline mode on a machine without internet access use URL=Offline.

Authentication type values for either proxy or HTTP authentication must be one of the following:

NONE         - No authentication
BASIC        - Basic authentication
DIGEST       - Digest authentication
NEGOTIATE    - GSS-Negotiate authentication
NTLM         - NTLM authentication
DIGEST_IE    - Digest authentication with IE flavour
NTLM_WB      - NTLM authentication delegated to winbind helper
ANY          - All types set (uses most secure available)
ANY_SAFE     - All types except Basic
Returns
The LicenseStatus indicating whether the machine is licensed to use the application.
Examples
HelloWorld.cpp, LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getAppName()

PGSLIC_API const char* getAppName ( )

Returns the name of your application which you have branded using the license settings defined in salesforce. Prevents license mixups if you license more than one software product.

Returns
The application name.
Examples
LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getClientName()

PGSLIC_API const char* getClientName ( )

Returns the name of the client to whom you have granted the software license.

Returns
The client name.
Examples
LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getDaysUntilExpiry()

PGSLIC_API int getDaysUntilExpiry ( )

Returns the number of days until the license expires.

Returns
The number of days to expiry.
Examples
RomanNumeralsCmd.cpp.

◆ getExpiryDate()

PGSLIC_API const char* getExpiryDate ( )

Returns the license expiry date in the form YYYY-MM-DD (month and day can be 1 character e.g. 2000-1-31).

Returns
The expiry date.
Examples
LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getLastError()

PGSLIC_API const char* getLastError ( )

Returns the last error message produced by a call to the PGSLIC API.

Returns
The last error message.
Examples
HelloWorld.cpp, LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getSetting()

PGSLIC_API const char* getSetting ( const char *  settingName)

Returns the value of an individual setting. For example if the settings string is "MaxLimit=500" getSetting("MaxLimit") will return "500".

Parameters
settingNameThe name of the setting whos value is requested.
Returns
The a license setting.
Examples
LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ getSettings()

PGSLIC_API const char* getSettings ( )

Returns the full license application settings string as specified by the license adminitrator in Salesforce.com.

Returns
The full settings string.
Examples
RomanNumeralsCmd.cpp.

◆ getStaleTime()

PGSLIC_API int getStaleTime ( )

Gets the number of seconds since the live license was last refreshed from the cloud.

Returns
The stale time in seconds.
Examples
RomanNumeralsCmd.cpp.

◆ isPerpetual()

PGSLIC_API int isPerpetual ( )

Returns the perpetual license flag.

Returns
Returns 1 if the license never expires; zero otherwise.
Examples
LicenseHelper.cs, and RomanNumeralsCmd.cpp.

◆ release()

PGSLIC_API LicenseStatus release ( const char *  pwd)

Releases the license acquired and verified by a prior call to checkLicense. The license is released back to the licensing cloud service and is then available for re-use on another machine. The license must be marked as Live for release to be used.

Parameters
pwdYour development password provided to you by Nuvovis.
Returns
The LicenseStatus indicating whether the license was successfully released.