• 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/**
17 * @file
18 * @kit NetworkKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22import type connection from './@ohos.net.connection';
23import type _AbilityContext from './application/UIAbilityContext';
24
25/**
26 * Provides VPN related interfaces.
27 * @namespace vpn
28 * @syscap SystemCapability.Communication.NetManager.Vpn
29 * @since 10
30 */
31declare namespace vpn {
32  /**
33   * Get network link information.
34   * @typedef { connection.LinkAddress }
35   * @syscap SystemCapability.Communication.NetManager.Core
36   * @since 10
37   */
38  export type LinkAddress = connection.LinkAddress;
39
40  /**
41   * Get network route information.
42   * @typedef { connection.RouteInfo }
43   * @syscap SystemCapability.Communication.NetManager.Core
44   * @since 10
45   */
46  export type RouteInfo = connection.RouteInfo;
47
48  /**
49   * The context of an ability. It allows access to ability-specific resources.
50   * @typedef _AbilityContext
51   * @syscap SystemCapability.Ability.AbilityRuntime.Core
52   * @since 10
53   */
54  export type AbilityContext = _AbilityContext;
55
56  /**
57   * Create a VPN connection using the AbilityContext.
58   * @param { AbilityContext } context - Indicates the context of application or capability.
59   * @returns { VpnConnection } the VpnConnection of the construct VpnConnection instance.
60   * @throws { BusinessError } 202 - Non-system applications use system APIs.
61   * @throws { BusinessError } 401 - Parameter error.
62   * @syscap SystemCapability.Communication.NetManager.Vpn
63   * @systemapi Hide this for inner system use.
64   * @since 10
65   */
66  function createVpnConnection(context: AbilityContext): VpnConnection;
67
68  /**
69   * Subscribes to vpn connect state changes.
70   * @permission ohos.permission.MANAGE_VPN
71   * @param { 'connect' } type - Indicates vpn connect state changes.
72   * @param { Callback<VpnConnectState> } callback - The callback of the vpn connect state.
73   * @throws { BusinessError } 201 - Permission denied.
74   * @throws { BusinessError } 202 - Non-system applications use system APIs.
75   * @throws { BusinessError } 401 - Parameter error.
76   * @throws { BusinessError } 2200001 - Invalid parameter value.
77   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
78   * @throws { BusinessError } 2200003 - System internal error.
79   * @syscap SystemCapability.Communication.NetManager.Vpn
80   * @systemapi Hide this for inner system use.
81   * @since 12
82   */
83  function on(type: 'connect', callback: Callback<VpnConnectState>): void;
84
85  /**
86   * Subscribes to vpn connect state changes.
87   * @permission ohos.permission.MANAGE_VPN
88   * @param { 'connectMulti' } type - Indicates multi vpn connect state changes.
89   * @param { Callback<MultiVpnConnectState> } callback - The callback of the multi vpn connect state.
90   * @throws { BusinessError } 201 - Permission denied.
91   * @throws { BusinessError } 202 - Non-system applications use system APIs.
92   * @throws { BusinessError } 19900001 - Invalid parameter value.
93   * @throws { BusinessError } 19900002 - System internal error.
94   * @syscap SystemCapability.Communication.NetManager.Vpn
95   * @systemapi Hide this for inner system use.
96   * @since 20
97   */
98  function on(type: 'connectMulti', callback: Callback<MultiVpnConnectState>): void;
99
100  /**
101   * Unsubscribes from vpn connect state changes.
102   * @permission ohos.permission.MANAGE_VPN
103   * @param { 'connect' } type - Indicates vpn connect state changes.
104   * @param { Callback<VpnConnectState> } callback - The callback of the vpn connect state.
105   * @throws { BusinessError } 201 - Permission denied.
106   * @throws { BusinessError } 202 - Non-system applications use system APIs.
107   * @throws { BusinessError } 401 - Parameter error.
108   * @throws { BusinessError } 2200001 - Invalid parameter value.
109   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
110   * @throws { BusinessError } 2200003 - System internal error.
111   * @syscap SystemCapability.Communication.NetManager.Vpn
112   * @systemapi Hide this for inner system use.
113   * @since 12
114   */
115  function off(type: 'connect', callback?: Callback<VpnConnectState>): void;
116
117  /**
118   * Unsubscribes from vpn connect state changes.
119   * @permission ohos.permission.MANAGE_VPN
120   * @param { 'connectMulti' } type - Indicates multi vpn connect state changes.
121   * @param { Callback<MultiVpnConnectState> } [callback] - The callback of the multi vpn connect state.
122   * @throws { BusinessError } 201 - Permission denied.
123   * @throws { BusinessError } 202 - Non-system applications use system APIs.
124   * @throws { BusinessError } 19900001 - Invalid parameter value.
125   * @throws { BusinessError } 19900002 - System internal error.
126   * @syscap SystemCapability.Communication.NetManager.Vpn
127   * @systemapi Hide this for inner system use.
128   * @since 20
129   */
130  function off(type: 'connectMulti', callback?: Callback<MultiVpnConnectState>): void;
131
132  /**
133   * Add a system VPN network configuration.
134   * @permission ohos.permission.MANAGE_VPN
135   * @param { SysVpnConfig } config - Indicates the {@link SysVpnConfig} configuration of the VPN network.
136   * @returns { Promise<void> } The promise returned by the function.
137   * @throws { BusinessError } 201 - Permission denied.
138   * @throws { BusinessError } 202 - Non-system applications use system APIs.
139   * @throws { BusinessError } 401 - Parameter error.
140   * @throws { BusinessError } 2200001 - Invalid parameter value.
141   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
142   * @throws { BusinessError } 2200003 - System internal error.
143   * @syscap SystemCapability.Communication.NetManager.Vpn
144   * @systemapi Hide this for inner system use.
145   * @since 12
146   */
147  function addSysVpnConfig(config: SysVpnConfig): Promise<void>;
148
149  /**
150   * Delete the configuration of system VPN network by the specified vpnId.
151   * @permission ohos.permission.MANAGE_VPN
152   * @param { string } vpnId - Indicates the uuid of the VPN network configuration.
153   * @returns { Promise<void> } The promise returned by the function.
154   * @throws { BusinessError } 201 - Permission denied.
155   * @throws { BusinessError } 202 - Non-system applications use system APIs.
156   * @throws { BusinessError } 401 - Parameter error.
157   * @throws { BusinessError } 2200001 - Invalid parameter value.
158   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
159   * @throws { BusinessError } 2200003 - System internal error.
160   * @syscap SystemCapability.Communication.NetManager.Vpn
161   * @systemapi Hide this for inner system use.
162   * @since 12
163   */
164  function deleteSysVpnConfig(vpnId: string): Promise<void>;
165
166  /**
167   * Get all system VPN network configuration.
168   * @permission ohos.permission.MANAGE_VPN
169   * @returns { Promise<Array<SysVpnConfig>> } The promise returned by the all VPN network configuration.
170   * @throws { BusinessError } 201 - Permission denied.
171   * @throws { BusinessError } 202 - Non-system applications use system APIs.
172   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
173   * @throws { BusinessError } 2200003 - System internal error.
174   * @syscap SystemCapability.Communication.NetManager.Vpn
175   * @systemapi Hide this for inner system use.
176   * @since 12
177   */
178  function getSysVpnConfigList(): Promise<Array<SysVpnConfig>>;
179
180  /**
181   * Get the configuration of system VPN network by the specified vpnId.
182   * @permission ohos.permission.MANAGE_VPN
183   * @param { string } vpnId - Indicates the uuid of the VPN network.
184   * @returns { Promise<SysVpnConfig> } The promise returned by the VPN network configuration.
185   * @throws { BusinessError } 201 - Permission denied.
186   * @throws { BusinessError } 202 - Non-system applications use system APIs.
187   * @throws { BusinessError } 401 - Parameter error.
188   * @throws { BusinessError } 2200001 - Invalid parameter value.
189   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
190   * @throws { BusinessError } 2200003 - System internal error.
191   * @syscap SystemCapability.Communication.NetManager.Vpn
192   * @systemapi Hide this for inner system use.
193   * @since 12
194   */
195  function getSysVpnConfig(vpnId: string): Promise<SysVpnConfig>;
196
197  /**
198   * Get the connected VPN network configuration.
199   * @permission ohos.permission.MANAGE_VPN
200   * @returns { Promise<SysVpnConfig> } The promise returned by the connected VPN network configuration.
201   * @throws { BusinessError } 201 - Permission denied.
202   * @throws { BusinessError } 202 - Non-system applications use system APIs.
203   * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
204   * @throws { BusinessError } 2200003 - System internal error.
205   * @syscap SystemCapability.Communication.NetManager.Vpn
206   * @systemapi Hide this for inner system use.
207   * @since 12
208   */
209  function getConnectedSysVpnConfig(): Promise<SysVpnConfig>;
210
211  /**
212   * Get the connected VPN App Info.
213   * @permission ohos.permission.MANAGE_VPN
214   * @returns { Promise<Array<string>> } The promise returned by the connected VPN App Info.
215   * @throws { BusinessError } 201 - Permission denied.
216   * @throws { BusinessError } 202 - Non-system applications use system APIs.
217   * @throws { BusinessError } 19900001 - Invalid parameter value.
218   * @throws { BusinessError } 19900002 - System internal error.
219   * @syscap SystemCapability.Communication.NetManager.Vpn
220   * @systemapi Hide this for inner system use.
221   * @since 20
222   */
223  function getConnectedVpnAppInfo(): Promise<Array<string>>;
224
225  /**
226   * Defines a VPN connection.
227   * @interface VpnConnection
228   * @syscap SystemCapability.Communication.NetManager.Vpn
229   * @systemapi Hide this for inner system use.
230   * @since 10
231   */
232  export interface VpnConnection {
233    /**
234     * Create a VPN network using the VpnConfig.
235     * @permission ohos.permission.MANAGE_VPN
236     * @param { VpnConfig } config - Indicates the {@link VpnConfig} configuration of the VPN network.
237     * @param { AsyncCallback<number> } callback - The callback is used to return file descriptor of VPN interface.
238     * @throws { BusinessError } 201 - Permission denied.
239     * @throws { BusinessError } 202 - Non-system applications use system APIs.
240     * @throws { BusinessError } 401 - Parameter error.
241     * @throws { BusinessError } 2200001 - Invalid parameter value.
242     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
243     * @throws { BusinessError } 2200003 - System internal error.
244     * @throws { BusinessError } 2203001 - VPN creation denied. Check the user type.
245     * @throws { BusinessError } 2203002 - VPN already exists.
246     * @syscap SystemCapability.Communication.NetManager.Vpn
247     * @systemapi Hide this for inner system use.
248     * @since 10
249     */
250    setUp(config: VpnConfig, callback: AsyncCallback<number>): void;
251
252    /**
253     * Create a VPN network using the VpnConfig.
254     * @permission ohos.permission.MANAGE_VPN
255     * @param { VpnConfig } config - Indicates the {@link VpnConfig} configuration of the VPN network.
256     * @returns { Promise<number> } The promise returns file descriptor of VPN interface.
257     * @throws { BusinessError } 201 - Permission denied.
258     * @throws { BusinessError } 202 - Non-system applications use system APIs.
259     * @throws { BusinessError } 401 - Parameter error.
260     * @throws { BusinessError } 2200001 - Invalid parameter value.
261     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
262     * @throws { BusinessError } 2200003 - System internal error.
263     * @throws { BusinessError } 2203001 - VPN creation denied. Check the user type.
264     * @throws { BusinessError } 2203002 - VPN already exists.
265     * @syscap SystemCapability.Communication.NetManager.Vpn
266     * @systemapi Hide this for inner system use.
267     * @since 10
268     */
269    setUp(config: VpnConfig): Promise<number>;
270
271    /**
272     * Protect a socket from VPN connections. After protecting, data sent through this socket will go directly to the
273     * underlying network so its traffic will not be forwarded through the VPN.
274     * @permission ohos.permission.MANAGE_VPN
275     * @param { number } socketFd - File descriptor of socket, this socket from @ohos.net.socket.
276     * @param { AsyncCallback<void> } callback - The callback of protect.
277     * @throws { BusinessError } 201 - Permission denied.
278     * @throws { BusinessError } 202 - Non-system applications use system APIs.
279     * @throws { BusinessError } 401 - Parameter error.
280     * @throws { BusinessError } 2200001 - Invalid parameter value.
281     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
282     * @throws { BusinessError } 2200003 - System internal error.
283     * @throws { BusinessError } 2203004 - Invalid socket file descriptor.
284     * @syscap SystemCapability.Communication.NetManager.Vpn
285     * @systemapi Hide this for inner system use.
286     * @since 10
287     */
288    protect(socketFd: number, callback: AsyncCallback<void>): void;
289
290    /**
291     * Protect a socket from VPN connections. After protecting, data sent through this socket will go directly to the
292     * underlying network so its traffic will not be forwarded through the VPN.
293     * @permission ohos.permission.MANAGE_VPN
294     * @param { number } socketFd - File descriptor of socket, this socket from @ohos.net.socket.
295     * @returns { Promise<void> } The promise returned by the function.
296     * @throws { BusinessError } 201 - Permission denied.
297     * @throws { BusinessError } 202 - Non-system applications use system APIs.
298     * @throws { BusinessError } 401 - Parameter error.
299     * @throws { BusinessError } 2200001 - Invalid parameter value.
300     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
301     * @throws { BusinessError } 2200003 - System internal error.
302     * @throws { BusinessError } 2203004 - Invalid socket file descriptor.
303     * @syscap SystemCapability.Communication.NetManager.Vpn
304     * @systemapi Hide this for inner system use.
305     * @since 10
306     */
307    protect(socketFd: number): Promise<void>;
308
309    /**
310     * Destroy the VPN network.
311     * @permission ohos.permission.MANAGE_VPN
312     * @param { AsyncCallback<void> } callback - The callback of destroy.
313     * @throws { BusinessError } 201 - Permission denied.
314     * @throws { BusinessError } 202 - Non-system applications use system APIs.
315     * @throws { BusinessError } 401 - Parameter error.
316     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
317     * @throws { BusinessError } 2200003 - System internal error.
318     * @syscap SystemCapability.Communication.NetManager.Vpn
319     * @systemapi Hide this for inner system use.
320     * @since 10
321     */
322    destroy(callback: AsyncCallback<void>): void;
323
324    /**
325     * Destroy the VPN network.
326     * @permission ohos.permission.MANAGE_VPN
327     * @returns { Promise<void> } The promise returned by the function.
328     * @throws { BusinessError } 201 - Permission denied.
329     * @throws { BusinessError } 202 - Non-system applications use system APIs.
330     * @throws { BusinessError } 401 - Parameter error.
331     * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service.
332     * @throws { BusinessError } 2200003 - System internal error.
333     * @syscap SystemCapability.Communication.NetManager.Vpn
334     * @systemapi Hide this for inner system use.
335     * @since 10
336     */
337    destroy(): Promise<void>;
338  }
339
340  /**
341   * Define configuration of the VPN network.
342   * @typedef VpnConfig
343   * @syscap SystemCapability.Communication.NetManager.Vpn
344   * @systemapi Hide this for inner system use.
345   * @since 10
346   */
347  export interface VpnConfig {
348    /**
349     * The uuid for the VPN network.
350     * @type {?string}
351     * @syscap SystemCapability.Communication.NetManager.Vpn
352     * @systemapi Hide this for inner system use.
353     * @since 20
354     */
355    vpnId?: string;
356
357    /**
358     * The array of addresses for VPN interface.
359     * @type {Array<LinkAddress>}
360     * @syscap SystemCapability.Communication.NetManager.Vpn
361     * @systemapi Hide this for inner system use.
362     * @since 10
363     */
364    addresses: Array<LinkAddress>;
365
366    /**
367     * The array of routes for VPN interface.
368     * @type {?Array<RouteInfo>}
369     * @syscap SystemCapability.Communication.NetManager.Vpn
370     * @systemapi Hide this for inner system use.
371     * @since 10
372     */
373    routes?: Array<RouteInfo>;
374
375    /**
376     * The array of DNS servers for the VPN network.
377     * @type {?Array<string>}
378     * @syscap SystemCapability.Communication.NetManager.Vpn
379     * @systemapi Hide this for inner system use.
380     * @since 10
381     */
382    dnsAddresses?: Array<string>;
383
384    /**
385     * The array of search domains for the DNS resolver.
386     * @type {?Array<string>}
387     * @syscap SystemCapability.Communication.NetManager.Vpn
388     * @systemapi Hide this for inner system use.
389     * @since 10
390     */
391    searchDomains?: Array<string>;
392
393    /**
394     * The maximum transmission unit (MTU) for the VPN interface.
395     * @type {?number}
396     * @syscap SystemCapability.Communication.NetManager.Vpn
397     * @systemapi Hide this for inner system use.
398     * @since 10
399     */
400    mtu?: number;
401
402    /**
403     * Whether ipv4 is supported. The default value is true.
404     * @type {?boolean}
405     * @syscap SystemCapability.Communication.NetManager.Vpn
406     * @systemapi Hide this for inner system use.
407     * @since 10
408     */
409    isIPv4Accepted?: boolean;
410
411    /**
412     * Whether ipv6 is supported. The default value is false.
413     * @type {?boolean}
414     * @syscap SystemCapability.Communication.NetManager.Vpn
415     * @systemapi Hide this for inner system use.
416     * @since 10
417     */
418    isIPv6Accepted?: boolean;
419
420    /**
421     * Whether to use the built-in VPN. The default value is false.
422     * @type {?boolean}
423     * @syscap SystemCapability.Communication.NetManager.Vpn
424     * @systemapi Hide this for inner system use.
425     * @since 10
426     */
427    isLegacy?: boolean;
428
429    /**
430     * Whether the VPN interface's file descriptor is in blocking/non-blocking mode. The default value is false.
431     * @type {?boolean}
432     * @syscap SystemCapability.Communication.NetManager.Vpn
433     * @systemapi Hide this for inner system use.
434     * @since 10
435     */
436    isBlocking?: boolean;
437
438    /**
439     * The array of trustlist for the VPN network. The string indicates package name.
440     * @type {?Array<string>}
441     * @syscap SystemCapability.Communication.NetManager.Vpn
442     * @systemapi Hide this for inner system use.
443     * @since 10
444     */
445    trustedApplications?: Array<string>;
446
447    /**
448     * The array of blocklist for the VPN network. The string indicates package name.
449     * @type {?Array<string>}
450     * @syscap SystemCapability.Communication.NetManager.Vpn
451     * @systemapi Hide this for inner system use.
452     * @since 10
453     */
454    blockedApplications?: Array<string>;
455  }
456
457  /**
458   * Define configuration of the system VPN network.
459   * @typedef SysVpnConfig
460   * @extends VpnConfig
461   * @syscap SystemCapability.Communication.NetManager.Vpn
462   * @systemapi Hide this for inner system use.
463   * @since 12
464   */
465  export interface SysVpnConfig extends VpnConfig {
466    /**
467     * The uuid for the VPN network.
468     * @type {?string}
469     * @syscap SystemCapability.Communication.NetManager.Vpn
470     * @systemapi Hide this for inner system use.
471     * @since 12
472     */
473    vpnId?: string;
474
475    /**
476     * The name for the VPN network.
477     * @type {?string}
478     * @syscap SystemCapability.Communication.NetManager.Vpn
479     * @systemapi Hide this for inner system use.
480     * @since 12
481     */
482    vpnName?: string;
483
484    /**
485     * The type for the VPN network.
486     * @type {?SysVpnType}
487     * See {@link SysVpnType}
488     * @syscap SystemCapability.Communication.NetManager.Vpn
489     * @systemapi Hide this for inner system use.
490     * @since 12
491     */
492    vpnType?: SysVpnType;
493
494    /**
495     * The user name for the VPN network.
496     * @type {?string}
497     * @syscap SystemCapability.Communication.NetManager.Vpn
498     * @systemapi Hide this for inner system use.
499     * @since 12
500     */
501    userName?: string;
502
503    /**
504     * The user password for the VPN network.
505     * @type {?string}
506     * @syscap SystemCapability.Communication.NetManager.Vpn
507     * @systemapi Hide this for inner system use.
508     * @since 12
509     */
510    password?: string;
511
512    /**
513     * Whether the VPN network save login name and password. The default value is false.
514     * @type {?boolean}
515     * @syscap SystemCapability.Communication.NetManager.Vpn
516     * @systemapi Hide this for inner system use.
517     * @since 12
518     */
519    saveLogin?: boolean;
520
521    /**
522     * The system user id for the VPN network.
523     * @type {?number}
524     * @syscap SystemCapability.Communication.NetManager.Vpn
525     * @systemapi Hide this for inner system use.
526     * @since 12
527     */
528    userId?: number;
529
530    /**
531     * The forwarding routes for the VPN network.
532     * @type {?string}
533     * @syscap SystemCapability.Communication.NetManager.Vpn
534     * @systemapi Hide this for inner system use.
535     * @since 12
536     */
537    forwardingRoutes?: string;
538
539    /**
540     * The array of addresses for remote server.
541     * @type {?Array<string>}
542     * @syscap SystemCapability.Communication.NetManager.Vpn
543     * @systemapi Hide this for inner system use.
544     * @since 20
545     */
546    remoteAddresses?: Array<string>;
547
548    /**
549     * The p12 cert password for the ipsec VPN network.
550     * @type {?string}
551     * @syscap SystemCapability.Communication.NetManager.Vpn
552     * @systemapi Hide this for inner system use.
553     * @since 20
554     */
555    pkcs12Password?: string;
556
557    /**
558     * The p12 cert data for the ipsec VPN network.
559     * @type {?Uint8Array}
560     * @syscap SystemCapability.Communication.NetManager.Vpn
561     * @systemapi Hide this for inner system use.
562     * @since 20
563     */
564    pkcs12FileData?: Uint8Array;
565  }
566
567  /**
568   * Define configuration of the open VPN network.
569   * @typedef OpenVpnConfig
570   * @extends SysVpnConfig
571   * @syscap SystemCapability.Communication.NetManager.Vpn
572   * @systemapi Hide this for inner system use.
573   * @since 12
574   */
575  export interface OpenVpnConfig extends SysVpnConfig {
576    /**
577     * The port for the openvpn VPN network.
578     * @type {?string}
579     * @syscap SystemCapability.Communication.NetManager.Vpn
580     * @systemapi Hide this for inner system use.
581     * @since 12
582     */
583    ovpnPort?: string;
584
585    /**
586     * The protocol for the openvpn VPN network.
587     * @type {?number}
588     * @syscap SystemCapability.Communication.NetManager.Vpn
589     * @systemapi Hide this for inner system use.
590     * @since 12
591     */
592    ovpnProtocol?: number;
593
594    /**
595     * The config for the openvpn VPN network.
596     * @type {?string}
597     * @syscap SystemCapability.Communication.NetManager.Vpn
598     * @systemapi Hide this for inner system use.
599     * @since 12
600     */
601    ovpnConfig?: string;
602
603    /**
604     * The auth type for the openvpn VPN network.
605     * @type {?number}
606     * @syscap SystemCapability.Communication.NetManager.Vpn
607     * @systemapi Hide this for inner system use.
608     * @since 12
609     */
610    ovpnAuthType?: number;
611
612    /**
613     * The ask pass for the openvpn VPN network.
614     * @type {?string}
615     * @syscap SystemCapability.Communication.NetManager.Vpn
616     * @systemapi Hide this for inner system use.
617     * @since 12
618     */
619    askpass?: string;
620
621    /**
622     * The config file path for the openvpn VPN network.
623     * @type {?string}
624     * @syscap SystemCapability.Communication.NetManager.Vpn
625     * @systemapi Hide this for inner system use.
626     * @since 12
627     */
628    ovpnConfigFilePath?: string;
629
630    /**
631     * The ca cert file path for the openvpn VPN network.
632     * @type {?string}
633     * @syscap SystemCapability.Communication.NetManager.Vpn
634     * @systemapi Hide this for inner system use.
635     * @since 12
636     */
637    ovpnCaCertFilePath?: string;
638
639    /**
640     * The user cert file path for the openvpn VPN network.
641     * @type {?string}
642     * @syscap SystemCapability.Communication.NetManager.Vpn
643     * @systemapi Hide this for inner system use.
644     * @since 12
645     */
646    ovpnUserCertFilePath?: string;
647
648    /**
649     * The private key file path for the openvpn VPN network.
650     * @type {?string}
651     * @syscap SystemCapability.Communication.NetManager.Vpn
652     * @systemapi Hide this for inner system use.
653     * @since 12
654     */
655    ovpnPrivateKeyFilePath?: string;
656  }
657
658  /**
659   * Define configuration of the ipsec VPN network.
660   * @typedef IpsecVpnConfig
661   * @extends SysVpnConfig
662   * @syscap SystemCapability.Communication.NetManager.Vpn
663   * @systemapi Hide this for inner system use.
664   * @since 12
665   */
666  export interface IpsecVpnConfig extends SysVpnConfig {
667    /**
668     * The pre share key for the ipsec VPN network.
669     * @type {?string}
670     * @syscap SystemCapability.Communication.NetManager.Vpn
671     * @systemapi Hide this for inner system use.
672     * @since 12
673     */
674    ipsecPreSharedKey?: string;
675
676    /**
677     * The identifier for the ipsec VPN network.
678     * @type {?string}
679     * @syscap SystemCapability.Communication.NetManager.Vpn
680     * @systemapi Hide this for inner system use.
681     * @since 12
682     */
683    ipsecIdentifier?: string;
684
685    /**
686     * The swanctl config for the ipsec VPN network.
687     * @type {?string}
688     * @syscap SystemCapability.Communication.NetManager.Vpn
689     * @systemapi Hide this for inner system use.
690     * @since 12
691     */
692    swanctlConfig?: string;
693
694    /**
695     * The strongSwan config for the ipsec VPN network.
696     * @type {?string}
697     * @syscap SystemCapability.Communication.NetManager.Vpn
698     * @systemapi Hide this for inner system use.
699     * @since 12
700     */
701    strongSwanConfig?: string;
702
703    /**
704     * The ca cert config for the ipsec VPN network.
705     * @type {?string}
706     * @syscap SystemCapability.Communication.NetManager.Vpn
707     * @systemapi Hide this for inner system use.
708     * @since 12
709     */
710    ipsecCaCertConfig?: string;
711
712    /**
713     * The private user cert config for the ipsec VPN network.
714     * @type {?string}
715     * @syscap SystemCapability.Communication.NetManager.Vpn
716     * @systemapi Hide this for inner system use.
717     * @since 12
718     */
719    ipsecPrivateUserCertConfig?: string;
720
721    /**
722     * The public user cert config for the ipsec VPN network.
723     * @type {?string}
724     * @syscap SystemCapability.Communication.NetManager.Vpn
725     * @systemapi Hide this for inner system use.
726     * @since 12
727     */
728    ipsecPublicUserCertConfig?: string;
729
730    /**
731     * The private server cert config for the ipsec VPN network.
732     * @type {?string}
733     * @syscap SystemCapability.Communication.NetManager.Vpn
734     * @systemapi Hide this for inner system use.
735     * @since 12
736     */
737    ipsecPrivateServerCertConfig?: string;
738
739    /**
740     * The public server cert config for the ipsec VPN network.
741     * @type {?string}
742     * @syscap SystemCapability.Communication.NetManager.Vpn
743     * @systemapi Hide this for inner system use.
744     * @since 12
745     */
746    ipsecPublicServerCertConfig?: string;
747
748    /**
749     * The ca cert file path for the ipsec VPN network.
750     * @type {?string}
751     * @syscap SystemCapability.Communication.NetManager.Vpn
752     * @systemapi Hide this for inner system use.
753     * @since 12
754     */
755    ipsecCaCertFilePath?: string;
756
757    /**
758     * The private user cert file path for the ipsec VPN network.
759     * @type {?string}
760     * @syscap SystemCapability.Communication.NetManager.Vpn
761     * @systemapi Hide this for inner system use.
762     * @since 12
763     */
764    ipsecPrivateUserCertFilePath?: string;
765
766    /**
767     * The public user cert file path for the ipsec VPN network.
768     * @type {?string}
769     * @syscap SystemCapability.Communication.NetManager.Vpn
770     * @systemapi Hide this for inner system use.
771     * @since 12
772     */
773    ipsecPublicUserCertFilePath?: string;
774
775    /**
776     * The private server cert file path for the ipsec VPN network.
777     * @type {?string}
778     * @syscap SystemCapability.Communication.NetManager.Vpn
779     * @systemapi Hide this for inner system use.
780     * @since 12
781     */
782    ipsecPrivateServerCertFilePath?: string;
783
784    /**
785     * The public server cert file path for the ipsec VPN network.
786     * @type {?string}
787     * @syscap SystemCapability.Communication.NetManager.Vpn
788     * @systemapi Hide this for inner system use.
789     * @since 12
790     */
791    ipsecPublicServerCertFilePath?: string;
792  }
793
794  /**
795   * Define configuration of the l2tp VPN network.
796   * @typedef L2tpVpnConfig
797   * @extends SysVpnConfig
798   * @syscap SystemCapability.Communication.NetManager.Vpn
799   * @systemapi Hide this for inner system use.
800   * @since 12
801   */
802  export interface L2tpVpnConfig extends SysVpnConfig {
803    /**
804     * The pre share key for the l2tp VPN network.
805     * @type {?string}
806     * @syscap SystemCapability.Communication.NetManager.Vpn
807     * @systemapi Hide this for inner system use.
808     * @since 12
809     */
810    ipsecPreSharedKey?: string;
811
812    /**
813     * The identifier for the l2tp VPN network.
814     * @type {?string}
815     * @syscap SystemCapability.Communication.NetManager.Vpn
816     * @systemapi Hide this for inner system use.
817     * @since 12
818     */
819    ipsecIdentifier?: string;
820
821    /**
822     * The strongSwan config for the l2tp VPN network.
823     * @type {?string}
824     * @syscap SystemCapability.Communication.NetManager.Vpn
825     * @systemapi Hide this for inner system use.
826     * @since 12
827     */
828    strongSwanConfig?: string;
829
830    /**
831     * The ca cert config for the l2tp VPN network.
832     * @type {?string}
833     * @syscap SystemCapability.Communication.NetManager.Vpn
834     * @systemapi Hide this for inner system use.
835     * @since 12
836     */
837    ipsecCaCertConfig?: string;
838
839    /**
840     * The private user cert config for the l2tp VPN network.
841     * @type {?string}
842     * @syscap SystemCapability.Communication.NetManager.Vpn
843     * @systemapi Hide this for inner system use.
844     * @since 12
845     */
846    ipsecPrivateUserCertConfig?: string;
847
848    /**
849     * The public user cert config for the l2tp VPN network.
850     * @type {?string}
851     * @syscap SystemCapability.Communication.NetManager.Vpn
852     * @systemapi Hide this for inner system use.
853     * @since 12
854     */
855    ipsecPublicUserCertConfig?: string;
856
857    /**
858     * The private server cert config for the l2tp VPN network.
859     * @type {?string}
860     * @syscap SystemCapability.Communication.NetManager.Vpn
861     * @systemapi Hide this for inner system use.
862     * @since 12
863     */
864    ipsecPrivateServerCertConfig?: string;
865
866    /**
867     * The public server cert config for the l2tp VPN network.
868     * @type {?string}
869     * @syscap SystemCapability.Communication.NetManager.Vpn
870     * @systemapi Hide this for inner system use.
871     * @since 12
872     */
873    ipsecPublicServerCertConfig?: string;
874
875    /**
876     * The ca cert file path for the l2tp VPN network.
877     * @type {?string}
878     * @syscap SystemCapability.Communication.NetManager.Vpn
879     * @systemapi Hide this for inner system use.
880     * @since 12
881     */
882    ipsecCaCertFilePath?: string;
883
884    /**
885     * The private user cert file path for the l2tp VPN network.
886     * @type {?string}
887     * @syscap SystemCapability.Communication.NetManager.Vpn
888     * @systemapi Hide this for inner system use.
889     * @since 12
890     */
891    ipsecPrivateUserCertFilePath?: string;
892
893    /**
894     * The public user cert file path for the l2tp VPN network.
895     * @type {?string}
896     * @syscap SystemCapability.Communication.NetManager.Vpn
897     * @systemapi Hide this for inner system use.
898     * @since 12
899     */
900    ipsecPublicUserCertFilePath?: string;
901
902    /**
903     * The private server cert file path for the l2tp VPN network.
904     * @type {?string}
905     * @syscap SystemCapability.Communication.NetManager.Vpn
906     * @systemapi Hide this for inner system use.
907     * @since 12
908     */
909    ipsecPrivateServerCertFilePath?: string;
910
911    /**
912     * The public server cert file path for the l2tp VPN network.
913     * @type {?string}
914     * @syscap SystemCapability.Communication.NetManager.Vpn
915     * @systemapi Hide this for inner system use.
916     * @since 12
917     */
918    ipsecPublicServerCertFilePath?: string;
919
920    /**
921     * The config for the l2tp VPN network.
922     * @type {?string}
923     * @syscap SystemCapability.Communication.NetManager.Vpn
924     * @systemapi Hide this for inner system use.
925     * @since 12
926     */
927    ipsecConfig?: string;
928
929    /**
930     * The secrets for the l2tp VPN network.
931     * @type {?string}
932     * @syscap SystemCapability.Communication.NetManager.Vpn
933     * @systemapi Hide this for inner system use.
934     * @since 12
935     */
936    ipsecSecrets?: string;
937
938    /**
939     * The client options for the l2tp VPN network.
940     * @type {?string}
941     * @syscap SystemCapability.Communication.NetManager.Vpn
942     * @systemapi Hide this for inner system use.
943     * @since 12
944     */
945    optionsL2tpdClient?: string;
946
947    /**
948     * The xl2tpd config for the l2tp VPN network.
949     * @type {?string}
950     * @syscap SystemCapability.Communication.NetManager.Vpn
951     * @systemapi Hide this for inner system use.
952     * @since 12
953     */
954    xl2tpdConfig?: string;
955
956    /**
957     * The shared key for the l2tp VPN network.
958     * @type {?string}
959     * @syscap SystemCapability.Communication.NetManager.Vpn
960     * @systemapi Hide this for inner system use.
961     * @since 12
962     */
963    l2tpSharedKey?: string;
964  }
965
966  /**
967   * Defines the type for the VPN network.
968   * @enum {number}
969   * @syscap SystemCapability.Communication.NetManager.Vpn
970   * @systemapi Hide this for inner system use.
971   * @since 12
972   */
973  export enum SysVpnType {
974    /**
975     * The type for the IKEv2/IPsec MSCHAPv2 VPN network.
976     * @syscap SystemCapability.Communication.NetManager.Vpn
977     * @systemapi Hide this for inner system use.
978     * @since 12
979     */
980    IKEV2_IPSEC_MSCHAPV2 = 1,
981
982    /**
983     * The type for the IKEv2/IPsec PSK VPN network.
984     * @syscap SystemCapability.Communication.NetManager.Vpn
985     * @systemapi Hide this for inner system use.
986     * @since 12
987     */
988    IKEV2_IPSEC_PSK = 2,
989
990    /**
991     * The type for the IKEv2/IPsec RSA VPN network.
992     * @syscap SystemCapability.Communication.NetManager.Vpn
993     * @systemapi Hide this for inner system use.
994     * @since 12
995     */
996    IKEV2_IPSEC_RSA = 3,
997
998    /**
999     * The type for the L2TP/IPsec PSK VPN network.
1000     * @syscap SystemCapability.Communication.NetManager.Vpn
1001     * @systemapi Hide this for inner system use.
1002     * @since 12
1003     */
1004    L2TP_IPSEC_PSK = 4,
1005
1006    /**
1007     * The type for the L2TP/IPsec RSA VPN network.
1008     * @syscap SystemCapability.Communication.NetManager.Vpn
1009     * @systemapi Hide this for inner system use.
1010     * @since 12
1011     */
1012    L2TP_IPSEC_RSA = 5,
1013
1014    /**
1015     * The type for the IPsec XAUTH PSK VPN network.
1016     * @syscap SystemCapability.Communication.NetManager.Vpn
1017     * @systemapi Hide this for inner system use.
1018     * @since 12
1019     */
1020    IPSEC_XAUTH_PSK = 6,
1021
1022    /**
1023     * The type for the IPsec XAUTH RSA VPN network.
1024     * @syscap SystemCapability.Communication.NetManager.Vpn
1025     * @systemapi Hide this for inner system use.
1026     * @since 12
1027     */
1028    IPSEC_XAUTH_RSA = 7,
1029
1030    /**
1031     * The type for the IPsec HYBRID RSA VPN network.
1032     * @syscap SystemCapability.Communication.NetManager.Vpn
1033     * @systemapi Hide this for inner system use.
1034     * @since 12
1035     */
1036    IPSEC_HYBRID_RSA = 8,
1037
1038    /**
1039     * The type for the OpenVpn network.
1040     * @syscap SystemCapability.Communication.NetManager.Vpn
1041     * @systemapi Hide this for inner system use.
1042     * @since 12
1043     */
1044    OPENVPN = 9
1045  }
1046}
1047export default vpn;
1048
1049