LM_CHECKOUT(3)

NAME
lm_checkout - check out a license in an application

SYNOPSIS
#include <lm_client.h>

int lm_checkout(feature, version, num_licenses, flag, key, dup_group)
char *feature;
double version;
int num_licenses;
int flag;
VENDORCODE2 *key;
int dup_group;

typedef struct vendorcode {
	short type;		/* Type of VENDORCODE structure */
#define BIT64 1			/* 64-bit code */
	long data[2];		/* 64-bit code */
} VENDORCODE;

#define LM_CODE(name, x, y)  VENDORCODE name = { BIT64, (x), (y) }

DESCRIPTION
lm_checkout() checks out one (or more) license(s) of the specified feature from the license daemon, and keeps the daemon up to date on the status of the process using the license(s).

If the process that calls lm_checkout exits, the license(s) will be checked back in automatically.

feature is the name of the feature to be checked out.

version is the version number of the feature. If this version number is greater than the version number in the license file, the license will be denied.

num_licenses is the number of licenses for this feature that the client wants to check out. This number can be used, for example, to check out more licenses on a more powerful platform.

flag , if non-zero, specifies how the client should process the checkout request. flag can be set to one of the following values:

    LM_CO_NOWAIT
        specifies that no waiting for the license(s) is to be done.

    LM_CO_WAIT
        specifies that the client will wait until a license is available.

    LM_CO_QUEUE
        specifies that the client shall be placed into the queue for the license.

    LM_CO_LOCALTEST
        specifies that the client should do all local checks, but not attempt to check out the license from the daemon. This is useful to verify the correctness of a FEATURE line in the license file.

key is the vendors 64-bit encryption key for this feature. The key is typically created with the LM_CODE macro.

dup_group specifies the method for grouping duplicate requests for a given feature. dup_group is set to:
	LM_DUP_NONE 	/* No requests are counted as duplicates */
or
	LM_DUP_SITE	/* All requests are duplicates, i.e., a SITE license */
or by ORing from the following set of values:
	LM_DUP_USER	/* All requests from the same user are duplicates */
	LM_DUP_HOST	/* All requests from the same host are duplicates */
	LM_DUP_DISP	/* All requests from the same display are duplicates */
Any bits set in the dup_group mask will cause comparisons on the specified data. For example, if dup_group is set to LM_DUP_USER | LM_DUP_HOST then all requests from the same user on the same host will be treated as the same request (this is the same as the pre-V2 "count_duplicates").

NOTES
Because licenses are automatically returned when a process exits, you must make sure that a license is checked out by a process which is always alive during the time that your product requires the license.

RETURN VALUE
lm_checkout() returns 0 if the license was successfully checked out. If there is an error, lm_checkout() returns a non-zero value, and an error code is placed into the global variable _lm_errno .

SEE ALSO
lm_checkin(3), lm_errno(3)