• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef COMMON_DEFINES_H
17 #define COMMON_DEFINES_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif // __cplusplus
22 
23 typedef enum ResultCode {
24     RESULT_SUCCESS = 0x0,
25     RESULT_GENERAL_ERROR = 0x1,
26     RESULT_BAD_PARAM = 0x2,
27     RESULT_BAD_COPY = 0x3,
28     RESULT_NO_MEMORY = 0x4,
29     RESULT_NEED_INIT = 0x5,
30     RESULT_NOT_FOUND = 0x6,
31     RESULT_REACH_LIMIT = 0x7,
32     RESULT_DUPLICATE_CHECK_FAILED = 0x8,
33     RESULT_BAD_READ = 0x9,
34     RESULT_BAD_WRITE = 0xA,
35     RESULT_BAD_DEL = 0xB,
36     RESULT_UNKNOWN = 0xC,
37     RESULT_BAD_MATCH = 0xD,
38     RESULT_BAD_SIGN = 0xE,
39     RESULT_BUSY = 0xF,
40     RESULT_PIN_FREEZE = 0x11,
41     RESULT_PIN_FAIL = 0X12,
42     RESULT_COMPARE_FAIL = 0x13
43 } ResultCode;
44 
45 typedef enum ResultCodeForCoAuth {
46     /**
47      * Indicates that authentication is success or ability is supported.
48      */
49     SUCCESS = 0,
50 
51     /**
52      * Indicates the authenticator fails to identify user.
53      */
54     FAIL = 1,
55 
56     /**
57      * Indicates other errors.
58      */
59     GENERAL_ERROR = 2,
60 
61     /**
62      * Indicates that authentication has been canceled.
63      */
64     CANCELED = 3,
65 
66     /**
67      * Indicates that authentication has timed out.
68      */
69     TIMEOUT = 4,
70 
71     /**
72      * Indicates that this authentication type is not supported.
73      */
74     TYPE_NOT_SUPPORT = 5,
75 
76     /**
77      * Indicates that the authentication trust level is not supported.
78      */
79     TRUST_LEVEL_NOT_SUPPORT = 6,
80 
81     /**
82      * Indicates that the authentication task is busy. Wait for a few seconds and try again.
83      */
84     BUSY = 7,
85 
86     /**
87      * Indicates incorrect parameters.
88      */
89     INVALID_PARAMETERS = 8,
90 
91     /**
92      * Indicates that the authenticator is locked.
93      */
94     LOCKED = 9,
95 
96     /**
97      * Indicates that the user has not enrolled the authenticator.
98      */
99     NOT_ENROLLED = 10
100 } ResultCodeForCoAuth;
101 
102 typedef enum AuthType {
103     DEFAULT_AUTH_TYPE = 0,
104     PIN_AUTH = 1,
105     FACE_AUTH = 2,
106 } AuthType;
107 
108 typedef enum AuthSubType {
109     DEFAULT_TYPE = 0,
110 } AuthSubType;
111 
112 #define MAX_DULPLICATE_CHECK 100
113 
114 #ifdef __cplusplus
115 }
116 #endif // __cplusplus
117 #endif // COMMON_DEFINES_H
118