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 typedef enum ResultCode { 20 RESULT_SUCCESS = 0x0, 21 RESULT_GENERAL_ERROR = 0x1, 22 RESULT_BAD_PARAM = 0x2, 23 RESULT_BAD_COPY = 0x3, 24 RESULT_NO_MEMORY = 0x4, 25 RESULT_NEED_INIT = 0x5, 26 RESULT_NOT_FOUND = 0x6, 27 RESULT_REACH_LIMIT = 0x7, 28 RESULT_DUPLICATE_CHECK_FAILED = 0x8, 29 RESULT_BAD_READ = 0x9, 30 RESULT_BAD_WRITE = 0xA, 31 RESULT_BAD_DEL = 0xB, 32 RESULT_UNKNOWN = 0xC, 33 RESULT_BAD_MATCH = 0xD, 34 RESULT_BAD_SIGN = 0xE, 35 RESULT_BUSY = 0xF, 36 RESULT_PIN_FREEZE = 0x11, 37 RESULT_PIN_FAIL = 0X12, 38 RESULT_COMPARE_FAIL = 0x13 39 } ResultCode; 40 41 typedef enum ResultCodeForCoAuth { 42 /** 43 * Indicates that authentication is success or ability is supported. 44 */ 45 SUCCESS = 0, 46 47 /** 48 * Indicates the authenticator fails to identify user. 49 */ 50 FAIL = 1, 51 52 /** 53 * Indicates other errors. 54 */ 55 GENERAL_ERROR = 2, 56 57 /** 58 * Indicates that authentication has been canceled. 59 */ 60 CANCELED = 3, 61 62 /** 63 * Indicates that authentication has timed out. 64 */ 65 TIMEOUT = 4, 66 67 /** 68 * Indicates that this authentication type is not supported. 69 */ 70 TYPE_NOT_SUPPORT = 5, 71 72 /** 73 * Indicates that the authentication trust level is not supported. 74 */ 75 TRUST_LEVEL_NOT_SUPPORT = 6, 76 77 /** 78 * Indicates that the authentication task is busy. Wait for a few seconds and try again. 79 */ 80 BUSY = 7, 81 82 /** 83 * Indicates incorrect parameters. 84 */ 85 INVALID_PARAMETERS = 8, 86 87 /** 88 * Indicates that the authenticator is locked. 89 */ 90 LOCKED = 9, 91 92 /** 93 * Indicates that the user has not enrolled the authenticator. 94 */ 95 NOT_ENROLLED = 10 96 } ResultCodeForCoAuth; 97 98 typedef enum AuthType { 99 DEFAULT_AUTH_TYPE = 0, 100 PIN_AUTH = 1, 101 FACE_AUTH = 2, 102 } AuthType; 103 104 typedef enum AuthSubType { 105 DEFAULT_TYPE = 0, 106 } AuthSubType; 107 108 #define MAX_DULPLICATE_CHECK 100 109 110 #endif 111