From adcacf9cc82cc5b6600b98fd6f06ef58c93626d1 Mon Sep 17 00:00:00 2001 From: SS-Knife Date: Sun, 9 Feb 2025 21:03:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat():iptable=E6=93=8D=E4=BD=9C=E7=9B=B8?= =?UTF-8?q?=E5=85=B3interface=20DomainFilterRule=E6=96=B0=E5=A2=9Edirectio?= =?UTF-8?q?n=E5=8F=82=E6=95=B0=20feat():iptable=E6=93=8D=E4=BD=9C=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=9E=9A=E4=B8=BE=E5=80=BCaction=E6=96=B0=E5=A2=9Erej?= =?UTF-8?q?ect=E9=A1=B9=20feat():iptable=E6=93=8D=E4=BD=9C=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=9E=9A=E4=B8=BE=E5=80=BCdirection=E6=96=B0=E5=A2=9E?= =?UTF-8?q?forward=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SS-Knife --- api/@ohos.enterprise.networkManager.d.ts | 56 +++++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/api/@ohos.enterprise.networkManager.d.ts b/api/@ohos.enterprise.networkManager.d.ts index 2f24106ba6..688484230b 100644 --- a/api/@ohos.enterprise.networkManager.d.ts +++ b/api/@ohos.enterprise.networkManager.d.ts @@ -69,6 +69,14 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 + */ + /** + * Iptables rule direction. add new direction FORWARD + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 */ enum Direction { /** @@ -87,7 +95,16 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - OUTPUT = 1 + OUTPUT = 1, + + /** + * Forward direction + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + FORWARD = 2 } /** @@ -97,6 +114,14 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 + */ + /** + * Iptables rule action. add new action: REJECT + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 */ enum Action { /** @@ -115,7 +140,16 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - DENY = 1 + DENY = 1, + + /** + * Action reject + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ + REJECT = 2 } /** @@ -481,6 +515,14 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 + */ + /** + * Domain filter rule add new var: Direction direction + * + * @typedef DomainFilterRule + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 */ interface DomainFilterRule { /** @@ -512,6 +554,16 @@ declare namespace networkManager { * @since 12 */ action?: Action; + + /** + * Direction + * + * @type { ?Direction } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ + direction?: Direction; } /** -- Gitee From beac2806bc03f9e9fd8a66fce0965fa71bb55de9 Mon Sep 17 00:00:00 2001 From: SS-Knife Date: Mon, 10 Feb 2025 17:28:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat():=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?doc=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SS-Knife --- api/@ohos.enterprise.networkManager.d.ts | 141 +++++++++++++++++++---- 1 file changed, 116 insertions(+), 25 deletions(-) diff --git a/api/@ohos.enterprise.networkManager.d.ts b/api/@ohos.enterprise.networkManager.d.ts index 688484230b..0999033751 100644 --- a/api/@ohos.enterprise.networkManager.d.ts +++ b/api/@ohos.enterprise.networkManager.d.ts @@ -69,14 +69,6 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 - */ - /** - * Iptables rule direction. add new direction FORWARD - * - * @enum { number } - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 */ enum Direction { /** @@ -102,7 +94,7 @@ declare namespace networkManager { * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly - * @since 12 + * @since 15 */ FORWARD = 2 } @@ -114,14 +106,6 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 - */ - /** - * Iptables rule action. add new action: REJECT - * - * @enum { number } - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 */ enum Action { /** @@ -515,14 +499,6 @@ declare namespace networkManager { * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @stagemodelonly * @since 12 - */ - /** - * Domain filter rule add new var: Direction direction - * - * @typedef DomainFilterRule - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 */ interface DomainFilterRule { /** @@ -1156,6 +1132,25 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Adds firewall rule by {@link Firewall}. + * This function can be called by a super administrator. + * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { FirewallRule } firewallRule - firewall rule that needs to be added. + * enum direction add new item FORWARD. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; /** @@ -1176,6 +1171,26 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Removes firewall rule by {@link Firewall}. + * This function can be called by a super administrator. + * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. + * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. + * enum direction add new item FORWARD. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; /** @@ -1195,6 +1210,24 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. + * This function can be called by a super administrator. + * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } an array of added firewall rules. enum direction add new item FORWARD. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function getFirewallRules(admin: Want): Array; /** @@ -1214,6 +1247,25 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Adds domain filter rule by {@link DomainFilterRule}. + * This function can be called by a super administrator. + * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. + * add new enum direction. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; /** @@ -1234,6 +1286,26 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Removes domain filter rule by {@link DomainFilterRule}. + * This function can be called by a super administrator. + * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. + * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. + * add new enum direction. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; /** @@ -1253,6 +1325,25 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ + /** + * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. + * This function can be called by a super administrator. + * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } an array of added domain filter rules. + * add new enum direction. enum action add new item REJECT. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 15 + */ function getDomainFilterRules(admin: Want): Array; } -- Gitee From 93efd933baf5b6a0151b3ebb25c788598497069d Mon Sep 17 00:00:00 2001 From: SS-Knife Date: Mon, 10 Feb 2025 19:48:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix():=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88d?= =?UTF-8?q?oc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SS-Knife --- api/@ohos.enterprise.networkManager.d.ts | 115 ----------------------- 1 file changed, 115 deletions(-) diff --git a/api/@ohos.enterprise.networkManager.d.ts b/api/@ohos.enterprise.networkManager.d.ts index 0999033751..621872dfa1 100644 --- a/api/@ohos.enterprise.networkManager.d.ts +++ b/api/@ohos.enterprise.networkManager.d.ts @@ -1132,25 +1132,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Adds firewall rule by {@link Firewall}. - * This function can be called by a super administrator. - * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @param { FirewallRule } firewallRule - firewall rule that needs to be added. - * enum direction add new item FORWARD. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; /** @@ -1171,26 +1152,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Removes firewall rule by {@link Firewall}. - * This function can be called by a super administrator. - * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. - * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. - * enum direction add new item FORWARD. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; /** @@ -1210,24 +1171,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. - * This function can be called by a super administrator. - * enum direction in param FirewallRule add new item FORWARD. enum action in param FirewallRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @returns { Array } an array of added firewall rules. enum direction add new item FORWARD. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function getFirewallRules(admin: Want): Array; /** @@ -1247,25 +1190,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Adds domain filter rule by {@link DomainFilterRule}. - * This function can be called by a super administrator. - * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. - * add new enum direction. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; /** @@ -1286,26 +1210,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Removes domain filter rule by {@link DomainFilterRule}. - * This function can be called by a super administrator. - * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. - * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. - * add new enum direction. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; /** @@ -1325,25 +1229,6 @@ declare namespace networkManager { * @stagemodelonly * @since 12 */ - /** - * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. - * This function can be called by a super administrator. - * param DomainFilterRule add new enum direction. enum action in param DomainFilterRule add new item REJECT. - * - * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK - * @param { Want } admin - admin indicates the enterprise admin extension ability information. - * The admin must have the corresponding permission. - * @returns { Array } an array of added domain filter rules. - * add new enum direction. enum action add new item REJECT. - * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. - * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @stagemodelonly - * @since 15 - */ function getDomainFilterRules(admin: Want): Array; } -- Gitee