1/* 2 * Copyright (c) 2023-2024 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 MDMKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22import type Want from './@ohos.app.ability.Want'; 23import type connection from './@ohos.net.connection'; 24 25/** 26 * This module offers set network policies on the devices. 27 * 28 * @namespace networkManager 29 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 30 * @stagemodelonly 31 * @since 10 32 */ 33declare namespace networkManager { 34 /** 35 * Iptables rule add method. 36 * 37 * @enum { number } 38 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 39 * @systemapi 40 * @stagemodelonly 41 * @since 10 42 */ 43 enum AddMethod { 44 /** 45 * Append method 46 * 47 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 48 * @systemapi 49 * @stagemodelonly 50 * @since 10 51 */ 52 APPEND = 0, 53 54 /** 55 * Insert method 56 * 57 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 58 * @systemapi 59 * @stagemodelonly 60 * @since 10 61 */ 62 INSERT = 1 63 } 64 65 /** 66 * Iptables rule direction. 67 * 68 * @enum { number } 69 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 70 * @stagemodelonly 71 * @since 12 72 */ 73 enum Direction { 74 /** 75 * Input direction 76 * 77 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 78 * @stagemodelonly 79 * @since 12 80 */ 81 INPUT = 0, 82 83 /** 84 * Output direction 85 * 86 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 87 * @stagemodelonly 88 * @since 12 89 */ 90 OUTPUT = 1, 91 92 /** 93 * Forward direction 94 * 95 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 96 * @stagemodelonly 97 * @since 15 98 */ 99 FORWARD = 2 100 } 101 102 /** 103 * Iptables rule action. 104 * 105 * @enum { number } 106 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 107 * @stagemodelonly 108 * @since 12 109 */ 110 enum Action { 111 /** 112 * Action allow 113 * 114 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 115 * @stagemodelonly 116 * @since 12 117 */ 118 ALLOW = 0, 119 120 /** 121 * Action deny 122 * 123 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 124 * @stagemodelonly 125 * @since 12 126 */ 127 DENY = 1, 128 129 /** 130 * Action reject 131 * 132 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 133 * @stagemodelonly 134 * @since 15 135 */ 136 REJECT = 2 137 } 138 139 /** 140 * Iptables rule protocol 141 * 142 * @enum { number } 143 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 144 * @stagemodelonly 145 * @since 12 146 */ 147 enum Protocol { 148 /** 149 * Protocol all 150 * 151 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 152 * @stagemodelonly 153 * @since 12 154 */ 155 ALL = 0, 156 157 /** 158 * Protocol tcp 159 * 160 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 161 * @stagemodelonly 162 * @since 12 163 */ 164 TCP = 1, 165 166 /** 167 * Protocol udp 168 * 169 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 170 * @stagemodelonly 171 * @since 12 172 */ 173 UDP = 2, 174 175 /** 176 * Protocol icmp 177 * 178 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 179 * @stagemodelonly 180 * @since 12 181 */ 182 ICMP = 3 183 } 184 185 /** 186 * Iptables add filter rule 187 * 188 * @typedef AddFilterRule 189 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 190 * @systemapi 191 * @stagemodelonly 192 * @since 10 193 */ 194 interface AddFilterRule { 195 /** 196 * Iptables rule num 197 * 198 * @type { ?number } 199 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 200 * @systemapi 201 * @stagemodelonly 202 * @since 10 203 */ 204 ruleNo?: number; 205 206 /** 207 * Iptables ip source address 208 * 209 * @type { ?string } 210 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 211 * @systemapi 212 * @stagemodelonly 213 * @since 10 214 */ 215 srcAddr?: string; 216 217 /** 218 * Iptables ip destination address 219 * 220 * @type { ?string } 221 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 222 * @systemapi 223 * @stagemodelonly 224 * @since 10 225 */ 226 destAddr?: string; 227 228 /** 229 * Iptables source port 230 * 231 * @type { ?string } 232 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 233 * @systemapi 234 * @stagemodelonly 235 * @since 10 236 */ 237 srcPort?: string; 238 239 /** 240 * Iptables destination port 241 * 242 * @type { ?string } 243 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 244 * @systemapi 245 * @stagemodelonly 246 * @since 10 247 */ 248 destPort?: string; 249 250 /** 251 * Application uid 252 * 253 * @type { ?string } 254 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 255 * @systemapi 256 * @stagemodelonly 257 * @since 10 258 */ 259 uid?: string; 260 261 /** 262 * Add method 263 * 264 * @type { AddMethod } 265 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 266 * @systemapi 267 * @stagemodelonly 268 * @since 10 269 */ 270 method: AddMethod; 271 272 /** 273 * Direction 274 * 275 * @type { Direction } 276 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 277 * @systemapi 278 * @stagemodelonly 279 * @since 10 280 */ 281 direction: Direction; 282 283 /** 284 * Action 285 * 286 * @type { Action } 287 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 288 * @systemapi 289 * @stagemodelonly 290 * @since 10 291 */ 292 action: Action; 293 294 /** 295 * Protocol 296 * 297 * @type { ?Protocol } 298 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 299 * @systemapi 300 * @stagemodelonly 301 * @since 10 302 */ 303 protocol?: Protocol; 304 } 305 306 /** 307 * Iptables remove filter rule 308 * 309 * @typedef RemoveFilterRule 310 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 311 * @systemapi 312 * @stagemodelonly 313 * @since 10 314 */ 315 interface RemoveFilterRule { 316 /** 317 * Iptables ip source address 318 * 319 * @type { ?string } 320 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 321 * @systemapi 322 * @stagemodelonly 323 * @since 10 324 */ 325 srcAddr?: string; 326 327 /** 328 * Iptables ip destination address 329 * 330 * @type { ?string } 331 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 332 * @systemapi 333 * @stagemodelonly 334 * @since 10 335 */ 336 destAddr?: string; 337 338 /** 339 * Iptables source port 340 * 341 * @type { ?string } 342 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 343 * @systemapi 344 * @stagemodelonly 345 * @since 10 346 */ 347 srcPort?: string; 348 349 /** 350 * Iptables destination port 351 * 352 * @type { ?string } 353 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 354 * @systemapi 355 * @stagemodelonly 356 * @since 10 357 */ 358 destPort?: string; 359 360 /** 361 * Application uid 362 * 363 * @type { ?string } 364 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 365 * @systemapi 366 * @stagemodelonly 367 * @since 10 368 */ 369 uid?: string; 370 371 /** 372 * Direction 373 * 374 * @type { Direction } 375 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 376 * @systemapi 377 * @stagemodelonly 378 * @since 10 379 */ 380 direction: Direction; 381 382 /** 383 * Action 384 * 385 * @type { ?Action } 386 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 387 * @systemapi 388 * @stagemodelonly 389 * @since 10 390 */ 391 action?: Action; 392 393 /** 394 * Protocol 395 * 396 * @type { ?Protocol } 397 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 398 * @systemapi 399 * @stagemodelonly 400 * @since 10 401 */ 402 protocol?: Protocol; 403 } 404 405 /** 406 * Firewall rule 407 * 408 * @typedef FirewallRule 409 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 410 * @stagemodelonly 411 * @since 12 412 */ 413 interface FirewallRule { 414 /** 415 * Source IP 416 * 417 * @type { ?string } 418 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 419 * @stagemodelonly 420 * @since 12 421 */ 422 srcAddr?: string; 423 424 /** 425 * Destination IP 426 * 427 * @type { ?string } 428 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 429 * @stagemodelonly 430 * @since 12 431 */ 432 destAddr?: string; 433 434 /** 435 * Source Port 436 * 437 * @type { ?string } 438 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 439 * @stagemodelonly 440 * @since 12 441 */ 442 srcPort?: string; 443 444 /** 445 * Destination Port 446 * 447 * @type { ?string } 448 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 449 * @stagemodelonly 450 * @since 12 451 */ 452 destPort?: string; 453 454 /** 455 * Application uid 456 * 457 * @type { ?string } 458 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 459 * @stagemodelonly 460 * @since 12 461 */ 462 appUid?: string; 463 464 /** 465 * Direction 466 * 467 * @type { ?Direction } 468 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 469 * @stagemodelonly 470 * @since 12 471 */ 472 direction?: Direction; 473 474 /** 475 * Action 476 * 477 * @type { ?Action } 478 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 479 * @stagemodelonly 480 * @since 12 481 */ 482 action?: Action; 483 484 /** 485 * Protocol 486 * 487 * @type { ?Protocol } 488 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 489 * @stagemodelonly 490 * @since 12 491 */ 492 protocol?: Protocol; 493 } 494 495 /** 496 * Domain filter rule 497 * 498 * @typedef DomainFilterRule 499 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 500 * @stagemodelonly 501 * @since 12 502 */ 503 interface DomainFilterRule { 504 /** 505 * Domain name 506 * 507 * @type { ?string } 508 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 509 * @stagemodelonly 510 * @since 12 511 */ 512 domainName?: string; 513 514 /** 515 * Application uid 516 * 517 * @type { ?string } 518 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 519 * @stagemodelonly 520 * @since 12 521 */ 522 appUid?: string; 523 524 /** 525 * action 526 * 527 * @type { ?Action } 528 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 529 * @stagemodelonly 530 * @since 12 531 */ 532 action?: Action; 533 534 /** 535 * Direction 536 * 537 * @type { ?Direction } 538 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 539 * @stagemodelonly 540 * @since 15 541 */ 542 direction?: Direction; 543 } 544 545 /** 546 * Gets all of the network interfaces of the device. 547 * This function can be called by a super administrator. 548 * 549 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 550 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 551 * The admin must have the corresponding permission. 552 * @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces. 553 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 554 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 555 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 556 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 558 * 2. Incorrect parameter types; 3. Parameter verification failed. 559 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 560 * @systemapi 561 * @stagemodelonly 562 * @since 10 563 */ 564 function getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void; 565 566 /** 567 * Gets all of the network interfaces of the device. 568 * This function can be called by a super administrator. 569 * 570 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 571 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 572 * The admin must have the corresponding permission. 573 * @returns { Promise<Array<string>> } the promise returned by getAllNetworkInterfaces. 574 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 575 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 576 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 577 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 578 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 579 * 2. Incorrect parameter types; 3. Parameter verification failed. 580 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 581 * @systemapi 582 * @stagemodelonly 583 * @since 10 584 */ 585 function getAllNetworkInterfaces(admin: Want): Promise<Array<string>>; 586 587 /** 588 * Gets all the network interfaces of the device. 589 * This function can be called by a super administrator. 590 * 591 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 592 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 593 * The admin must have the corresponding permission. 594 * @returns { Array<string> } all the network interfaces of the device. 595 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 596 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 597 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 598 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 599 * 2. Incorrect parameter types; 3. Parameter verification failed. 600 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 601 * @stagemodelonly 602 * @since 12 603 */ 604 function getAllNetworkInterfacesSync(admin: Want): Array<string>; 605 606 /** 607 * Gets the ip address of the network interface. 608 * This function can be called by a super administrator. 609 * 610 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 611 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 612 * The admin must have the corresponding permission. 613 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 614 * @param { AsyncCallback<string> } callback - the callback of getIpAddress. 615 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 616 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 617 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 618 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 619 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 620 * 2. Incorrect parameter types; 3. Parameter verification failed. 621 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 622 * @systemapi 623 * @stagemodelonly 624 * @since 10 625 */ 626 function getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 627 628 /** 629 * Gets the ip address of the network interface. 630 * This function can be called by a super administrator. 631 * 632 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 633 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 634 * The admin must have the corresponding permission. 635 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 636 * @returns { Promise<string> } the promise returned by getIpAddress. 637 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 638 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 639 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 640 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 641 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 642 * 2. Incorrect parameter types; 3. Parameter verification failed. 643 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 644 * @systemapi 645 * @stagemodelonly 646 * @since 10 647 */ 648 function getIpAddress(admin: Want, networkInterface: string): Promise<string>; 649 650 /** 651 * Gets the ip address of the network interface. 652 * This function can be called by a super administrator. 653 * 654 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 655 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 656 * The admin must have the corresponding permission. 657 * @param { string } networkInterface - the ip address of the network interface. 658 * @returns { string } the promise returned by getIpAddress. 659 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 660 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 661 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 662 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 663 * 2. Incorrect parameter types; 3. Parameter verification failed. 664 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 665 * @stagemodelonly 666 * @since 12 667 */ 668 function getIpAddressSync(admin: Want, networkInterface: string): string; 669 670 /** 671 * Gets the mac address of the network interface. 672 * This function can be called by a super administrator. 673 * 674 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 675 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 676 * The admin must have the corresponding permission. 677 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 678 * @param { AsyncCallback<string> } callback - the callback of getMac. 679 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 680 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 681 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 682 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 683 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 684 * 2. Incorrect parameter types; 3. Parameter verification failed. 685 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 686 * @systemapi 687 * @stagemodelonly 688 * @since 10 689 */ 690 function getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 691 692 /** 693 * Gets the mac address of the network interface. 694 * This function can be called by a super administrator. 695 * 696 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 697 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 698 * The admin must have the corresponding permission. 699 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 700 * @returns { Promise<string> } the promise returned by getMac. 701 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 702 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 703 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 704 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 705 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 706 * 2. Incorrect parameter types; 3. Parameter verification failed. 707 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 708 * @systemapi 709 * @stagemodelonly 710 * @since 10 711 */ 712 function getMac(admin: Want, networkInterface: string): Promise<string>; 713 714 /** 715 * Gets the mac address of the network interface. 716 * This function can be called by a super administrator. 717 * 718 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 719 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 720 * The admin must have the corresponding permission. 721 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 722 * @returns { string } the mac address of the network interface. 723 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 724 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 725 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 727 * 2. Incorrect parameter types; 3. Parameter verification failed. 728 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 729 * @stagemodelonly 730 * @since 12 731 */ 732 function getMacSync(admin: Want, networkInterface: string): string; 733 734 /** 735 * Gets state of whether the network interface is disabled. 736 * This function can be called by a super administrator. 737 * 738 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 739 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 740 * The admin must have the corresponding permission. 741 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 742 * @param { AsyncCallback<boolean> } callback - the callback of isNetworkInterfaceDisabled. 743 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 744 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 745 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 746 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 747 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 748 * 2. Incorrect parameter types; 3. Parameter verification failed. 749 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 750 * @systemapi 751 * @stagemodelonly 752 * @since 10 753 */ 754 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback<boolean>): void; 755 756 /** 757 * Gets state of whether the network interface is disabled. 758 * This function can be called by a super administrator. 759 * 760 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 761 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 762 * The admin must have the corresponding permission. 763 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 764 * @returns { Promise<boolean> } the promise returned by isNetworkInterfaceDisabled. 765 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 766 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 767 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 768 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 769 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 770 * 2. Incorrect parameter types; 3. Parameter verification failed. 771 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 772 * @systemapi 773 * @stagemodelonly 774 * @since 10 775 */ 776 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<boolean>; 777 778 /** 779 * Gets state of whether the network interface is disabled. 780 * This function can be called by a super administrator. 781 * 782 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 783 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 784 * The admin must have the corresponding permission. 785 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 786 * @returns { boolean } true if disable the network interfaces, otherwise false. 787 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 788 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 789 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 790 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 791 * 2. Incorrect parameter types; 3. Parameter verification failed. 792 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 793 * @stagemodelonly 794 * @since 12 795 */ 796 function isNetworkInterfaceDisabledSync(admin: Want, networkInterface: string): boolean; 797 798 /** 799 * Disables the network interfaces. 800 * This function can be called by a super administrator. 801 * 802 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 803 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 804 * The admin must have the corresponding permission. 805 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 806 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 807 * @param { AsyncCallback<void> } callback - the callback of setNetworkInterfaceDisabled. 808 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 809 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 810 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 811 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 812 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 813 * 2. Incorrect parameter types; 3. Parameter verification failed. 814 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 815 * @systemapi 816 * @stagemodelonly 817 * @since 10 818 */ 819 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback<void>): void; 820 821 /** 822 * Disables the network interfaces. 823 * This function can be called by a super administrator. 824 * 825 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 826 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 827 * The admin must have the corresponding permission. 828 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 829 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 830 * @returns { Promise<void> } the promise returned setNetworkInterfaceDisabled. 831 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 832 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 833 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 834 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 835 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 836 * 2. Incorrect parameter types; 3. Parameter verification failed. 837 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 838 * @systemapi 839 * @stagemodelonly 840 * @since 10 841 */ 842 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise<void>; 843 844 /** 845 * Disables the network interfaces. 846 * This function can be called by a super administrator. 847 * 848 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 849 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 850 * The admin must have the corresponding permission. 851 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 852 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 853 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 854 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 855 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 856 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 857 * 2. Incorrect parameter types; 3. Parameter verification failed. 858 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 859 * @stagemodelonly 860 * @since 12 861 */ 862 function setNetworkInterfaceDisabledSync(admin: Want, networkInterface: string, isDisabled: boolean): void; 863 864 /** 865 * Set a network independent global {@link connection.HttpProxy} proxy. 866 * This function can be called by a super administrator. 867 * 868 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 869 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 870 * The admin must have the corresponding permission. 871 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 872 * @param { AsyncCallback<void> } callback - the callback of setGlobalProxy. 873 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 874 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 875 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 876 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 877 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 878 * 2. Incorrect parameter types; 3. Parameter verification failed. 879 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 880 * @systemapi 881 * @stagemodelonly 882 * @since 10 883 */ 884 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy, callback: AsyncCallback<void>): void; 885 886 /** 887 * Set a network independent global {@link connection.HttpProxy} proxy. 888 * This function can be called by a super administrator. 889 * 890 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 891 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 892 * The admin must have the corresponding permission. 893 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 894 * @returns { Promise<void> } the promise returned by the setGlobalProxy. 895 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 896 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 897 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 898 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 899 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 900 * 2. Incorrect parameter types; 3. Parameter verification failed. 901 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 902 * @systemapi 903 * @stagemodelonly 904 * @since 10 905 */ 906 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy): Promise<void>; 907 908 /** 909 * Set a network independent global {@link connection.HttpProxy} proxy. 910 * This function can be called by a super administrator. 911 * 912 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 913 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 914 * The admin must have the corresponding permission. 915 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 916 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 917 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 918 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 919 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 920 * 2. Incorrect parameter types; 3. Parameter verification failed. 921 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 922 * @stagemodelonly 923 * @since 12 924 */ 925 function setGlobalProxySync(admin: Want, httpProxy: connection.HttpProxy): void; 926 927 /** 928 * Set a network independent global {@link connection.HttpProxy} proxy for a system account. 929 * This function can be called by a super administrator. 930 * 931 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 932 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 933 * The admin must have the corresponding permission. 934 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 935 * @param { number } accountId - accountId indicates the account ID. 936 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 937 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 938 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 939 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 940 * 2. Incorrect parameter types; 3. Parameter verification failed. 941 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 942 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 943 * @stagemodelonly 944 * @since 15 945 */ 946 function setGlobalProxyForAccount(admin: Want, httpProxy: connection.HttpProxy, accountId: number): void; 947 948 /** 949 * Obtains the network independent global {@link connection.HttpProxy} proxy. 950 * This function can be called by a super administrator. 951 * 952 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 953 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 954 * have the corresponding permission. 955 * @param { AsyncCallback<connection.HttpProxy> } callback - the callback carries the network global proxy configuration information. 956 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 957 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 958 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 959 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 960 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 961 * 2. Incorrect parameter types; 3. Parameter verification failed. 962 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 963 * @systemapi 964 * @stagemodelonly 965 * @since 10 966 */ 967 function getGlobalProxy(admin: Want, callback: AsyncCallback<connection.HttpProxy>): void; 968 969 /** 970 * Obtains the network independent global {@link connection.HttpProxy} proxy. 971 * This function can be called by a super administrator. 972 * 973 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 974 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 975 * have the corresponding permission. 976 * @returns { Promise<connection.HttpProxy> } the promise carries the network global proxy configuration information. 977 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 978 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 979 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 980 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 981 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 982 * 2. Incorrect parameter types; 3. Parameter verification failed. 983 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 984 * @systemapi 985 * @stagemodelonly 986 * @since 10 987 */ 988 function getGlobalProxy(admin: Want): Promise<connection.HttpProxy>; 989 990 /** 991 * Obtains the network independent global {@link connection.HttpProxy} proxy. 992 * This function can be called by a super administrator. 993 * 994 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 995 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 996 * have the corresponding permission. 997 * @returns { connection.HttpProxy } the network global proxy configuration information. 998 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 999 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1000 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1001 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1002 * 2. Incorrect parameter types; 3. Parameter verification failed. 1003 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1004 * @stagemodelonly 1005 * @since 12 1006 */ 1007 function getGlobalProxySync(admin: Want): connection.HttpProxy; 1008 1009 /** 1010 * Obtains the network independent global {@link connection.HttpProxy} proxy for a system account. 1011 * This function can be called by a super administrator. 1012 * 1013 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1014 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 1015 * have the corresponding permission. 1016 * @param { number } accountId - accountId indicates the account ID. 1017 * @returns { connection.HttpProxy } the network global proxy configuration information. 1018 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1019 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1020 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1021 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1022 * 2. Incorrect parameter types; 3. Parameter verification failed. 1023 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1024 * @stagemodelonly 1025 * @since 15 1026 */ 1027 /** 1028 * Obtains the network independent global {@link connection.HttpProxy} proxy for a system account. 1029 * This function can be called by a super administrator. 1030 * 1031 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1032 * @param { Want | null } admin - admin indicates the administrator ability information.If the admin is not empty, it must 1033 * have the corresponding permission. 1034 * @param { number } accountId - accountId indicates the account ID. 1035 * @returns { connection.HttpProxy } the network global proxy configuration information. 1036 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1037 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1038 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1039 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 1040 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1041 * @stagemodelonly 1042 * @since 20 1043 */ 1044 function getGlobalProxyForAccount(admin: Want | null, accountId: number): connection.HttpProxy; 1045 1046 /** 1047 * Add iptables filter rule by {@link AddFilterRule}. 1048 * This function can be called by a super administrator. 1049 * 1050 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1051 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1052 * The admin must have the corresponding permission. 1053 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 1054 * @param { AsyncCallback<void> } callback - the callback of addIptablesFilterRule. 1055 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1056 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1057 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1058 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1059 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1060 * 2. Incorrect parameter types; 3. Parameter verification failed. 1061 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1062 * @systemapi 1063 * @stagemodelonly 1064 * @since 10 1065 */ 1066 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule, callback: AsyncCallback<void>): void; 1067 1068 /** 1069 * Add iptables filter rule by {@link AddFilterRule}. 1070 * This function can be called by a super administrator. 1071 * 1072 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1073 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1074 * The admin must have the corresponding permission. 1075 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 1076 * @returns { Promise<void> } the promise returned by the addIptablesFilterRule. 1077 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1078 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1079 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1080 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1081 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1082 * 2. Incorrect parameter types; 3. Parameter verification failed. 1083 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1084 * @systemapi 1085 * @stagemodelonly 1086 * @since 10 1087 */ 1088 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule): Promise<void>; 1089 1090 /** 1091 * Remove iptables filter rule by {@link RemoveFilterRule}. 1092 * This function can be called by a super administrator. 1093 * 1094 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1095 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1096 * The admin must have the corresponding permission. 1097 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 1098 * @param { AsyncCallback<void> } callback - the callback of removeIptablesFilterRule. 1099 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1100 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1101 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1102 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1103 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1104 * 2. Incorrect parameter types; 3. Parameter verification failed. 1105 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1106 * @systemapi 1107 * @stagemodelonly 1108 * @since 10 1109 */ 1110 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule, callback: AsyncCallback<void>): void; 1111 1112 /** 1113 * Remove iptables filter rule by {@link RemoveFilterRule}. 1114 * This function can be called by a super administrator. 1115 * 1116 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1117 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1118 * The admin must have the corresponding permission. 1119 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 1120 * @returns { Promise<void> } the promise returned by the removeIptablesFilterRule. 1121 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1122 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1123 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1124 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1125 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1126 * 2. Incorrect parameter types; 3. Parameter verification failed. 1127 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1128 * @systemapi 1129 * @stagemodelonly 1130 * @since 10 1131 */ 1132 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule): Promise<void>; 1133 1134 /** 1135 * Query iptables rule and list the result. 1136 * This function can be called by a super administrator. 1137 * 1138 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1139 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1140 * The admin must have the corresponding permission. 1141 * @param { AsyncCallback<string> } callback - the callback carries the iptables rules in the table filter. 1142 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1143 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1144 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1145 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1146 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1147 * 2. Incorrect parameter types; 3. Parameter verification failed. 1148 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1149 * @systemapi 1150 * @stagemodelonly 1151 * @since 10 1152 */ 1153 function listIptablesFilterRules(admin: Want, callback: AsyncCallback<string>): void; 1154 1155 /** 1156 * Query iptables rule and list the result. 1157 * This function can be called by a super administrator. 1158 * 1159 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1160 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1161 * The admin must have the corresponding permission. 1162 * @returns { Promise<string> } the promise carries the iptables rules in the table filter. 1163 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1164 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1165 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1166 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1168 * 2. Incorrect parameter types; 3. Parameter verification failed. 1169 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1170 * @systemapi 1171 * @stagemodelonly 1172 * @since 10 1173 */ 1174 function listIptablesFilterRules(admin: Want): Promise<string>; 1175 1176 /** 1177 * Adds firewall rule by {@link Firewall}. 1178 * This function can be called by a super administrator. 1179 * 1180 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1181 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1182 * The admin must have the corresponding permission. 1183 * @param { FirewallRule } firewallRule - firewall rule that needs to be added. 1184 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1185 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1186 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1187 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1188 * 2. Incorrect parameter types; 3. Parameter verification failed. 1189 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1190 * @stagemodelonly 1191 * @since 12 1192 */ 1193 function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; 1194 1195 /** 1196 * Removes firewall rule by {@link Firewall}. 1197 * This function can be called by a super administrator. 1198 * 1199 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1200 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1201 * The admin must have the corresponding permission. 1202 * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. 1203 * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. 1204 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1205 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1206 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1208 * 2. Incorrect parameter types; 3. Parameter verification failed. 1209 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1210 * @stagemodelonly 1211 * @since 12 1212 */ 1213 function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; 1214 1215 /** 1216 * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. 1217 * This function can be called by a super administrator. 1218 * 1219 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1220 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1221 * The admin must have the corresponding permission. 1222 * @returns { Array<FirewallRule> } an array of added firewall rules. 1223 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1224 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1225 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1227 * 2. Incorrect parameter types; 3. Parameter verification failed. 1228 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1229 * @stagemodelonly 1230 * @since 12 1231 */ 1232 function getFirewallRules(admin: Want): Array<FirewallRule>; 1233 1234 /** 1235 * Adds domain filter rule by {@link DomainFilterRule}. 1236 * This function can be called by a super administrator. 1237 * 1238 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1239 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1240 * The admin must have the corresponding permission. 1241 * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. 1242 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1243 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1244 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1245 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1246 * 2. Incorrect parameter types; 3. Parameter verification failed. 1247 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1248 * @stagemodelonly 1249 * @since 12 1250 */ 1251 function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; 1252 1253 /** 1254 * Removes domain filter rule by {@link DomainFilterRule}. 1255 * This function can be called by a super administrator. 1256 * 1257 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1258 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1259 * The admin must have the corresponding permission. 1260 * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. 1261 * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. 1262 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1263 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1264 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1266 * 2. Incorrect parameter types; 3. Parameter verification failed. 1267 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1268 * @stagemodelonly 1269 * @since 12 1270 */ 1271 function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; 1272 1273 /** 1274 * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. 1275 * This function can be called by a super administrator. 1276 * 1277 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1278 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1279 * The admin must have the corresponding permission. 1280 * @returns { Array<DomainFilterRule> } an array of added domain filter rules. 1281 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1282 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1283 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1284 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1285 * 2. Incorrect parameter types; 3. Parameter verification failed. 1286 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1287 * @stagemodelonly 1288 * @since 12 1289 */ 1290 function getDomainFilterRules(admin: Want): Array<DomainFilterRule>; 1291 1292 /** 1293 * Turn on mobile data. 1294 * This function can be called by a super administrator. 1295 * 1296 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1297 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1298 * The admin must have the corresponding permission. 1299 * @param { boolean } isForce - True means force open mobile data, user can not turn off it, false means user can turn off it. 1300 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1301 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1302 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1303 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1304 * @stagemodelonly 1305 * @since 20 1306 */ 1307 function turnOnMobileData(admin: Want, isForce: boolean): void; 1308 1309 /** 1310 * Turn off mobile data. 1311 * This function can be called by a super administrator. 1312 * 1313 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1314 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1315 * The admin must have the corresponding permission. 1316 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1317 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1318 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1319 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1320 * @stagemodelonly 1321 * @since 20 1322 */ 1323 function turnOffMobileData(admin: Want): void; 1324 1325 /** 1326 * Add apn to the device. 1327 * This function can be called by a super administrator. 1328 * 1329 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1330 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1331 * The admin must have the corresponding permission. 1332 * @param { Record<string, string> } apnInfo - Apn param info that needs to be added. 1333 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1334 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1335 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1336 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1337 * @stagemodelonly 1338 * @since 20 1339 */ 1340 function addApn(admin: Want, apnInfo: Record<string, string>): void; 1341 1342 /** 1343 * Delete apn by appId. 1344 * This function can be called by a super administrator. 1345 * 1346 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1347 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1348 * The admin must have the corresponding permission. 1349 * @param { string } apnId - Apn id that needs to be deleted. 1350 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1351 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1352 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1353 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1354 * @stagemodelonly 1355 * @since 20 1356 */ 1357 function deleteApn(admin: Want, apnId: string): void; 1358 1359 /** 1360 * Update apn. 1361 * This function can be called by a super administrator. 1362 * 1363 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1364 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1365 * The admin must have the corresponding permission. 1366 * @param { Record<string, string> } apnInfo - Apn param info that needs to be updated. 1367 * @param { string } apnId - Apn id that needs to be update. 1368 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1369 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1370 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1371 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1372 * @stagemodelonly 1373 * @since 20 1374 */ 1375 function updateApn(admin: Want, apnInfo: Record<string, string>, apnId: string): void; 1376 1377 /** 1378 * Sets preferred apn. 1379 * This function can be called by a super administrator. 1380 * 1381 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1382 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1383 * The admin must have the corresponding permission. 1384 * @param { string } apnId - Apn id that needs to be set prefer. 1385 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1386 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1387 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1388 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1389 * @stagemodelonly 1390 * @since 20 1391 */ 1392 function setPreferredApn(admin: Want, apnId: string): void; 1393 1394 /** 1395 * Get the apn params for the specific apn info. 1396 * This function can be called by a super administrator. 1397 * 1398 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1399 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1400 * The admin must have the corresponding permission. 1401 * @param { Record<string, string> } apnInfo - The query conditions for the apn. 1402 * @returns { Array<string> } id(s) of the apns which meet the query conditions. 1403 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1404 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1405 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1406 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1407 * @stagemodelonly 1408 * @since 20 1409 */ 1410 function queryApn(admin: Want, apnInfo: Record<string, string>): Array<string>; 1411 1412 /** 1413 * Get the apn params for the specific apn id. 1414 * This function can be called by a super administrator. 1415 * 1416 * @permission ohos.permission.ENTERPRISE_MANAGE_APN 1417 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1418 * The admin must have the corresponding permission. 1419 * @param { string } apnId - The id of the apn. 1420 * @returns { Record<string, string> } The apn params for the specific apn id. 1421 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1422 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1423 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1424 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1425 * @stagemodelonly 1426 * @since 20 1427 */ 1428 function queryApn(admin: Want, apnId: string): Record<string, string>; 1429} 1430 1431export default networkManager; 1432