• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 DEVICE_AUTH_DEFINES_H
17 #define DEVICE_AUTH_DEFINES_H
18 
19 #define HC_GROUP_FRIEND_MAX_NUM 100 /* Visibility is 1, friend list is available, and max is 100 */
20 #define HC_GROUP_MANAGER_MAX_NUM 10 /* manager max number is 10, it includes owner and other managers */
21 
22 #define PUBLIC_KEY_MAX_LENGTH 128
23 
24 enum {
25     /* common error code, 0x00000000 ~ 0x00000FFF */
26     HC_SUCCESS = 0x00000000,
27 
28     HC_ERROR = 0x00000001,
29     HC_ERR_INVALID_PARAMS = 0x00000002,
30     HC_ERR_INVALID_LEN = 0x00000003,
31     HC_ERR_NULL_PTR = 0x00000004,
32     HC_ERR_ALLOC_MEMORY = 0x00000005,
33     HC_ERR_MEMORY_COPY = 0x00000006,
34     HC_ERR_CONVERT_FAILED = 0x00000007,
35     HC_ERR_NOT_SUPPORT = 0x00000008,
36     HC_ERR_TIME_OUT = 0x00000009,
37     HC_ERR_CASE = 0x0000000A,
38     HC_ERR_BAD_TIMING = 0x0000000B,
39     HC_ERR_PEER_ERROR = 0x0000000C,
40     HC_ERR_FILE = 0x0000000D,
41     HC_ERR_MEMORY_COMPARE = 0x0000000E,
42     HC_ERR_OUT_OF_LIMIT = 0x0000000F,
43     HC_ERR_INIT_FAILED = 0x00000010,
44 
45     /* error code for algorithm adapter , 0x00001000 ~ 0x00001FFF */
46     HC_ERR_KEY_NOT_EXIST = 0x00001001,
47     HC_ERR_GENERATE_KEY_FAILED = 0x000010002,
48     HC_ERR_INVALID_PUBLIC_KEY = 0x00001003,
49     HC_ERR_VERIFY_FAILED = 0x00001004,
50     HC_ERR_HASH_FAIL = 0x00001005,
51     HC_ERR_ALG_FAIL = 0x00001006,
52 
53     /* error code for json util , 0x00002000 ~ 0x00002FFF */
54     HC_ERR_JSON_FAIL = 0x00002001,
55     HC_ERR_JSON_CREATE = 0x00002002,
56     HC_ERR_JSON_GET = 0x00002003,
57     HC_ERR_JSON_ADD = 0x00002004,
58     HC_ERR_PACKAGE_JSON_TO_STRING_FAIL = 0x00002005,
59 
60     /* error code for ipc, 0x00003000 ~ 0x00003FFF */
61     HC_ERR_IPC_INTERNAL_FAILED = 0x00003001,
62     HC_ERR_IPC_UNKNOW_OPCODE = 0x00003002,
63     HC_ERR_IPC_CALL_DATA_LENGTH = 0x00003003,
64     HC_ERR_IPC_METHOD_ID_INVALID = 0x00003004,
65     HC_ERR_IPC_BAD_MESSAGE_LENGTH = 0x00003005,
66     HC_ERR_IPC_BAD_VAL_LENGTH = 0x00003006,
67     HC_ERR_IPC_BAD_PARAM_NUM = 0x00003007,
68     HC_ERR_IPC_BAD_MSG_TYPE = 0x00003008,
69     HC_ERR_IPC_GET_SERVICE = 0x00003009,
70     HC_ERR_IPC_GET_PROXY = 0x0000300A,
71     HC_ERR_IPC_INIT = 0x0000300B,
72     HC_ERR_IPC_BUILD_PARAM = 0x0000300C,
73     HC_ERR_IPC_PROC_FAILED = 0x0000300D,
74     HC_ERR_IPC_UNKNOW_REPLY = 0x0000300E,
75     HC_ERR_IPC_OUT_DATA_NUM = 0x0000300F,
76     HC_ERR_IPC_OUT_DATA = 0x00003010,
77     HC_ERR_IPC_BAD_PARAM = 0x00003011,
78 
79     /* error code for module , 0x00004000 ~ 0x00004FFF */
80     HC_ERR_MODULE_NOT_FOUNT = 0x00004001,
81     HC_ERR_UNSUPPORTED_METHOD = 0x00004002,
82     HC_ERR_UNSUPPORTED_VERSION = 0x00004003,
83     HC_ERR_UNSUPPORTED_CURVE = 0x00004004,
84     HC_ERR_BAD_MESSAGE = 0x00004005,
85     HC_ERR_PROOF_NOT_MATCH = 0x00004006,
86     HC_ERR_INIT_TASK_FAIL = 0x00004007,
87     HC_ERR_TASK_IS_NULL = 0x00004008,
88     HC_ERR_TASK_ID_IS_NOT_MATCH = 0x00004009,
89     HC_ERR_INVALID_ALG = 0x0000400A,
90     HC_ERR_IGNORE_MSG = 0x0000400B,
91     HC_ERR_LOCAL_IDENTITY_NOT_EXIST = 0x0000400C,
92 
93     /* error code for group , 0x00005000 ~ 0x00005FFF */
94     HC_ERR_ACCESS_DENIED = 0x00005001,
95     HC_ERR_CALLBACK_NOT_FOUND = 0x00005002,
96     HC_ERR_SERVICE_NEED_RESTART = 0x00005003,
97     HC_ERR_NO_CANDIDATE_GROUP = 0x00005004,
98     HC_ERR_TRANSMIT_FAIL = 0x00005005,
99     HC_ERR_REQUEST_EXIST = 0x00005006,
100     HC_ERR_REQUEST_NOT_FOUND = 0x00005007,
101     HC_ERR_SESSION_NOT_EXIST = 0x00005008,
102     HC_ERR_SESSION_ID_CONFLICT = 0x00005009,
103     HC_ERR_REQ_REJECTED = 0x0000500A,
104     HC_ERR_SERVER_CONFIRM_FAIL = 0x0000500B,
105     HC_ERR_CREATE_SESSION_FAIL = 0x0000500C,
106     HC_ERR_SESSION_IS_FULL = 0x0000500D,
107     HC_ERR_INVALID_UDID = 0x0000500E,
108     HC_ERR_INVALID_TCIS_ID = 0x0000500F,
109     HC_ERR_INFORM_ERR = 0x00005011,
110 
111     /* error code for database , 0x00006000 ~ 0x00006FFF */
112     HC_ERR_DB = 0x00006001,
113     HC_ERR_BEYOND_LIMIT = 0x00006002,
114     HC_ERR_SAVE_DB_FAILED = 0x00006003,
115     HC_ERR_ROLE_NOT_EXIST = 0x00006004,
116     HC_ERR_MANAGER_NOT_EXIST = 0x00006005,
117     HC_ERR_GROUP_DUPLICATE = 0x00006006,
118     HC_ERR_GROUP_NOT_EXIST = 0x00006007,
119     HC_ERR_DEVICE_NOT_EXIST = 0x00006008,
120     HC_ERR_DEVICE_DUPLICATE = 0x00006009,
121     HC_ERR_LOST_DATA = 0x0000600A,
122 
123     /* error code for broadcast , 0x00007000 ~ 0x00007FFF */
124     HC_ERR_LISTENER_NOT_EXIST = 0x00007001,
125 
126     /* error code for channel , 0x00008000 ~ 0x00008FFF */
127     HC_ERR_CHANNEL_NOT_EXIST = 0x00008001,
128     HC_ERR_SOFT_BUS = 0x00008002,
129 
130     /* error code used on DAS service */
131     INVALID_PARAMETERS = 0xF0000001,
132     EXCEED_AUTHORITY = 0xF0000002,
133     TIMEOUT = 0xF0000003,
134     NOT_REGISTERED = 0xF0000004,
135     NOT_TRUST_PEER = 0xF0000005,
136     NOT_TRUST_CONTROLLER = 0xF0000006,
137     NOT_TRUST_ACCESSORY = 0xF0000007,
138     OVER_MAX_TRUST_NUM = 0xF0000008,
139     CONNECTION_INTERRUPTED = 0xF0000009,
140     UNSUPPORTED_VERSION = 0xF000000A,
141     BAD_PAYLOAD = 0xF000000B,
142     ALGORITHM_UNSUPPORTED = 0xF000000C,
143     PROOF_MISMATCH = 0xF000000D,
144     UNKNOWN = 0xF0000000,
145 };
146 
147 #endif
148