• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 NETSYS_POLICY_WRAPPER_H
17 #define NETSYS_POLICY_WRAPPER_H
18 
19 #include <iostream>
20 
21 #include "singleton.h"
22 
23 #include "net_mgr_log_wrapper.h"
24 #include "netsys_controller.h"
25 
26 namespace OHOS {
27 namespace NetManagerStandard {
28 class NetsysPolicyWrapper {
29     DECLARE_DELAYED_SINGLETON(NetsysPolicyWrapper)
30 
31 public:
32     int32_t RegisterNetsysCallback(sptr<NetsysControllerCallback> callback);
33     int32_t UnregisterNetsysCallback(sptr<NetsysControllerCallback> callback);
34     int32_t BandwidthEnableDataSaver(bool enable);
35     int32_t BandwidthSetIfaceQuota(const std::string &iface, int64_t bytes);
36     int32_t BandwidthRemoveIfaceQuota(const std::string &iface);
37     int32_t BandwidthAddDeniedList(uint32_t uid);
38     int32_t BandwidthRemoveDeniedList(uint32_t uid);
39     int32_t BandwidthAddAllowedList(uint32_t uid);
40     int32_t BandwidthRemoveAllowedList(uint32_t uid);
41     int32_t FirewallSetUidsAllowedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
42     int32_t FirewallSetUidsDeniedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
43     int32_t FirewallSetUidRule(uint32_t chain, const std::vector<uint32_t> &uids, uint32_t firewallRule);
44     int32_t FirewallEnableChain(uint32_t chain, bool enable);
45 };
46 } // namespace NetManagerStandard
47 } // namespace OHOS
48 #endif // NETSYS_POLICY_WRAPPER_H
49