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 OHOS_IPC_RPC_TYPES_H
17 #define OHOS_IPC_RPC_TYPES_H
18 
19 #define ZIPC_PACK_CHARS(c1, c2, c3, c4) ((((c1) << 24)) | (((c2) << 16)) | (((c3) << 8)) | (c4))
20 #define GET_IDLE_THREAD_WAIT_TIME 1000
21 
22 enum {
23     FIRST_CALL_TRANSACTION = 0x00000001,
24     LAST_CALL_TRANSACTION = 0x00ffffff,
25     PING_TRANSACTION = ZIPC_PACK_CHARS('_', 'P', 'N', 'G'),
26     DUMP_TRANSACTION = ZIPC_PACK_CHARS('_', 'D', 'M', 'P'),
27     SHELL_COMMAND_TRANSACTION = ZIPC_PACK_CHARS('_', 'C', 'M', 'D'),
28     INTERFACE_TRANSACTION = ZIPC_PACK_CHARS('_', 'N', 'T', 'F'),
29     SYSPROPS_TRANSACTION = ZIPC_PACK_CHARS('_', 'S', 'P', 'R'),
30     SYNCHRONIZE_REFERENCE = ZIPC_PACK_CHARS('_', 'S', 'Y', 'C'),
31     INVOKE_LISTEN_THREAD = ZIPC_PACK_CHARS('_', 'I', 'L', 'T'),
32     GET_PROTO_INFO = ZIPC_PACK_CHARS('_', 'G', 'R', 'I'),
33     GET_UIDPID_INFO = ZIPC_PACK_CHARS('_', 'G', 'U', 'I'),
34     GRANT_DATABUS_NAME = ZIPC_PACK_CHARS('_', 'G', 'D', 'N'),
35     DBINDER_OBITUARY_TRANSACTION = ZIPC_PACK_CHARS('_', 'D', 'O', 'T'),
36     DBINDER_INCREFS_TRANSACTION = ZIPC_PACK_CHARS('_', 'D', 'I', 'T'),
37     DBINDER_DECREFS_TRANSACTION = ZIPC_PACK_CHARS('_', 'D', 'D', 'T'),
38     DBINDER_ADD_COMMAUTH = ZIPC_PACK_CHARS('_', 'D', 'A', 'C'),
39     TRANS_SYNC = 0,
40     TRANS_ASYNC = 1,
41 };
42 
43 enum {
44     IF_PROT_BINDER = 0,
45     IF_PROT_DATABUS = 1,
46 };
47 
48 #define SET_MAX_THREADS_DEFAULT 4
49 #define SET_MAX_THREADS_MAX     16
50 #define MAX_DEATH_CALLBACK_NUM  4
51 
52 #define RPC_DEFAULT_SEND_WAIT_TIME 4
53 #define RPC_MAX_SEND_WAIT_TIME 3000
54 
55 #if defined(__LITEOS_M__)
56 #define IF_PROT_DEFAULT IF_PROT_DATABUS
57 #else
58 #define IF_PROT_DEFAULT IF_PROT_BINDER
59 #endif
60 
61 #endif /* OHOS_IPC_RPC_TYPES_H */