Packages provide a way in which a software developer can ensure that their application is used only on systems for which it is licensed and with a defined user limit. QM supports two distinct types of package; registered packages that can be licensed by QM resellers via the openqm.com web site and private packages that manage the licensing internally.
Registered packages are managed by the QM licensing system. A reseller can register a package name with Ladybridge Systems and then use the web site to generate licences to use that package. Registered packages are identified by names of up to 15 characters that commence with an uppercase letter and may have an associated user limit and expiry date. They are tied to a specific QM licence by QM's own licence authentication system. QM resellers who own registered packages will have access to the relevant licensing screens on the openqm.com web site.
A package licence is enabled by use of the PACKAGE.LICENCE command in the QMSYS account. The package name and authorization code are entered by the user and then validated by QM before being applied to the internal registered package list. This command can also be used to remove a package licence or to amend the authorisation code.
Private packages are applications that are released directly by their developer. They are identified by names of up to 15 characters that commence with a lowercase letter. All aspects of licence authentication is the responsibility of the application. The only involvement of QM in this process is tracking the number of users currently active in the package.
Entering a Package
An application uses the QMBasic ENTER.PACKAGE() function to indicate that it is entering the package.
For a registered package this function returns True if it is successful, False if it fails. In the event of failure, the STATUS() function can be used to determine the cause.
For a private package, the function returns the number of users in the package, including the one that executed this function. The application can determine from its own licensing rules whether the user limit has been reached. If so, it should exit the package as described below.
Where a package is to be tied to a specific QM licence, the licence number can be obtained using SYSTEM(31).
Exiting from a Package
An application uses the QMBasic EXIT.PACKAGE() function to indicate that it is leaving the package.
This function returns True if it is successful, False if it fails. In the event of failure, the STATUS() function can be used to determine the cause. Note that a registered package may be configured not to allow exit.
QM will automatically update the internal data managing package access if a process terminates without exiting from a package that it had previously entered.
Identifying Active Packages
An application can obtain a field mark delimited list of currently active packages by use of the SYSTEM(1054) function. Although this should not normally be required as the process should be able to track package entry and exit, it might be useful, for example, to test if a malicious user has attempted to defeat the user limit mechanism by executing an EXIT.PACKAGE() function. A test such as
IF LISTINDEX(SYSTEM(1054), @FM, package.name) THEN
could be used periodically to confirm that the process is stall active in that package.
An application installer can add a licence for a registered package by using the !PACKAGE() subroutine.