visit Kofax web site

SPTicket.h File Reference


Detailed Description

SignWare Dynamic Development toolkit, ticket object.

Author:
uko
This header defines the deprecated SPTicket object. See SignWare License for details on licenses.

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.
The License Manager must be initialized at program start. Please include these steps:

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

SPINT32 __cdecl SPTicketCharge pSPTICKET_T  pTicket  ) 
 

Charge an empty license ticket.

The license action, license count, and session identifier passed to SPTicketCreate will be used for charging the ticket.

Deprecated:
Please use a license key.
Parameters:
pTicket [i] pointer to an SPTicket object containing an empty ticket.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate, SPSignwareSetTicket

SPINT32 __cdecl SPTicketClone pSPTICKET_T  pTicket,
pSPTICKET_T ppTicket
 

Create a copy of an SPTicket object.

Deprecated:
Please use a license key.
Parameters:
pTicket [i] pointer to the SPTicket object to be copied.
ppTicket [o] pointer to a variable that will be filled with a pointer to a new SPTicket object. The caller is responsible for deallocating the new object by calling SPTicketFree.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate, SPTicketFree

SPINT32 __cdecl SPTicketCreate pSPTICKET_T ppTicket,
SPINT32  iUsage,
SPINT32  iTicketCount,
const char *  pszSession
 

Create a new SPTicket object containing an empty license ticket.

Deprecated:
Please use a license key.
Parameters:
ppTicket [o] pointer to a variable that will be filled with a pointer to a new SPTicket object containing an empty license ticket. The caller is responsible for deallocating the new object by calling SPTicketFree.
iUsage [i] license action (SP_TICKET_LOAD_SIGNWARE etc.) for which the ticket will be used.
iTicketCount [i] number of licenses requested (usually 1).
pszSession [i] session identifier, or NULL if not applicable. A session identifier is an arbitrary UTF-8-encoded string identifying uniquely a session.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCharge, SPTicketCreateFromFlatFile, SPTicketFree

SPINT32 __cdecl SPTicketCreateFromFlatFile pSPTICKET_T ppTicket,
const SPUCHAR pbFlatFile,
SPINT32  iFlatFileLen
 

Create a new SPTicket object from a flat file object.

Deprecated:
Please use a license key.
This function deserializes an SPTicket object serialized by SPFlatFileCreateFromTicket.

Parameters:
ppTicket [o] pointer to a variable that will be filled with a pointer to a new SPTicket object containing an empty license ticket. The caller is responsible for deallocating the new object by calling SPTicketFree.
pbFlatFile [i] pointer to an array of bytes containing a serialized SPTicket object.
iFlatFileLen [i] length (in bytes) of the serialized data pointed to by pbFlatFile.
Returns:
SP_NOERR on sucess, else error code
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate, SPTicketFree, SPFlatFileCreateFromTicket

SPINT32 __cdecl SPTicketFree pSPTICKET_T ppTicket  ) 
 

Deallocate an SPTicket object.

The SPTicket object must have been created by SPTicketCreate, SPTicketCreateFromFlatFile, or SPTicketClone.

Deprecated:
Please use a license key.
Parameters:
ppTicket [io] pointer to a variable containing a pointer to an SPTicket object. The variable will be set to NULL if this function succeeds.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate, SPTicketCreateFromFlatFile, SPTicketClone

SPINT32 __cdecl SPTicketGetCount pSPTICKET_T  pTicket,
SPINT32 piCount
 

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).

Deprecated:
Please use a license key.
Parameters:
pTicket [i] pointer to an SPTicket object.
piCount [o] pointer to a variable that will be filled with the license count of the ticket.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate

SPINT32 __cdecl SPTicketGetSession pSPTICKET_T  pTicket,
SPCHAR **  ppszSession
 

Get the session identifier of an SPTicket object.

Deprecated:
Please use a license key.
Parameters:
pTicket [i] pointer to an SPTicket object.
ppszSession [o] pointer to a variable that will be filled with a pointer to a null-terminated string containing the UTF-8-encoded session identifier. The caller is responsible for deallocating the string by calling SPFreeString.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate

SPINT32 __cdecl SPTicketGetUsage pSPTICKET_T  pTicket,
SPINT32 piUsage
 

Get the intended usage (license action) of an SPTicket object.

Deprecated:
Please use a license key.
Parameters:
pTicket [i] pointer to an SPTicket object.
piUsage [o] pointer to a variable that will be filled with the license action for which the ticket is to be used.
Returns:
SP_NOERR on sucess, else error code:
Operating Systems:
Windows (Win32), Linux (i386), Linux (x86_64), Linux (ARM), Android (ARMv7a)
See also:
SPTicketCreate