SDKs for Zentitle V10 can no longer be downloaded from links in the documentation. If you require the current SDK in your chosen programming language, please log a support ticket and our support staff will be happy to provide one.
The code examples demonstrate the use of the API calls involved in license management using NSL V10.
You are also advised to consult the following documents that explain the logical flow using .NET as an example:
Licensing Logic of Your Application
Retrieving a License From the Activation Server
These provide in-depth descriptions of the license life-cycle and how this should be implemented in a commercial application.
Introduction
In this article, we are going to show you an example ARM app.
NSL and NSA can easily be added to new or existing software as it is a shared library and can be accessed as such.
The Nalpeiron ARM libraries consist of the standard Nalpeiron C library.
The ARMCode example currently supports ARMv5t, ARMv7a, ARMv8a, soft and hard floating point with more support coming.

Having downloaded your Custom Licensing/Analytics library you will now need to code your project with the quick changes listed below.
Please note that this is simply a code example and it is not a complete application, please use this to understand the basics of how you might implement licensing and then create your own code. It is not a finished work and will need modifying in a number of ways depending on your use case.
Download your custom Nalpeiron Libraries and place in your Project
Please see the article about how to generate your custom libraries.
Please ensure you download each architecture (variant) and place the .so files into each folder as below.

Collect some test Nalpeiron License Codes
In order to try out various functions and features of the Nalpeiron Service, you will need to make sure you have a "Product" setup in the Nalpeiron Publisher Center and to have a number of license code numbers ready to input into the UI (or if you are using ADB) generated by the sample code.

Getting Started using ARM
The process is much like all our other OS, simply create a custom library and call that with your code. Then you can test. Here we provide sample projects to allow you to test quickly without the need for your own application code.
1. Setup your device for testing e.g. Raspberry Pi, BeagleBone Black etc
Each device is different in terms of ability, storage,portsandOSsoweare not covering them all here but more general concepts.
Once you have your device setup, in order to test you will need storage access and the ability to run the sample code on the device.
You can make many of the required edits below before sending the test projects to the device via SSH, or via a direct load using removable storage compatible with your device.
2. Download and unpack the Nalpeiron ARM SDK.

- Download SDK to your device (via removable sd card,flashdriveorothermethod)
- Upack:tarxzvf./ ARMCodeKit.tgz
- cd ./ARMCodeKit

- nsaTermandnslTermare C projects that allow you to do your testing (for licensing:nslTermorforanalytics collection:nsaTerm).
- Both need editing and having their parameters changed to match your own.
After unpacking the example, you will have an ARMCodeKit directory.
3. Create and download your Custom Library (from the publisher center)

The custom Nalpeiron libraries must be copied into place for the build to work correctly.
Choosing the correct Nalpeiron Library
You should know the details of your hardware in order to choose the correct library version to use with it. If you are not sure you can use the following method to get an indication (not totally definitive but useful).
Currently, Nalpeiron provides five varieties of the ARM library: armv5te hard and soft floating point, armv7a hard and soft floating point, and armv8a 64 bit hard floating. You will need to determine which library version is appropriate for your device and download the correct one.
If you are unsure which library to use you can find the information from your device in several ways. One method of doing this is to locate the libc.so.6 library and determine its architecture.
You may use the find command to locate the library:
find / -name libc.so.6 2>/dev/null

Then query that library using the readelf command:
readelf -A /lib/arm-linux-gnueabihf/libc.so.6
In this case, we see that the c library is ARMv6 hard floating point by reviewing the 3rd line from the bottom. The Tag_ABI_HardFP_use: SP and DP. There will be no equivalent lineifitisn'thardfp.
Similar information can be obtained from any ARM system.
Below is information gathered from a Beagle Bone Black:

- The above image shows an ARMv7a hard floating point.

- The above image shows an ARMv4t soft floating point.
So in the example of Raspberry Pi above, if the system is ARMv6 then you can use the Nalpeiron ARMv5 library but not an ARMV7 library.
The "readelf-A" method of telling hard float from soft isn't foolproof. On a 64 bit machine, for instance, readelf-A returns no information at all. On the BBone, you have both sets of libraries one for hardfp and a second set for soft. However, the system boots to hard and there is no easy way to use the soft. If you're just running readelf-A onlibc.so.6 files, you won't necessarily know which is being used.

- A downloaded library of the appropriate architecture for your device should be copied into the directory where you unpacked the code example.
The build expects the library to be named "ShaferFilechck.so". However, the downloaded versions are named for the architecture they are for as a zip file i.e. the lib file is always called ShaferFilechck.so once unzipped, unless you rename it, despite there being many versions.

- Ensure you place each file in the correct corresponding folders for their architecture armv5t, armv7a, armv8a (if you plan to try various device architectures)
Editing the Example Project

You should now have the project example open and in the editor window on your device. The editor that is pre-installed on all Linux systems is vi and that can be used to edit the project if you understand how to use it, or in this case, we have used a text editor to avoid changing the underlying code in any way.

You will now edit the sample code block that contains some variables that relate to your specific Nalpeiron account.
Input your 2 variables (CustomerID and ProductID) which will be available to your Application Load event and set them to the values for your NSA/NSL product in your Nalpeiron Publisher Center.
char *nslVersion = NULL; char *nsaVersion = NULL; char *compID = NULL; char *nslHostName = NULL; char *nsaHostName = NULL; char *licenseCode = NULL; char *licenseInfo = NULL; char *expDate = NULL; char *licenseStatus = NULL; //edit below// char custID[] = "4613"; char prodID[] = "100"; //edit// char libPath[] = "home/pi/Desktop/ARMCodeKit/ShaferFilechck.so"; void *libHandle = NULL; char *miscStr1 = NULL; char *miscStr2 = NULL;
Remember you are replacing the test parameters in the code with your own specific Customer and ProductIDs and with your own specific library, all downloaded from the Nalpeiron Publisher Center.
You can edit the C files on your development machine/desktop but you must run the "make" command on the test device itself and not on the test machine i.e. the build must be on the test device OS.
The CustomerID and ProductID are internal Nalpeiron numbers issued to you, they are unique to you and should be kept secret. They were sent with your trial setup email and can also be accessed again anytime from your Product details within the Publisher Center.Next change the location of your library file libPath[] to where you have stored the file and the associated code project, in this case: /ARMCodeKit/ShaferFilechck.so.
char *nslVersion = NULL; char *nsaVersion = NULL; char *compID = NULL; char *nslHostName = NULL; char *nsaHostName = NULL; char *licenseCode = NULL; char *licenseInfo = NULL; char *expDate = NULL; char *licenseStatus = NULL; char custID[] = "4613"; char prodID[] = "100"; //edit below// char libPath[] = "home/pi/Desktop/ARMCodeKit/ShaferFilechck.so"; //edit// void *libHandle = NULL; char *miscStr1 = NULL; char *miscStr2 = NULL;
Be sure that this is correct to the folder on the device.
Finally change the Security Constants (X, Y and Z values) to match those stamped into your library (for the NSL example). Do not copy this example as many others may read this document and your values should be unique and secret!
int offset;
int main(
void
)
{
//edit below//
unsigned int xauth = 9;
unsigned int yauth = 599;
unsigned int zauth = 399;
//edit//
unsigned int security;
char *xmlParams;
Remember the Security Constants are set to "0" (or off) by default and you need to change them when generating your DLL. We highly recommend adding these constants to help improve security.
Differences in the NSA code
char custID[] = "3183"; char prodID[] = "100"; char libPath[] = "/tmp/test30.so";
Build the Example Project
Now you can save and test build the project.
- Run the "make" command to build the Projects.

There should be no errors and you should have two binaries when complete: nslTerm and nsaTerm. Now you have everything successfully building you can start to use the example code and start any testing.
Start Testing
Now you may run the edited example code on your ARM device using nslTerm and nsaTerm (for licensing: nslTerm or for analytics collection: nsaTerm).
-
Start nslTerm with:
./nslTerm
Once running you will have a test UI:

The GUI shows various useful details such as:
- The current library path and the Customer and product IDs parameters that should match your own. The "computerID" is a unique Nalpeiron ID for your device that we will use to track it on the Server side, Library versions and the server location shown above as NSL/NSA host (my.nalpeiron.com).
- The license status area shows the license state and any error numbers.
- The column of number options allows you to test various license processes.
callNalpLibOpen Parameters
The prototype of NSA.callNalpLibOpen is:
int callNalpLibOpen(String Filename, boolean NSAEnable, boolean NSLEnable, int LogLevel, String WorkDir, int LogQLen, int CacheQLen, int NetThMin, int NetThMax, int OfflineMode, String ProxyIP, String ProxyPort, String ProxyUsername, String ProxyPass, int security)
where: Filename use this parameter to change the location and/or name of the libNSA libraries.
NSAEnable - If true the NSA portion of the library is enabled. NSLEnable - If true the NSL portion of the library is enabled. WorkDir is the location where NSA/NSL will store its log file, licensing files, cache file, etc.
If this value is not specified the files will be stored in the current working directory as defined by your running software on Linux and Mac.
On Windows, the library will use a publically accessible directory (selected by the OS). loglevel is an integer 0 to 6.
If loglevel is not specified it will default to level 0 (off). You should not use log level higher than 4.
The higher levels do not provide any useful end-user debugging.
| 0 | logging off |
| 1 | errors only |
| 2 | errors and warnings |
| 3 | errors, warnings, and informational messages |
| 4 | errors, warnings, info and debug |
| 5/6 | Nalpeiron internal use |
LogQLen is the maximum length of the log queue. Once the log queue reaches this length, additional log entries will be discarded.
As messages in the queue are written to the log file, the queue will shrink and logging will automatically resume. The default is 300.
CacheQLen is the maximum length of the cache queue. Once the cache queue reaches this length, additional cache entries will be discarded. As messages in the queue are written to the cache file, the queue will shrink and caching will automatically begin again. The default is 25.
SoapThreadsMin/SoapThreadsMax - Network connections between the NSA library and the Nalpeiron server are handled by a lthread pool. The values specify the minimum number of threads available to the pool and the maximum number of threads available to the pool. The number of threads in the pool will grow and shrink between these two extremes as needed. The default for each is 10.
ProxyIP/ProxyPort - If the NSA library is connecting to the internet via a proxy use these values to specify the IP address and port number of the proxy server. If no proxy is used, they can be left empty or completely unspecified. The default is no proxy. ProxyUsername/ProxyPassword - If you are using a network proxy to which requires a username and password, specify them here.
OfflineMode - If OfflineMode is on (1), the no data is sent to the Nalpeiron server. All transactions are written immediately to cache. The library makes no attempts to collection location information or send the cache to Nalpeiron. The default is 0 (ie on-line).
Security - Security is a random value created by you at the start of your program (see NalpExample.java for an example of this process). This value in combination with the x, y and z authentication values you stamped into your library when you created it are used for security in the NSL licensing functions. If the security value is specified, all returns from the NSL library will include an offset. Your calling program will need to calculate this offset and subtract it from the return values. In this example, the offset is calculated in NalpExample.java.
The return values are adjusted inside the C wrapper library (nsljava.c).
Library Prototypes
All functions return positive numbers (or 0) on success and a negative number on error. Strings passed into NSA are expected to be either ANSI C strings or UTF8 encoded Unicode. The following functions are provided by the NSA library. Of course, as you will be accessing them from the shared libraries rather than directly you need to use the typedeffed functions pointers (see NSAFunctions.h in the c/c++ SDK) rather than these prototypes.
For example, usage see: nsaExample.c in the SDK.
| Function Call | Description | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| int callNalpLibOpen(String Filename, boolean NSAEnable, boolean NSLEnable, int LogLevel, String WorkDir, int LogQLen, int CacheQLen, int NetThMin, int NetThMax, int OfflineMode, String ProxyIP, String ProxyPort, String ProxyUsername, String ProxyPass, int security) | Initializes the library. THIS FUNCTION MUST BE CALLED AFTER THE LIBRARY IS OPENED (with dlopen, for instance) BUT BEFORE THE LIBRARY IS ACCESSED. For parameter information see callNalpLibOpen section above. | ||||||||||||||||||||||||||||||||||||||
| int callNalpLibClose() | Shuts down the library. THIS FUNCTION MUST BE CALLED IMMEDIATELY BEFORE CLOSING THE LIBRARY (ie with dlclose). If this function is not called before the library is closed, information may be lost and memory corruption could occur. Returns 0 for success and a negative number for an error. | ||||||||||||||||||||||||||||||||||||||
| callNalpGetErrorMsg(int NalpErrno) | Returns a descriptive error message associated with NalpErrno. All NSA/NSL C functions return 0 on success and a negative error number on failure. It is this negative error return that may be passed into callNalpGetErrorMsg. | ||||||||||||||||||||||||||||||||||||||
| int callNSAGetPrivacy() | Checks current privacy settings. Returns 0 for "no privacy", 1 for "privacy enabled", 2 for "unset" and a negative number for an error. If privacy is unset, the privacy setting used will be the one stamped into the library. | ||||||||||||||||||||||||||||||||||||||
| int callNSASetPrivacy(int setting) | Sets a privacy value for the library. Possible values for setting are 0 "no privacy", 1 "privacy enabled" or a negative number for an error. | ||||||||||||||||||||||||||||||||||||||
| String callNSAGetVersion() | Returns a string containing the library version and the NSA version | ||||||||||||||||||||||||||||||||||||||
| String callNSAGetHostName() | Returns a string containing the hostname of the SOAP server NSA contacts with analytics information. | ||||||||||||||||||||||||||||||||||||||
| int callNSAApStart(int transID) | Records startup of your application. Returns 0 on success and a negative number for an error. | ||||||||||||||||||||||||||||||||||||||
| int callNSAApStop(int transID) | Records shutdown of your application. Returns 0 on success and a negative number for an error. | ||||||||||||||||||||||||||||||||||||||
| int callNSALogin(String username, int transID) | Records login of the username. Returns 0 on success and a negative number for an error. Username should bea ANSI C string or a utf8 encoded as a Unicode string. | ||||||||||||||||||||||||||||||||||||||
| int callNSALogout(String username, int transID) | Recordslogoutof username. Returns 0 on success and a negative number for an error. Username should be a ANSI C string or a utf8 encoded Unicode string. | ||||||||||||||||||||||||||||||||||||||
| int callNSAFeatureStart( String username, String featureCode, int transID) | Records start of use of featureCode by username. Returns 0 on success and a negative number for an error. Username and featureCode should be a ANSI C strings ora utf8 encoded Unicode strings. | ||||||||||||||||||||||||||||||||||||||
| int callNSAFeatureStop(String username, String featureCode, int transID) | Records end of use of featureCode by username. Returns 0 on success and a negative number for an error. Username and featureCode should be a ANSI C strings ora utf8 encoded Unicode strings. | ||||||||||||||||||||||||||||||||||||||
| int callNSAException(String username, String exceptionCode, String description) | Records an error of type exceptionCode by username with details in description. Returns 0 on success and a negative number for an error. Username, featureCode, and description should be a ANSI C strings ora utf8 encoded Unicode strings. | ||||||||||||||||||||||||||||||||||||||
| int callNSASysInfo( String username, Stringapplang, String version, String edition, String build, String licenseStatus) |
Send information about the system to Nalpeiron. Returns 0 on success and a negative number for an error. Username, applang, version, edition, build, and licenseStatus should be a ANSI C strings or a utf8 encoded Unicode strings. callNSASysInfo sends the following information to Nalpeiron
|
||||||||||||||||||||||||||||||||||||||
| int callNSASendCache(String username) | Check NSA's job cache. If not empty, send it. Returns 0 on success and a negative number for an error. Username should bea ANSIC string or a utf8 encodedunicodestring. This function is provided for special circumstances but should be largely unnecessary as sending of the cache is automatic. Upon a successful completion of any of the functions about, the communication thread checks to see if the cache contains information. If it doesn't, it is sent to Nalpeiron. | ||||||||||||||||||||||||||||||||||||||
| String callNSAGetStats() | Returns information about the NSA library's status. The following information is return in the form of a string
<?xml version="1.0" encoding="UTF-8"?> <NSA Current Statistics> <OfflineMode>0</OfflineMode> <LocationInfo>1</LocationInfo> <Cache Thread> <Max Cache Que Len>25</Max Cache Que Len> <Current Cache Que Len>0</Current Cache Que Len> <Cache writes>1</Cache writes> <Cache fails>0</Cache fails> </Cache Thread> <Soap Pool> <Min Soap Threads>10</Min Soap Threads> <Max Soap Threads>10</Max Soap Threads> <Queued Jobs>0</Queued Jobs> <Running Jobs>0</Running Jobs> <Finished Jobs>145</Finished Jobs> </Soap Pool> </NSA Current Statistics>
|
||||||||||||||||||||||||||||||||||||||
| String callNSLGetVersion() | Returns a string containing the library version and the version of NSL. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetComputerID() | Returns a string containing the computer ID of the current system. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetHostName() | Returns a string containing the hostname of the SOAP server NSL contacts for licensing information. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetLeaseExpDate() | Returns a string containing the expiration date (day, month, year and time) of the expiration of the current license. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetLeaseExpSec() | Returns the number of seconds until lease expiration. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetMaintExpDate() | Returns a string containing the expiration date (day, month, year and time) of the expiration of the maintenance period. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetMaintExpSec() |
|
||||||||||||||||||||||||||||||||||||||
| int callNSLGetSubExpSec() | Returns the number of seconds until subscription period expiration. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetSubExpDate() | Returns a string containing the expiration date (day, month, year and time) of the expiration of the current subscription period. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetTrialExpSec() | Returns the number of seconds until trial expiration. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetTrialExpDate() | Returns a string containing the expiration date (day, month, year and time) of the expiration of the current trial. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetLeaseExpSec() | Returns the number of seconds until license expiration. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetLicenseStatus() | Returns an integer explaining the status of the license.
|
||||||||||||||||||||||||||||||||||||||
| int callNSLValidateLibrary(int customerID, int productID) | Checks the validity of the library to make sure it has not been spoofed and corresponds to you and your product. It is VERY important that this function is called before any licensing information is processed. It is theoretically possible for someone to replace the NSL library with one that always returns ok for all licensing functions. ValidateLibrary will ensure that has not happened. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetLicense(String licenseNo, String xmlRegInfo) | Attempt to get a valid full or trial license from the Nalpeiron server. If licenseNo is empty, an attempt will be made to retrieve a trial license. If licenseNo is non-empty, it will be used when contacting the Nalpeiron server to attempt to retrieve a full license. The function returns the status of the retrieved license. The xmlRegInfo is optional registration information that may be passed to the Nalpeiron server during registration. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetFeatureStatus(String featureName) | Returns the status of featureName. The featurestatus uses the same values as the license status shown above. | ||||||||||||||||||||||||||||||||||||||
| int callNSLReturnLicense(String licenseNo) | Returns the current license to the Nalpeiron server. | ||||||||||||||||||||||||||||||||||||||
| int callNSLImportCertificate(String licenseNo, String cert) | Imports a license certificate (ie creates a license from a license certificate). | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetActivationCertReq(String licenseNo, String xmlRegInfo) | Creates a request for a license certification. The request can be used on Nalpeiron's certs page to get a license certificate. | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetDeactivationCertReq(String licenseNo) | Creates a request for license deactivation. The deactivation request may be used on Nalpeiron's cert page to deactivate a license. | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetTimeStamp() | Get a timestamp from the Nalpeiron server | ||||||||||||||||||||||||||||||||||||||
| String callNSLGetUDFValue(String UDFName) | Return the UDF value associated with UDFName | ||||||||||||||||||||||||||||||||||||||
| int callNSLGetNumbAvailProc(int[] maxProc, int[] availProc) | Returns the Maximum number of process allowed and the number remaining. | ||||||||||||||||||||||||||||||||||||||
| int callNSLRegister(String licenseNo, String xmlRegInfo) | Registers a user on the Nalperion server. |
Download the Example Application
Release Notes (Please always check the release notes for the latest updates)
You can download the required sample files at the Customer Center below: