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 #ifndef PROTO_H 16 #define PROTO_H 17 #include <sys/types.h> 18 #define MAX_EVENT_SIZE 100 19 static constexpr int32_t STREAM_BUF_READ_FAIL { 1 }; 20 static constexpr int32_t STREAM_BUF_WRITE_FAIL { 2 }; 21 static constexpr int32_t MAX_VECTOR_SIZE { 10 }; 22 static constexpr int32_t MEM_OUT_OF_BOUNDS { 3 }; 23 static constexpr int32_t MEMCPY_SEC_FUN_FAIL { 4 }; 24 static constexpr int32_t PARAM_INPUT_INVALID { 5 }; 25 static constexpr int32_t MAX_STREAM_BUF_SIZE { 256 }; 26 static constexpr size_t MAX_PACKET_BUF_SIZE { 256 }; 27 static constexpr int32_t ONCE_PROCESS_NETPACKET_LIMIT { 100 }; 28 static constexpr int32_t INVALID_FD { 6 }; 29 static constexpr int32_t INVALID_PID { 7 }; 30 static constexpr int32_t SESSION_NOT_FOUND { 8 }; 31 static constexpr int32_t EPOLL_MODIFY_FAIL { 9 }; 32 static constexpr int32_t ADD_SESSION_FAIL { 11 }; 33 static constexpr size_t MAX_SESSON_ALARM { 100 }; 34 static constexpr int32_t MAX_RECV_LIMIT { 13 }; 35 static constexpr int32_t SERVICE_NOT_RUNNING { 14 }; 36 #define CONNECT_MODULE_TYPE_FI_CLIENT 0 37 #define CLIENT_RECONNECT_COOLING_TIME 800 38 #define SEND_RETRY_LIMIT 32 39 #define SEND_RETRY_SLEEP_TIME 10000 40 41 enum class MessageId : int32_t { 42 INVALID, 43 44 COORDINATION_ADD_LISTENER, 45 COORDINATION_MESSAGE, 46 COORDINATION_GET_STATE, 47 48 DRAG_NOTIFY_RESULT, 49 DRAG_STATE_LISTENER 50 }; 51 52 enum TokenType : int32_t { 53 TOKEN_INVALID = -1, 54 TOKEN_HAP = 0, 55 TOKEN_NATIVE, 56 TOKEN_SHELL 57 }; 58 #endif // PROTO_H