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 21 inline constexpr int32_t MAX_EVENT_SIZE { 100 }; 22 inline constexpr int32_t STREAM_BUF_READ_FAIL { 1 }; 23 inline constexpr int32_t STREAM_BUF_WRITE_FAIL { 2 }; 24 inline constexpr int32_t MAX_VECTOR_SIZE { 10 }; 25 inline constexpr int32_t MEM_OUT_OF_BOUNDS { 3 }; 26 inline constexpr int32_t MEMCPY_SEC_FUN_FAIL { 4 }; 27 inline constexpr int32_t PARAM_INPUT_INVALID { 5 }; 28 inline constexpr int32_t MAX_STREAM_BUF_SIZE { 1024 }; 29 inline constexpr size_t MAX_PACKET_BUF_SIZE { MAX_STREAM_BUF_SIZE }; 30 inline constexpr int32_t ONCE_PROCESS_NETPACKET_LIMIT { 100 }; 31 inline constexpr int32_t INVALID_FD { 6 }; 32 inline constexpr int32_t INVALID_PID { 7 }; 33 inline constexpr int32_t SESSION_NOT_FOUND { 8 }; 34 inline constexpr int32_t EPOLL_MODIFY_FAIL { 9 }; 35 inline constexpr int32_t ADD_SESSION_FAIL { 11 }; 36 inline constexpr size_t MAX_SESSION_ALARM { 100 }; 37 inline constexpr int32_t MAX_RECV_LIMIT { 13 }; 38 inline constexpr int32_t SERVICE_NOT_RUNNING { 14 }; 39 inline constexpr int32_t CONNECT_MODULE_TYPE_FI_CLIENT { 0 }; 40 inline constexpr int64_t CLIENT_RECONNECT_COOLING_TIME { 800 }; 41 inline constexpr int32_t SEND_RETRY_LIMIT { 32 }; 42 inline constexpr useconds_t SEND_RETRY_SLEEP_TIME { 10000 }; 43 44 enum 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 }; 76 77 enum TokenType : int32_t { 78 TOKEN_INVALID = -1, 79 TOKEN_HAP = 0, 80 TOKEN_NATIVE, 81 TOKEN_SHELL 82 }; 83 #endif // PROTO_H 84