ContextNewScope Function

Description

Establishes a License Manager context for subsequent administration requests.

To establish an HTTPS context for a remote License Manager, you must:

> Specify the same public certificate that is present on the remote License Manager server.

>Use the Admin API standalone library.

Syntax

sntl_admin_status_t SNTL_ADMIN_CALLCONV sntl_admin_context_new_scope(
            sntl_admin_context_t ** admin_context,
            const char * scope
            )

Parameters

admin_context

Pointer to the License Manager context created for this session.

scope

XML scope specification, as described below.

Usage Notes

This function replaces the ContextNew function.

This function establishes a context to one of the available Sentinel License Managers.

Up to three types of License Managers may be available:

>License Manager service (Admin License Manager) - This is a component of the Sentinel LDK Run-time Environment.

>Integrated License Manager - This is included automatically in each protected application.

>External License Manager - This is in an external file that may be included with the protected application.

You can choose to connect to either of the following:

>License Manager service

>Integrated or External License Manager. One of the two will be selected automatically as described below.

Connecting to a License Manager Service – XML Scope

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
  <host>host</host>
  <port>portNumber</port>
  <password>password</password>
</haspscope>

where

host Host name or address for the License Manager service. To create a context for the local License Manager service, specify the host name as localhost.
portNumber (Optional) Port number for the License Manager Service. Default: 1947
password (Optional) Password (if set) to perform administrative functions in the License Manager service.

Specifying an HTTPS Certificate – XML Scope

The HTTPS mode for Admin API is enabled if, when creating a new context with sntl_admin_context_new_scope(), a certificate is specified. You must specify the same public certificate that is present on the remote license server machine.

For example:

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
    <host>localhost</host>
    <certificate>-----BEGIN CERTIFICATE----- 
MIIDizCCAnOgAwIBAgIJAOoF2ZIk4O+cMA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNV
BAYTAklUMQ4wDAYDVQQIDAVJdGFseTEQMA4GA1UEBwwHQmVyZ2FtbzEUMBIGA1UE
CgwLU2VudGluZWwgQ0ExFTATBgNVBAMMDGxvY2FsaG9zdCBDQTAeFw0xOTEwMDMx
MjI3MjRaFw00NzAyMTgxMjI3MjRaMFwxCzAJBgNVBAYTAklUMQ4wDAYDVQQIDAVJ
dGFseTEQMA4GA1UEBwwHQmVyZ2FtbzEUMBIGA1UECgwLU2VudGluZWwgQ0ExFTAT
BgNVBAMMDGxvY2FsaG9zdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAM1WIkTMEy/D8NIDMUO29y0vQCu58Ff3L+ktN/cPGtcJjszLHn/EBfQED/gR
e5hCh+LkBuXVqcNeWY21oOF23OUM3CreHUz17ElG0IwUxPvD9wwHDFuoOJWpsYD6
dXzTizhixNvSch2D09/8x6Y7HZdUPejgkNlKkklwdWjAV8MiE9368X/g2taYZ2MM
+z0xIhLFPQ+RKdFiV75Yws47cdGnp9qRos27gd3WycavK70X295IHANw7oFlGHRi
oQiU2grTQ814SWXw9nnM+oJlA5zyJHOGopbIbehf6O2B9ALP5MdZ8BHFw9NBxbgu
DKmmdp02s+KqC1QIJ+qeCDo13h8CAwEAAaNQME4wHQYDVR0OBBYEFDUiS6Mtv8N6
3WalNf2aRlWmcK10MB8GA1UdIwQYMBaAFDUiS6Mtv8N63WalNf2aRlWmcK10MAwG
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAG1tl9AAm6ntYvMLT80JZdH0
aDB9p99GF/2YjCmjGsPkordVsM2RcjPnENZV9txllmIvQ6MmxP1Sw0ZG/3Q0GejX
XNt6W3I0DM3RJw0/NLg5n0HoOTZtwqbPOfqMaZryvJ8ogxaR4GWPBQg6u3SYy9S5
CmKgB7FtmUh0EKtd1h39qNfaK+pI2SlGbMqHmSdVXRV71LrAg0jTEx4TUExY0oKO
C84Blk2U5fde+qAgOw/coRTpPiGXHdY3X6JvsfOJh2Pf8rz8FX0OYsPYGfsdPe8X
uwgUNRDWZTC8vVQMe7s6SEZTFDZxKWBhzKWy/6I1O56yXLSqBrSq33ny/KfEmD4=
-----END CERTIFICATE-----
    </certificate>
</haspscope> 

Connecting to the Integrated License Manager or External License Manager

You can choose to connect to the Integrated or External License Manager (instead of connecting to the License Manager service), but the function determines which of these two (Integrated or External) to select if both are available. The function automatically connects to the External License Manager unless the Integrated License Manager is a later version than the External License Manager.

The Sentinel Admin API functionality for these License Managers is included in the Sentinel Licensing API. To connect to the Integrated/External License Manager, use the Licensing API library in the protected application.

NOTE    Do not use sntl_adminapi_windows.lib. This is a standalone library that does not support the Integrated/External License Manager.

To connect to the Integrated/External License Manager, specify the host name as sntl_integrated_lm instead of localhost.

The following code snippet demonstrates how to use Sentinel Admin API with the Integrated/External License Manager:

#define DEMOMA_DRIVERLESS_SCOPE "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" \
"<haspscope>"\
"  <host>sntl_integrated_lm</host>"\
"  <vendor_code>vendorCodeString</vendor_code>"\
"</haspscope>"

sntl_admin_context_t *AdminContext;
sntl_admin_status_t result = sntl_admin_context_new_scope (&AdminContext,
DEMOMA_DRIVERLESS_SCOPE);
if (SNTL_ADMIN_STATUS_OK != result)
{
   printf ("\n\nError %d found during context_new...\n\n", result);
   _getch();
   exit (1);
}

vendorCodeString is required in the scope XML when establishing a context to the Integrated or External License Manager. This is used to talk to the Licensing C API, which also contains Admin API.

vendorCodeString is not required in the scope XML when establishing a context to the Admin License Manager (Admin LM).

Return Values

SNTL_ADMIN_STATUS_OK

SNTL_ADMIN_SCOPE_ERROR

SNTL_ADMIN_INSUF_MEM

Related Topics

ContextDelete Function

Sentinel License Managers - Overview