• 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 #include <memory>
17 
18 #include "networkvpn_service_stub.h"
19 #include "net_manager_constants.h"
20 #include "netmanager_base_permission.h"
21 #include "netmgr_ext_log_wrapper.h"
22 
23 namespace OHOS {
24 namespace NetManagerStandard {
25 
NetworkVpnServiceStub()26 NetworkVpnServiceStub::NetworkVpnServiceStub()
27 {
28     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_PREPARE] = {
29         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyPrepare};
30     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_START_VPN] = {
31         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplySetUpVpn};
32     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_PROTECT] = {
33         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyProtect};
34     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_STOP_VPN] = {
35         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyDestroyVpn};
36 #ifdef SUPPORT_SYSVPN
37     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_SETUP_SYS_VPN] = {
38         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplySetUpSysVpn};
39     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_ADD_SYS_VPN_CONFIG] = {
40         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyAddSysVpnConfig};
41     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_DELETE_SYS_VPN_CONFIG] = {
42         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyDeleteSysVpnConfig};
43     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_GET_SYS_VPN_CONFIG_LIST] = {
44         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyGetSysVpnConfigList};
45     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_GET_SYS_VPN_CONFIG] = {
46         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyGetSysVpnConfig};
47     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_GET_CONNECTED_SYS_VPN_CONFIG] = {
48         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyGetConnectedSysVpnConfig};
49     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_NOTIFY_CONNECT_STAGE] = {
50         "", &NetworkVpnServiceStub::ReplyNotifyConnectStage};
51     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_GET_SYS_VPN_CERT_URI] = {
52         "", &NetworkVpnServiceStub::ReplyGetSysVpnCertUri};
53 #endif // SUPPORT_SYSVPN
54     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_REGISTER_EVENT_CALLBACK] = {
55         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyRegisterVpnEvent};
56     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_UNREGISTER_EVENT_CALLBACK] = {
57         Permission::MANAGE_VPN, &NetworkVpnServiceStub::ReplyUnregisterVpnEvent};
58     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_CREATE_VPN_CONNECTION] = {
59         "", &NetworkVpnServiceStub::ReplyCreateVpnConnection};
60     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_FACTORYRESET_VPN] = {
61         "", &NetworkVpnServiceStub::ReplyFactoryResetVpn};
62     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_CREATE_VPN_CONNECTION_EXT] = {
63         "", &NetworkVpnServiceStub::ReplyCreateVpnConnection};
64     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_START_VPN_EXT] = {
65         "", &NetworkVpnServiceStub::ReplySetUpVpn};
66     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_PROTECT_EXT] = {
67         "", &NetworkVpnServiceStub::ReplyProtect};
68     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_STOP_VPN_EXT] = {
69         "", &NetworkVpnServiceStub::ReplyDestroyVpn};
70     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_REGISTER_BUNDLENAME] = {
71         "", &NetworkVpnServiceStub::ReplyRegisterBundleName};
72     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_GET_SELF_APP_NAME] = {
73         "", &NetworkVpnServiceStub::ReplyGetSelfAppName};
74     permissionAndFuncMap_[INetworkVpnService::MessageCode::CMD_SET_SELF_VPN_PID] = {
75         "", &NetworkVpnServiceStub::ReplySetSelfVpnPid};
76 }
77 
CheckVpnPermission(std::string & strPermission)78 int32_t NetworkVpnServiceStub::CheckVpnPermission(std::string &strPermission)
79 {
80     if (!NetManagerPermission::IsSystemCaller()) {
81         NETMGR_EXT_LOG_E("is not system call");
82         return NETMANAGER_ERR_NOT_SYSTEM_CALL;
83     }
84     if (!strPermission.empty() && !NetManagerPermission::CheckPermission(strPermission)) {
85         NETMGR_EXT_LOG_E("Permission denied permission: %{public}s", strPermission.c_str());
86         return NETMANAGER_ERR_PERMISSION_DENIED;
87     }
88     return NETMANAGER_SUCCESS;
89 }
90 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)91 int32_t NetworkVpnServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
92                                                MessageOption &option)
93 {
94     if (NetworkVpnServiceStub::GetDescriptor() != data.ReadInterfaceToken()) {
95         NETMGR_EXT_LOG_E("descriptor checked failed");
96         return NETMANAGER_EXT_ERR_DESCRIPTOR_MISMATCH;
97     }
98     auto itr = permissionAndFuncMap_.find(static_cast<INetworkVpnService::MessageCode>(code));
99     if (itr != permissionAndFuncMap_.end()) {
100         if (itr->first >= INetworkVpnService::MessageCode::CMD_START_VPN_EXT &&
101                 itr->first <= INetworkVpnService::MessageCode::CMD_GET_SELF_APP_NAME) {
102             NETMGR_EXT_LOG_I("enter OnRemoteRequest code %{public}d:", code);
103             auto serviceFunc = itr->second.serviceFunc;
104             if (serviceFunc != nullptr) {
105                 return (this->*serviceFunc)(data, reply);
106             }
107         } else {
108             NETMGR_EXT_LOG_I("enter OnRemoteRequest code %{public}d:", code);
109             int32_t checkResult = CheckVpnPermission(itr->second.strPermission);
110             if (checkResult != NETMANAGER_SUCCESS) {
111                 return checkResult;
112             }
113             auto serviceFunc = itr->second.serviceFunc;
114             if (serviceFunc != nullptr) {
115                 return (this->*serviceFunc)(data, reply);
116             }
117         }
118     }
119 
120     NETMGR_EXT_LOG_I("stub default case, need check");
121     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
122 }
123 
ReplyPrepare(MessageParcel & data,MessageParcel & reply)124 int32_t NetworkVpnServiceStub::ReplyPrepare(MessageParcel &data, MessageParcel &reply)
125 {
126     bool isExist = false;
127     bool isRun = false;
128     std::string pkg;
129     int32_t ret = Prepare(isExist, isRun, pkg);
130     bool allOK = reply.WriteInt32(ret) && reply.WriteBool(isExist) && reply.WriteBool(isRun) && reply.WriteString(pkg);
131     return allOK ? NETMANAGER_EXT_SUCCESS : NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
132 }
133 
ReplySetUpVpn(MessageParcel & data,MessageParcel & reply)134 int32_t NetworkVpnServiceStub::ReplySetUpVpn(MessageParcel &data, MessageParcel &reply)
135 {
136     sptr<VpnConfig> config = VpnConfig::Unmarshalling(data);
137     if (config == nullptr) {
138         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
139     }
140 
141     int32_t result = SetUpVpn(config);
142     if (!reply.WriteInt32(result)) {
143         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
144     }
145     return NETMANAGER_EXT_SUCCESS;
146 }
147 
ReplyProtect(MessageParcel & data,MessageParcel & reply)148 int32_t NetworkVpnServiceStub::ReplyProtect(MessageParcel &data, MessageParcel &reply)
149 {
150     int32_t result = Protect();
151     if (!reply.WriteInt32(result)) {
152         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
153     }
154     return NETMANAGER_EXT_SUCCESS;
155 }
156 
ReplyDestroyVpn(MessageParcel & data,MessageParcel & reply)157 int32_t NetworkVpnServiceStub::ReplyDestroyVpn(MessageParcel &data, MessageParcel &reply)
158 {
159     int32_t result = DestroyVpn();
160     if (!reply.WriteInt32(result)) {
161         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
162     }
163     return NETMANAGER_EXT_SUCCESS;
164 }
165 
166 #ifdef SUPPORT_SYSVPN
ReplySetUpSysVpn(MessageParcel & data,MessageParcel & reply)167 int32_t NetworkVpnServiceStub::ReplySetUpSysVpn(MessageParcel &data, MessageParcel &reply)
168 {
169     sptr<SysVpnConfig> config = new (std::nothrow) SysVpnConfig();
170     if (config == nullptr) {
171         NETMGR_EXT_LOG_E("ReplySetUpSysVpn failed, config is null");
172         return NETMANAGER_EXT_ERR_INTERNAL;
173     }
174     if (!(data.ReadString(config->vpnId_) && data.ReadInt32(config->vpnType_))) {
175         NETMGR_EXT_LOG_E("ReplySetUpSysVpn read data failed");
176         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
177     }
178     NETMGR_EXT_LOG_I("ReplySetUpSysVpn id=%{public}s", config->vpnId_.c_str());
179     int32_t result = SetUpVpn(config);
180     if (!reply.WriteInt32(result)) {
181         NETMGR_EXT_LOG_E("ReplySetUpSysVpn write reply failed");
182         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
183     }
184     return NETMANAGER_EXT_SUCCESS;
185 }
186 
ReplyAddSysVpnConfig(MessageParcel & data,MessageParcel & reply)187 int32_t NetworkVpnServiceStub::ReplyAddSysVpnConfig(MessageParcel &data, MessageParcel &reply)
188 {
189     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyAddSysVpnConfig");
190     sptr<SysVpnConfig> config = SysVpnConfig::Unmarshalling(data);
191     if (config == nullptr) {
192         NETMGR_EXT_LOG_E("ReplyAddSysVpnConfig read data failed");
193         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
194     }
195     int32_t result = AddSysVpnConfig(config);
196     if (!reply.WriteInt32(result)) {
197         NETMGR_EXT_LOG_E("ReplyAddSysVpnConfig write reply failed");
198         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
199     }
200     return NETMANAGER_EXT_SUCCESS;
201 }
202 
ReplyDeleteSysVpnConfig(MessageParcel & data,MessageParcel & reply)203 int32_t NetworkVpnServiceStub::ReplyDeleteSysVpnConfig(MessageParcel &data, MessageParcel &reply)
204 {
205     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyDeleteSysVpnConfig");
206     std::string vpnId;
207     if (!data.ReadString(vpnId)) {
208         NETMGR_EXT_LOG_E("ReplyDeleteSysVpnConfig read data failed");
209         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
210     }
211     int32_t result = DeleteSysVpnConfig(vpnId);
212     if (!reply.WriteInt32(result)) {
213         NETMGR_EXT_LOG_E("ReplyDeleteSysVpnConfig write reply failed");
214         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
215     }
216     return NETMANAGER_EXT_SUCCESS;
217 }
218 
ReplyGetSysVpnConfigList(MessageParcel & data,MessageParcel & reply)219 int32_t NetworkVpnServiceStub::ReplyGetSysVpnConfigList(MessageParcel &data, MessageParcel &reply)
220 {
221     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyGetSysVpnConfigList");
222     std::vector<SysVpnConfig> vpnList;
223     int32_t result = GetSysVpnConfigList(vpnList);
224     if (result != NETMANAGER_EXT_SUCCESS) {
225         NETMGR_EXT_LOG_E("ReplyGetSysVpnConfigList failed, result=%{public}d", result);
226         return result;
227     }
228     int32_t vpnListSize = static_cast<int32_t>(vpnList.size());
229     if (!reply.WriteInt32(vpnListSize)) {
230         NETMGR_EXT_LOG_E("ReplyGetSysVpnConfigList write reply failed");
231         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
232     }
233     for (auto &config : vpnList) {
234         if (!(reply.WriteString(config.vpnId_) && reply.WriteString(config.vpnName_) &&
235             reply.WriteInt32(config.vpnType_))) {
236             NETMGR_EXT_LOG_E("ReplyGetSysVpnConfigList write reply failed");
237             return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
238         }
239     }
240     return NETMANAGER_EXT_SUCCESS;
241 }
242 
ReplyGetSysVpnConfig(MessageParcel & data,MessageParcel & reply)243 int32_t NetworkVpnServiceStub::ReplyGetSysVpnConfig(MessageParcel &data, MessageParcel &reply)
244 {
245     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyGetSysVpnConfig");
246     std::string vpnId;
247     if (!data.ReadString(vpnId)) {
248         NETMGR_EXT_LOG_E("ReplyGetSysVpnConfig read data failed");
249         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
250     }
251     sptr<SysVpnConfig> config = nullptr;
252     int32_t result = GetSysVpnConfig(config, vpnId);
253     if (result != NETMANAGER_EXT_SUCCESS) {
254         NETMGR_EXT_LOG_E("ReplyGetSysVpnConfig failed, result=%{public}d", result);
255         return result;
256     }
257     if (config != nullptr && !config->Marshalling(reply)) {
258         NETMGR_EXT_LOG_E("ReplyGetSysVpnConfig write reply failed");
259         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
260     }
261     return NETMANAGER_EXT_SUCCESS;
262 }
263 
ReplyGetConnectedSysVpnConfig(MessageParcel & data,MessageParcel & reply)264 int32_t NetworkVpnServiceStub::ReplyGetConnectedSysVpnConfig(MessageParcel &data, MessageParcel &reply)
265 {
266     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyGetConnectedSysVpnConfig");
267     sptr<SysVpnConfig> config = nullptr;
268     int32_t result = GetConnectedSysVpnConfig(config);
269     if (result != NETMANAGER_EXT_SUCCESS) {
270         NETMGR_EXT_LOG_E("ReplyGetConnectedSysVpnConfig failed, result=%{public}d", result);
271         return result;
272     }
273     if (config != nullptr && !config->Marshalling(reply)) {
274         NETMGR_EXT_LOG_E("ReplyGetConnectedSysVpnConfig write reply failed");
275         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
276     }
277     return NETMANAGER_EXT_SUCCESS;
278 }
279 
ReplyNotifyConnectStage(MessageParcel & data,MessageParcel & reply)280 int32_t NetworkVpnServiceStub::ReplyNotifyConnectStage(MessageParcel &data, MessageParcel &reply)
281 {
282     NETMGR_EXT_LOG_I("NetworkVpnServiceStub ReplyNotifyConnectStage");
283     std::string stage;
284     if (!data.ReadString(stage)) {
285         NETMGR_EXT_LOG_E("ReplyNotifyConnectStage read data failed");
286         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
287     }
288     int32_t result;
289     if (!data.ReadInt32(result)) {
290         NETMGR_EXT_LOG_E("ReplyNotifyConnectStage read data failed");
291         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
292     }
293     int32_t ret = NotifyConnectStage(stage, result);
294     if (!reply.WriteInt32(ret)) {
295         NETMGR_EXT_LOG_E("ReplyNotifyConnectStage write reply failed");
296         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
297     }
298     return NETMANAGER_EXT_SUCCESS;
299 }
300 
ReplyGetSysVpnCertUri(MessageParcel & data,MessageParcel & reply)301 int32_t NetworkVpnServiceStub::ReplyGetSysVpnCertUri(MessageParcel &data, MessageParcel &reply)
302 {
303     int32_t certType;
304     if (!data.ReadInt32(certType)) {
305         NETMGR_EXT_LOG_E("ReplyGetSysVpnCertUri read data failed");
306         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
307     }
308     std::string certUri;
309     int32_t ret = GetSysVpnCertUri(certType, certUri);
310     if (ret != NETMANAGER_EXT_SUCCESS) {
311         NETMGR_EXT_LOG_E("ReplyGetSysVpnCertUri failed, ret=%{public}d", ret);
312         return ret;
313     }
314     if (!reply.WriteString(certUri)) {
315         NETMGR_EXT_LOG_E("ReplyGetSysVpnCertUri write reply failed");
316         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
317     }
318     return NETMANAGER_EXT_SUCCESS;
319 }
320 #endif // SUPPORT_SYSVPN
321 
ReplyRegisterVpnEvent(MessageParcel & data,MessageParcel & reply)322 int32_t NetworkVpnServiceStub::ReplyRegisterVpnEvent(MessageParcel &data, MessageParcel &reply)
323 {
324     sptr<IVpnEventCallback> callback = iface_cast<IVpnEventCallback>(data.ReadRemoteObject());
325     if (callback == nullptr) {
326         NETMGR_EXT_LOG_E("ReplyRegisterVpnEvent callback is null.");
327         return NETMANAGER_EXT_ERR_LOCAL_PTR_NULL;
328     }
329 
330     int32_t result = RegisterVpnEvent(callback);
331     if (!reply.WriteInt32(result)) {
332         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
333     }
334     return NETMANAGER_EXT_SUCCESS;
335 }
336 
ReplyUnregisterVpnEvent(MessageParcel & data,MessageParcel & reply)337 int32_t NetworkVpnServiceStub::ReplyUnregisterVpnEvent(MessageParcel &data, MessageParcel &reply)
338 {
339     sptr<IVpnEventCallback> callback = iface_cast<IVpnEventCallback>(data.ReadRemoteObject());
340     if (callback == nullptr) {
341         NETMGR_EXT_LOG_E("ReplyUnregisterVpnEvent callback is null.");
342         return NETMANAGER_EXT_ERR_LOCAL_PTR_NULL;
343     }
344 
345     int32_t result = UnregisterVpnEvent(callback);
346     if (!reply.WriteInt32(result)) {
347         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
348     }
349     return NETMANAGER_EXT_SUCCESS;
350 }
351 
ReplyCreateVpnConnection(MessageParcel & data,MessageParcel & reply)352 int32_t NetworkVpnServiceStub::ReplyCreateVpnConnection(MessageParcel &data, MessageParcel &reply)
353 {
354     int32_t result = CreateVpnConnection();
355     if (!reply.WriteInt32(result)) {
356         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
357     }
358     return NETMANAGER_EXT_SUCCESS;
359 }
360 
ReplyFactoryResetVpn(MessageParcel & data,MessageParcel & reply)361 int32_t NetworkVpnServiceStub::ReplyFactoryResetVpn(MessageParcel &data, MessageParcel &reply)
362 {
363     return NETMANAGER_EXT_SUCCESS;
364 }
365 
ReplyRegisterBundleName(MessageParcel & data,MessageParcel & reply)366 int32_t NetworkVpnServiceStub::ReplyRegisterBundleName(MessageParcel &data, MessageParcel &reply)
367 {
368     std::string bundleName;
369     if (!data.ReadString(bundleName)) {
370         NETMGR_EXT_LOG_E("ReplyRegisterBundleName read data failed");
371         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
372     }
373     std::string abilityName;
374     if (!data.ReadString(abilityName)) {
375         NETMGR_EXT_LOG_E("ReplyRegisterBundleName read data failed");
376         return NETMANAGER_EXT_ERR_READ_DATA_FAIL;
377     }
378 
379     int32_t result = RegisterBundleName(bundleName, abilityName);
380     if (!reply.WriteInt32(result)) {
381         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
382     }
383     return NETMANAGER_EXT_SUCCESS;
384 }
385 
ReplyGetSelfAppName(MessageParcel & data,MessageParcel & reply)386 int32_t NetworkVpnServiceStub::ReplyGetSelfAppName(MessageParcel &data, MessageParcel &reply)
387 {
388     std::string selfAppName;
389     std::string selfBundleName;
390     int32_t result = GetSelfAppName(selfAppName, selfBundleName);
391     if (result != ERR_NONE) {
392         NETMGR_EXT_LOG_E("GetSelfAppName failed on service");
393         return result;
394     }
395     if (!reply.WriteString(selfAppName)) {
396         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
397     }
398     if (!reply.WriteString(selfBundleName)) {
399         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
400     }
401     return NETMANAGER_EXT_SUCCESS;
402 }
403 
ReplySetSelfVpnPid(MessageParcel & data,MessageParcel & reply)404 int32_t NetworkVpnServiceStub::ReplySetSelfVpnPid(MessageParcel &data, MessageParcel &reply)
405 {
406     int32_t result = SetSelfVpnPid();
407     if (!reply.WriteInt32(result)) {
408         return NETMANAGER_EXT_ERR_WRITE_REPLY_FAIL;
409     }
410     return NETMANAGER_EXT_SUCCESS;
411 }
412 } // namespace NetManagerStandard
413 } // namespace OHOS
414