• 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 I_NETWORK_VPN_SERVICE_H
17 #define I_NETWORK_VPN_SERVICE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "iremote_broker.h"
23 #include "iremote_object.h"
24 
25 #include "i_vpn_event_callback.h"
26 #include "net_manager_ext_constants.h"
27 #include "vpn_config.h"
28 
29 namespace OHOS {
30 namespace NetManagerStandard {
31 class INetworkVpnService : public IRemoteBroker {
32 public:
33     enum class MessageCode {
34         CMD_START_INTERNAL_VPN, // for start internal vpn
35         CMD_PREPARE,
36         CMD_START_VPN, // for start extended vpn
37         CMD_PROTECT,
38         CMD_STOP_VPN,
39         CMD_REGISTER_EVENT_CALLBACK,
40         CMD_UNREGISTER_EVENT_CALLBACK,
41         CMD_CREATE_VPN_CONNECTION,
42     };
43 
44 public:
45     virtual int32_t Prepare(bool &isExistVpn, bool &isRun, std::string &pkg) = 0;
46     virtual int32_t SetUpVpn(const sptr<VpnConfig> &config) = 0;
47     virtual int32_t Protect() = 0;
48     virtual int32_t DestroyVpn() = 0;
49     virtual int32_t RegisterVpnEvent(const sptr<IVpnEventCallback> callback) = 0;
50     virtual int32_t UnregisterVpnEvent(const sptr<IVpnEventCallback> callback) = 0;
51     virtual int32_t CreateVpnConnection() = 0;
52 
53     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetworkVpnService");
54 };
55 } // namespace NetManagerStandard
56 } // namespace OHOS
57 #endif // I_NETWORK_VPN_SERVICE_H
58