Using XML Tags to Define Scope

Scope XML tags are used to define where the application is to search licenses when using the LoginScope function. It is also used in the GetInfo function, to define from which objects information is to be gathered.

Scope XML tags are used to filter possible licenses. They are not used to add information to facilitate the search.

In this topic:

>Unlimited Searches

>Searches According to Attribute

>Example

>Examples for Cloud Licensing

Unlimited Searches

The root tag for a Scope template is always <haspscope>. If you want to run an unlimited search, use the empty XML <haspscope />.

Searches According to Attribute

If you want to constrain your search, you must define at least one "child" tag. See Scope Input XML Tags for a list of the available tags. These tags have the following general syntax:

<object attribute="value">  

You can only specify one attribute for each XML element. The exception to this rule is the optional cmp attribute. When this attribute is used, it must be placed after the tag to which it refers.

NOTE   The cmp attribute can have any of the following values:

equ  -  equal to

lt   -  less than

le   -  less than or equal to

gt   -  greater than

ge   -  greater than or equal to

If you want the search to be made only on HASP HL keys, you would use the following scope:

<haspscope>
<hasp type="HASP-HL">
  <hasp version="4.0" cmp="lt"/>
</hasp>
</haspscope>

You can include additional attributes. Nested child tags are connected using AND. Child tags on the same level are connected using OR.

To search for keys that are both HL keys AND have a firmware version of 3.21 or later, use the following scope:

<haspscope>
    <hasp type="HASP-HL">
      <hasp version="3.21" cmp="ge" />
    </hasp>
</haspscope>

In the above example, the attributes (type and version) are nested, indicating that both must be present.

In the following examples, either of the two equivalent Scope XML descriptions can be used to create a template that specifies that a program may only search for locally connected HL keys.

Example 1:

<haspscope>
   <hasp type="HASP-HL">
     <license_manager hostname="localhost" />
   </hasp>
</haspscope>

Example 2:

<haspscope>
   <license_manager hostname="localhost">
     <hasp type="HASP-HL"/>
   </license_manager>
</haspscope>

If there are multiple attributes, and only one of them need be present, then the attributes must all be children of the same tag. In the following example, HL keys OR SL keys are accepted:

<haspscope>
   <hasp type="HASP-HL" />
   <hasp type="HASP-SL" />
</haspscope>

Both definitions can also be combined. The following example describes a Scope in which only SL keys OR remotely connected HL keys are accepted.

<haspscope>
   <license_manager hostname="localhost">
      <hasp type="HASP-SL" />
   </license_manager>
   <license_manager hostname="~localhost">
      <hasp type="HASP-HL" />
   </license_manager>
</haspscope>

NOTE   When you execute a search using a Scope template, the search is performed on each individual Feature ID in turn. Consider the following example in which the Scope and Format are specified in such a way that an empty output is returned.

Example

The user wants to create a list of all Sentinel protection keys that contain both Feature ID 1 and Feature ID 2. The result will be an empty list because the scope is tested against every Feature, not against every Sentinel protection key. (The return code will be HASP_SCOPE_RESULTS_EMPTY)

Scope

<?xml version="1.0" encoding="UTF-8"?>
<haspscope>
   <feature id="1">
     <feature id="2"/>
   </feature>
</haspscope>

Format

<?xml version="1.0" encoding="UTF-8"?>
<haspformat root="hasp_info">
   <hasp>
     <attribute name="id"/>
   </hasp>
</haspformat>

Output

<?xml version="1.0" encoding="UTF-8"?>
<hasp_info/>

Examples for Cloud Licensing

Determine whether an SL key is cloud-originated. Log in to the cloud license or in to a license detached from a cloud license. If required, a license is detached automatically from a cloud license.

Identify which SL keys are cloud licenses or originate from a cloud license:

Call GetInfo with the following format:

<?xml version="1.0" encoding="UTF-8" ?>
<haspformat root="hasp_info">
  <hasp>
    <attribute name="id" />
    <attribute name="type" />
    <attribute name="cloud_originated" />
  </hasp>
</haspformat>

Output is similar to the following:

<?xml version="1.0" encoding="UTF-8" ?>
<hasp_info>
   <hasp id="135910784149841919" type="HASP-SL" cloud_originated="false" />
   <hasp id="451033848957556425" type="HASP-SL" cloud_originated="true" />
</hasp_info>

Log in to the parent cloud license only:

Call LoginScope with the following scope:

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
  <hasp cloud_originated="true">
    <hasp attached="false"/>
  </hasp>
</haspscope>

Log In to a license detached from a cloud license:

Call LoginScope with the following scope:

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
  <hasp cloud_originated="true">
    <hasp attached="true"/>
  </hasp>
</haspscope>

If a detached license exists, LoginScope logs in to the detached license.

If no detached license exists on the user's machine, a license is automatically detached from the cloud license and attached to the end user’s machine if the following additional conditions are satisfied:

a. Sentinel Run-time Environment is installed on the end user’s machine.

b.Automatic detaching of licenses is enabled on the Sentinel LDK License Manager server.

c.Allow Remote Detach Access was enabled when the client identity was created.

Log in to the detached license by specifying the parent ID:

Call LoginScope with the following scope:

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
  <hasp cloud_originated="true">
    <hasp parentid="451033848957556425" />
  </hasp>
</haspscope>

If a detached license exists, LoginScope logs in to the detached license.

If no detached license exists on the user's machine, a license is automatically detached from the cloud license and attached to the end user’s machine if the following additional conditions are satisfied:

a. Sentinel Run-time Environment is installed on the end user’s machine.

b.Automatic detaching of licenses is enabled on the Sentinel LDK License Manager server.

c.Allow Remote Detach Access was enabled when the client identity was created.

Log in to the child license or the parent license by specifying the family ID:

Call LoginScope with the following scope:

<?xml version="1.0" encoding="UTF-8" ?>
<haspscope>
  <hasp cloud_originated="true">
    <hasp familyid="451033848957556425" />
  </hasp>
</haspscope>

If a detached license exists, LoginScope logs in to the detached license.

If no detached license exists on the user's machine, a license is automatically detached from the cloud license and attached to the end user’s machine if the following additional conditions are satisfied:

a. Sentinel Run-time Environment is installed on the end user’s machine.

b.Automatic detaching of licenses is enabled on the Sentinel LDK License Manager server.

c.Allow Remote Detach Access was enabled when the client identity was created.

Related Topics

Scope Input XML Tags

LoginScope Function

GetInfo Function

About XML Tags