-
Notifications
You must be signed in to change notification settings - Fork 34
/
liclock.h
94 lines (78 loc) · 1.87 KB
/
liclock.h
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
93
94
#ifndef LICENSE_H
#define LICENSE_H
#include <grutil.hpp>
#include <grutilex.hpp>
#include <sysinc.hpp>
#include <license.h>
#if defined(__cplusplus)
extern "C"{
#endif
//error code
#define HY_ENODEVICE 0x01
#define HY_EOUTMEM 0x02
#define HY_EENUMDEV 0x03
#define HY_EOPENDEV 0x04
#define HY_EROOTDIR 0x05
#define HY_EUSERPIN 0x06
#define HY_EDEVPIN 0x07
typedef struct{
uint64_t id;
uint64_t lower;
uint64_t upper;
}hy_license_quota_t;
typedef struct{
uint32_t len;
uint32_t pad;
}hy_license_head_t;
typedef struct{
uint16_t total;
uint16_t nentry;
uint16_t pad;
hy_license_quota_t *entries;
}hy_license_body_t;
typedef struct{
hy_license_head_t head;
hy_license_body_t body;
}hy_license_t;
typedef struct{
char *licpath;
char *licext;
char *licprefix;
}hy_license_init_t;
typedef enum{
lic_NVR,
lic_TVW,
lic_CLIENT
}hy_license_type_t;
typedef enum{
LRT_SUCCESS = 0,
LRT_NO_INIT = 1,
LRT_NO_LIC = 2,
LRT_NO_MATCH = 3,
LRT_DAMAGE = 4,
LRT_LIMIT = 5,
LRT_DUP_LIC = 6,
LRT_FAILURE = 7,
LRT_SN_ERROR = 8
}hy_ret_t;
typedef struct{
uint64_t req_cam_num;
uint64_t req_screen_num;
gr_license_t lic;
}hy_dev_license_t;
//key
int GRCALL hy_verify(unsigned char sn[22], int Alen);
int GRCALL hy_reset();
int GRCALL hy_write_file(const char *Aid, const char* Apath, int Aoverwrite);
//quota
int GRCALL hy_get_quota(uint64_t id, uint64_t *lower, uint64_t *upper);
int GRCALL hy_set_quota(uint64_t id, uint64_t lower, uint64_t upper);
//license
int GRCALL hy_license_init(hy_license_init_t *Ainit);
int GRCALL hy_license_destroy();
int GRCALL hy_active_dev_license(hy_dev_license_t *Alic);
int GRCALL hy_load_dev_license(hy_dev_license_t *Alic);
#if defined(__cplusplus)
}
#endif
#endif // LICENSE_H