154 lines
3.4 KiB
C++
154 lines
3.4 KiB
C++
#include <stdio.h>
|
|
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
#include "ssadll.h"
|
|
#include "SSAJni.h"
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1Login
|
|
(JNIEnv *env, jobject obj, jstring id, jstring prod)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* prodotto = env->GetStringUTFChars(prod, JNI_FALSE);
|
|
if (prodotto == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_Login(idClient, prodotto);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1Login1
|
|
(JNIEnv *env, jobject obj, jstring id, jstring prod, jstring pi)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* prodotto = env->GetStringUTFChars(prod, JNI_FALSE);
|
|
if (prodotto == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* piva = env->GetStringUTFChars(pi, JNI_FALSE);
|
|
if (piva == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_Login1(idClient, prodotto, piva);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1Logout
|
|
(JNIEnv * env, jobject obj, jstring id, jstring prod)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* prodotto = env->GetStringUTFChars(prod, JNI_FALSE);
|
|
if (prodotto == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_Logout(idClient, prodotto);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1ApriModulo
|
|
(JNIEnv * env, jobject obj, jstring id, jstring mod)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* modulo = env->GetStringUTFChars(mod, JNI_FALSE);
|
|
if (modulo == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_ApriModulo(idClient, modulo);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1ChiudiModulo
|
|
(JNIEnv * env, jobject obj, jstring id, jstring mod)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* modulo= env->GetStringUTFChars(mod, JNI_FALSE);
|
|
if (modulo == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_ChiudiModulo(idClient, modulo);
|
|
}
|
|
|
|
JNIEXPORT jstring JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1GetLastErrorString
|
|
(JNIEnv * env, jobject obj)
|
|
{
|
|
const char * error = SSA_DecodificaUltimoErrore();
|
|
return env->NewStringUTF(error);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1VerificaModulo
|
|
(JNIEnv * env, jobject obj, jstring prod, jstring mod)
|
|
{
|
|
const char* prodotto = env->GetStringUTFChars(prod, JNI_FALSE);
|
|
if (prodotto == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* modulo = env->GetStringUTFChars(mod, JNI_FALSE);
|
|
if (modulo == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_VerificaModulo(prodotto, modulo);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1VerificaModulo1
|
|
(JNIEnv * env, jobject obj, jstring prod, jstring mod, jstring pi)
|
|
{
|
|
const char* prodotto = env->GetStringUTFChars(prod, JNI_FALSE);
|
|
if (prodotto == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* modulo = env->GetStringUTFChars(mod, JNI_FALSE);
|
|
if (modulo == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
const char* piva = env->GetStringUTFChars(pi, JNI_FALSE);
|
|
if (piva == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_VerificaModulo1(prodotto, modulo, piva);
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL Java_it_sirio_sicurezza_SSAJni_SSA_1Ping
|
|
(JNIEnv * env, jobject obj, jstring id)
|
|
{
|
|
const char *idClient;
|
|
idClient = env->GetStringUTFChars(id, JNI_FALSE);
|
|
if (idClient == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
return SSA_Ping(idClient);
|
|
}
|