1 /* 2 * Copyright (c) 2024 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 BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_COMMON_INCLUDE_DISTRIBUTED_DATA_DEFINE_H 17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_COMMON_INCLUDE_DISTRIBUTED_DATA_DEFINE_H 18 19 #include <string> 20 #include <set> 21 #include <mutex> 22 #include <unordered_set> 23 #include "notification_operation_info.h" 24 25 namespace OHOS { 26 namespace Notification { 27 28 namespace { 29 constexpr const int32_t MIN_DATA_LENGTH = 4; 30 constexpr char const AnonymousString[] = "******"; 31 constexpr int32_t DEFAULT_REPLY_TIMEOUT = 3; 32 } 33 34 struct DistributedDeviceConfig { 35 int32_t maxTitleLength; 36 int32_t maxContentLength; 37 uint32_t startAbilityTimeout; 38 int32_t operationReplyTimeout = DEFAULT_REPLY_TIMEOUT; 39 std::string localType; 40 std::set<std::string> supportPeerDevice; 41 std::unordered_set<std::string> collaborativeDeleteTypes; 42 }; 43 StringAnonymous(const std::string & data)44static std::string StringAnonymous(const std::string& data) 45 { 46 std::string result; 47 if (data.length() <= MIN_DATA_LENGTH) { 48 result = data + AnonymousString + data; 49 } else { 50 result = data.substr(0, MIN_DATA_LENGTH) + AnonymousString + 51 data.substr(data.length() - MIN_DATA_LENGTH, MIN_DATA_LENGTH); 52 } 53 return result; 54 } 55 56 } // namespace Notification 57 } // namespace OHOS 58 59 #endif // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_COMMON_INCLUDE_DISTRIBUTED_DATA_DEFINE_H 60