1 /* 2 * Copyright (c) 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 INTERFACES_INNER_API_NETWORK_MANAGER_INCLUDE_IPTABLES_DOMAIN_FILTER_RULE_H 17 #define INTERFACES_INNER_API_NETWORK_MANAGER_INCLUDE_IPTABLES_DOMAIN_FILTER_RULE_H 18 19 #include <tuple> 20 21 #include "iptables_utils.h" 22 #include "message_parcel.h" 23 24 namespace OHOS { 25 namespace EDM { 26 namespace IPTABLES { 27 28 const int32_t DOMAIN_ACTION_IND = 0; 29 const int32_t DOMAIN_APPUID_IND = 1; 30 const int32_t DOMAIN_DOMAINNAME_IND = 2; 31 32 using DomainFilterRule = std::tuple<Action, std::string /*appUid*/, std::string /*domainName*/>; 33 34 class DomainFilterRuleParcel { 35 public: 36 DomainFilterRuleParcel() = default; 37 explicit DomainFilterRuleParcel(DomainFilterRule rule); 38 39 [[nodiscard]] DomainFilterRule GetRule() const; 40 41 bool Marshalling(MessageParcel& parcel) const; 42 43 static bool Unmarshalling(MessageParcel& parcel, DomainFilterRuleParcel& domainFilterRuleParcel); 44 45 private: 46 DomainFilterRule rule_; 47 }; 48 } // namespace IPTABLES 49 } // namespace EDM 50 } // namespace OHOS 51 #endif // INTERFACES_INNER_API_NETWORK_MANAGER_INCLUDE_IPTABLES_DOMAIN_FILTER_RULE_H 52