Blame view

3rdparty/atlas_lic-aarch64-20220112/atlas_lic/include/atlas_licence.h 2.54 KB
b309bd27   Zhao Shuaihua   通途版本增加授权
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  #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