• 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 I_NETSHARE_SERVICE_H
17 #define I_NETSHARE_SERVICE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "iremote_broker.h"
23 #include "iremote_object.h"
24 
25 #include "net_manager_ext_constants.h"
26 #include "i_netshare_result_callback.h"
27 #include "i_sharing_event_callback.h"
28 
29 namespace OHOS {
30 namespace NetManagerStandard {
31 class INetworkShareService : public IRemoteBroker {
32 public:
33     enum class MessageCode {
34         CMD_GET_SHARING_SUPPORTED,
35         CMD_GET_IS_SHARING,
36         CMD_START_NETWORKSHARE,
37         CMD_STOP_NETWORKSHARE,
38         CMD_GET_SHARABLE_REGEXS,
39         CMD_GET_SHARING_STATE,
40         CMD_GET_SHARING_IFACES,
41         CMD_REGISTER_EVENT_CALLBACK,
42         CMD_UNREGISTER_EVENT_CALLBACK,
43         CMD_GET_ACTIVATE_INTERFACE,
44         CMD_GET_RX_BYTES,
45         CMD_GET_TX_BYTES,
46         CMD_GET_TOTAL_BYTES,
47     };
48 
49 public:
50     virtual int32_t IsNetworkSharingSupported(int32_t &supported) = 0;
51     virtual int32_t IsSharing(int32_t &sharingStatus) = 0;
52     virtual int32_t StartNetworkSharing(const SharingIfaceType &type) = 0;
53     virtual int32_t StopNetworkSharing(const SharingIfaceType &type) = 0;
54     virtual int32_t GetSharableRegexs(SharingIfaceType type, std::vector<std::string> &ifaceRegexs) = 0;
55     virtual int32_t GetSharingState(SharingIfaceType type, SharingIfaceState &state) = 0;
56     virtual int32_t GetNetSharingIfaces(const SharingIfaceState &state, std::vector<std::string> &ifaces) = 0;
57     virtual int32_t RegisterSharingEvent(sptr<ISharingEventCallback> callback) = 0;
58     virtual int32_t UnregisterSharingEvent(sptr<ISharingEventCallback> callback) = 0;
59     virtual int32_t GetStatsRxBytes(int32_t &bytes) = 0;
60     virtual int32_t GetStatsTxBytes(int32_t &bytes) = 0;
61     virtual int32_t GetStatsTotalBytes(int32_t &bytes) = 0;
62 
63     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetworkShareService");
64 };
65 } // namespace NetManagerStandard
66 } // namespace OHOS
67 #endif // I_NETSHARE_SERVICE_H
68