• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 const int32_t DOMAIN_DIRECTION_IND = 3;
32 
33 using DomainFilterRule = std::tuple<Action, std::string /*appUid*/, std::string /*domainName*/, Direction>;
34 
35 class DomainFilterRuleParcel {
36 public:
37     DomainFilterRuleParcel() = default;
38     explicit DomainFilterRuleParcel(DomainFilterRule rule);
39 
40     [[nodiscard]] DomainFilterRule GetRule() const;
41 
42     bool Marshalling(MessageParcel& parcel) const;
43 
44     static bool Unmarshalling(MessageParcel& parcel, DomainFilterRuleParcel& domainFilterRuleParcel);
45 
46 private:
47     DomainFilterRule rule_;
48 };
49 } // namespace IPTABLES
50 } // namespace EDM
51 } // namespace OHOS
52 #endif // INTERFACES_INNER_API_NETWORK_MANAGER_INCLUDE_IPTABLES_DOMAIN_FILTER_RULE_H
53