#ifndef ATLASLIC_ATLAS_LICENCE_H #define ATLASLIC_ATLAS_LICENCE_H #ifdef _MSC_VER #ifdef ATLAS_LICENCE_EXPORTS #define ATLAS_LICENCE_API __declspec(dllexport) #else #define ATLAS_LICENCE_API __declspec(dllimport) #endif #else #define ATLAS_LICENCE_API __attribute__ ((visibility ("default"))) #endif #define STATUS_SUCCESS 0 /* Success */ #define STATUS_ERROR -1 /* Generic error */ #ifndef __ATLAS_LICENCE_PARAM__ #define __ATLAS_LICENCE_PARAM__ #define MAX_LENGTH 128 typedef struct atlas_licence_param { char product_id[MAX_LENGTH]; char guid[MAX_LENGTH]; char token_pwd[MAX_LENGTH]; int channel_num; } atlas_licence_param; typedef struct atlas_licence_token { int code; char msg[MAX_LENGTH]; char token[2048]; } atlas_licence_token; typedef struct atlas_licence_check_param { char token[2048]; char token_pwd[MAX_LENGTH]; char time[MAX_LENGTH]; int consume; } atlas_licence_check_param; typedef struct atlas_licence_check_result{ int code; char msg[MAX_LENGTH]; }atlas_licence_check_result; #endif extern "C" { /************************************************************************* * FUNCTION: atlas_licence_init * PURPOSE: 打开连接 * PARAM: [out] skt_handle - 句柄 [in] param - 初始化参数 * RETURN: [out] int - 初始化是否成功0表示成功,-1表示失败 * NOTES: *************************************************************************/ ATLAS_LICENCE_API int atlas_licence_connect(void **skt_handle, atlas_licence_param param, atlas_licence_token *param_token); /************************************************************************* * FUNCTION: atlas_licence_check * PURPOSE: 验证 * PARAM: [in] skt_handle - 句柄 [in] token - token [in] time - 时间 [in] consume - 消费数 [out] result - 校验结果 * RETURN: [out] int - 是否成功0表示成功,-1表示失败 * NOTES: *************************************************************************/ ATLAS_LICENCE_API int atlas_licence_check(void *skt_handle, atlas_licence_check_param check_param, atlas_licence_check_result *result); /************************************************************************* * FUNCTION: atlas_licence_close * PURPOSE: 关闭连接 * PARAM: [in] skt_handle - 句柄 * RETURN: [out] int - 是否成功0表示成功,-1表示失败 * NOTES: *************************************************************************/ ATLAS_LICENCE_API int atlas_licence_close(void **skt_handle); } #endif //ATLASLIC_ATLAS_LICENCE_H