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 /** 94 * Iptables rule action. 95 * 96 * @enum { number } 97 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 98 * @stagemodelonly 99 * @since 12 100 */ 101 enum Action { 102 /** 103 * Action allow 104 * 105 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 106 * @stagemodelonly 107 * @since 12 108 */ 109 ALLOW = 0, 110 111 /** 112 * Action deny 113 * 114 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 115 * @stagemodelonly 116 * @since 12 117 */ 118 DENY = 1 119 } 120 121 /** 122 * Iptables rule protocol 123 * 124 * @enum { number } 125 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 126 * @stagemodelonly 127 * @since 12 128 */ 129 enum Protocol { 130 /** 131 * Protocol all 132 * 133 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 134 * @stagemodelonly 135 * @since 12 136 */ 137 ALL = 0, 138 139 /** 140 * Protocol tcp 141 * 142 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 143 * @stagemodelonly 144 * @since 12 145 */ 146 TCP = 1, 147 148 /** 149 * Protocol udp 150 * 151 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 152 * @stagemodelonly 153 * @since 12 154 */ 155 UDP = 2, 156 157 /** 158 * Protocol icmp 159 * 160 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 161 * @stagemodelonly 162 * @since 12 163 */ 164 ICMP = 3 165 } 166 167 /** 168 * Iptables add filter rule 169 * 170 * @typedef AddFilterRule 171 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 172 * @systemapi 173 * @stagemodelonly 174 * @since 10 175 */ 176 interface AddFilterRule { 177 /** 178 * Iptables rule num 179 * 180 * @type { ?number } 181 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 182 * @systemapi 183 * @stagemodelonly 184 * @since 10 185 */ 186 ruleNo?: number; 187 188 /** 189 * Iptables ip source address 190 * 191 * @type { ?string } 192 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 193 * @systemapi 194 * @stagemodelonly 195 * @since 10 196 */ 197 srcAddr?: string; 198 199 /** 200 * Iptables ip destination address 201 * 202 * @type { ?string } 203 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 204 * @systemapi 205 * @stagemodelonly 206 * @since 10 207 */ 208 destAddr?: string; 209 210 /** 211 * Iptables source port 212 * 213 * @type { ?string } 214 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 215 * @systemapi 216 * @stagemodelonly 217 * @since 10 218 */ 219 srcPort?: string; 220 221 /** 222 * Iptables destination port 223 * 224 * @type { ?string } 225 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 226 * @systemapi 227 * @stagemodelonly 228 * @since 10 229 */ 230 destPort?: string; 231 232 /** 233 * Application uid 234 * 235 * @type { ?string } 236 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 237 * @systemapi 238 * @stagemodelonly 239 * @since 10 240 */ 241 uid?: string; 242 243 /** 244 * Add method 245 * 246 * @type { AddMethod } 247 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 248 * @systemapi 249 * @stagemodelonly 250 * @since 10 251 */ 252 method: AddMethod; 253 254 /** 255 * Direction 256 * 257 * @type { Direction } 258 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 259 * @systemapi 260 * @stagemodelonly 261 * @since 10 262 */ 263 direction: Direction; 264 265 /** 266 * Action 267 * 268 * @type { Action } 269 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 270 * @systemapi 271 * @stagemodelonly 272 * @since 10 273 */ 274 action: Action; 275 276 /** 277 * Protocol 278 * 279 * @type { ?Protocol } 280 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 281 * @systemapi 282 * @stagemodelonly 283 * @since 10 284 */ 285 protocol?: Protocol; 286 } 287 288 /** 289 * Iptables remove filter rule 290 * 291 * @typedef RemoveFilterRule 292 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 293 * @systemapi 294 * @stagemodelonly 295 * @since 10 296 */ 297 interface RemoveFilterRule { 298 /** 299 * Iptables ip source address 300 * 301 * @type { ?string } 302 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 303 * @systemapi 304 * @stagemodelonly 305 * @since 10 306 */ 307 srcAddr?: string; 308 309 /** 310 * Iptables ip destination address 311 * 312 * @type { ?string } 313 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 314 * @systemapi 315 * @stagemodelonly 316 * @since 10 317 */ 318 destAddr?: string; 319 320 /** 321 * Iptables source port 322 * 323 * @type { ?string } 324 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 325 * @systemapi 326 * @stagemodelonly 327 * @since 10 328 */ 329 srcPort?: string; 330 331 /** 332 * Iptables destination port 333 * 334 * @type { ?string } 335 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 336 * @systemapi 337 * @stagemodelonly 338 * @since 10 339 */ 340 destPort?: string; 341 342 /** 343 * Application uid 344 * 345 * @type { ?string } 346 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 347 * @systemapi 348 * @stagemodelonly 349 * @since 10 350 */ 351 uid?: string; 352 353 /** 354 * Direction 355 * 356 * @type { Direction } 357 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 358 * @systemapi 359 * @stagemodelonly 360 * @since 10 361 */ 362 direction: Direction; 363 364 /** 365 * Action 366 * 367 * @type { ?Action } 368 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 369 * @systemapi 370 * @stagemodelonly 371 * @since 10 372 */ 373 action?: Action; 374 375 /** 376 * Protocol 377 * 378 * @type { ?Protocol } 379 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 380 * @systemapi 381 * @stagemodelonly 382 * @since 10 383 */ 384 protocol?: Protocol; 385 } 386 387 /** 388 * Firewall rule 389 * 390 * @typedef FirewallRule 391 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 392 * @stagemodelonly 393 * @since 12 394 */ 395 interface FirewallRule { 396 /** 397 * Source IP 398 * 399 * @type { ?string } 400 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 401 * @stagemodelonly 402 * @since 12 403 */ 404 srcAddr?: string; 405 406 /** 407 * Destination IP 408 * 409 * @type { ?string } 410 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 411 * @stagemodelonly 412 * @since 12 413 */ 414 destAddr?: string; 415 416 /** 417 * Source Port 418 * 419 * @type { ?string } 420 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 421 * @stagemodelonly 422 * @since 12 423 */ 424 srcPort?: string; 425 426 /** 427 * Destination Port 428 * 429 * @type { ?string } 430 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 431 * @stagemodelonly 432 * @since 12 433 */ 434 destPort?: string; 435 436 /** 437 * Application uid 438 * 439 * @type { ?string } 440 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 441 * @stagemodelonly 442 * @since 12 443 */ 444 appUid?: string; 445 446 /** 447 * Direction 448 * 449 * @type { ?Direction } 450 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 451 * @stagemodelonly 452 * @since 12 453 */ 454 direction?: Direction; 455 456 /** 457 * Action 458 * 459 * @type { ?Action } 460 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 461 * @stagemodelonly 462 * @since 12 463 */ 464 action?: Action; 465 466 /** 467 * Protocol 468 * 469 * @type { ?Protocol } 470 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 471 * @stagemodelonly 472 * @since 12 473 */ 474 protocol?: Protocol; 475 } 476 477 /** 478 * Domain filter rule 479 * 480 * @typedef DomainFilterRule 481 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 482 * @stagemodelonly 483 * @since 12 484 */ 485 interface DomainFilterRule { 486 /** 487 * Domain name 488 * 489 * @type { ?string } 490 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 491 * @stagemodelonly 492 * @since 12 493 */ 494 domainName?: string; 495 496 /** 497 * Application uid 498 * 499 * @type { ?string } 500 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 501 * @stagemodelonly 502 * @since 12 503 */ 504 appUid?: string; 505 506 /** 507 * action 508 * 509 * @type { ?Action } 510 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 511 * @stagemodelonly 512 * @since 12 513 */ 514 action?: Action; 515 } 516 517 /** 518 * Gets all of the network interfaces of the device. 519 * This function can be called by a super administrator. 520 * 521 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 522 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 523 * The admin must have the corresponding permission. 524 * @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces. 525 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 526 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 527 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 528 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 529 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 530 * 2. Incorrect parameter types; 3. Parameter verification failed. 531 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 532 * @systemapi 533 * @stagemodelonly 534 * @since 10 535 */ 536 function getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void; 537 538 /** 539 * Gets all of the network interfaces of the device. 540 * This function can be called by a super administrator. 541 * 542 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 543 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 544 * The admin must have the corresponding permission. 545 * @returns { Promise<Array<string>> } the promise returned by getAllNetworkInterfaces. 546 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 547 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 548 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 549 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 550 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 551 * 2. Incorrect parameter types; 3. Parameter verification failed. 552 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 553 * @systemapi 554 * @stagemodelonly 555 * @since 10 556 */ 557 function getAllNetworkInterfaces(admin: Want): Promise<Array<string>>; 558 559 /** 560 * Gets all the network interfaces of the device. 561 * This function can be called by a super administrator. 562 * 563 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 564 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 565 * The admin must have the corresponding permission. 566 * @returns { Array<string> } all the network interfaces of the device. 567 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 568 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 569 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 570 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 571 * 2. Incorrect parameter types; 3. Parameter verification failed. 572 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 573 * @stagemodelonly 574 * @since 12 575 */ 576 function getAllNetworkInterfacesSync(admin: Want): Array<string>; 577 578 /** 579 * Gets the ip address of the network interface. 580 * This function can be called by a super administrator. 581 * 582 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 583 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 584 * The admin must have the corresponding permission. 585 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 586 * @param { AsyncCallback<string> } callback - the callback of getIpAddress. 587 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 588 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 589 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 590 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 591 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 592 * 2. Incorrect parameter types; 3. Parameter verification failed. 593 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 594 * @systemapi 595 * @stagemodelonly 596 * @since 10 597 */ 598 function getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 599 600 /** 601 * Gets the ip address of the network interface. 602 * This function can be called by a super administrator. 603 * 604 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 605 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 606 * The admin must have the corresponding permission. 607 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 608 * @returns { Promise<string> } the promise returned by getIpAddress. 609 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 610 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 611 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 612 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 613 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 614 * 2. Incorrect parameter types; 3. Parameter verification failed. 615 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 616 * @systemapi 617 * @stagemodelonly 618 * @since 10 619 */ 620 function getIpAddress(admin: Want, networkInterface: string): Promise<string>; 621 622 /** 623 * Gets the ip address of the network interface. 624 * This function can be called by a super administrator. 625 * 626 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 627 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 628 * The admin must have the corresponding permission. 629 * @param { string } networkInterface - the ip address of the network interface. 630 * @returns { string } the promise returned by getIpAddress. 631 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 632 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 633 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 634 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 635 * 2. Incorrect parameter types; 3. Parameter verification failed. 636 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 637 * @stagemodelonly 638 * @since 12 639 */ 640 function getIpAddressSync(admin: Want, networkInterface: string): string; 641 642 /** 643 * Gets the mac address of the network interface. 644 * This function can be called by a super administrator. 645 * 646 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 647 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 648 * The admin must have the corresponding permission. 649 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 650 * @param { AsyncCallback<string> } callback - the callback of getMac. 651 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 652 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 653 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 654 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 655 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 656 * 2. Incorrect parameter types; 3. Parameter verification failed. 657 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 658 * @systemapi 659 * @stagemodelonly 660 * @since 10 661 */ 662 function getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 663 664 /** 665 * Gets the mac address of the network interface. 666 * This function can be called by a super administrator. 667 * 668 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 669 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 670 * The admin must have the corresponding permission. 671 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 672 * @returns { Promise<string> } the promise returned by getMac. 673 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 674 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 675 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 676 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 677 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 678 * 2. Incorrect parameter types; 3. Parameter verification failed. 679 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 680 * @systemapi 681 * @stagemodelonly 682 * @since 10 683 */ 684 function getMac(admin: Want, networkInterface: string): Promise<string>; 685 686 /** 687 * Gets the mac address of the network interface. 688 * This function can be called by a super administrator. 689 * 690 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 691 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 692 * The admin must have the corresponding permission. 693 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 694 * @returns { string } the mac address of the network interface. 695 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 696 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 697 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 698 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 699 * 2. Incorrect parameter types; 3. Parameter verification failed. 700 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 701 * @stagemodelonly 702 * @since 12 703 */ 704 function getMacSync(admin: Want, networkInterface: string): string; 705 706 /** 707 * Gets state of whether the network interface is disabled. 708 * This function can be called by a super administrator. 709 * 710 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 711 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 712 * The admin must have the corresponding permission. 713 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 714 * @param { AsyncCallback<boolean> } callback - the callback of isNetworkInterfaceDisabled. 715 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 716 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 717 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 718 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 720 * 2. Incorrect parameter types; 3. Parameter verification failed. 721 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 722 * @systemapi 723 * @stagemodelonly 724 * @since 10 725 */ 726 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback<boolean>): void; 727 728 /** 729 * Gets state of whether the network interface is disabled. 730 * This function can be called by a super administrator. 731 * 732 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 733 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 734 * The admin must have the corresponding permission. 735 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 736 * @returns { Promise<boolean> } the promise returned by isNetworkInterfaceDisabled. 737 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 738 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 739 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 740 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 742 * 2. Incorrect parameter types; 3. Parameter verification failed. 743 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 744 * @systemapi 745 * @stagemodelonly 746 * @since 10 747 */ 748 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<boolean>; 749 750 /** 751 * Gets state of whether the network interface is disabled. 752 * This function can be called by a super administrator. 753 * 754 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 755 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 756 * The admin must have the corresponding permission. 757 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 758 * @returns { boolean } true if disable the network interfaces, otherwise false. 759 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 760 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 761 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 762 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 763 * 2. Incorrect parameter types; 3. Parameter verification failed. 764 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 765 * @stagemodelonly 766 * @since 12 767 */ 768 function isNetworkInterfaceDisabledSync(admin: Want, networkInterface: string): boolean; 769 770 /** 771 * Disables the network interfaces. 772 * This function can be called by a super administrator. 773 * 774 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 775 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 776 * The admin must have the corresponding permission. 777 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 778 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 779 * @param { AsyncCallback<void> } callback - the callback of setNetworkInterfaceDisabled. 780 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 781 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 782 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 783 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 784 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 785 * 2. Incorrect parameter types; 3. Parameter verification failed. 786 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 787 * @systemapi 788 * @stagemodelonly 789 * @since 10 790 */ 791 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback<void>): void; 792 793 /** 794 * Disables the network interfaces. 795 * This function can be called by a super administrator. 796 * 797 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 798 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 799 * The admin must have the corresponding permission. 800 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 801 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 802 * @returns { Promise<void> } the promise returned setNetworkInterfaceDisabled. 803 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 804 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 805 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 806 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 807 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 808 * 2. Incorrect parameter types; 3. Parameter verification failed. 809 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 810 * @systemapi 811 * @stagemodelonly 812 * @since 10 813 */ 814 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise<void>; 815 816 /** 817 * Disables the network interfaces. 818 * This function can be called by a super administrator. 819 * 820 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 821 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 822 * The admin must have the corresponding permission. 823 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 824 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 825 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 826 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 827 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 828 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 829 * 2. Incorrect parameter types; 3. Parameter verification failed. 830 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 831 * @stagemodelonly 832 * @since 12 833 */ 834 function setNetworkInterfaceDisabledSync(admin: Want, networkInterface: string, isDisabled: boolean): void; 835 836 /** 837 * Set a network independent global {@link connection.HttpProxy} proxy. 838 * This function can be called by a super administrator. 839 * 840 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 841 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 842 * The admin must have the corresponding permission. 843 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 844 * @param { AsyncCallback<void> } callback - the callback of setGlobalProxy. 845 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 846 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 847 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 848 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 850 * 2. Incorrect parameter types; 3. Parameter verification failed. 851 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 852 * @systemapi 853 * @stagemodelonly 854 * @since 10 855 */ 856 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy, callback: AsyncCallback<void>): void; 857 858 /** 859 * Set a network independent global {@link connection.HttpProxy} proxy. 860 * This function can be called by a super administrator. 861 * 862 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 863 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 864 * The admin must have the corresponding permission. 865 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 866 * @returns { Promise<void> } the promise returned by the setGlobalProxy. 867 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 868 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 869 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 870 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 871 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 872 * 2. Incorrect parameter types; 3. Parameter verification failed. 873 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 874 * @systemapi 875 * @stagemodelonly 876 * @since 10 877 */ 878 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy): Promise<void>; 879 880 /** 881 * Set a network independent global {@link connection.HttpProxy} proxy. 882 * This function can be called by a super administrator. 883 * 884 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 885 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 886 * The admin must have the corresponding permission. 887 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 888 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 889 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 890 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 891 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 892 * 2. Incorrect parameter types; 3. Parameter verification failed. 893 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 894 * @stagemodelonly 895 * @since 12 896 */ 897 function setGlobalProxySync(admin: Want, httpProxy: connection.HttpProxy): void; 898 899 /** 900 * Obtains the network independent global {@link connection.HttpProxy} proxy. 901 * This function can be called by a super administrator. 902 * 903 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 904 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 905 * have the corresponding permission. 906 * @param { AsyncCallback<connection.HttpProxy> } callback - the callback carries the network global proxy configuration information. 907 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 908 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 909 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 910 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 911 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 912 * 2. Incorrect parameter types; 3. Parameter verification failed. 913 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 914 * @systemapi 915 * @stagemodelonly 916 * @since 10 917 */ 918 function getGlobalProxy(admin: Want, callback: AsyncCallback<connection.HttpProxy>): void; 919 920 /** 921 * Obtains the network independent global {@link connection.HttpProxy} proxy. 922 * This function can be called by a super administrator. 923 * 924 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 925 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 926 * have the corresponding permission. 927 * @returns { Promise<connection.HttpProxy> } the promise carries the network global proxy configuration information. 928 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 929 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 930 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 931 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 932 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 933 * 2. Incorrect parameter types; 3. Parameter verification failed. 934 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 935 * @systemapi 936 * @stagemodelonly 937 * @since 10 938 */ 939 function getGlobalProxy(admin: Want): Promise<connection.HttpProxy>; 940 941 /** 942 * Obtains the network independent global {@link connection.HttpProxy} proxy. 943 * This function can be called by a super administrator. 944 * 945 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 946 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 947 * have the corresponding permission. 948 * @returns { connection.HttpProxy } the network global proxy configuration information. 949 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 950 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 951 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 952 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 953 * 2. Incorrect parameter types; 3. Parameter verification failed. 954 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 955 * @stagemodelonly 956 * @since 12 957 */ 958 function getGlobalProxySync(admin: Want): connection.HttpProxy; 959 960 /** 961 * Add iptables filter rule by {@link AddFilterRule}. 962 * This function can be called by a super administrator. 963 * 964 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 965 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 966 * The admin must have the corresponding permission. 967 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 968 * @param { AsyncCallback<void> } callback - the callback of addIptablesFilterRule. 969 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 970 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 971 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 972 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 973 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 974 * 2. Incorrect parameter types; 3. Parameter verification failed. 975 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 976 * @systemapi 977 * @stagemodelonly 978 * @since 10 979 */ 980 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule, callback: AsyncCallback<void>): void; 981 982 /** 983 * Add iptables filter rule by {@link AddFilterRule}. 984 * This function can be called by a super administrator. 985 * 986 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 987 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 988 * The admin must have the corresponding permission. 989 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 990 * @returns { Promise<void> } the promise returned by the addIptablesFilterRule. 991 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 992 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 993 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 994 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 995 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 996 * 2. Incorrect parameter types; 3. Parameter verification failed. 997 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 998 * @systemapi 999 * @stagemodelonly 1000 * @since 10 1001 */ 1002 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule): Promise<void>; 1003 1004 /** 1005 * Remove iptables filter rule by {@link RemoveFilterRule}. 1006 * This function can be called by a super administrator. 1007 * 1008 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1009 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1010 * The admin must have the corresponding permission. 1011 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 1012 * @param { AsyncCallback<void> } callback - the callback of removeIptablesFilterRule. 1013 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1014 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1015 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1016 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1017 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1018 * 2. Incorrect parameter types; 3. Parameter verification failed. 1019 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1020 * @systemapi 1021 * @stagemodelonly 1022 * @since 10 1023 */ 1024 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule, callback: AsyncCallback<void>): void; 1025 1026 /** 1027 * Remove iptables filter rule by {@link RemoveFilterRule}. 1028 * This function can be called by a super administrator. 1029 * 1030 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1031 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1032 * The admin must have the corresponding permission. 1033 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 1034 * @returns { Promise<void> } the promise returned by the removeIptablesFilterRule. 1035 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1036 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1037 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1038 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1039 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1040 * 2. Incorrect parameter types; 3. Parameter verification failed. 1041 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1042 * @systemapi 1043 * @stagemodelonly 1044 * @since 10 1045 */ 1046 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule): Promise<void>; 1047 1048 /** 1049 * Query iptables rule and list the result. 1050 * This function can be called by a super administrator. 1051 * 1052 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1053 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1054 * The admin must have the corresponding permission. 1055 * @param { AsyncCallback<string> } callback - the callback carries the iptables rules in the table filter. 1056 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1057 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1058 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1059 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1060 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1061 * 2. Incorrect parameter types; 3. Parameter verification failed. 1062 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1063 * @systemapi 1064 * @stagemodelonly 1065 * @since 10 1066 */ 1067 function listIptablesFilterRules(admin: Want, callback: AsyncCallback<string>): void; 1068 1069 /** 1070 * Query iptables rule and list the result. 1071 * This function can be called by a super administrator. 1072 * 1073 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1074 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1075 * The admin must have the corresponding permission. 1076 * @returns { Promise<string> } the promise carries the iptables rules in the table filter. 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 listIptablesFilterRules(admin: Want): Promise<string>; 1089 1090 /** 1091 * Adds firewall rule by {@link Firewall}. 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 { FirewallRule } firewallRule - firewall rule that needs to be added. 1098 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1099 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1100 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1101 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1102 * 2. Incorrect parameter types; 3. Parameter verification failed. 1103 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1104 * @stagemodelonly 1105 * @since 12 1106 */ 1107 function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; 1108 1109 /** 1110 * Removes firewall rule by {@link Firewall}. 1111 * This function can be called by a super administrator. 1112 * 1113 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1114 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1115 * The admin must have the corresponding permission. 1116 * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. 1117 * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. 1118 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1119 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1120 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1121 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1122 * 2. Incorrect parameter types; 3. Parameter verification failed. 1123 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1124 * @stagemodelonly 1125 * @since 12 1126 */ 1127 function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; 1128 1129 /** 1130 * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. 1131 * This function can be called by a super administrator. 1132 * 1133 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1134 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1135 * The admin must have the corresponding permission. 1136 * @returns { Array<FirewallRule> } an array of added firewall rules. 1137 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1138 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1139 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1140 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1141 * 2. Incorrect parameter types; 3. Parameter verification failed. 1142 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1143 * @stagemodelonly 1144 * @since 12 1145 */ 1146 function getFirewallRules(admin: Want): Array<FirewallRule>; 1147 1148 /** 1149 * Adds domain filter rule by {@link DomainFilterRule}. 1150 * This function can be called by a super administrator. 1151 * 1152 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1153 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1154 * The admin must have the corresponding permission. 1155 * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. 1156 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1157 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1158 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1160 * 2. Incorrect parameter types; 3. Parameter verification failed. 1161 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1162 * @stagemodelonly 1163 * @since 12 1164 */ 1165 function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; 1166 1167 /** 1168 * Removes domain filter rule by {@link DomainFilterRule}. 1169 * This function can be called by a super administrator. 1170 * 1171 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1172 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1173 * The admin must have the corresponding permission. 1174 * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. 1175 * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. 1176 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1177 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1178 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1180 * 2. Incorrect parameter types; 3. Parameter verification failed. 1181 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1182 * @stagemodelonly 1183 * @since 12 1184 */ 1185 function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; 1186 1187 /** 1188 * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. 1189 * This function can be called by a super administrator. 1190 * 1191 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1192 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1193 * The admin must have the corresponding permission. 1194 * @returns { Array<DomainFilterRule> } an array of added domain filter rules. 1195 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1196 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1197 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1198 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1199 * 2. Incorrect parameter types; 3. Parameter verification failed. 1200 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1201 * @stagemodelonly 1202 * @since 12 1203 */ 1204 function getDomainFilterRules(admin: Want): Array<DomainFilterRule>; 1205} 1206 1207export default networkManager; 1208