Contents - Index


4.2.3.40 Update Licence

HRESULT SLS_Update(
                                     LPCSTR pszProductID,
                                      SLS_HANDLE lLicenceHandle,
                                     SLS_UPDATE *pUpdate,
                                     SLS_PERMIT *pPermit,
                                     SLS_CHALLENGE *pChallenge)

The SLS_Update function reports the up-to-date licence usage to the licence system and synchronizes between the licensed application software and the licence system.

Parameters

pszProductID

Points to a string that uniquely identifies the application's Product ID.

lLicenseHandle

Specifies the handle to the licensing context. This parameter must be a handle created with the SLS_Request function.

pUpdate

This parameter is used only if a policy is in effect that consists of unit metering licences (and if you choose to implement such a licensing policy in the application). The UnitsConsumed parameter in the Update structure specifies the total number of units consumed in this handle context since the initial call to the SLS_Request function. The UnitsReserved parameter specifies the total number of units to be reserved.

pPermit

Provides a structure for receiving licence permit. Permit data members are explained in the Permit data structure.

pChallenge

Points to a challenge structure. The challenge response will also be returned in this structure.

Return Values

SLS_SUCCESS if the function is successful. Otherwise an error status code is returned to indicate the cause of the error.

The typical error status codes are:

SLS_E_LICENCE_SUSPENDED
SLS_E_LICENCE_EXCEEDED
SLS_E_LICENCE_EXHAUSTED
SLS_E_LICENCE_EXPIRED
SLS_E_LICENCE_INVALID

Remarks

Your application should periodically call the SLS_Update function to verify that the current licence is still valid. The maximum interval is 30 minutes.

The SLS_Update function verifies that the licence system context has not changed from the one expected by the licensed software. The SLS_Update function can determine if the licensing resources granted to the specified handle are still reserved for this application. In a distributed licence system, an error might indicate a temporary network interruption. It can also determine if the licence system has released the licensing resources granted to the specified handle. An error indicates the software no longer has authorisation to execute in a typical manner.

The call to the SLS_Update function can also indicate that the current licensing context has expired. For example, in the case of a time-restricted licensing policy it returns the warning status SLS_LICENSE_EXPIRED.

If the number of new units requested in the Update.UnitsReserved parameter is greater than the number available, then the update request fails and it returns the error SLS_LICENCE_ EXHAUSTED.

If the call completes successfully, the value returned in the Permit.UnitsGranted parameter indicates the current total of units granted.

If SLS_Update returns an error, it does not return a challenge response.

If any error is returned, a call to the SLS_Release function is still required.