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 #include "vpn_connection.h"
17 
18 #include "destroy_context.h"
19 #include "module_template.h"
20 #include "prepare_context.h"
21 #include "protect_context.h"
22 #include "setup_context.h"
23 #include "vpn_async_work.h"
24 
25 namespace OHOS {
26 namespace NetManagerStandard {
27 namespace VpnConnection {
Prepare(napi_env env,napi_callback_info info)28 napi_value Prepare(napi_env env, napi_callback_info info)
29 {
30     return ModuleTemplate::Interface<PrepareContext>(env, info, PREPARE, nullptr, VpnAsyncWork::ExecPrepare,
31                                                      VpnAsyncWork::PrepareCallback);
32 }
33 
SetUp(napi_env env,napi_callback_info info)34 napi_value SetUp(napi_env env, napi_callback_info info)
35 {
36     return ModuleTemplate::Interface<SetUpContext>(env, info, SET_UP, nullptr, VpnAsyncWork::ExecSetUp,
37                                                    VpnAsyncWork::SetUpCallback);
38 }
39 
Protect(napi_env env,napi_callback_info info)40 napi_value Protect(napi_env env, napi_callback_info info)
41 {
42     return ModuleTemplate::Interface<ProtectContext>(env, info, PROTECT, nullptr, VpnAsyncWork::ExecProtect,
43                                                      VpnAsyncWork::ProtectCallback);
44 }
45 
Destroy(napi_env env,napi_callback_info info)46 napi_value Destroy(napi_env env, napi_callback_info info)
47 {
48     return ModuleTemplate::Interface<DestroyContext>(env, info, DESTROY, nullptr, VpnAsyncWork::ExecDestroy,
49                                                      VpnAsyncWork::DestroyCallback);
50 }
51 } // namespace VpnConnection
52 } // namespace NetManagerStandard
53 } // namespace OHOS