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 CMD_FACTORYRESET_VPN, 43 CMD_START_VPN_EXT, // for start extension extended vpn 44 CMD_PROTECT_EXT, 45 CMD_STOP_VPN_EXT, 46 CMD_CREATE_VPN_CONNECTION_EXT 47 }; 48 49 public: 50 virtual int32_t Prepare(bool &isExistVpn, bool &isRun, std::string &pkg) = 0; 51 virtual int32_t SetUpVpn(const sptr<VpnConfig> &config, bool isVpnExtCall = false) = 0; 52 virtual int32_t Protect(bool isVpnExtCall = false) = 0; 53 virtual int32_t DestroyVpn(bool isVpnExtCall = false) = 0; 54 virtual int32_t RegisterVpnEvent(const sptr<IVpnEventCallback> callback) = 0; 55 virtual int32_t UnregisterVpnEvent(const sptr<IVpnEventCallback> callback) = 0; 56 virtual int32_t CreateVpnConnection(bool isVpnExtCall = false) = 0; 57 virtual int32_t FactoryResetVpn() = 0; 58 59 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NetManagerStandard.INetworkVpnService"); 60 }; 61 } // namespace NetManagerStandard 62 } // namespace OHOS 63 #endif // I_NETWORK_VPN_SERVICE_H 64