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