I am working on ITLSSPProc.dll which has native methods, it has the following struct definition in C-language but I have to write code in Java. I have searched continuously for the last three days but can’t find a solution.
1.typedef struct{
unsigned __int64 FixedKey; // 8 byte number for fixed host key
unsigned __int64 EncryptKey; // 8 Byte number for variable key
}SSP_FULL_KEY;
2.typedef struct{
unsigned __int64 Generator;
unsigned __int64 Modulus;
unsigned __int64 HostInter;
unsigned __int64 HostRandom;
unsigned __int64 SlaveInterKey;
unsigned __int64 SlaveRandom;
unsigned __int64 KeyHost;
unsigned __int64 KeySlave;
}SSP_KEYS
3.typedef struct{
SSP_FULL_KEY Key; // the full key
unsigned long BaudRate; // baud rate of the packet
unsigned long Timeout; // how long in ms to wait for a reply from the slave
unsigned char PortNumber; // the serial com port number of the host
unsigned char SSPAddress; // the SSP address of the slave
unsigned char RetryLevel; // how many retries to the slave for non-response
unsigned char EncryptionStatus; // is this an encrypted command 0 – No, 1 - Yes
unsigned char CommandDataLength; // Number of bytes in the command
unsigned char CommandData[255]; // Array containing the command bytes
unsigned char ResponseStatus; // Response Status (PORT_STATUS enum)
unsigned char ResponseDataLength; // how many bytes in the response
unsigned char ResponseData[255]; // an array of response data
unsigned char IgnoreError; // flag to suppress error box (0 – display,1 suppress)
}SSP_COMMAND
Here is the Java code I have tried, but I am not able to call the native methods:
public class SSP_FULL_KEY
{
long FixedKey;
long EncryptKey;
public SSP_FULL_KEY(long fix, long encr)
{
FixedKey = fix;
EncryptKey = encr;
}
}
public class SSP_COMMAND
{
//string PortNumber;
SSP_FULL_KEY key;
long BaudRate; // baud rate of the packet
long Timeout; // how long in ms to wait for a reply from the slave
String PortNumber; // the serial com port number of the host
String SSPAddress; // the SSP address of the slave
String RetryLevel; // how many retries to the slave for non-response
String EncryptionStatus; // is this an encrypted command 0 - No, 1 - Yes
String CommandDataLength; // Number of bytes in the command
String[] CommandData = new String[255]; // Array containing the command bytes
String ResponseStatus; // Response Status (PORT_STATUS enum)
String ResponseDataLength; // how many bytes in the response
String ResponseData[] = new String[255]; // an array of response data
String IgnoreError; // flag to suppress error box (0 - display,1- suppress)
public SSP_COMMAND(String comport)
{
BaudRate = 9600;
Timeout = 500;
PortNumber = comport;
RetryLevel = "5";
IgnoreError = "0";
EncryptionStatus = "0";
ResponseStatus = "0";
ResponseDataLength = "0";
SSPAddress = "0";
CommandDataLength = "0";
key = new SSP_FULL_KEY(012345670123, 012345670123);
}
}
native method:OpenSSPComPort(SSPCOMMAND * cmd)
Here I pass the parameters:
Pointer to SSP_COMMAND structure Returns: WORD 0 for fail, 1 for success
and getting error unsatisfied link error
Take a look on C to java converter