
Description | Cautions | Example | Errors | See Also
Name: |
int dx_gtsernum (devd, subfcn, buffp ) | |
Inputs: |
int devd |
|
|
int subfcn |
|
|
void *buffp |
|
Returns: |
0 if success | |
|
-1 if failure | |
Includes: |
dxxxlib.h | |
|
srllib.h | |
Category: |
Configuration | |
Mode: |
synchronous | |
The dx_gtsernum( ) function returns the board serial number, either the standard serial number or the silicon serial number (where supported). Where supported, the silicon serial number is the preferred method for uniquely identifying boards.
The board serial number consists of eight ASCII characters and is printed on the serial number sticker on the board. The silicon serial number (when supported) consists of an additional six-byte serial number encoded into the board and can include non-printable characters.
The serial number is supported on all boards, and the silicon serial number is supported on ProLine/2V, D/41H and D/21H boards.
The serial number and silicon serial number can be used for developing software security in an application program. For example, an application program can be "locked" to a Dialogic board as part of the application installation procedure, by getting and saving the serial number in a secure place within the application. From then on, when the application is executed, it can check for the presence of the board and match it with the board serial number secured within the application program.
This function has the following parameters:
Parameter |
Description | |
devd |
Valid Dialogic board device handle. | |
subfcn |
Specifies one of the following sub-functions: | |
|
GS_SN |
Returns the standard board serial number, consisting of eight ASCII characters followed by a NULL byte. This number is printed on the serial number sticker attached to the board. |
|
GS_SSN |
Returns the board silicon serial number (if supported), consisting of six bytes of any value, including 0x00. An EDX_BADPROD error is returned if the specified board does not support the silicon serial number. |
buffp |
Pointer to buffer where the serial number is returned. | |
The silicon serial number (GS_SSN) can only be obtained from ProLine/2V, D/41H and D/21H boards.
/*$ dx_gtsernum( ) example $*/
#include "stdio.h"
#include "srllib.h"
#include "dxxxlib.h"
void main(int argc, char **argv)
{
int dev;
char serial[10];
/* open the board device */
if ((dev=dx_open("dxxxB1",0 )) == -1) {
printf("Error opening dxxxB1\n");
exit(1);
}
/* get the board serial number and display it */
if (dx_gtsernum(dev, GS_SN, serial) == 0) {
printf("dxxxB1: %s\n", serial);
} else {
printf("Error %d, %s\n", ATDV_LASTERR(dev), ATDV_ERRMSGP(dev));
}
dx_close(dev);
exit(0);
}
If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value. The board device is busy. |
EDX_BADPARM |
Invalid device handle or sub-function. |
EDX_BADPROD |
The board does not support GS_SSN (silicon serial number). |
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation