1 /* 2 * Copyright (c) 2022 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_DISTRIBUTED_DATA_ADAPTER_COMMUNICATOR_COMMU_TYPES_H 17 #define OHOS_DISTRIBUTED_DATA_ADAPTER_COMMUNICATOR_COMMU_TYPES_H 18 #include <string> 19 #include "device_manager/device_manager_types.h" 20 #include "store_errno.h" 21 #include "visibility.h" 22 namespace OHOS::AppDistributedKv { 23 using Status = DistributedKv::Status; 24 using DeviceInfo = DistributedData::DeviceInfo; 25 26 struct API_EXPORT AccessCaller { 27 std::string accountId; 28 std::string bundleName; 29 std::string networkId; 30 int32_t userId; 31 }; 32 33 struct API_EXPORT AccessCallee { 34 std::string accountId; 35 std::string networkId; 36 int32_t userId; 37 }; 38 39 struct API_EXPORT AclParams { 40 AccessCaller accCaller; 41 AccessCallee accCallee; 42 int32_t authType = 0; 43 }; 44 45 enum RouteType : int32_t { 46 INVALID_ROUTE_TYPE = -1, 47 ROUTE_TYPE_ALL = 0, 48 WIFI_STA, 49 WIFI_P2P, 50 BT_BR, 51 BT_BLE, 52 BUTT, 53 }; 54 55 struct ExtraDataInfo { 56 std::string userId; 57 std::string appId; 58 std::string bundleName; 59 std::string storeId; 60 uint32_t tokenId = 0; 61 }; 62 63 struct DataInfo { 64 uint8_t *data; 65 uint32_t length; 66 ExtraDataInfo extraInfo; 67 }; 68 69 struct API_EXPORT PipeInfo { 70 std::string pipeId; 71 std::string userId; 72 }; 73 74 struct API_EXPORT DeviceId { 75 std::string deviceId; 76 }; 77 78 enum class API_EXPORT MessageType { 79 DEFAULT = 0, 80 FILE = 1, 81 }; 82 83 struct API_EXPORT MessageInfo { 84 MessageType msgType; 85 }; 86 87 enum class API_EXPORT DeviceChangeType { 88 DEVICE_OFFLINE = 0, 89 DEVICE_ONLINE = 1, 90 DEVICE_ONREADY = 2, 91 }; 92 93 enum class API_EXPORT DeviceStatus { 94 OFFLINE = 0, 95 ONLINE = 1, 96 }; 97 98 struct API_EXPORT LevelInfo { 99 uint16_t dynamic; 100 uint16_t statics; 101 uint32_t switches; 102 uint16_t switchesLen; 103 }; 104 105 struct API_EXPORT SessionAccessInfo { 106 int32_t userId = -1; 107 std::string bundleName; 108 std::string storeId; 109 std::string accountId; 110 uint32_t tokenId = 0; 111 bool isOHType = true; 112 }; 113 } 114 #endif // OHOS_DISTRIBUTED_DATA_ADAPTER_COMMUNICATOR_COMMU_TYPES_H 115