SPTicket.h File Reference
Detailed Description
SignWare Dynamic Development toolkit, ticket object.
- Author:
- uko
Using the Kofax License Manager
- Note:
- SignWare now uses license keys, usage of license tickets is deprecated. The following description only applies if you still use ticket license files.
- Set the product ID if you use a product code other than SignWare. SignWare sets the product code to SignWare, but an application can override this setting by calling SPSignwareSetLM2, but this must be the very first call to SignWare.
- Check whether to use tickets or not, see SPSignwareNeedTicket.
- If tickets are used, create and charge a ticket for each required load action, SPTicketCreate, SPTicketCharge, SPSignwareSetTicket.
- Check if your product is loadable when using a product code other than SignWare, see SPSignwareCheckLM.
- Finally, the application should check if the license is valid, see SPSignwareDaysLM.
Typical startup code
bool bNeedTicket = false; // global flag to determine if tickets are used bool bhasLicense = false; // global flag: has a license int main(int argc, char *argv[]) { .... // if you've overridden the product code rc = SPSignwareSetLM2(iProdId1, iProdId2); // check rc SPINT32 iNeedTicket; rc = SPSignwareNeedTicket(&iNeedTicket); if(rc == SP_NOERR) bNeedTicket = iNeedTicket != 0; if(bNeedTicket) { // if you've overridden the product code, else you don't need SP_TICKET_LOAD_SELF passLoadTicket(SP_TICKET_LOAD_SELF); passLoadTicket(SP_TICKET_LOAD_SIGNWARE); // always needed // only if static compare engine is required passLoadTicket(SP_TICKET_LOAD_STATIC); // only if dynamic compare engine is required passLoadTicket(SP_TICKET_LOAD_DYNAMIC); } // if you've overridden the product ID rc = SPSignwareCheckLM(SP_TICKET_LOOAD_SELF); int iNumDays = -1; if(rc == SP_NOERR) rc = SPSignwareDaysLM(&iNumDays); if(rc != SP_NOERR) { // we don't have a license } else { // Number of days must be >= 0, else no license... if(iNumDays >= 0) { bHasLicense = true; } } // The process limit might also apply, the easiest way to check if this // process has a license is to instantiate an object if(bHasLicense) { pSPREFERENCE_T pReference = 0; // If there is a license error then the process limit is reached if(SPReferenceCreate(&pReference) == SP_LICENSEERR) bHasLicense = false; SPReferenceFree(&pReference); } } // This is a simplistic implementation which assumes that the ticket // consumer is identical to the ticket requestor. int passLoadTicket(SPINT32 iAction) { pSPTICKET_T pTicket; int rc; rc = SPTicketCreate(&pTicket, iAction, 1, NULL); if(rc == SP_NOERR) { rc = SPTicketCharge(pTicket); if(rc == SP_NOERR) rc = SPSignwareSetTicket(pTicket); SPTicketFree(&pTicket); } return rc; }
Functions | |
SPINT32 __cdecl | SPTicketCharge (pSPTICKET_T pTicket) |
Charge an empty license ticket. | |
SPINT32 __cdecl | SPTicketClone (pSPTICKET_T pTicket, pSPTICKET_T *ppTicket) |
Create a copy of an SPTicket object. | |
SPINT32 __cdecl | SPTicketCreate (pSPTICKET_T *ppTicket, SPINT32 iUsage, SPINT32 iTicketCount, const char *pszSession) |
Create a new SPTicket object containing an empty license ticket. | |
SPINT32 __cdecl | SPTicketCreateFromFlatFile (pSPTICKET_T *ppTicket, const SPUCHAR *pbFlatFile, SPINT32 iFlatFileLen) |
Create a new SPTicket object from a flat file object. | |
SPINT32 __cdecl | SPTicketFree (pSPTICKET_T *ppTicket) |
Deallocate an SPTicket object. | |
SPINT32 __cdecl | SPTicketGetCount (pSPTICKET_T pTicket, SPINT32 *piCount) |
Get the license count of an SPTicket object. | |
SPINT32 __cdecl | SPTicketGetSession (pSPTICKET_T pTicket, SPCHAR **ppszSession) |
Get the session identifier of an SPTicket object. | |
SPINT32 __cdecl | SPTicketGetUsage (pSPTICKET_T pTicket, SPINT32 *piUsage) |
Get the intended usage (license action) of an SPTicket object. |
Function Documentation
|
Charge an empty license ticket. The license action, license count, and session identifier passed to SPTicketCreate will be used for charging the ticket.
|
|
Create a copy of an SPTicket object.
|
|
Create a new SPTicket object containing an empty license ticket.
|
|
Create a new SPTicket object from a flat file object.
|
|
Deallocate an SPTicket object. The SPTicket object must have been created by SPTicketCreate, SPTicketCreateFromFlatFile, or SPTicketClone.
|
|
Get the license count of an SPTicket object. Before a ticket is charged, this function gives the requested license count (as passed to SPTicketCreate). After a ticket has been charged, this function gives the license count granted by the License Server. A negative number indicates an error (license exhausted, License Server not available).
|
|
Get the session identifier of an SPTicket object.
|
|
Get the intended usage (license action) of an SPTicket object.
|