1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit 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 * @systemapi 31 * @stagemodelonly 32 * @since 10 33 */ 34declare namespace networkManager { 35 /** 36 * Iptables rule add method. 37 * 38 * @enum { number } 39 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 40 * @systemapi 41 * @stagemodelonly 42 * @since 10 43 */ 44 enum AddMethod { 45 /** 46 * Append method 47 * 48 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 49 * @systemapi 50 * @stagemodelonly 51 * @since 10 52 */ 53 APPEND = 0, 54 55 /** 56 * Insert method 57 * 58 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 59 * @systemapi 60 * @stagemodelonly 61 * @since 10 62 */ 63 INSERT = 1 64 } 65 66 /** 67 * Iptables rule direction. 68 * 69 * @enum { number } 70 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 71 * @systemapi 72 * @stagemodelonly 73 * @since 10 74 */ 75 enum Direction { 76 /** 77 * Input direction 78 * 79 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 80 * @systemapi 81 * @stagemodelonly 82 * @since 10 83 */ 84 INPUT = 0, 85 86 /** 87 * Output direction 88 * 89 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 90 * @systemapi 91 * @stagemodelonly 92 * @since 10 93 */ 94 OUTPUT = 1 95 } 96 97 /** 98 * Iptables rule action. 99 * 100 * @enum { number } 101 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 102 * @systemapi 103 * @stagemodelonly 104 * @since 10 105 */ 106 enum Action { 107 /** 108 * Action allow 109 * 110 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 111 * @systemapi 112 * @stagemodelonly 113 * @since 10 114 */ 115 ALLOW = 0, 116 117 /** 118 * Action deny 119 * 120 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 121 * @systemapi 122 * @stagemodelonly 123 * @since 10 124 */ 125 DENY = 1 126 } 127 128 /** 129 * Iptables rule protocol 130 * 131 * @enum { number } 132 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 133 * @systemapi 134 * @stagemodelonly 135 * @since 10 136 */ 137 enum Protocol { 138 /** 139 * Protocol all 140 * 141 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 142 * @systemapi 143 * @stagemodelonly 144 * @since 10 145 */ 146 ALL = 0, 147 148 /** 149 * Protocol tcp 150 * 151 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 152 * @systemapi 153 * @stagemodelonly 154 * @since 10 155 */ 156 TCP = 1, 157 158 /** 159 * Protocol udp 160 * 161 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 162 * @systemapi 163 * @stagemodelonly 164 * @since 10 165 */ 166 UDP = 2, 167 168 /** 169 * Protocol icmp 170 * 171 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 172 * @systemapi 173 * @stagemodelonly 174 * @since 10 175 */ 176 ICMP = 3 177 } 178 179 /** 180 * Iptables add filter rule 181 * 182 * @typedef AddFilterRule 183 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 184 * @systemapi 185 * @stagemodelonly 186 * @since 10 187 */ 188 interface AddFilterRule { 189 /** 190 * Iptables rule num 191 * 192 * @type { ?number } 193 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 194 * @systemapi 195 * @stagemodelonly 196 * @since 10 197 */ 198 ruleNo?: number; 199 200 /** 201 * Iptables ip source address 202 * 203 * @type { ?string } 204 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 205 * @systemapi 206 * @stagemodelonly 207 * @since 10 208 */ 209 srcAddr?: string; 210 211 /** 212 * Iptables ip destination address 213 * 214 * @type { ?string } 215 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 216 * @systemapi 217 * @stagemodelonly 218 * @since 10 219 */ 220 destAddr?: string; 221 222 /** 223 * Iptables source port 224 * 225 * @type { ?string } 226 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 227 * @systemapi 228 * @stagemodelonly 229 * @since 10 230 */ 231 srcPort?: string; 232 233 /** 234 * Iptables destination port 235 * 236 * @type { ?string } 237 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 238 * @systemapi 239 * @stagemodelonly 240 * @since 10 241 */ 242 destPort?: string; 243 244 /** 245 * Application uid 246 * 247 * @type { ?string } 248 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 249 * @systemapi 250 * @stagemodelonly 251 * @since 10 252 */ 253 uid?: string; 254 255 /** 256 * Add method 257 * 258 * @type { AddMethod } 259 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 260 * @systemapi 261 * @stagemodelonly 262 * @since 10 263 */ 264 method: AddMethod; 265 266 /** 267 * Direction 268 * 269 * @type { Direction } 270 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 271 * @systemapi 272 * @stagemodelonly 273 * @since 10 274 */ 275 direction: Direction; 276 277 /** 278 * Action 279 * 280 * @type { Action } 281 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 282 * @systemapi 283 * @stagemodelonly 284 * @since 10 285 */ 286 action: Action; 287 288 /** 289 * Protocol 290 * 291 * @type { ?Protocol } 292 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 293 * @systemapi 294 * @stagemodelonly 295 * @since 10 296 */ 297 protocol?: Protocol; 298 } 299 300 /** 301 * Iptables remove filter rule 302 * 303 * @typedef RemoveFilterRule 304 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 305 * @systemapi 306 * @stagemodelonly 307 * @since 10 308 */ 309 interface RemoveFilterRule { 310 /** 311 * Iptables ip source address 312 * 313 * @type { ?string } 314 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 315 * @systemapi 316 * @stagemodelonly 317 * @since 10 318 */ 319 srcAddr?: string; 320 321 /** 322 * Iptables ip destination address 323 * 324 * @type { ?string } 325 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 326 * @systemapi 327 * @stagemodelonly 328 * @since 10 329 */ 330 destAddr?: string; 331 332 /** 333 * Iptables source port 334 * 335 * @type { ?string } 336 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 337 * @systemapi 338 * @stagemodelonly 339 * @since 10 340 */ 341 srcPort?: string; 342 343 /** 344 * Iptables destination port 345 * 346 * @type { ?string } 347 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 348 * @systemapi 349 * @stagemodelonly 350 * @since 10 351 */ 352 destPort?: string; 353 354 /** 355 * Application uid 356 * 357 * @type { ?string } 358 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 359 * @systemapi 360 * @stagemodelonly 361 * @since 10 362 */ 363 uid?: string; 364 365 /** 366 * Direction 367 * 368 * @type { Direction } 369 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 370 * @systemapi 371 * @stagemodelonly 372 * @since 10 373 */ 374 direction: Direction; 375 376 /** 377 * Action 378 * 379 * @type { ?Action } 380 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 381 * @systemapi 382 * @stagemodelonly 383 * @since 10 384 */ 385 action?: Action; 386 387 /** 388 * Protocol 389 * 390 * @type { ?Protocol } 391 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 392 * @systemapi 393 * @stagemodelonly 394 * @since 10 395 */ 396 protocol?: Protocol; 397 } 398 399 /** 400 * Firewall rule 401 * 402 * @typedef FirewallRule 403 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 404 * @systemapi 405 * @stagemodelonly 406 * @since 11 407 */ 408 interface FirewallRule { 409 /** 410 * Source IP 411 * 412 * @type { ?string } 413 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 414 * @systemapi 415 * @stagemodelonly 416 * @since 11 417 */ 418 srcAddr?: string; 419 420 /** 421 * Destination IP 422 * 423 * @type { ?string } 424 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 425 * @systemapi 426 * @stagemodelonly 427 * @since 11 428 */ 429 destAddr?: string; 430 431 /** 432 * Source Port 433 * 434 * @type { ?string } 435 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 436 * @systemapi 437 * @stagemodelonly 438 * @since 11 439 */ 440 srcPort?: string; 441 442 /** 443 * Destination Port 444 * 445 * @type { ?string } 446 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 447 * @systemapi 448 * @stagemodelonly 449 * @since 11 450 */ 451 destPort?: string; 452 453 /** 454 * Application uid 455 * 456 * @type { ?string } 457 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 458 * @systemapi 459 * @stagemodelonly 460 * @since 11 461 */ 462 appUid?: string; 463 464 /** 465 * Direction 466 * 467 * @type { ?Direction } 468 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 469 * @systemapi 470 * @stagemodelonly 471 * @since 11 472 */ 473 direction?: Direction; 474 475 /** 476 * Action 477 * 478 * @type { ?Action } 479 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 480 * @systemapi 481 * @stagemodelonly 482 * @since 11 483 */ 484 action?: Action; 485 486 /** 487 * Protocol 488 * 489 * @type { ?Protocol } 490 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 491 * @systemapi 492 * @stagemodelonly 493 * @since 11 494 */ 495 protocol?: Protocol; 496 } 497 498 /** 499 * Domain filter rule 500 * 501 * @typedef DomainFilterRule 502 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 503 * @systemapi 504 * @stagemodelonly 505 * @since 11 506 */ 507 interface DomainFilterRule { 508 /** 509 * Domain name 510 * 511 * @type { ?string } 512 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 513 * @systemapi 514 * @stagemodelonly 515 * @since 11 516 */ 517 domainName?: string; 518 519 /** 520 * Application uid 521 * 522 * @type { ?string } 523 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 524 * @systemapi 525 * @stagemodelonly 526 * @since 11 527 */ 528 appUid?: string; 529 530 /** 531 * action 532 * 533 * @type { ?Action } 534 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 535 * @systemapi 536 * @stagemodelonly 537 * @since 11 538 */ 539 action?: Action; 540 } 541 542 /** 543 * Gets all of the network interfaces of the device. 544 * This function can be called by a super administrator. 545 * 546 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 547 * @param { Want } admin - admin indicates the administrator ability information. 548 * @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces. 549 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 550 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 551 * @throws { BusinessError } 201 - the application does not have permission to call this function. 552 * @throws { BusinessError } 202 - not system application. 553 * @throws { BusinessError } 401 - invalid input parameter. 554 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 555 * @systemapi 556 * @stagemodelonly 557 * @since 10 558 */ 559 function getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void; 560 561 /** 562 * Gets all of the network interfaces of the device. 563 * This function can be called by a super administrator. 564 * 565 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 566 * @param { Want } admin - admin indicates the administrator ability information. 567 * @returns { Promise<Array<string>> } the promise returned by getAllNetworkInterfaces. 568 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 569 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 570 * @throws { BusinessError } 201 - the application does not have permission to call this function. 571 * @throws { BusinessError } 202 - not system application. 572 * @throws { BusinessError } 401 - invalid input parameter. 573 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 574 * @systemapi 575 * @stagemodelonly 576 * @since 10 577 */ 578 function getAllNetworkInterfaces(admin: Want): Promise<Array<string>>; 579 580 /** 581 * Gets the ip address of the network interface. 582 * This function can be called by a super administrator. 583 * 584 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 585 * @param { Want } admin - admin indicates the administrator ability information. 586 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 587 * @param { AsyncCallback<string> } callback - the callback of getIpAddress. 588 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 589 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 590 * @throws { BusinessError } 201 - the application does not have permission to call this function. 591 * @throws { BusinessError } 202 - not system application. 592 * @throws { BusinessError } 401 - invalid input parameter. 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 administrator ability information. 606 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 607 * @returns { Promise<string> } the promise returned by getIpAddress. 608 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 609 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 610 * @throws { BusinessError } 201 - the application does not have permission to call this function. 611 * @throws { BusinessError } 202 - not system application. 612 * @throws { BusinessError } 401 - invalid input parameter. 613 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 614 * @systemapi 615 * @stagemodelonly 616 * @since 10 617 */ 618 function getIpAddress(admin: Want, networkInterface: string): Promise<string>; 619 620 /** 621 * Gets the mac address of the network interface. 622 * This function can be called by a super administrator. 623 * 624 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 625 * @param { Want } admin - admin indicates the administrator ability information. 626 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 627 * @param { AsyncCallback<string> } callback - the callback of getMac. 628 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 629 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 630 * @throws { BusinessError } 201 - the application does not have permission to call this function. 631 * @throws { BusinessError } 202 - not system application. 632 * @throws { BusinessError } 401 - invalid input parameter. 633 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 634 * @systemapi 635 * @stagemodelonly 636 * @since 10 637 */ 638 function getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 639 640 /** 641 * Gets the mac address of the network interface. 642 * This function can be called by a super administrator. 643 * 644 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 645 * @param { Want } admin - admin indicates the administrator ability information. 646 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 647 * @returns { Promise<string> } the promise returned by getMac. 648 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 649 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 650 * @throws { BusinessError } 201 - the application does not have permission to call this function. 651 * @throws { BusinessError } 202 - not system application. 652 * @throws { BusinessError } 401 - invalid input parameter. 653 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 654 * @systemapi 655 * @stagemodelonly 656 * @since 10 657 */ 658 function getMac(admin: Want, networkInterface: string): Promise<string>; 659 660 /** 661 * Gets state of whether the network interface is disabled. 662 * This function can be called by a super administrator. 663 * 664 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 665 * @param { Want } admin - admin indicates the administrator ability information. 666 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 667 * @param { AsyncCallback<boolean> } callback - the callback of isNetworkInterfaceDisabled. 668 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 669 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 670 * @throws { BusinessError } 201 - the application does not have permission to call this function. 671 * @throws { BusinessError } 202 - not system application. 672 * @throws { BusinessError } 401 - invalid input parameter. 673 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 674 * @systemapi 675 * @stagemodelonly 676 * @since 10 677 */ 678 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback<boolean>): void; 679 680 /** 681 * Gets state of whether the network interface is disabled. 682 * This function can be called by a super administrator. 683 * 684 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 685 * @param { Want } admin - admin indicates the administrator ability information. 686 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 687 * @returns { Promise<boolean> } the promise returned by isNetworkInterfaceDisabled. 688 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 689 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 690 * @throws { BusinessError } 201 - the application does not have permission to call this function. 691 * @throws { BusinessError } 202 - not system application. 692 * @throws { BusinessError } 401 - invalid input parameter. 693 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 694 * @systemapi 695 * @stagemodelonly 696 * @since 10 697 */ 698 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<boolean>; 699 700 /** 701 * Disables the network interfaces. 702 * This function can be called by a super administrator. 703 * 704 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 705 * @param { Want } admin - admin indicates the administrator ability information. 706 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 707 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 708 * @param { AsyncCallback<void> } callback - the callback of setNetworkInterfaceDisabled. 709 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 710 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 711 * @throws { BusinessError } 201 - the application does not have permission to call this function. 712 * @throws { BusinessError } 202 - not system application. 713 * @throws { BusinessError } 401 - invalid input parameter. 714 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 715 * @systemapi 716 * @stagemodelonly 717 * @since 10 718 */ 719 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback<void>): void; 720 721 /** 722 * Disables the network interfaces. 723 * This function can be called by a super administrator. 724 * 725 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 726 * @param { Want } admin - admin indicates the administrator ability information. 727 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 728 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 729 * @returns { Promise<void> } the promise returned setNetworkInterfaceDisabled. 730 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 731 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 732 * @throws { BusinessError } 201 - the application does not have permission to call this function. 733 * @throws { BusinessError } 202 - not system application. 734 * @throws { BusinessError } 401 - invalid input parameter. 735 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 736 * @systemapi 737 * @stagemodelonly 738 * @since 10 739 */ 740 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise<void>; 741 742 /** 743 * Set a network independent global {@link connection.HttpProxy} proxy. 744 * This function can be called by a super administrator. 745 * 746 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 747 * @param { Want } admin - admin indicates the administrator ability information. 748 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 749 * @param { AsyncCallback<void> } callback - the callback of setGlobalProxy. 750 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 751 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 752 * @throws { BusinessError } 201 - the application does not have permission to call this function. 753 * @throws { BusinessError } 202 - not system application. 754 * @throws { BusinessError } 401 - invalid input parameter. 755 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 756 * @systemapi 757 * @stagemodelonly 758 * @since 10 759 */ 760 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy, callback: AsyncCallback<void>): void; 761 762 /** 763 * Set a network independent global {@link connection.HttpProxy} proxy. 764 * This function can be called by a super administrator. 765 * 766 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 767 * @param { Want } admin - admin indicates the administrator ability information. 768 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 769 * @returns { Promise<void> } the promise returned by the setGlobalProxy. 770 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 771 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 772 * @throws { BusinessError } 201 - the application does not have permission to call this function. 773 * @throws { BusinessError } 202 - not system application. 774 * @throws { BusinessError } 401 - invalid input parameter. 775 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 776 * @systemapi 777 * @stagemodelonly 778 * @since 10 779 */ 780 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy): Promise<void>; 781 782 /** 783 * Obtains the network independent global {@link connection.HttpProxy} proxy. 784 * This function can be called by a super administrator. 785 * 786 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 787 * @param { Want } admin - admin indicates the administrator ability information. 788 * @param { AsyncCallback<connection.HttpProxy> } callback - the callback carries the network global proxy configuration information. 789 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 790 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 791 * @throws { BusinessError } 201 - the application does not have permission to call this function. 792 * @throws { BusinessError } 202 - not system application. 793 * @throws { BusinessError } 401 - invalid input parameter. 794 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 795 * @systemapi 796 * @stagemodelonly 797 * @since 10 798 */ 799 function getGlobalProxy(admin: Want, callback: AsyncCallback<connection.HttpProxy>): void; 800 801 /** 802 * Obtains the network independent global {@link connection.HttpProxy} proxy. 803 * This function can be called by a super administrator. 804 * 805 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 806 * @param { Want } admin - admin indicates the administrator ability information. 807 * @returns { Promise<connection.HttpProxy> } the promise carries the network global proxy configuration information. 808 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 809 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 810 * @throws { BusinessError } 201 - the application does not have permission to call this function. 811 * @throws { BusinessError } 202 - not system application. 812 * @throws { BusinessError } 401 - invalid input parameter. 813 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 814 * @systemapi 815 * @stagemodelonly 816 * @since 10 817 */ 818 function getGlobalProxy(admin: Want): Promise<connection.HttpProxy>; 819 820 /** 821 * Add iptables filter rule by {@link AddFilterRule}. 822 * This function can be called by a super administrator. 823 * 824 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 825 * @param { Want } admin - admin indicates the administrator ability information. 826 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 827 * @param { AsyncCallback<void> } callback - the callback of addIptablesFilterRule. 828 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 829 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 830 * @throws { BusinessError } 201 - the application does not have permission to call this function. 831 * @throws { BusinessError } 202 - not system application. 832 * @throws { BusinessError } 401 - invalid input parameter. 833 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 834 * @systemapi 835 * @stagemodelonly 836 * @since 10 837 */ 838 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule, callback: AsyncCallback<void>): void; 839 840 /** 841 * Add iptables filter rule by {@link AddFilterRule}. 842 * This function can be called by a super administrator. 843 * 844 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 845 * @param { Want } admin - admin indicates the administrator ability information. 846 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 847 * @returns { Promise<void> } the promise returned by the addIptablesFilterRule. 848 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 849 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 850 * @throws { BusinessError } 201 - the application does not have permission to call this function. 851 * @throws { BusinessError } 202 - not system application. 852 * @throws { BusinessError } 401 - invalid input parameter. 853 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 854 * @systemapi 855 * @stagemodelonly 856 * @since 10 857 */ 858 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule): Promise<void>; 859 860 /** 861 * Remove iptables filter rule by {@link RemoveFilterRule}. 862 * This function can be called by a super administrator. 863 * 864 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 865 * @param { Want } admin - admin indicates the administrator ability information. 866 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 867 * @param { AsyncCallback<void> } callback - the callback of removeIptablesFilterRule. 868 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 869 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 870 * @throws { BusinessError } 201 - the application does not have permission to call this function. 871 * @throws { BusinessError } 202 - not system application. 872 * @throws { BusinessError } 401 - invalid input parameter. 873 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 874 * @systemapi 875 * @stagemodelonly 876 * @since 10 877 */ 878 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule, callback: AsyncCallback<void>): void; 879 880 /** 881 * Remove iptables filter rule by {@link RemoveFilterRule}. 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 administrator ability information. 886 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 887 * @returns { Promise<void> } the promise returned by the removeIptablesFilterRule. 888 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 889 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 890 * @throws { BusinessError } 201 - the application does not have permission to call this function. 891 * @throws { BusinessError } 202 - not system application. 892 * @throws { BusinessError } 401 - invalid input parameter. 893 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 894 * @systemapi 895 * @stagemodelonly 896 * @since 10 897 */ 898 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule): Promise<void>; 899 900 /** 901 * Query iptables rule and list the result. 902 * This function can be called by a super administrator. 903 * 904 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 905 * @param { Want } admin - admin indicates the administrator ability information. 906 * @param { AsyncCallback<string> } callback - the callback carries the iptables rules in the table filter. 907 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 908 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 909 * @throws { BusinessError } 201 - the application does not have permission to call this function. 910 * @throws { BusinessError } 202 - not system application. 911 * @throws { BusinessError } 401 - invalid input parameter. 912 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 913 * @systemapi 914 * @stagemodelonly 915 * @since 10 916 */ 917 function listIptablesFilterRules(admin: Want, callback: AsyncCallback<string>): void; 918 919 /** 920 * Query iptables rule and list the result. 921 * This function can be called by a super administrator. 922 * 923 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 924 * @param { Want } admin - admin indicates the administrator ability information. 925 * @returns { Promise<string> } the promise carries the iptables rules in the table filter. 926 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 927 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 928 * @throws { BusinessError } 201 - the application does not have permission to call this function. 929 * @throws { BusinessError } 202 - not system application. 930 * @throws { BusinessError } 401 - invalid input parameter. 931 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 932 * @systemapi 933 * @stagemodelonly 934 * @since 10 935 */ 936 function listIptablesFilterRules(admin: Want): Promise<string>; 937 938 /** 939 * Adds firewall rule by {@link Firewall}. 940 * This function can be called by a super administrator. 941 * 942 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 943 * @param { Want } admin - admin indicates the administrator ability information. 944 * @param { FirewallRule } firewallRule - firewall rule that needs to be added. 945 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 946 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 947 * @throws { BusinessError } 201 - the application does not have permission to call this function. 948 * @throws { BusinessError } 202 - not system application. 949 * @throws { BusinessError } 401 - invalid input parameter. 950 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 951 * @systemapi 952 * @stagemodelonly 953 * @since 11 954 */ 955 function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; 956 957 /** 958 * Removes firewall rule by {@link Firewall}. 959 * This function can be called by a super administrator. 960 * 961 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 962 * @param { Want } admin - admin indicates the administrator ability information. 963 * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. 964 * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. 965 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 966 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 967 * @throws { BusinessError } 201 - the application does not have permission to call this function. 968 * @throws { BusinessError } 202 - not system application. 969 * @throws { BusinessError } 401 - invalid input parameter. 970 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 971 * @systemapi 972 * @stagemodelonly 973 * @since 11 974 */ 975 function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; 976 977 /** 978 * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. 979 * This function can be called by a super administrator. 980 * 981 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 982 * @param { Want } admin - admin indicates the administrator ability information. 983 * @returns { Array<FirewallRule> } an array of added firewall rules. 984 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 985 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 986 * @throws { BusinessError } 201 - the application does not have permission to call this function. 987 * @throws { BusinessError } 202 - not system application. 988 * @throws { BusinessError } 401 - invalid input parameter. 989 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 990 * @systemapi 991 * @stagemodelonly 992 * @since 11 993 */ 994 function getFirewallRules(admin: Want): Array<FirewallRule>; 995 996 /** 997 * Adds domain filter rule by {@link DomainFilterRule}. 998 * This function can be called by a super administrator. 999 * 1000 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1001 * @param { Want } admin - admin indicates the administrator ability information. 1002 * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. 1003 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 1004 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 1005 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1006 * @throws { BusinessError } 202 - not system application. 1007 * @throws { BusinessError } 401 - invalid input parameter. 1008 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1009 * @systemapi 1010 * @stagemodelonly 1011 * @since 11 1012 */ 1013 function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; 1014 1015 /** 1016 * Removes domain filter rule by {@link DomainFilterRule}. 1017 * This function can be called by a super administrator. 1018 * 1019 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1020 * @param { Want } admin - admin indicates the administrator ability information. 1021 * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. 1022 * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. 1023 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 1024 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 1025 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1026 * @throws { BusinessError } 202 - not system application. 1027 * @throws { BusinessError } 401 - invalid input parameter. 1028 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1029 * @systemapi 1030 * @stagemodelonly 1031 * @since 11 1032 */ 1033 function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; 1034 1035 /** 1036 * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. 1037 * This function can be called by a super administrator. 1038 * 1039 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 1040 * @param { Want } admin - admin indicates the administrator ability information. 1041 * @returns { Array<DomainFilterRule> } an array of added domain filter rules. 1042 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 1043 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 1044 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1045 * @throws { BusinessError } 202 - not system application. 1046 * @throws { BusinessError } 401 - invalid input parameter. 1047 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1048 * @systemapi 1049 * @stagemodelonly 1050 * @since 11 1051 */ 1052 function getDomainFilterRules(admin: Want): Array<DomainFilterRule>; 1053} 1054 1055export default networkManager; 1056