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 16import type { AsyncCallback } from './@ohos.base'; 17import type Want from './@ohos.app.ability.Want'; 18import type connection from './@ohos.net.connection'; 19 20/** 21 * This module offers set network policies on the devices. 22 * 23 * @namespace networkManager 24 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 25 * @systemapi 26 * @stagemodelonly 27 * @since 10 28 */ 29declare namespace networkManager { 30 /** 31 * Iptables rule add method. 32 * 33 * @enum { number } 34 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 35 * @systemapi 36 * @stagemodelonly 37 * @since 10 38 */ 39 enum AddMethod { 40 /** 41 * Append method 42 * 43 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 44 * @systemapi 45 * @stagemodelonly 46 * @since 10 47 */ 48 APPEND = 0, 49 50 /** 51 * Insert method 52 * 53 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 54 * @systemapi 55 * @stagemodelonly 56 * @since 10 57 */ 58 INSERT = 1 59 } 60 61 /** 62 * Iptables rule direction. 63 * 64 * @enum { number } 65 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 66 * @systemapi 67 * @stagemodelonly 68 * @since 10 69 */ 70 enum Direction { 71 /** 72 * Input direction 73 * 74 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 75 * @systemapi 76 * @stagemodelonly 77 * @since 10 78 */ 79 INPUT = 0, 80 81 /** 82 * Output direction 83 * 84 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 85 * @systemapi 86 * @stagemodelonly 87 * @since 10 88 */ 89 OUTPUT = 1 90 } 91 92 /** 93 * Iptables rule action. 94 * 95 * @enum { number } 96 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 97 * @systemapi 98 * @stagemodelonly 99 * @since 10 100 */ 101 enum Action { 102 /** 103 * Action allow 104 * 105 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 106 * @systemapi 107 * @stagemodelonly 108 * @since 10 109 */ 110 ALLOW = 0, 111 112 /** 113 * Action deny 114 * 115 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 116 * @systemapi 117 * @stagemodelonly 118 * @since 10 119 */ 120 DENY = 1 121 } 122 123 /** 124 * Iptables rule protocol 125 * 126 * @enum { number } 127 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 128 * @systemapi 129 * @stagemodelonly 130 * @since 10 131 */ 132 enum Protocol { 133 /** 134 * Protocol all 135 * 136 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 137 * @systemapi 138 * @stagemodelonly 139 * @since 10 140 */ 141 ALL = 0, 142 143 /** 144 * Protocol tcp 145 * 146 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 147 * @systemapi 148 * @stagemodelonly 149 * @since 10 150 */ 151 TCP = 1, 152 153 /** 154 * Protocol udp 155 * 156 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 157 * @systemapi 158 * @stagemodelonly 159 * @since 10 160 */ 161 UDP = 2, 162 163 /** 164 * Protocol icmp 165 * 166 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 167 * @systemapi 168 * @stagemodelonly 169 * @since 10 170 */ 171 ICMP = 3 172 } 173 174 /** 175 * Iptables add filter rule 176 * 177 * @typedef AddFilterRule 178 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 179 * @systemapi 180 * @stagemodelonly 181 * @since 10 182 */ 183 interface AddFilterRule { 184 /** 185 * Iptables rule num 186 * 187 * @type { ?number } 188 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 189 * @systemapi 190 * @stagemodelonly 191 * @since 10 192 */ 193 ruleNo?: number; 194 195 /** 196 * Iptables ip source address 197 * 198 * @type { ?string } 199 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 200 * @systemapi 201 * @stagemodelonly 202 * @since 10 203 */ 204 srcAddr?: string; 205 206 /** 207 * Iptables ip destination address 208 * 209 * @type { ?string } 210 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 211 * @systemapi 212 * @stagemodelonly 213 * @since 10 214 */ 215 destAddr?: string; 216 217 /** 218 * Iptables source port 219 * 220 * @type { ?string } 221 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 222 * @systemapi 223 * @stagemodelonly 224 * @since 10 225 */ 226 srcPort?: string; 227 228 /** 229 * Iptables destination port 230 * 231 * @type { ?string } 232 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 233 * @systemapi 234 * @stagemodelonly 235 * @since 10 236 */ 237 destPort?: string; 238 239 /** 240 * Application uid 241 * 242 * @type { ?string } 243 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 244 * @systemapi 245 * @stagemodelonly 246 * @since 10 247 */ 248 uid?: string; 249 250 /** 251 * Add method 252 * 253 * @type { AddMethod } 254 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 255 * @systemapi 256 * @stagemodelonly 257 * @since 10 258 */ 259 method: AddMethod; 260 261 /** 262 * Direction 263 * 264 * @type { Direction } 265 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 266 * @systemapi 267 * @stagemodelonly 268 * @since 10 269 */ 270 direction: Direction; 271 272 /** 273 * Action 274 * 275 * @type { Action } 276 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 277 * @systemapi 278 * @stagemodelonly 279 * @since 10 280 */ 281 action: Action; 282 283 /** 284 * Protocol 285 * 286 * @type { ?Protocol } 287 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 288 * @systemapi 289 * @stagemodelonly 290 * @since 10 291 */ 292 protocol?: Protocol; 293 } 294 295 /** 296 * Iptables remove filter rule 297 * 298 * @typedef RemoveFilterRule 299 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 300 * @systemapi 301 * @stagemodelonly 302 * @since 10 303 */ 304 interface RemoveFilterRule { 305 /** 306 * Iptables ip source address 307 * 308 * @type { ?string } 309 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 310 * @systemapi 311 * @stagemodelonly 312 * @since 10 313 */ 314 srcAddr?: string; 315 316 /** 317 * Iptables ip destination address 318 * 319 * @type { ?string } 320 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 321 * @systemapi 322 * @stagemodelonly 323 * @since 10 324 */ 325 destAddr?: string; 326 327 /** 328 * Iptables source port 329 * 330 * @type { ?string } 331 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 332 * @systemapi 333 * @stagemodelonly 334 * @since 10 335 */ 336 srcPort?: string; 337 338 /** 339 * Iptables destination port 340 * 341 * @type { ?string } 342 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 343 * @systemapi 344 * @stagemodelonly 345 * @since 10 346 */ 347 destPort?: string; 348 349 /** 350 * Application uid 351 * 352 * @type { ?string } 353 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 354 * @systemapi 355 * @stagemodelonly 356 * @since 10 357 */ 358 uid?: string; 359 360 /** 361 * Direction 362 * 363 * @type { Direction } 364 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 365 * @systemapi 366 * @stagemodelonly 367 * @since 10 368 */ 369 direction: Direction; 370 371 /** 372 * Action 373 * 374 * @type { ?Action } 375 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 376 * @systemapi 377 * @stagemodelonly 378 * @since 10 379 */ 380 action?: Action; 381 382 /** 383 * Protocol 384 * 385 * @type { ?Protocol } 386 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 387 * @systemapi 388 * @stagemodelonly 389 * @since 10 390 */ 391 protocol?: Protocol; 392 } 393 394 /** 395 * Gets all of the network interfaces of the device. 396 * This function can be called by a super administrator. 397 * 398 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 399 * @param { Want } admin - admin indicates the administrator ability information. 400 * @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces. 401 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 402 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 403 * @throws { BusinessError } 201 - the application does not have permission to call this function. 404 * @throws { BusinessError } 202 - not system application. 405 * @throws { BusinessError } 401 - invalid input parameter. 406 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 407 * @systemapi 408 * @stagemodelonly 409 * @since 10 410 */ 411 function getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void; 412 413 /** 414 * Gets all of the network interfaces of the device. 415 * This function can be called by a super administrator. 416 * 417 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 418 * @param { Want } admin - admin indicates the administrator ability information. 419 * @returns { Promise<Array<string>> } the promise returned by getAllNetworkInterfaces. 420 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 421 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 422 * @throws { BusinessError } 201 - the application does not have permission to call this function. 423 * @throws { BusinessError } 202 - not system application. 424 * @throws { BusinessError } 401 - invalid input parameter. 425 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 426 * @systemapi 427 * @stagemodelonly 428 * @since 10 429 */ 430 function getAllNetworkInterfaces(admin: Want): Promise<Array<string>>; 431 432 /** 433 * Gets the ip address of the network interface. 434 * This function can be called by a super administrator. 435 * 436 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 437 * @param { Want } admin - admin indicates the administrator ability information. 438 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 439 * @param { AsyncCallback<string> } callback - the callback of getIpAddress. 440 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 441 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 442 * @throws { BusinessError } 201 - the application does not have permission to call this function. 443 * @throws { BusinessError } 202 - not system application. 444 * @throws { BusinessError } 401 - invalid input parameter. 445 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 446 * @systemapi 447 * @stagemodelonly 448 * @since 10 449 */ 450 function getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 451 452 /** 453 * Gets the ip address of the network interface. 454 * This function can be called by a super administrator. 455 * 456 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 457 * @param { Want } admin - admin indicates the administrator ability information. 458 * @param { string } networkInterface - networkInterface indicates the network interface to get ip address. 459 * @returns { Promise<string> } the promise returned by getIpAddress. 460 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 461 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 462 * @throws { BusinessError } 201 - the application does not have permission to call this function. 463 * @throws { BusinessError } 202 - not system application. 464 * @throws { BusinessError } 401 - invalid input parameter. 465 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 466 * @systemapi 467 * @stagemodelonly 468 * @since 10 469 */ 470 function getIpAddress(admin: Want, networkInterface: string): Promise<string>; 471 472 /** 473 * Gets the mac address of the network interface. 474 * This function can be called by a super administrator. 475 * 476 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 477 * @param { Want } admin - admin indicates the administrator ability information. 478 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 479 * @param { AsyncCallback<string> } callback - the callback of getMac. 480 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 481 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 482 * @throws { BusinessError } 201 - the application does not have permission to call this function. 483 * @throws { BusinessError } 202 - not system application. 484 * @throws { BusinessError } 401 - invalid input parameter. 485 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 486 * @systemapi 487 * @stagemodelonly 488 * @since 10 489 */ 490 function getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void; 491 492 /** 493 * Gets the mac address of the network interface. 494 * This function can be called by a super administrator. 495 * 496 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 497 * @param { Want } admin - admin indicates the administrator ability information. 498 * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. 499 * @returns { Promise<string> } the promise returned by getMac. 500 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 501 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 502 * @throws { BusinessError } 201 - the application does not have permission to call this function. 503 * @throws { BusinessError } 202 - not system application. 504 * @throws { BusinessError } 401 - invalid input parameter. 505 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 506 * @systemapi 507 * @stagemodelonly 508 * @since 10 509 */ 510 function getMac(admin: Want, networkInterface: string): Promise<string>; 511 512 /** 513 * Gets state of whether the network interface is disabled. 514 * This function can be called by a super administrator. 515 * 516 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 517 * @param { Want } admin - admin indicates the administrator ability information. 518 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 519 * @param { AsyncCallback<boolean> } callback - the callback of isNetworkInterfaceDisabled. 520 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 521 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 522 * @throws { BusinessError } 201 - the application does not have permission to call this function. 523 * @throws { BusinessError } 202 - not system application. 524 * @throws { BusinessError } 401 - invalid input parameter. 525 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 526 * @systemapi 527 * @stagemodelonly 528 * @since 10 529 */ 530 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback<boolean>): void; 531 532 /** 533 * Gets state of whether the network interface is disabled. 534 * This function can be called by a super administrator. 535 * 536 * @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO 537 * @param { Want } admin - admin indicates the administrator ability information. 538 * @param { string } networkInterface - networkInterface indicates the network interface to get status. 539 * @returns { Promise<boolean> } the promise returned by isNetworkInterfaceDisabled. 540 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 541 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 542 * @throws { BusinessError } 201 - the application does not have permission to call this function. 543 * @throws { BusinessError } 202 - not system application. 544 * @throws { BusinessError } 401 - invalid input parameter. 545 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 546 * @systemapi 547 * @stagemodelonly 548 * @since 10 549 */ 550 function isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<boolean>; 551 552 /** 553 * Disables the network interfaces. 554 * This function can be called by a super administrator. 555 * 556 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 557 * @param { Want } admin - admin indicates the administrator ability information. 558 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 559 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 560 * @param { AsyncCallback<void> } callback - the callback of setNetworkInterfaceDisabled. 561 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 562 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 563 * @throws { BusinessError } 201 - the application does not have permission to call this function. 564 * @throws { BusinessError } 202 - not system application. 565 * @throws { BusinessError } 401 - invalid input parameter. 566 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 567 * @systemapi 568 * @stagemodelonly 569 * @since 10 570 */ 571 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback<void>): void; 572 573 /** 574 * Disables the network interfaces. 575 * This function can be called by a super administrator. 576 * 577 * @permission ohos.permission.ENTERPRISE_SET_NETWORK 578 * @param { Want } admin - admin indicates the administrator ability information. 579 * @param { string } networkInterface - networkInterface indicates the network interface to set status. 580 * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. 581 * @returns { Promise<void> } the promise returned setNetworkInterfaceDisabled. 582 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 583 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 584 * @throws { BusinessError } 201 - the application does not have permission to call this function. 585 * @throws { BusinessError } 202 - not system application. 586 * @throws { BusinessError } 401 - invalid input parameter. 587 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 588 * @systemapi 589 * @stagemodelonly 590 * @since 10 591 */ 592 function setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise<void>; 593 594 /** 595 * Set a network independent global {@link connection.HttpProxy} proxy. 596 * This function can be called by a super administrator. 597 * 598 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 599 * @param { Want } admin - admin indicates the administrator ability information. 600 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 601 * @param { AsyncCallback<void> } callback - the callback of setGlobalProxy. 602 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 603 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 604 * @throws { BusinessError } 201 - the application does not have permission to call this function. 605 * @throws { BusinessError } 202 - not system application. 606 * @throws { BusinessError } 401 - invalid input parameter. 607 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 608 * @systemapi 609 * @stagemodelonly 610 * @since 10 611 */ 612 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy, callback: AsyncCallback<void>): void; 613 614 /** 615 * Set a network independent global {@link connection.HttpProxy} proxy. 616 * This function can be called by a super administrator. 617 * 618 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 619 * @param { Want } admin - admin indicates the administrator ability information. 620 * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. 621 * @returns { Promise<void> } the promise returned by the setGlobalProxy. 622 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 623 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 624 * @throws { BusinessError } 201 - the application does not have permission to call this function. 625 * @throws { BusinessError } 202 - not system application. 626 * @throws { BusinessError } 401 - invalid input parameter. 627 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 628 * @systemapi 629 * @stagemodelonly 630 * @since 10 631 */ 632 function setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy): Promise<void>; 633 634 /** 635 * Obtains the network independent global {@link connection.HttpProxy} proxy. 636 * This function can be called by a super administrator. 637 * 638 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 639 * @param { Want } admin - admin indicates the administrator ability information. 640 * @param { AsyncCallback<connection.HttpProxy> } callback - the callback carries the network global proxy configuration information. 641 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 642 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 643 * @throws { BusinessError } 201 - the application does not have permission to call this function. 644 * @throws { BusinessError } 202 - not system application. 645 * @throws { BusinessError } 401 - invalid input parameter. 646 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 647 * @systemapi 648 * @stagemodelonly 649 * @since 10 650 */ 651 function getGlobalProxy(admin: Want, callback: AsyncCallback<connection.HttpProxy>): void; 652 653 /** 654 * Obtains the network independent global {@link connection.HttpProxy} proxy. 655 * This function can be called by a super administrator. 656 * 657 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 658 * @param { Want } admin - admin indicates the administrator ability information. 659 * @returns { Promise<connection.HttpProxy> } the promise carries the network global proxy configuration information. 660 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 661 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 662 * @throws { BusinessError } 201 - the application does not have permission to call this function. 663 * @throws { BusinessError } 202 - not system application. 664 * @throws { BusinessError } 401 - invalid input parameter. 665 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 666 * @systemapi 667 * @stagemodelonly 668 * @since 10 669 */ 670 function getGlobalProxy(admin: Want): Promise<connection.HttpProxy>; 671 672 /** 673 * Add iptables filter rule by {@link AddFilterRule}. 674 * This function can be called by a super administrator. 675 * 676 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 677 * @param { Want } admin - admin indicates the administrator ability information. 678 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 679 * @param { AsyncCallback<void> } callback - the callback of addIptablesFilterRule. 680 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 681 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 682 * @throws { BusinessError } 201 - the application does not have permission to call this function. 683 * @throws { BusinessError } 202 - not system application. 684 * @throws { BusinessError } 401 - invalid input parameter. 685 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 686 * @systemapi 687 * @stagemodelonly 688 * @since 10 689 */ 690 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule, callback: AsyncCallback<void>): void; 691 692 /** 693 * Add iptables filter rule by {@link AddFilterRule}. 694 * This function can be called by a super administrator. 695 * 696 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 697 * @param { Want } admin - admin indicates the administrator ability information. 698 * @param { AddFilterRule } filterRule - iptables filter rule configuration information. 699 * @returns { Promise<void> } the promise returned by the addIptablesFilterRule. 700 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 701 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 702 * @throws { BusinessError } 201 - the application does not have permission to call this function. 703 * @throws { BusinessError } 202 - not system application. 704 * @throws { BusinessError } 401 - invalid input parameter. 705 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 706 * @systemapi 707 * @stagemodelonly 708 * @since 10 709 */ 710 function addIptablesFilterRule(admin: Want, filterRule: AddFilterRule): Promise<void>; 711 712 /** 713 * Remove iptables filter rule by {@link RemoveFilterRule}. 714 * This function can be called by a super administrator. 715 * 716 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 717 * @param { Want } admin - admin indicates the administrator ability information. 718 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 719 * @param { AsyncCallback<void> } callback - the callback of removeIptablesFilterRule. 720 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 721 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 722 * @throws { BusinessError } 201 - the application does not have permission to call this function. 723 * @throws { BusinessError } 202 - not system application. 724 * @throws { BusinessError } 401 - invalid input parameter. 725 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 726 * @systemapi 727 * @stagemodelonly 728 * @since 10 729 */ 730 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule, callback: AsyncCallback<void>): void; 731 732 /** 733 * Remove iptables filter rule by {@link RemoveFilterRule}. 734 * This function can be called by a super administrator. 735 * 736 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 737 * @param { Want } admin - admin indicates the administrator ability information. 738 * @param { RemoveFilterRule } filterRule - iptables filter rule configuration information. 739 * @returns { Promise<void> } the promise returned by the removeIptablesFilterRule. 740 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 741 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 742 * @throws { BusinessError } 201 - the application does not have permission to call this function. 743 * @throws { BusinessError } 202 - not system application. 744 * @throws { BusinessError } 401 - invalid input parameter. 745 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 746 * @systemapi 747 * @stagemodelonly 748 * @since 10 749 */ 750 function removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule): Promise<void>; 751 752 /** 753 * Query iptables rule and list the result. 754 * This function can be called by a super administrator. 755 * 756 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 757 * @param { Want } admin - admin indicates the administrator ability information. 758 * @param { AsyncCallback<string> } callback - the callback carries the iptables rules in the table filter. 759 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 760 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 761 * @throws { BusinessError } 201 - the application does not have permission to call this function. 762 * @throws { BusinessError } 202 - not system application. 763 * @throws { BusinessError } 401 - invalid input parameter. 764 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 765 * @systemapi 766 * @stagemodelonly 767 * @since 10 768 */ 769 function listIptablesFilterRules(admin: Want, callback: AsyncCallback<string>): void; 770 771 /** 772 * Query iptables rule and list the result. 773 * This function can be called by a super administrator. 774 * 775 * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK 776 * @param { Want } admin - admin indicates the administrator ability information. 777 * @returns { Promise<string> } the promise carries the iptables rules in the table filter. 778 * @throws { BusinessError } 9200001 - the application is not an administrator of the device. 779 * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. 780 * @throws { BusinessError } 201 - the application does not have permission to call this function. 781 * @throws { BusinessError } 202 - not system application. 782 * @throws { BusinessError } 401 - invalid input parameter. 783 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 784 * @systemapi 785 * @stagemodelonly 786 * @since 10 787 */ 788 function listIptablesFilterRules(admin: Want): Promise<string>; 789} 790 791export default networkManager; 792