1/*
2 * Copyright (c) 2021-2023 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 PROTO_H
17#define PROTO_H
18
19#include <sys/types.h>
20
21inline constexpr int32_t MAX_EVENT_SIZE { 100 };
22inline constexpr int32_t STREAM_BUF_READ_FAIL { 1 };
23inline constexpr int32_t STREAM_BUF_WRITE_FAIL { 2 };
24inline constexpr int32_t MAX_VECTOR_SIZE { 10 };
25inline constexpr int32_t MEM_OUT_OF_BOUNDS { 3 };
26inline constexpr int32_t MEMCPY_SEC_FUN_FAIL { 4 };
27inline constexpr int32_t PARAM_INPUT_INVALID { 5 };
28inline constexpr int32_t MAX_STREAM_BUF_SIZE { 1024 };
29inline constexpr size_t MAX_PACKET_BUF_SIZE { MAX_STREAM_BUF_SIZE };
30inline constexpr int32_t ONCE_PROCESS_NETPACKET_LIMIT { 100 };
31inline constexpr int32_t INVALID_FD { 6 };
32inline constexpr int32_t INVALID_PID { 7 };
33inline constexpr int32_t SESSION_NOT_FOUND { 8 };
34inline constexpr int32_t EPOLL_MODIFY_FAIL { 9 };
35inline constexpr int32_t ADD_SESSION_FAIL { 11 };
36inline constexpr size_t MAX_SESSION_ALARM { 100 };
37inline constexpr int32_t MAX_RECV_LIMIT { 13 };
38inline constexpr int32_t SERVICE_NOT_RUNNING { 14 };
39inline constexpr int32_t CONNECT_MODULE_TYPE_FI_CLIENT { 0 };
40inline constexpr int64_t CLIENT_RECONNECT_COOLING_TIME { 800 };
41inline constexpr int32_t SEND_RETRY_LIMIT { 32 };
42inline constexpr useconds_t SEND_RETRY_SLEEP_TIME { 10000 };
43
44enum class MessageId : int32_t {
45    INVALID,
46
47    COORDINATION_ADD_LISTENER,
48    COORDINATION_MESSAGE,
49    COORDINATION_GET_STATE,
50    HOT_AREA_ADD_LISTENER,
51    MOUSE_LOCATION_ADD_LISTENER,
52
53    DSOFTBUS_START_COOPERATE,
54    DSOFTBUS_START_COOPERATE_RESPONSE,
55    DSOFTBUS_START_COOPERATE_FINISHED,
56    DSOFTBUS_STOP_COOPERATE,
57    DSOFTBUS_COME_BACK,
58    DSOFTBUS_RELAY_COOPERATE,
59    DSOFTBUS_RELAY_COOPERATE_FINISHED,
60    DSOFTBUS_INPUT_POINTER_EVENT,
61    DSOFTBUS_INPUT_KEY_EVENT,
62    DSOFTBUS_SUBSCRIBE_MOUSE_LOCATION,
63    DSOFTBUS_UNSUBSCRIBE_MOUSE_LOCATION,
64    DSOFTBUS_REPLY_SUBSCRIBE_MOUSE_LOCATION,
65    DSOFTBUS_REPLY_UNSUBSCRIBE_MOUSE_LOCATION,
66    DSOFTBUS_MOUSE_LOCATION,
67
68    DRAG_NOTIFY_RESULT,
69    DRAG_STATE_LISTENER,
70    DRAG_NOTIFY_HIDE_ICON,
71    DRAG_STYLE_LISTENER,
72    DSOFTBUS_INPUT_DEV_HOT_PLUG,
73    DSOFTBUS_INPUT_DEV_SYNC,
74    MAX_MESSAGE_ID,
75    ADD_SELECTED_PIXELMAP_RESULT
76};
77
78enum TokenType : int32_t {
79    TOKEN_INVALID = -1,
80    TOKEN_HAP = 0,
81    TOKEN_NATIVE,
82    TOKEN_SHELL
83};
84#endif // PROTO_H
85