diff options
Diffstat (limited to 'common/netd')
262 files changed, 0 insertions, 17558 deletions
diff --git a/common/netd/Android.bp b/common/netd/Android.bp deleted file mode 100644 index d135a1c8..00000000 --- a/common/netd/Android.bp +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (C) 2021 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library { - name: "netd_aidl_interface-lateststable-java", - sdk_version: "system_current", - min_sdk_version: "29", - static_libs: [ - "netd_aidl_interface-V13-java", - ], - apex_available: [ - "//apex_available:platform", // used from services.net - "com.android.tethering", - "com.android.wifi", - ], -} - -cc_library_static { - name: "netd_event_listener_interface-lateststable-ndk", - whole_static_libs: [ - "netd_event_listener_interface-V1-ndk", - ], - apex_available: [ - "com.android.resolv", - ], - min_sdk_version: "29", -} - -cc_library_static { - name: "netd_aidl_interface-lateststable-ndk", - whole_static_libs: [ - "netd_aidl_interface-V13-ndk", - ], - apex_available: [ - "com.android.resolv", - "com.android.tethering", - ], - min_sdk_version: "29", -} - -cc_defaults { - name: "netd_aidl_interface_lateststable_cpp_static", - static_libs: ["netd_aidl_interface-V13-cpp"], -} - -cc_defaults { - name: "netd_aidl_interface_lateststable_cpp_shared", - shared_libs: ["netd_aidl_interface-V13-cpp"], -} - -aidl_interface { - name: "netd_aidl_interface", - local_include_dir: "binder", - srcs: [ - "binder/android/net/INetd.aidl", - // AIDL interface that callers can implement to receive networking events from netd. - "binder/android/net/INetdUnsolicitedEventListener.aidl", - "binder/android/net/InterfaceConfigurationParcel.aidl", - "binder/android/net/IpSecMigrateInfoParcel.aidl", - "binder/android/net/MarkMaskParcel.aidl", - "binder/android/net/NativeNetworkConfig.aidl", - "binder/android/net/NativeNetworkType.aidl", - "binder/android/net/NativeVpnType.aidl", - "binder/android/net/RouteInfoParcel.aidl", - "binder/android/net/TetherConfigParcel.aidl", - "binder/android/net/TetherOffloadRuleParcel.aidl", - "binder/android/net/TetherStatsParcel.aidl", - "binder/android/net/UidRangeParcel.aidl", - // Add new AIDL classes in android.net.netd.aidl to consist with other network modules. - "binder/android/net/netd/aidl/**/*.aidl", - ], - backend: { - cpp: { - gen_log: true, - }, - java: { - // TODO: Remove apex_available and restrict visibility to only mainline modules that are - // either outside the system server or use jarjar to rename the generated AIDL classes. - apex_available: [ - "//apex_available:platform", // used from services.net - "com.android.tethering", - "com.android.wifi", - ], - // this is part of updatable modules(NetworkStack) which targets 29(Q) - min_sdk_version: "29", - }, - ndk: { - apex_available: [ - "//apex_available:platform", - "com.android.tethering", - ], - // This is necessary for the DnsResovler tests to run in Android Q. - // Soong would recognize this value and produce the Q compatible aidl library. - min_sdk_version: "29", - }, - }, - versions_with_info: [ - { - version: "1", - imports: [], - }, - { - version: "2", - imports: [], - }, - { - version: "3", - imports: [], - }, - { - version: "4", - imports: [], - }, - { - version: "5", - imports: [], - }, - { - version: "6", - imports: [], - }, - { - version: "7", - imports: [], - }, - { - version: "8", - imports: [], - }, - { - version: "9", - imports: [], - }, - { - version: "10", - imports: [], - }, - { - version: "11", - imports: [], - }, - { - version: "12", - imports: [], - }, - { - version: "13", - imports: [], - }, - - ], - -} - -java_library { - name: "netd_event_listener_interface-lateststable-java", - sdk_version: "system_current", - min_sdk_version: "29", - static_libs: [ - "netd_event_listener_interface-V1-java", - ], - apex_available: [ - "//apex_available:platform", - "com.android.wifi", - "com.android.tethering", - ], -} - -aidl_interface { - name: "netd_event_listener_interface", - local_include_dir: "binder", - srcs: [ - "binder/android/net/metrics/INetdEventListener.aidl", - ], - - backend: { - ndk: { - apex_available: [ - "//apex_available:platform", - "com.android.resolv", - ], - min_sdk_version: "29", - }, - java: { - apex_available: [ - "//apex_available:platform", - "com.android.wifi", - "com.android.tethering", - ], - min_sdk_version: "29", - }, - }, - versions_with_info: [ - { - version: "1", - imports: [], - }, - { - version: "2", - imports: [], - }, - - ], - frozen: true, - -} - -java_library { - name: "mdns_aidl_interface-lateststable-java", - sdk_version: "module_current", - min_sdk_version: "30", - static_libs: [ - "mdns_aidl_interface-V1-java", - ], - apex_available: [ - "//apex_available:platform", - "com.android.tethering", - ], -} - -aidl_interface { - name: "mdns_aidl_interface", - local_include_dir: "binder", - srcs: [ - "binder/android/net/mdns/aidl/**/*.aidl", - ], - backend: { - java: { - sdk_version: "module_current", - apex_available: [ - "//apex_available:platform", - "com.android.tethering", - ], - min_sdk_version: "30", - }, - }, - versions: ["1"], -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/.hash b/common/netd/aidl_api/mdns_aidl_interface/1/.hash deleted file mode 100644 index d952c598..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/.hash +++ /dev/null @@ -1 +0,0 @@ -ae4cfe565d66acc7d816aabd0dfab991e64031ab diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/DiscoveryInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/DiscoveryInfo.aidl deleted file mode 100644 index d31a3278..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/DiscoveryInfo.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable DiscoveryInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - @utf8InCpp String domainName; - int interfaceIdx; - int netId; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/GetAddressInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/GetAddressInfo.aidl deleted file mode 100644 index 20492744..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/GetAddressInfo.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable GetAddressInfo { - int id; - int result; - @utf8InCpp String hostname; - @utf8InCpp String address; - int interfaceIdx; - int netId; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDns.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDns.aidl deleted file mode 100644 index ecbe966d..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDns.aidl +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -interface IMDns { - void startDaemon(); - void stopDaemon(); - void registerService(in android.net.mdns.aidl.RegistrationInfo info); - void discover(in android.net.mdns.aidl.DiscoveryInfo info); - void resolve(in android.net.mdns.aidl.ResolutionInfo info); - void getServiceAddress(in android.net.mdns.aidl.GetAddressInfo info); - void stopOperation(int id); - void registerEventListener(in android.net.mdns.aidl.IMDnsEventListener listener); - void unregisterEventListener(in android.net.mdns.aidl.IMDnsEventListener listener); -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDnsEventListener.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDnsEventListener.aidl deleted file mode 100644 index 4625cac7..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/IMDnsEventListener.aidl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -interface IMDnsEventListener { - oneway void onServiceRegistrationStatus(in android.net.mdns.aidl.RegistrationInfo status); - oneway void onServiceDiscoveryStatus(in android.net.mdns.aidl.DiscoveryInfo status); - oneway void onServiceResolutionStatus(in android.net.mdns.aidl.ResolutionInfo status); - oneway void onGettingServiceAddressStatus(in android.net.mdns.aidl.GetAddressInfo status); - const int SERVICE_DISCOVERY_FAILED = 602; - const int SERVICE_FOUND = 603; - const int SERVICE_LOST = 604; - const int SERVICE_REGISTRATION_FAILED = 605; - const int SERVICE_REGISTERED = 606; - const int SERVICE_RESOLUTION_FAILED = 607; - const int SERVICE_RESOLVED = 608; - const int SERVICE_GET_ADDR_FAILED = 611; - const int SERVICE_GET_ADDR_SUCCESS = 612; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/RegistrationInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/RegistrationInfo.aidl deleted file mode 100644 index 185111b4..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/RegistrationInfo.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable RegistrationInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - int port; - byte[] txtRecord; - int interfaceIdx; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/ResolutionInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/ResolutionInfo.aidl deleted file mode 100644 index 4aa7d791..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/1/android/net/mdns/aidl/ResolutionInfo.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable ResolutionInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - @utf8InCpp String domain; - @utf8InCpp String serviceFullName; - @utf8InCpp String hostname; - int port; - byte[] txtRecord; - int interfaceIdx; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/DiscoveryInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/DiscoveryInfo.aidl deleted file mode 100644 index d31a3278..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/DiscoveryInfo.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable DiscoveryInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - @utf8InCpp String domainName; - int interfaceIdx; - int netId; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/GetAddressInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/GetAddressInfo.aidl deleted file mode 100644 index 20492744..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/GetAddressInfo.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable GetAddressInfo { - int id; - int result; - @utf8InCpp String hostname; - @utf8InCpp String address; - int interfaceIdx; - int netId; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDns.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDns.aidl deleted file mode 100644 index ecbe966d..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDns.aidl +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -interface IMDns { - void startDaemon(); - void stopDaemon(); - void registerService(in android.net.mdns.aidl.RegistrationInfo info); - void discover(in android.net.mdns.aidl.DiscoveryInfo info); - void resolve(in android.net.mdns.aidl.ResolutionInfo info); - void getServiceAddress(in android.net.mdns.aidl.GetAddressInfo info); - void stopOperation(int id); - void registerEventListener(in android.net.mdns.aidl.IMDnsEventListener listener); - void unregisterEventListener(in android.net.mdns.aidl.IMDnsEventListener listener); -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDnsEventListener.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDnsEventListener.aidl deleted file mode 100644 index 4625cac7..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/IMDnsEventListener.aidl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -interface IMDnsEventListener { - oneway void onServiceRegistrationStatus(in android.net.mdns.aidl.RegistrationInfo status); - oneway void onServiceDiscoveryStatus(in android.net.mdns.aidl.DiscoveryInfo status); - oneway void onServiceResolutionStatus(in android.net.mdns.aidl.ResolutionInfo status); - oneway void onGettingServiceAddressStatus(in android.net.mdns.aidl.GetAddressInfo status); - const int SERVICE_DISCOVERY_FAILED = 602; - const int SERVICE_FOUND = 603; - const int SERVICE_LOST = 604; - const int SERVICE_REGISTRATION_FAILED = 605; - const int SERVICE_REGISTERED = 606; - const int SERVICE_RESOLUTION_FAILED = 607; - const int SERVICE_RESOLVED = 608; - const int SERVICE_GET_ADDR_FAILED = 611; - const int SERVICE_GET_ADDR_SUCCESS = 612; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/RegistrationInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/RegistrationInfo.aidl deleted file mode 100644 index 185111b4..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/RegistrationInfo.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable RegistrationInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - int port; - byte[] txtRecord; - int interfaceIdx; -} diff --git a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/ResolutionInfo.aidl b/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/ResolutionInfo.aidl deleted file mode 100644 index 4aa7d791..00000000 --- a/common/netd/aidl_api/mdns_aidl_interface/current/android/net/mdns/aidl/ResolutionInfo.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.mdns.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable ResolutionInfo { - int id; - int result; - @utf8InCpp String serviceName; - @utf8InCpp String registrationType; - @utf8InCpp String domain; - @utf8InCpp String serviceFullName; - @utf8InCpp String hostname; - int port; - byte[] txtRecord; - int interfaceIdx; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/1/.hash b/common/netd/aidl_api/netd_aidl_interface/1/.hash deleted file mode 100644 index d33e9038..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/.hash +++ /dev/null @@ -1 +0,0 @@ -69c2ac134efbb31e9591d7e5c3640fb839e23bdb diff --git a/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetd.aidl deleted file mode 100644 index 664c643f..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetd.aidl +++ /dev/null @@ -1,132 +0,0 @@ -package android.net; -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isWhitelist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - void networkCreatePhysical(int netId, int permission); - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 18631ffa..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,14 +0,0 @@ -package android.net; -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/1/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/1/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 93407dcb..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net; -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/1/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/1/android/net/TetherStatsParcel.aidl deleted file mode 100644 index d1782bb0..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net; -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/1/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/1/android/net/UidRangeParcel.aidl deleted file mode 100644 index d3bc7edf..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/1/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package android.net; -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/.hash b/common/netd/aidl_api/netd_aidl_interface/10/.hash deleted file mode 100644 index 6ec36135..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/.hash +++ /dev/null @@ -1 +0,0 @@ -3943383e838f39851675e3640fcdf27b42f8c9fc diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetd.aidl deleted file mode 100644 index e671fdb7..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetd.aidl +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int CLAT_MARK = -559038041; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkType.aidl deleted file mode 100644 index 06c8979d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/10/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/10/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/10/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/.hash b/common/netd/aidl_api/netd_aidl_interface/11/.hash deleted file mode 100644 index d22cb04b..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/.hash +++ /dev/null @@ -1 +0,0 @@ -d384a1d9f2f6dc0301a43d2b9d6d3a49e3898ae7 diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetd.aidl deleted file mode 100644 index e671fdb7..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetd.aidl +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int CLAT_MARK = -559038041; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkType.aidl deleted file mode 100644 index e77a1432..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, - PHYSICAL_LOCAL = 2, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/11/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/11/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/11/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/.hash b/common/netd/aidl_api/netd_aidl_interface/12/.hash deleted file mode 100644 index 7a4d53c2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/.hash +++ /dev/null @@ -1 +0,0 @@ -5a3a5f46fe31c118889d7a92be4faafb3df651ff diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetd.aidl deleted file mode 100644 index 763b92ac..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetd.aidl +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void ipSecMigrate(in android.net.IpSecMigrateInfoParcel migrateInfo); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int CLAT_MARK = -559038041; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; - const int IPSEC_DIRECTION_IN = 0; - const int IPSEC_DIRECTION_OUT = 1; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/IpSecMigrateInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/IpSecMigrateInfoParcel.aidl deleted file mode 100644 index 975a2619..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/IpSecMigrateInfoParcel.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@JavaOnlyImmutable -parcelable IpSecMigrateInfoParcel { - int requestId; - int selAddrFamily; - int direction; - @utf8InCpp String oldSourceAddress; - @utf8InCpp String oldDestinationAddress; - @utf8InCpp String newSourceAddress; - @utf8InCpp String newDestinationAddress; - int interfaceId; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkType.aidl deleted file mode 100644 index e77a1432..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, - PHYSICAL_LOCAL = 2, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/12/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/12/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/12/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/.hash b/common/netd/aidl_api/netd_aidl_interface/13/.hash deleted file mode 100644 index d3c72cfb..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/.hash +++ /dev/null @@ -1 +0,0 @@ -38614f80a23b92603d4851177e57c460aec1b606 diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetd.aidl deleted file mode 100644 index 35077847..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetd.aidl +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void ipSecMigrate(in android.net.IpSecMigrateInfoParcel migrateInfo); - void setNetworkAllowlist(in android.net.netd.aidl.NativeUidRangeConfig[] allowedNetworks); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int CLAT_MARK = 0xdeadc1a7; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = (-1); - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; - const int IPSEC_DIRECTION_IN = 0; - const int IPSEC_DIRECTION_OUT = 1; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/IpSecMigrateInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/IpSecMigrateInfoParcel.aidl deleted file mode 100644 index 975a2619..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/IpSecMigrateInfoParcel.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@JavaOnlyImmutable -parcelable IpSecMigrateInfoParcel { - int requestId; - int selAddrFamily; - int direction; - @utf8InCpp String oldSourceAddress; - @utf8InCpp String oldDestinationAddress; - @utf8InCpp String newSourceAddress; - @utf8InCpp String newDestinationAddress; - int interfaceId; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkType.aidl deleted file mode 100644 index e77a1432..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, - PHYSICAL_LOCAL = 2, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/13/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/13/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/13/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/2/.hash b/common/netd/aidl_api/netd_aidl_interface/2/.hash deleted file mode 100644 index 5fc5b2d7..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/.hash +++ /dev/null @@ -1 +0,0 @@ -e395d63302c47e7d2dac0d503045779029ff598b diff --git a/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetd.aidl deleted file mode 100644 index 0e2d5f43..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetd.aidl +++ /dev/null @@ -1,153 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isWhitelist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - void networkCreatePhysical(int netId, int permission); - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 621f1cf8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/2/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/2/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 18de61f3..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/2/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/2/android/net/TetherStatsParcel.aidl deleted file mode 100644 index c0ba6766..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/2/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/2/android/net/UidRangeParcel.aidl deleted file mode 100644 index c2c35db2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/2/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/.hash b/common/netd/aidl_api/netd_aidl_interface/3/.hash deleted file mode 100644 index 59cf7089..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/.hash +++ /dev/null @@ -1 +0,0 @@ -e17c1f9b2068b539b22e3a4a447edea3c80aee4b diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetd.aidl deleted file mode 100644 index 135b7385..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetd.aidl +++ /dev/null @@ -1,161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isWhitelist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - void networkCreatePhysical(int netId, int permission); - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 44593632..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 01e0f955..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 62be8384..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5e0ee62a..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherConfigParcel.aidl deleted file mode 100644 index b1364545..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 3abf0f89..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 71ffb9b9..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/3/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/3/android/net/UidRangeParcel.aidl deleted file mode 100644 index 84ff4572..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/3/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/.hash b/common/netd/aidl_api/netd_aidl_interface/4/.hash deleted file mode 100644 index 0c3f810e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/.hash +++ /dev/null @@ -1 +0,0 @@ -63adaa5098e4d8621e90c5a84f7cb93505c79311 diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetd.aidl deleted file mode 100644 index 47e2931d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetd.aidl +++ /dev/null @@ -1,164 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isWhitelist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - void networkCreatePhysical(int netId, int permission); - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 44593632..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 01e0f955..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 62be8384..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5e0ee62a..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherConfigParcel.aidl deleted file mode 100644 index b1364545..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index c9d84580..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 0b0960ef..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/4/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/4/android/net/UidRangeParcel.aidl deleted file mode 100644 index 84ff4572..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/4/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/.hash b/common/netd/aidl_api/netd_aidl_interface/5/.hash deleted file mode 100644 index a6ced453..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/.hash +++ /dev/null @@ -1 +0,0 @@ -d97c56dd789cee9eeb5cdcec43a99df0a01873a5 diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetd.aidl deleted file mode 100644 index b30748a3..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetd.aidl +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - void networkCreatePhysical(int netId, int permission); - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - const @JavaPassthrough(annotation="@Deprecated") int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - const @JavaPassthrough(annotation="@Deprecated") int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 44593632..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 01e0f955..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 62be8384..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5e0ee62a..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherConfigParcel.aidl deleted file mode 100644 index b1364545..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index c9d84580..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 0b0960ef..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/5/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/5/android/net/UidRangeParcel.aidl deleted file mode 100644 index debc6be2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/5/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/.hash b/common/netd/aidl_api/netd_aidl_interface/6/.hash deleted file mode 100644 index f5acf5d1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/.hash +++ /dev/null @@ -1 +0,0 @@ -b08451d9673b09cba84f1fd8740e1fdac64ff7be diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetd.aidl deleted file mode 100644 index a7952f28..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetd.aidl +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 76562b29..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkType.aidl deleted file mode 100644 index 06c8979d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/6/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/6/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/6/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/.hash b/common/netd/aidl_api/netd_aidl_interface/7/.hash deleted file mode 100644 index cad59dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/.hash +++ /dev/null @@ -1 +0,0 @@ -850353de5d19a0dd718f8fd20791f0532e6a34c7 diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetd.aidl deleted file mode 100644 index ec03d86b..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetd.aidl +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 76562b29..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkType.aidl deleted file mode 100644 index 06c8979d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/7/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/7/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/7/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/.hash b/common/netd/aidl_api/netd_aidl_interface/8/.hash deleted file mode 100644 index 09338161..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/.hash +++ /dev/null @@ -1 +0,0 @@ -e8cf8586fc5da9063818d8775e9a21c4b0addb5b diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetd.aidl deleted file mode 100644 index ec03d86b..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetd.aidl +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkType.aidl deleted file mode 100644 index 06c8979d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/8/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/8/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/8/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/.hash b/common/netd/aidl_api/netd_aidl_interface/9/.hash deleted file mode 100644 index 94dd240d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/.hash +++ /dev/null @@ -1 +0,0 @@ -2bffe06ea8c13f35f90b86d6dfd1a2b4c4d4daf5 diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetd.aidl deleted file mode 100644 index c780a59e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetd.aidl +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = -1; - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkType.aidl deleted file mode 100644 index 06c8979d..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/9/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/9/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/9/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetd.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetd.aidl deleted file mode 100644 index 35077847..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetd.aidl +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetd { - boolean isAlive(); - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, boolean isAllowlist, in int[] uids); - boolean bandwidthEnableDataSaver(boolean enable); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreatePhysical(int netId, int permission); - /** - * @deprecated use networkCreate() instead. - */ - void networkCreateVpn(int netId, boolean secure); - void networkDestroy(int netId); - void networkAddInterface(int netId, in @utf8InCpp String iface); - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - void networkAddUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRemoveUidRanges(int netId, in android.net.UidRangeParcel[] uidRanges); - void networkRejectNonSecureVpn(boolean add, in android.net.UidRangeParcel[] uidRanges); - void socketDestroy(in android.net.UidRangeParcel[] uidRanges, in int[] exemptUids); - boolean tetherApplyDnsInterfaces(); - android.net.TetherStatsParcel[] tetherGetStats(); - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, int prefixLength); - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, in @utf8InCpp String parameter, in @utf8InCpp String value); - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - int ipSecAllocateSpi(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecAddSecurityAssociation(int transformId, int mode, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int underlyingNetId, int spi, int markValue, int markMask, in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, int encapType, int encapLocalPort, int encapRemotePort, int interfaceId); - void ipSecDeleteSecurityAssociation(int transformId, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecApplyTransportModeTransform(in ParcelFileDescriptor socket, int transformId, int direction, in @utf8InCpp String sourceAddress, in @utf8InCpp String destinationAddress, int spi); - void ipSecRemoveTransportModeTransform(in ParcelFileDescriptor socket); - void ipSecAddSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecUpdateSecurityPolicy(int transformId, int selAddrFamily, int direction, in @utf8InCpp String tmplSrcAddress, in @utf8InCpp String tmplDstAddress, int spi, int markValue, int markMask, int interfaceId); - void ipSecDeleteSecurityPolicy(int transformId, int selAddrFamily, int direction, int markValue, int markMask, int interfaceId); - void ipSecAddTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecUpdateTunnelInterface(in @utf8InCpp String deviceName, in @utf8InCpp String localAddress, in @utf8InCpp String remoteAddress, int iKey, int oKey, int interfaceId); - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - void idletimerAddInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void idletimerRemoveInterface(in @utf8InCpp String ifName, int timeout, in @utf8InCpp String classLabel); - void strictUidCleartextPenalty(int uid, int policyPenalty); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd control plane moved to the mainline module starting in T. See ClatCoordinator. - */ - void clatdStop(in @utf8InCpp String ifName); - boolean ipfwdEnabled(); - @utf8InCpp String[] ipfwdGetRequesterList(); - void ipfwdEnableForwarding(in @utf8InCpp String requester); - void ipfwdDisableForwarding(in @utf8InCpp String requester); - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - void bandwidthSetGlobalAlert(long bytes); - void bandwidthAddNaughtyApp(int uid); - void bandwidthRemoveNaughtyApp(int uid); - void bandwidthAddNiceApp(int uid); - void bandwidthRemoveNiceApp(int uid); - void tetherStart(in @utf8InCpp String[] dhcpRanges); - void tetherStop(); - boolean tetherIsEnabled(); - void tetherInterfaceAdd(in @utf8InCpp String ifName); - void tetherInterfaceRemove(in @utf8InCpp String ifName); - @utf8InCpp String[] tetherInterfaceList(); - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - @utf8InCpp String[] tetherDnsList(); - void networkAddRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkRemoveRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop); - void networkAddLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - void networkRemoveLegacyRoute(int netId, in @utf8InCpp String ifName, in @utf8InCpp String destination, in @utf8InCpp String nextHop, int uid); - int networkGetDefault(); - void networkSetDefault(int netId); - void networkClearDefault(); - void networkSetPermissionForNetwork(int netId, int permission); - void networkSetPermissionForUser(int permission, in int[] uids); - void networkClearPermissionForUser(in int[] uids); - void trafficSetNetPermForUids(int permission, in int[] uids); - void networkSetProtectAllow(int uid); - void networkSetProtectDeny(int uid); - boolean networkCanProtect(int uid); - void firewallSetFirewallType(int firewalltype); - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - void firewallSetUidRule(int childChain, int uid, int firewallRule); - void firewallEnableChildChain(int childChain, boolean enable); - @utf8InCpp String[] interfaceGetList(); - android.net.InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - void interfaceSetCfg(in android.net.InterfaceConfigurationParcel cfg); - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - void interfaceClearAddrs(in @utf8InCpp String ifName); - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - void registerUnsolicitedEventListener(android.net.INetdUnsolicitedEventListener listener); - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - void firewallRemoveUidInterfaceRules(in int[] uids); - void trafficSwapActiveStatsMap(); - IBinder getOemNetd(); - void tetherStartWithConfiguration(in android.net.TetherConfigParcel config); - android.net.MarkMaskParcel getFwmarkForNetwork(int netId); - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleAdd(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadRuleRemove(in android.net.TetherOffloadRuleParcel rule); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel[] tetherOffloadGetStats(); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - /** - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline module accesses the BPF map directly starting in S. See BpfCoordinator. - */ - android.net.TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - void networkCreate(in android.net.NativeNetworkConfig config); - void networkAddUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void networkRemoveUidRangesParcel(in android.net.netd.aidl.NativeUidRangeConfig uidRangesConfig); - void ipSecMigrate(in android.net.IpSecMigrateInfoParcel migrateInfo); - void setNetworkAllowlist(in android.net.netd.aidl.NativeUidRangeConfig[] allowedNetworks); - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - const int CLAT_MARK = 0xdeadc1a7; - const int LOCAL_NET_ID = 99; - const int DUMMY_NET_ID = 51; - const int UNREACHABLE_NET_ID = 52; - const String NEXTHOP_NONE = ""; - const String NEXTHOP_UNREACHABLE = "unreachable"; - const String NEXTHOP_THROW = "throw"; - const int PERMISSION_NONE = 0; - const int PERMISSION_NETWORK = 1; - const int PERMISSION_SYSTEM = 2; - const int NO_PERMISSIONS = 0; - const int PERMISSION_INTERNET = 4; - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - const int PERMISSION_UNINSTALLED = (-1); - /** - * @deprecated use FIREWALL_ALLOWLIST. - */ - const int FIREWALL_WHITELIST = 0; - const int FIREWALL_ALLOWLIST = 0; - /** - * @deprecated use FIREWALL_DENYLIST. - */ - const int FIREWALL_BLACKLIST = 1; - const int FIREWALL_DENYLIST = 1; - const int FIREWALL_RULE_ALLOW = 1; - const int FIREWALL_RULE_DENY = 2; - const int FIREWALL_CHAIN_NONE = 0; - const int FIREWALL_CHAIN_DOZABLE = 1; - const int FIREWALL_CHAIN_STANDBY = 2; - const int FIREWALL_CHAIN_POWERSAVE = 3; - const int FIREWALL_CHAIN_RESTRICTED = 4; - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; - const int IPSEC_DIRECTION_IN = 0; - const int IPSEC_DIRECTION_OUT = 1; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 31775dfd..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -interface INetdUnsolicitedEventListener { - oneway void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid); - oneway void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - oneway void onInterfaceDnsServerInfo(@utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - oneway void onInterfaceAddressUpdated(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAddressRemoved(@utf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope); - oneway void onInterfaceAdded(@utf8InCpp String ifName); - oneway void onInterfaceRemoved(@utf8InCpp String ifName); - oneway void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - oneway void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - oneway void onRouteChanged(boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName); - oneway void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/InterfaceConfigurationParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index 1869d8d4..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - @utf8InCpp String[] flags; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/IpSecMigrateInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/IpSecMigrateInfoParcel.aidl deleted file mode 100644 index 975a2619..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/IpSecMigrateInfoParcel.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@JavaOnlyImmutable -parcelable IpSecMigrateInfoParcel { - int requestId; - int selAddrFamily; - int direction; - @utf8InCpp String oldSourceAddress; - @utf8InCpp String oldDestinationAddress; - @utf8InCpp String newSourceAddress; - @utf8InCpp String newDestinationAddress; - int interfaceId; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/MarkMaskParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 8ea20d11..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable MarkMaskParcel { - int mark; - int mask; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 77d814b8..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeNetworkConfig { - int netId; - android.net.NativeNetworkType networkType = android.net.NativeNetworkType.PHYSICAL; - int permission; - boolean secure; - android.net.NativeVpnType vpnType = android.net.NativeVpnType.PLATFORM; - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkType.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkType.aidl deleted file mode 100644 index e77a1432..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeNetworkType { - PHYSICAL = 0, - VIRTUAL = 1, - PHYSICAL_LOCAL = 2, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeVpnType.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeVpnType.aidl deleted file mode 100644 index 8a8be839..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -@Backing(type="int") -enum NativeVpnType { - SERVICE = 1, - PLATFORM = 2, - LEGACY = 3, - OEM = 4, -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/RouteInfoParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/RouteInfoParcel.aidl deleted file mode 100644 index 5ef95e67..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable RouteInfoParcel { - @utf8InCpp String destination; - @utf8InCpp String ifName; - @utf8InCpp String nextHop; - int mtu; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherConfigParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 7b39c22e..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherConfigParcel { - boolean usingLegacyDnsProxy; - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherOffloadRuleParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index 983e9860..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherOffloadRuleParcel { - int inputInterfaceIndex; - int outputInterfaceIndex; - byte[] destination; - int prefixLength; - byte[] srcL2Address; - byte[] dstL2Address; - int pmtu = 1500; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherStatsParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 5f1b7226..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -parcelable TetherStatsParcel { - @utf8InCpp String iface; - long rxBytes; - long rxPackets; - long txBytes; - long txPackets; - int ifIndex = 0; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/UidRangeParcel.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/UidRangeParcel.aidl deleted file mode 100644 index 72e987a2..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/aidl_api/netd_aidl_interface/current/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/aidl_api/netd_aidl_interface/current/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 9bb679f1..00000000 --- a/common/netd/aidl_api/netd_aidl_interface/current/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.netd.aidl; -/* @hide */ -@JavaDerive(equals=true, toString=true) @JavaOnlyImmutable -parcelable NativeUidRangeConfig { - int netId; - android.net.UidRangeParcel[] uidRanges; - int subPriority; -} diff --git a/common/netd/aidl_api/netd_event_listener_interface/1/.hash b/common/netd/aidl_api/netd_event_listener_interface/1/.hash deleted file mode 100644 index f39f730f..00000000 --- a/common/netd/aidl_api/netd_event_listener_interface/1/.hash +++ /dev/null @@ -1 +0,0 @@ -8e27594d285ca7c567d87e8cf74766c27647e02b diff --git a/common/netd/aidl_api/netd_event_listener_interface/1/android/net/metrics/INetdEventListener.aidl b/common/netd/aidl_api/netd_event_listener_interface/1/android/net/metrics/INetdEventListener.aidl deleted file mode 100644 index 9898a674..00000000 --- a/common/netd/aidl_api/netd_event_listener_interface/1/android/net/metrics/INetdEventListener.aidl +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.metrics; -interface INetdEventListener { - oneway void onDnsEvent(int netId, int eventType, int returnCode, int latencyMs, @utf8InCpp String hostname, in @utf8InCpp String[] ipAddresses, int ipAddressesCount, int uid); - oneway void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, boolean validated); - oneway void onConnectEvent(int netId, int error, int latencyMs, String ipAddr, int port, int uid); - oneway void onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader, in byte[] dstHw, String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs); - oneway void onTcpSocketStatsEvent(in int[] networkIds, in int[] sentPackets, in int[] lostPackets, in int[] rttUs, in int[] sentAckDiffMs); - oneway void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString, int prefixLength); - const int EVENT_GETADDRINFO = 1; - const int EVENT_GETHOSTBYNAME = 2; - const int EVENT_GETHOSTBYADDR = 3; - const int EVENT_RES_NSEND = 4; - const int REPORTING_LEVEL_NONE = 0; - const int REPORTING_LEVEL_METRICS = 1; - const int REPORTING_LEVEL_FULL = 2; - const int DNS_REPORTED_IP_ADDRESSES_LIMIT = 10; -} diff --git a/common/netd/aidl_api/netd_event_listener_interface/2/.hash b/common/netd/aidl_api/netd_event_listener_interface/2/.hash deleted file mode 100644 index 67c55b77..00000000 --- a/common/netd/aidl_api/netd_event_listener_interface/2/.hash +++ /dev/null @@ -1 +0,0 @@ -1b765b02815e970a124de92e793e42e0ceff5384 diff --git a/common/netd/aidl_api/netd_event_listener_interface/2/android/net/metrics/INetdEventListener.aidl b/common/netd/aidl_api/netd_event_listener_interface/2/android/net/metrics/INetdEventListener.aidl deleted file mode 100644 index 1b0fe132..00000000 --- a/common/netd/aidl_api/netd_event_listener_interface/2/android/net/metrics/INetdEventListener.aidl +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.metrics; -/* @hide */ -interface INetdEventListener { - oneway void onDnsEvent(int netId, int eventType, int returnCode, int latencyMs, @utf8InCpp String hostname, in @utf8InCpp String[] ipAddresses, int ipAddressesCount, int uid); - oneway void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, boolean validated); - oneway void onConnectEvent(int netId, int error, int latencyMs, String ipAddr, int port, int uid); - oneway void onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader, in byte[] dstHw, String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs); - oneway void onTcpSocketStatsEvent(in int[] networkIds, in int[] sentPackets, in int[] lostPackets, in int[] rttUs, in int[] sentAckDiffMs); - oneway void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString, int prefixLength); - const int EVENT_GETADDRINFO = 1; - const int EVENT_GETHOSTBYNAME = 2; - const int EVENT_GETHOSTBYADDR = 3; - const int EVENT_RES_NSEND = 4; - const int REPORTING_LEVEL_NONE = 0; - const int REPORTING_LEVEL_METRICS = 1; - const int REPORTING_LEVEL_FULL = 2; - const int DNS_REPORTED_IP_ADDRESSES_LIMIT = 10; -} diff --git a/common/netd/aidl_api/netd_event_listener_interface/current/android/net/metrics/INetdEventListener.aidl b/common/netd/aidl_api/netd_event_listener_interface/current/android/net/metrics/INetdEventListener.aidl deleted file mode 100644 index d71c3f29..00000000 --- a/common/netd/aidl_api/netd_event_listener_interface/current/android/net/metrics/INetdEventListener.aidl +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.metrics; -/* @hide */ -interface INetdEventListener { - oneway void onDnsEvent(int netId, int eventType, int returnCode, int latencyMs, @utf8InCpp String hostname, in @utf8InCpp String[] ipAddresses, int ipAddressesCount, int uid); - oneway void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, boolean validated); - oneway void onConnectEvent(int netId, int error, int latencyMs, String ipAddr, int port, int uid); - oneway void onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader, in byte[] dstHw, String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs); - oneway void onTcpSocketStatsEvent(in int[] networkIds, in int[] sentPackets, in int[] lostPackets, in int[] rttUs, in int[] sentAckDiffMs); - oneway void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString, int prefixLength); - const int EVENT_GETADDRINFO = 1; - const int EVENT_GETHOSTBYNAME = 2; - const int EVENT_GETHOSTBYADDR = 3; - const int EVENT_RES_NSEND = 4; - const int REPORTING_LEVEL_NONE = 0; - const int REPORTING_LEVEL_METRICS = 1; - const int REPORTING_LEVEL_FULL = 2; - const int DNS_REPORTED_IP_ADDRESSES_LIMIT = 10; -} diff --git a/common/netd/binder/android/net/INetd.aidl b/common/netd/binder/android/net/INetd.aidl deleted file mode 100644 index 27d9a035..00000000 --- a/common/netd/binder/android/net/INetd.aidl +++ /dev/null @@ -1,1438 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -import android.net.INetdUnsolicitedEventListener; -import android.net.InterfaceConfigurationParcel; -import android.net.IpSecMigrateInfoParcel; -import android.net.MarkMaskParcel; -import android.net.NativeNetworkConfig; -import android.net.RouteInfoParcel; -import android.net.TetherConfigParcel; -import android.net.TetherOffloadRuleParcel; -import android.net.TetherStatsParcel; -import android.net.UidRangeParcel; -import android.net.netd.aidl.NativeUidRangeConfig; - -/** {@hide} */ -interface INetd { - /** - * Returns true if the service is responding. - */ - boolean isAlive(); - - /** - * Replaces the contents of the specified UID-based firewall chain. - * - * The chain may be an allowlist chain or a denylist chain. A denylist chain contains DROP - * rules for the specified UIDs and a RETURN rule at the end. An allowlist chain contains RETURN - * rules for the system UID range (0 to {@code UID_APP} - 1), RETURN rules for for the specified - * UIDs, and a DROP rule at the end. The chain will be created if it does not exist. - * - * @param chainName The name of the chain to replace. - * @param isAllowlist Whether this is an allowlist or denylist chain. - * @param uids The list of UIDs to allow/deny. - * @return true if the chain was successfully replaced, false otherwise. - */ - boolean firewallReplaceUidChain(in @utf8InCpp String chainName, - boolean isAllowlist, - in int[] uids); - - /** - * Enables or disables data saver mode on costly network interfaces. - * - * - When disabled, all packets to/from apps in the penalty box chain are rejected on costly - * interfaces. Traffic to/from other apps or on other network interfaces is allowed. - * - When enabled, only apps that are in the happy box chain and not in the penalty box chain - * are allowed network connectivity on costly interfaces. All other packets on these - * interfaces are rejected. The happy box chain always contains all system UIDs; to disallow - * traffic from system UIDs, place them in the penalty box chain. - * - * By default, data saver mode is disabled. This command has no effect but might still return an - * error) if {@code enable} is the same as the current value. - * - * @param enable whether to enable or disable data saver mode. - * @return true if the if the operation was successful, false otherwise. - */ - boolean bandwidthEnableDataSaver(boolean enable); - - /** - * Creates a physical network (i.e., one containing physical interfaces. - * @deprecated use networkCreate() instead. - * - * @param netId the networkId to create. - * @param permission the permission necessary to use the network. Must be one of - * PERMISSION_NONE/PERMISSION_NETWORK/PERMISSION_SYSTEM. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkCreatePhysical(int netId, int permission); - - /** - * Creates a VPN network. - * @deprecated use networkCreate() instead. - * - * @param netId the network to create. - * @param secure whether unprivileged apps are allowed to bypass the VPN. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkCreateVpn(int netId, boolean secure); - - /** - * Destroys a network. Any interfaces added to the network are removed, and the network ceases - * to be the default network. - * - * @param netId the network to destroy. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkDestroy(int netId); - - /** - * Adds an interface to a network. The interface must not be assigned to any network, including - * the specified network. - * - * @param netId the network to add the interface to. - * @param interface the name of the interface to add. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkAddInterface(int netId, in @utf8InCpp String iface); - - /** - * Adds an interface to a network. The interface must be assigned to the specified network. - * - * @param netId the network to remove the interface from. - * @param interface the name of the interface to remove. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkRemoveInterface(int netId, in @utf8InCpp String iface); - - /** - * Adds the specified UID ranges to the specified network. The network can be physical or - * virtual. Traffic from the UID ranges will be routed to the network by default. - * - * @param netId the network ID of the network to add the ranges to. - * @param uidRanges a set of non-overlapping ranges of UIDs to add. These exact ranges - * must not overlap with existing ranges assigned to this network. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkAddUidRanges(int netId, in UidRangeParcel[] uidRanges); - - /** - * Remove the specified UID ranges from the specified network. The network can be physical or - * virtual. Traffic from the UID ranges will no longer be routed to the network by default. - * - * @param netId the network ID of the network to remove the ranges from. - * @param uidRanges a set of non-overlapping ranges of UIDs to remove. These exact ranges - * must already be assigned to this network. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkRemoveUidRanges(int netId, in UidRangeParcel[] uidRanges); - - /** - * Adds or removes one rule for each supplied UID range to prohibit all network activity outside - * of secure VPN. - * - * When a UID is covered by one of these rules, traffic sent through any socket that is not - * protected or explicitly overriden by the system will be rejected. The kernel will respond - * with an ICMP prohibit message. - * - * Initially, there are no such rules. Any rules that are added will only last until the next - * restart of netd or the device. - * - * @param add {@code true} if the specified UID ranges should be denied access to any network - * which is not secure VPN by adding rules, {@code false} to remove existing rules. - * @param uidRanges a set of non-overlapping, contiguous ranges of UIDs to which to apply or - * remove this restriction. - * <p> Added rules should not overlap with existing rules. Likewise, removed rules should - * each correspond to an existing rule. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkRejectNonSecureVpn(boolean add, in UidRangeParcel[] uidRanges); - - /** - * Administratively closes sockets belonging to the specified UIDs. - */ - void socketDestroy(in UidRangeParcel[] uidRanges, in int[] exemptUids); - - /** - * Instruct the tethering DNS server to reevaluated serving interfaces. - * This is needed to for the DNS server to observe changes in the set - * of potential listening IP addresses. (Listening on wildcard addresses - * can turn the device into an open resolver; b/7530468) - * - * TODO: Return something richer than just a boolean. - */ - boolean tetherApplyDnsInterfaces(); - - /** - * Return tethering statistics. - * - * @return an array of TetherStatsParcel, where each entry contains the upstream interface - * name and its tethering statistics since netd startup. - * There will only ever be one entry for a given interface. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - TetherStatsParcel[] tetherGetStats(); - - /** - * Add/Remove and IP address from an interface. - * - * @param ifName the interface name - * @param addrString the IP address to add/remove as a string literal - * @param prefixLength the prefix length associated with this IP address - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, - int prefixLength); - void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, - int prefixLength); - - /** - * Set and get /proc/sys/net interface configuration parameters. - * - * @param ipversion One of IPV4/IPV6 integers, indicating the desired IP version directory. - * @param which One of CONF/NEIGH integers, indicating the desired parameter category directory. - * @param ifname The interface name portion of the path; may also be "all" or "default". - * @param parameter The parameter name portion of the path. - * @param value The value string to be written into the assembled path. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - - const int IPV4 = 4; - const int IPV6 = 6; - const int CONF = 1; - const int NEIGH = 2; - @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, - in @utf8InCpp String parameter); - void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, - in @utf8InCpp String parameter, in @utf8InCpp String value); - - /** - * Sets owner of socket ParcelFileDescriptor to the new UID, checking to ensure that the caller's - * uid is that of the old owner's, and that this is a UDP-encap socket - * - * @param ParcelFileDescriptor socket Socket file descriptor - * @param int newUid UID of the new socket fd owner - */ - void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); - - /** - * Reserve an SPI from the kernel - * - * @param transformId a unique identifier for allocated resources - * @param sourceAddress InetAddress as string for the sending endpoint - * @param destinationAddress InetAddress as string for the receiving endpoint - * @param spi a requested 32-bit unique ID or 0 to request random allocation - * @return the SPI that was allocated or 0 if failed - */ - int ipSecAllocateSpi( - int transformId, - in @utf8InCpp String sourceAddress, - in @utf8InCpp String destinationAddress, - int spi); - - /** - * Update an IPsec SA (xfrm_state) describing how ip(v6) traffic will be encrypted - * or decrypted. - * - * @param transformId a unique identifier for allocated resources - * @param mode either Transport or Tunnel mode - * @param sourceAddress InetAddress as string for the sending endpoint - * @param destinationAddress InetAddress as string for the receiving endpoint - * @param underlyingNetId the netId of the network to which the SA is applied. Only accepted for - * tunnel mode SAs. - * @param spi a 32-bit unique ID allocated to the user - * @param markValue a 32-bit unique ID chosen by the user - * @param markMask a 32-bit mask chosen by the user - * @param authAlgo a string identifying the authentication algorithm to be used - * @param authKey a byte array containing the authentication key - * @param authTruncBits the truncation length of the MAC produced by the authentication algorithm - * @param cryptAlgo a string identifying the encryption algorithm to be used - * @param cryptKey a byte arrray containing the encryption key - * @param cryptTruncBits unused parameter - * @param aeadAlgo a string identifying the authenticated encryption algorithm to be used - * @param aeadKey a byte arrray containing the key to be used in authenticated encryption - * @param aeadIcvBits the truncation length of the ICV produced by the authentication algorithm - * (similar to authTruncBits in function) - * @param encapType encapsulation type used (if any) for the udp encap socket - * @param encapLocalPort the port number on the host to be used in encap packets - * @param encapRemotePort the port number of the remote to be used for encap packets - * @param interfaceId the identifier for the IPsec tunnel interface. - * Only accepted for tunnel mode SAs. - */ - void ipSecAddSecurityAssociation( - int transformId, - int mode, - in @utf8InCpp String sourceAddress, - in @utf8InCpp String destinationAddress, - int underlyingNetId, - int spi, - int markValue, - int markMask, - in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, - in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, - in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, - int encapType, - int encapLocalPort, - int encapRemotePort, - int interfaceId); - - /** - * Delete a previously created security association identified by the provided parameters - * - * @param transformId a unique identifier for allocated resources - * @param sourceAddress InetAddress as string for the sending endpoint - * @param destinationAddress InetAddress as string for the receiving endpoint - * @param spi a requested 32-bit unique ID allocated to the user - * @param markValue a 32-bit unique ID chosen by the user - * @param markMask a 32-bit mask chosen by the user - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecDeleteSecurityAssociation( - int transformId, - in @utf8InCpp String sourceAddress, - in @utf8InCpp String destinationAddress, - int spi, - int markValue, - int markMask, - int interfaceId); - - /** - * Apply a previously created SA to a specified socket, starting IPsec on that socket - * - * @param socket a user-provided socket that will have IPsec applied - * @param transformId a unique identifier for allocated resources - * @param direction DIRECTION_IN or DIRECTION_OUT - * @param sourceAddress InetAddress as string for the sending endpoint - * @param destinationAddress InetAddress as string for the receiving endpoint - * @param spi a 32-bit unique ID allocated to the user (socket owner) - */ - void ipSecApplyTransportModeTransform( - in ParcelFileDescriptor socket, - int transformId, - int direction, - in @utf8InCpp String sourceAddress, - in @utf8InCpp String destinationAddress, - int spi); - - /** - * Remove an IPsec SA from a given socket. This will allow unencrypted traffic to flow - * on that socket if a transform had been previously applied. - * - * @param socket a user-provided socket from which to remove any IPsec configuration - */ - void ipSecRemoveTransportModeTransform( - in ParcelFileDescriptor socket); - - /** - * Adds an IPsec global policy. - * - * @param transformId a unique identifier for allocated resources - * @param selAddrFamily the address family identifier for the selector - * @param direction DIRECTION_IN or DIRECTION_OUT - * @param tmplSrcAddress InetAddress as string for the sending endpoint - * @param tmplDstAddress InetAddress as string for the receiving endpoint - * @param spi a 32-bit unique ID allocated to the user - * @param markValue a 32-bit unique ID chosen by the user - * @param markMask a 32-bit mask chosen by the user - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecAddSecurityPolicy( - int transformId, - int selAddrFamily, - int direction, - in @utf8InCpp String tmplSrcAddress, - in @utf8InCpp String tmplDstAddress, - int spi, - int markValue, - int markMask, - int interfaceId); - - /** - * Updates an IPsec global policy. - * - * @param transformId a unique identifier for allocated resources - * @param selAddrFamily the address family identifier for the selector - * @param direction DIRECTION_IN or DIRECTION_OUT - * @param tmplSrcAddress InetAddress as string for the sending endpoint - * @param tmplDstAddress InetAddress as string for the receiving endpoint - * @param spi a 32-bit unique ID allocated to the user - * @param markValue a 32-bit unique ID chosen by the user - * @param markMask a 32-bit mask chosen by the user - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecUpdateSecurityPolicy( - int transformId, - int selAddrFamily, - int direction, - in @utf8InCpp String tmplSrcAddress, - in @utf8InCpp String tmplDstAddress, - int spi, - int markValue, - int markMask, - int interfaceId); - - /** - * Deletes an IPsec global policy. - * - * Deletion of global policies does not do any matching based on the templates, thus - * template source/destination addresses are not needed (as opposed to add/update). - * - * @param transformId a unique identifier for allocated resources - * @param selAddrFamily the address family identifier for the selector - * @param direction DIRECTION_IN or DIRECTION_OUT - * @param markValue a 32-bit unique ID chosen by the user - * @param markMask a 32-bit mask chosen by the user - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecDeleteSecurityPolicy( - int transformId, - int selAddrFamily, - int direction, - int markValue, - int markMask, - int interfaceId); - - // This could not be declared as @uft8InCpp; thus, when used in native code it must be - // converted from a UTF-16 string to an ASCII string. - const String IPSEC_INTERFACE_PREFIX = "ipsec"; - - /** - * Add a IPsec Tunnel Interface. - * - * @param devName a unique identifier that represents the name of the device - * @param localAddress InetAddress as string for the local endpoint - * @param remoteAddress InetAddress as string for the remote endpoint - * @param iKey, to match Policies and SAs for input packets. - * @param oKey, to match Policies and SAs for output packets. - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecAddTunnelInterface( - in @utf8InCpp String deviceName, - in @utf8InCpp String localAddress, - in @utf8InCpp String remoteAddress, - int iKey, - int oKey, - int interfaceId); - - /** - * Update a IPsec Tunnel Interface. - * - * @param devName a unique identifier that represents the name of the device - * @param localAddress InetAddress as string for the local endpoint - * @param remoteAddress InetAddress as string for the remote endpoint - * @param iKey, to match Policies and SAs for input packets. - * @param oKey, to match Policies and SAs for output packets. - * @param interfaceId the identifier for the IPsec tunnel interface. - */ - void ipSecUpdateTunnelInterface( - in @utf8InCpp String deviceName, - in @utf8InCpp String localAddress, - in @utf8InCpp String remoteAddress, - int iKey, - int oKey, - int interfaceId); - - /** - * Removes a IPsec Tunnel Interface. - * - * @param devName a unique identifier that represents the name of the device - */ - void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); - - /** - * Request notification of wakeup packets arriving on an interface. Notifications will be - * delivered to INetdEventListener.onWakeupEvent(). - * - * @param ifName the interface - * @param prefix arbitrary string used to identify wakeup sources in onWakeupEvent - */ - void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - - /** - * Stop notification of wakeup packets arriving on an interface. - * - * @param ifName the interface - * @param prefix arbitrary string used to identify wakeup sources in onWakeupEvent - */ - void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); - - const int IPV6_ADDR_GEN_MODE_EUI64 = 0; - const int IPV6_ADDR_GEN_MODE_NONE = 1; - const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; - const int IPV6_ADDR_GEN_MODE_RANDOM = 3; - - const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; - /** - * Set IPv6 address generation mode. IPv6 should be disabled before changing mode. - * - * @param mode SLAAC address generation mechanism to use - */ - void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); - - /** - * Add idletimer for specific interface - * - * @param ifName Name of target interface - * @param timeout The time in seconds that will trigger idletimer - * @param classLabel The unique identifier for this idletimer - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void idletimerAddInterface( - in @utf8InCpp String ifName, - int timeout, - in @utf8InCpp String classLabel); - - /** - * Remove idletimer for specific interface - * - * @param ifName Name of target interface - * @param timeout The time in seconds that will trigger idletimer - * @param classLabel The unique identifier for this idletimer - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void idletimerRemoveInterface( - in @utf8InCpp String ifName, - int timeout, - in @utf8InCpp String classLabel); - - const int PENALTY_POLICY_ACCEPT = 1; - const int PENALTY_POLICY_LOG = 2; - const int PENALTY_POLICY_REJECT = 3; - - /** - * Offers to detect sockets sending data not wrapped inside a layer of SSL/TLS encryption. - * - * @param uid Uid of the app - * @param policyPenalty The penalty policy of the app - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void strictUidCleartextPenalty(int uid, int policyPenalty); - - /** - * Start clatd - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd - * control plane moved to the mainline module starting in T. See ClatCoordinator. - * @param ifName interface name to start clatd - * @param nat64Prefix the NAT64 prefix, e.g., "2001:db8:64::/96". - * @return a string, the IPv6 address that will be used for 464xlat. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); - - /** - * Stop clatd - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd - * control plane moved to the mainline module starting in T. See ClatCoordinator. - * @param ifName interface name to stop clatd - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void clatdStop(in @utf8InCpp String ifName); - - /** - * Packet mark that identifies non-offloaded ingress clat packets. - */ - const int CLAT_MARK = 0xdeadc1a7; - - /** - * Get status of IP forwarding - * - * @return true if IP forwarding is enabled, false otherwise. - */ - boolean ipfwdEnabled(); - - /** - * Get requester list of IP forwarding - * - * @return An array of strings containing requester list of IP forwarding - */ - @utf8InCpp String[] ipfwdGetRequesterList(); - - /** - * Enable IP forwarding for specific requester - * - * @param requester requester name to enable IP forwarding. It is a unique name which will be - * stored in Netd to make sure if any requester needs IP forwarding. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void ipfwdEnableForwarding(in @utf8InCpp String requester); - - /** - * Disable IP forwarding for specific requester - * - * @param requester requester name to disable IP forwarding. This name should match the - * names which are set by ipfwdEnableForwarding. - * IP forwarding would be disabled if it is the last requester. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void ipfwdDisableForwarding(in @utf8InCpp String requester); - - /** - * Add forwarding ip rule - * - * @param fromIface interface name to add forwarding ip rule - * @param toIface interface name to add forwarding ip rule - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - - /** - * Remove forwarding ip rule - * - * @param fromIface interface name to remove forwarding ip rule - * @param toIface interface name to remove forwarding ip rule - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); - - /** - * Set quota for interface - * - * @param ifName Name of target interface - * @param bytes Quota value in bytes - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); - - /** - * Remove quota for interface - * - * @param ifName Name of target interface - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); - - /** - * Set alert for interface - * - * @param ifName Name of target interface - * @param bytes Alert value in bytes - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); - - /** - * Remove alert for interface - * - * @param ifName Name of target interface - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); - - /** - * Set global alert - * - * @param bytes Alert value in bytes - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthSetGlobalAlert(long bytes); - - /** - * Add naughty app bandwidth rule for specific app - * - * @param uid uid of target app - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthAddNaughtyApp(int uid); - - /** - * Remove naughty app bandwidth rule for specific app - * - * @param uid uid of target app - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthRemoveNaughtyApp(int uid); - - /** - * Add nice app bandwidth rule for specific app - * - * @param uid uid of target app - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthAddNiceApp(int uid); - - /** - * Remove nice app bandwidth rule for specific app - * - * @param uid uid of target app - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void bandwidthRemoveNiceApp(int uid); - - /** - * Start tethering - * - * @param dhcpRanges dhcp ranges to set. - * dhcpRanges might contain many addresss {addr1, addr2, aadr3, addr4...} - * Netd splits them into ranges: addr1-addr2, addr3-addr4, etc. - * An odd number of addrs will fail. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherStart(in @utf8InCpp String[] dhcpRanges); - - /** - * Stop tethering - * - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherStop(); - - /** - * Get status of tethering - * - * @return true if tethering is enabled, false otherwise. - */ - boolean tetherIsEnabled(); - - /** - * Setup interface for tethering - * - * @param ifName interface name to add - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherInterfaceAdd(in @utf8InCpp String ifName); - - /** - * Reset interface for tethering - * - * @param ifName interface name to remove - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherInterfaceRemove(in @utf8InCpp String ifName); - - /** - * Get the interface list which is stored in netd - * The list contains the interfaces managed by tetherInterfaceAdd/tetherInterfaceRemove - * - * @return An array of strings containing interface list result - */ - @utf8InCpp String[] tetherInterfaceList(); - - /** - * Set DNS forwarder server - * - * @param netId the upstream network to forward DNS queries to - * @param dnsAddrs DNS server address to set - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); - - /** - * Return the DNS list set by tetherDnsSet - * - * @return An array of strings containing the list of DNS servers - */ - @utf8InCpp String[] tetherDnsList(); - - const int LOCAL_NET_ID = 99; - - /** - * Constant net ID for the "dummy" network. - * - * The dummy network is used to blackhole or reject traffic. Any attempt to use it will - * either drop the packets or fail with ENETUNREACH. - */ - const int DUMMY_NET_ID = 51; - - /** - * Constant net ID for the "unreachable" network. - * - * The unreachable network is used to reject traffic. Any attempt to use it will fail - * with ENETUNREACH. - */ - const int UNREACHABLE_NET_ID = 52; - - // Route does not specify a next hop - const String NEXTHOP_NONE = ""; - // Route next hop is unreachable - const String NEXTHOP_UNREACHABLE = "unreachable"; - // Route next hop is throw - const String NEXTHOP_THROW = "throw"; - - /** - * Add a route for specific network - * - * @param netId the network to add the route to - * @param ifName the name of interface of the route. - * This interface should be assigned to the netID. - * @param destination the destination of the route - * @param nextHop The route's next hop address, - * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkAddRoute( - int netId, - in @utf8InCpp String ifName, - in @utf8InCpp String destination, - in @utf8InCpp String nextHop); - - /** - * Remove a route for specific network - * - * @param netId the network to remove the route from - * @param ifName the name of interface of the route. - * This interface should be assigned to the netID. - * @param destination the destination of the route - * @param nextHop The route's next hop address, - * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkRemoveRoute( - int netId, - in @utf8InCpp String ifName, - in @utf8InCpp String destination, - in @utf8InCpp String nextHop); - - /** - * Add a route to legacy routing table for specific network - * - * @param netId the network to add the route to - * @param ifName the name of interface of the route. - * This interface should be assigned to the netID. - * @param destination the destination of the route - * @param nextHop The route's next hop address, - * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. - * @param uid uid of the user - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkAddLegacyRoute( - int netId, - in @utf8InCpp String ifName, - in @utf8InCpp String destination, - in @utf8InCpp String nextHop, - int uid); - - /** - * Remove a route from legacy routing table for specific network - * - * @param netId the network to remove the route from - * @param ifName the name of interface of the route. - * This interface should be assigned to the netID. - * @param destination the destination of the route - * @param nextHop The route's next hop address, - * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. - * @param uid uid of the user - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkRemoveLegacyRoute( - int netId, - in @utf8InCpp String ifName, - in @utf8InCpp String destination, - in @utf8InCpp String nextHop, - int uid); - - /** - * Get default network - * - * @return netId of default network - */ - int networkGetDefault(); - - /** - * Set network as default network - * - * @param netId the network to set as the default - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkSetDefault(int netId); - - /** - * Clear default network - * - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkClearDefault(); - - /** - * PERMISSION_NONE is used for regular networks and apps. TODO: use PERMISSION_INTERNET - * for this instead, and use PERMISSION_NONE to indicate no network permissions at all. - */ - const int PERMISSION_NONE = 0; - - /** - * PERMISSION_NETWORK represents the CHANGE_NETWORK_STATE permission. - */ - const int PERMISSION_NETWORK = 1; - - /** - * PERMISSION_SYSTEM represents the ability to use restricted networks. This is mostly - * equivalent to the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission. - */ - const int PERMISSION_SYSTEM = 2; - - /** - * NO_PERMISSIONS indicates that this app is installed and doesn't have either - * PERMISSION_INTERNET or PERMISSION_UPDATE_DEVICE_STATS. - * TODO: use PERMISSION_NONE to represent this case - */ - const int NO_PERMISSIONS = 0; - - /** - * PERMISSION_INTERNET indicates that the app can create AF_INET and AF_INET6 sockets - */ - const int PERMISSION_INTERNET = 4; - - /** - * PERMISSION_UPDATE_DEVICE_STATS is used for system UIDs and privileged apps - * that have the UPDATE_DEVICE_STATS permission - */ - const int PERMISSION_UPDATE_DEVICE_STATS = 8; - - /** - * PERMISSION_UNINSTALLED is used when an app is uninstalled from the device. All internet - * related permissions need to be cleaned - */ - const int PERMISSION_UNINSTALLED = -1; - - - /** - * Sets the permission required to access a specific network. - * - * @param netId the network to set - * @param permission network permission to use - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkSetPermissionForNetwork(int netId, int permission); - - /** - * Assigns network access permissions to the specified users. - * - * @param permission network permission to use - * @param uids uid of users to set permission - */ - void networkSetPermissionForUser(int permission, in int[] uids); - - /** - * Clears network access permissions for the specified users. - * - * @param uids uid of users to clear permission - */ - void networkClearPermissionForUser(in int[] uids); - - /** - * Assigns android.permission.INTERNET and/or android.permission.UPDATE_DEVICE_STATS to the uids - * specified. Or remove all permissions from the uids. - * - * @param permission The permission to grant, it could be either PERMISSION_INTERNET and/or - * PERMISSION_UPDATE_DEVICE_STATS. If the permission is NO_PERMISSIONS, then - * revoke all permissions for the uids. - * @param uids uid of users to grant permission - */ - void trafficSetNetPermForUids(int permission, in int[] uids); - - /** - * Gives the specified user permission to protect sockets from VPNs. - * Typically used by VPN apps themselves, to ensure that the sockets - * they use to communicate with the VPN server aren't routed through - * the VPN network. - * - * @param uid uid of user to set - */ - void networkSetProtectAllow(int uid); - - /** - * Removes the permission to protect sockets from VPN. - * - * @param uid uid of user to set - */ - void networkSetProtectDeny(int uid); - - /** - * Get the status of network protect for user - * - * @param uids uid of user - * @return true if the user can protect sockets from VPN, false otherwise. - */ - boolean networkCanProtect(int uid); - - /** Only allows packets from specific UID/Interface. - @deprecated use FIREWALL_ALLOWLIST. */ - const int FIREWALL_WHITELIST = 0; - - /** Only allows packets from specific UID/Interface. */ - const int FIREWALL_ALLOWLIST = 0; - - /** Blocks packets from specific UID/Interface. - @deprecated use FIREWALL_DENYLIST. */ - const int FIREWALL_BLACKLIST = 1; - - /** Blocks packets from specific UID/Interface. */ - const int FIREWALL_DENYLIST = 1; - - /** - * Set type of firewall - * Type allowlist only allows packets from specific UID/Interface - * Type denylist blocks packets from specific UID/Interface - * - * @param firewalltype type of firewall, either FIREWALL_ALLOWLIST or FIREWALL_DENYLIST - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallSetFirewallType(int firewalltype); - - // Specify allow Rule which allows packets - const int FIREWALL_RULE_ALLOW = 1; - // Specify deny Rule which drops packets - const int FIREWALL_RULE_DENY = 2; - - // No specific chain is chosen, use general firewall chain(fw_input, fw_output) - const int FIREWALL_CHAIN_NONE = 0; - // Specify DOZABLE chain(fw_dozable) which is used in dozable mode - const int FIREWALL_CHAIN_DOZABLE = 1; - // Specify STANDBY chain(fw_standby) which is used in standby mode - const int FIREWALL_CHAIN_STANDBY = 2; - // Specify POWERSAVE chain(fw_powersave) which is used in power save mode - const int FIREWALL_CHAIN_POWERSAVE = 3; - // Specify RESTRICTED chain(fw_restricted) which is used in restricted - // networking mode - const int FIREWALL_CHAIN_RESTRICTED = 4; - - /** - * Set firewall rule for interface - * - * @param ifName the interface to allow/deny - * @param firewallRule either FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); - - /** - * Set firewall rule for uid - * - * @param childChain target chain - * @param uid uid to allow/deny - * @param firewallRule either FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallSetUidRule(int childChain, int uid, int firewallRule); - - /** - * Enable/Disable target firewall child chain - * - * @param childChain target chain to enable - * @param enable whether to enable or disable child chain. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallEnableChildChain(int childChain, boolean enable); - - /** - * Get interface list - * - * @return An array of strings containing all the interfaces on the system. - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - @utf8InCpp String[] interfaceGetList(); - - // Must be kept in sync with constant in InterfaceConfiguration.java - const String IF_STATE_UP = "up"; - const String IF_STATE_DOWN = "down"; - - const String IF_FLAG_BROADCAST = "broadcast"; - const String IF_FLAG_LOOPBACK = "loopback"; - const String IF_FLAG_POINTOPOINT = "point-to-point"; - const String IF_FLAG_RUNNING = "running"; - const String IF_FLAG_MULTICAST = "multicast"; - - /** - * Get interface configuration - * - * @param ifName interface name - * @return An InterfaceConfigurationParcel for the specified interface. - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); - - /** - * Set interface configuration - * - * @param cfg Interface configuration to set - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void interfaceSetCfg(in InterfaceConfigurationParcel cfg); - - /** - * Set interface IPv6 privacy extensions - * - * @param ifName interface name - * @param enable whether to enable or disable this setting. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); - - /** - * Clear all IP addresses on the given interface - * - * @param ifName interface name - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * POSIX errno. - */ - void interfaceClearAddrs(in @utf8InCpp String ifName); - - /** - * Enable or disable IPv6 on the given interface - * - * @param ifName interface name - * @param enable whether to enable or disable this setting. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); - - /** - * Set interface MTU - * - * @param ifName interface name - * @param mtu MTU value - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); - - /** - * Add forwarding rule/stats on given interface. - * - * @param intIface downstream interface - * @param extIface upstream interface - */ - void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - - /** - * Remove forwarding rule/stats on given interface. - * - * @param intIface downstream interface - * @param extIface upstream interface - */ - void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); - - /** - * Set the values of tcp_{rmem,wmem}. - * - * @param rmemValues the target values of tcp_rmem, each value is separated by spaces - * @param wmemValues the target values of tcp_wmem, each value is separated by spaces - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); - - /** - * Register unsolicited event listener - * Netd supports multiple unsolicited event listeners. - * - * @param listener unsolicited event listener to register - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void registerUnsolicitedEventListener(INetdUnsolicitedEventListener listener); - - /** - * Add ingress interface filtering rules to a list of UIDs - * - * For a given uid, once a filtering rule is added, the kernel will only allow packets from the - * allowed interface and loopback to be sent to the list of UIDs. - * - * Calling this method on one or more UIDs with an existing filtering rule but a different - * interface name will result in the filtering rule being updated to allow the new interface - * instead. Otherwise calling this method will not affect existing rules set on other UIDs. - * - * @param ifName the name of the interface on which the filtering rules will allow packets to - be received. - * @param uids an array of UIDs which the filtering rules will be set - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); - - /** - * Remove ingress interface filtering rules from a list of UIDs - * - * Clear the ingress interface filtering rules from the list of UIDs which were previously set - * by firewallAddUidInterfaceRules(). Ignore any uid which does not have filtering rule. - * - * @param uids an array of UIDs from which the filtering rules will be removed - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void firewallRemoveUidInterfaceRules(in int[] uids); - - /** - * Request netd to change the current active network stats map. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void trafficSwapActiveStatsMap(); - - /** - * Retrieves OEM netd listener interface - * - * @return a IBinder object, it could be casted to oem specific interface. - */ - IBinder getOemNetd(); - - /** - * Start tethering with given configuration - * - * @param config config to start tethering. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherStartWithConfiguration(in TetherConfigParcel config); - - - /** - * Get the fwmark and its net id mask for the given network id. - * - * @param netId the network to get the fwmark and mask for. - * @return A MarkMaskParcel of the given network id. - */ - MarkMaskParcel getFwmarkForNetwork(int netId); - - /** - * Add a route for specific network - * - * @param netId the network to add the route to - * @param routeInfo parcelable with route information - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - - /** - * Update a route for specific network - * - * @param routeInfo parcelable with route information - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - - /** - * Remove a route for specific network - * - * @param routeInfo parcelable with route information - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); - - /** - * Adds a tethering offload rule, or updates it if it already exists. - * - * Currently, only downstream /128 IPv6 entries are supported. An existing rule will be updated - * if the input interface and destination prefix match. Otherwise, a new rule will be created. - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline - * module accesses the BPF map directly starting in S. See BpfCoordinator. - * @param rule The rule to add or update. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherOffloadRuleAdd(in TetherOffloadRuleParcel rule); - - /** - * Deletes a tethering offload rule. - * - * Currently, only downstream /128 IPv6 entries are supported. An existing rule will be deleted - * if the destination IP address and the source interface match. It is not an error if there is - * no matching rule to delete. - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline - * module accesses the BPF map directly starting in S. See BpfCoordinator. - * @param rule The rule to delete. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherOffloadRuleRemove(in TetherOffloadRuleParcel rule); - - /** - * Return BPF tethering offload statistics. - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline - * module accesses the BPF map directly starting in S. See BpfCoordinator. - * @return an array of TetherStatsParcel's, where each entry contains the upstream interface - * index and its tethering statistics since tethering was first started. - * There will only ever be one entry for a given interface index. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - TetherStatsParcel[] tetherOffloadGetStats(); - - /** - * Set a per-interface quota for tethering offload. - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline - * module accesses the BPF map directly starting in S. See BpfCoordinator. - * @param ifIndex Index of upstream interface - * @param quotaBytes The quota defined as the number of bytes, starting from zero and counting - * from *now*. A value of QUOTA_UNLIMITED (-1) indicates there is no limit. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); - - /** - * Return BPF tethering offload statistics and clear the stats for a given upstream. - * - * Must only be called once all offload rules have already been deleted for the given upstream - * interface. The existing stats will be fetched and returned. The stats and the limit for the - * given upstream interface will be deleted as well. - * - * The stats and limit for a given upstream interface must be initialized (using - * tetherOffloadSetInterfaceQuota) before any offload will occur on that interface. - * - * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline - * module accesses the BPF map directly starting in S. See BpfCoordinator. - * @param ifIndex Index of upstream interface. - * @return TetherStatsParcel, which contains the given upstream interface index and its - * tethering statistics since tethering was first started on that upstream interface. - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); - - /** - * Creates a network. - * - * @param config the configuration of network. - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkCreate(in NativeNetworkConfig config); - - /** - * Adds the specified UID ranges to the specified network. The network can be physical or - * virtual. Traffic from the UID ranges will be routed to the network by default. The possible - * value of subsidiary priority for physical and unreachable networks is 0-999. 0 is the highest - * priority. 0 is also the default value. Virtual network supports only the default value. - * - * @param NativeUidRangeConfig a parcel contains netId, UID ranges, subsidiary priority, etc. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkAddUidRangesParcel(in NativeUidRangeConfig uidRangesConfig); - - /** - * Removes the specified UID ranges from the specified network. The network can be physical or - * virtual. Traffic from the UID ranges will no longer be routed to the network by default. The - * possible value of subsidiary priority for physical and unreachable networks is 0-999. 0 is - * the highest priority. 0 is also the default value. Virtual network supports only the default - * value. - * - * @param NativeUidRangeConfig a parcel contains netId, UID ranges, subsidiary priority, etc. - * - * @throws ServiceSpecificException in case of failure, with an error code corresponding to the - * unix errno. - */ - void networkRemoveUidRangesParcel(in NativeUidRangeConfig uidRangesConfig); - - /** - * Migrate an existing IPsec tunnel mode SA to different addresses. - * - * If the underlying network also changes, caller must update it by - * calling ipSecAddSecurityAssociation. - * - * @param migrateInfo parcelable with migration info. - * - * @throws ServiceSpecificException in case of failure, with an error code indicating the - * cause of the failure. - */ - void ipSecMigrate(in android.net.IpSecMigrateInfoParcel migrateInfo); - - /** - * IPSEC_DIRECTION_IN is used for IPsec SAs or policies that direct traffic towards the host. - */ - const int IPSEC_DIRECTION_IN = 0; - - /** - * IPSEC_DIRECTION_OUT is used for IPsec SAs or policies that direct traffic away from the host. - */ - const int IPSEC_DIRECTION_OUT = 1; - - /** - * Set the list of allowed UIDs for all networks with restrictions. - * - * This list is the entire list of restrictions for all networks known by - * netd. Calling this function always defines the entire list of restrictions, - * and networks not in the passed list are always reset to having no - * restrictions. - * - * @param NativeUidRangeConfig[] An array of allowlists, one per network. For each allowlist: - * - netId: the netId on which to set the allowlist - * - uidRanges: the UIDs allowed to use this network - * - subPriority: unused - */ - void setNetworkAllowlist(in NativeUidRangeConfig[] allowedNetworks); -} diff --git a/common/netd/binder/android/net/INetdUnsolicitedEventListener.aidl b/common/netd/binder/android/net/INetdUnsolicitedEventListener.aidl deleted file mode 100644 index 652a79cb..00000000 --- a/common/netd/binder/android/net/INetdUnsolicitedEventListener.aidl +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * Unsolicited netd events which are reported by the kernel via netlink. - * This one-way interface groups asynchronous notifications sent - * by netd to any process that registered itself via INetd.registerUnsolEventListener. - * - * {@hide} - */ -oneway interface INetdUnsolicitedEventListener { - - /** - * Notifies that an interface has been idle/active for a certain period of time. - * It is the event for idletimer. - * - * @param isActive true for active status, false for idle - * @param timerLabel unique identifier of the idletimer. - * Since NMS only set the identifier as int, only report event with int label. - * @param timestampNs kernel timestamp of this event, 0 for no timestamp - * @param uid uid of this event, -1 for no uid. - * It represents the uid that was responsible for waking the radio. - */ - void onInterfaceClassActivityChanged( - boolean isActive, - int timerLabel, - long timestampNs, - int uid); - - /** - * Notifies that a specific interface reached its quota limit. - * - * @param alertName alert name of the quota limit - * @param ifName interface which reached the limit - */ - void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); - - /** - * Provides information on IPv6 DNS servers on a specific interface. - * - * @param ifName interface name - * @param lifetimeS lifetime for the DNS servers in seconds - * @param servers the address of servers. - * e.g. IpV6: "2001:4860:4860::6464" - * - */ - void onInterfaceDnsServerInfo( - @utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); - - /** - * Notifies that an address has updated on a specific interface. - * - * @param addr address that is being updated - * @param ifName the name of the interface on which the address is configured - * @param flags address flags, see ifa_flags in if_addr.h - * @param scope current scope of the address - */ - void onInterfaceAddressUpdated( - @utf8InCpp String addr, - @utf8InCpp String ifName, - int flags, - int scope); - - /** - * Notifies that an address has been removed on a specific interface. - * - * @param addr address of this change - * @param ifName the name of the interface that changed addresses - * @param flags address flags, see ifa_flags in if_addr.h - * @param scope address address scope - */ - void onInterfaceAddressRemoved( - @utf8InCpp String addr, - @utf8InCpp String ifName, - int flags, - int scope); - - /** - * Notifies that an interface has been added. - * - * @param ifName the name of the added interface - */ - void onInterfaceAdded(@utf8InCpp String ifName); - - /** - * Notifies that an interface has been removed. - * - * @param ifName the name of the removed interface - */ - void onInterfaceRemoved(@utf8InCpp String ifName); - - /** - * Notifies that the status of the specific interface has changed. - * - * @param ifName the name of the interface that changed status - * @param up true for interface up, false for down - */ - void onInterfaceChanged(@utf8InCpp String ifName, boolean up); - - /** - * Notifies that the link state of the specific interface has changed. - * - * @param ifName the name of the interface whose link state has changed - * @param up true for interface link state up, false for link state down - */ - void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); - - /** - * Notifies that an IP route has changed. - * - * @param updated true for update, false for remove - * @param route destination prefix of this route, e.g., "2001:db8::/64" - * @param gateway address of gateway, empty string for no gateway - * @param ifName interface name of this route, empty string for no interface - */ - void onRouteChanged( - boolean updated, - @utf8InCpp String route, - @utf8InCpp String gateway, - @utf8InCpp String ifName); - - /** - * Notifies that kernel has detected a socket sending data not wrapped - * inside a layer of SSL/TLS encryption. - * - * @param uid uid of this event - * @param hex packet content in hex format - */ - void onStrictCleartextDetected(int uid, @utf8InCpp String hex); -} diff --git a/common/netd/binder/android/net/InterfaceConfigurationParcel.aidl b/common/netd/binder/android/net/InterfaceConfigurationParcel.aidl deleted file mode 100644 index c20792c0..00000000 --- a/common/netd/binder/android/net/InterfaceConfigurationParcel.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * Configuration details for a network interface. - * - * {@hide} - */ -parcelable InterfaceConfigurationParcel { - @utf8InCpp String ifName; - @utf8InCpp String hwAddr; - @utf8InCpp String ipv4Addr; - int prefixLength; - /** - * Interface flags, String versions of IFF_* defined in netd/if.h - */ - @utf8InCpp String[] flags; -} diff --git a/common/netd/binder/android/net/IpSecMigrateInfoParcel.aidl b/common/netd/binder/android/net/IpSecMigrateInfoParcel.aidl deleted file mode 100644 index e192d663..00000000 --- a/common/netd/binder/android/net/IpSecMigrateInfoParcel.aidl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -@JavaOnlyImmutable -parcelable IpSecMigrateInfoParcel { - /** The unique identifier for allocated resources. */ - int requestId; - /** - * The address family identifier for the new selector. Can be AF_INET - * or AF_INET6. - */ - int selAddrFamily; - /** IPSEC_DIRECTION_IN or IPSEC_DIRECTION_OUT. */ - int direction; - /** - * The IP address for the current sending endpoint. - * - * The local address for an outbound SA and the remote address for an - * inbound SA. - */ - @utf8InCpp String oldSourceAddress; - /** - * The IP address for the current receiving endpoint. - * - * The remote address for an outbound SA and the local address for an - * inbound SA. - */ - @utf8InCpp String oldDestinationAddress; - /** The IP address for the new sending endpoint. */ - @utf8InCpp String newSourceAddress; - /** The IP address for the new receiving endpoint. */ - @utf8InCpp String newDestinationAddress; - /** The identifier for the XFRM interface. */ - int interfaceId; -} diff --git a/common/netd/binder/android/net/MarkMaskParcel.aidl b/common/netd/binder/android/net/MarkMaskParcel.aidl deleted file mode 100644 index 932b7bff..00000000 --- a/common/netd/binder/android/net/MarkMaskParcel.aidl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * Structure that stores a firewall mark and its mask. - * - * {@hide} - */ -parcelable MarkMaskParcel { - // The fwmark. - int mark; - // Net id mask of fwmark. - int mask; -} diff --git a/common/netd/binder/android/net/NativeNetworkConfig.aidl b/common/netd/binder/android/net/NativeNetworkConfig.aidl deleted file mode 100644 index 96eccc7a..00000000 --- a/common/netd/binder/android/net/NativeNetworkConfig.aidl +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -import android.net.NativeNetworkType; -import android.net.NativeVpnType; - -/** - * The configuration to create a network. - * - * {@hide} - */ -@JavaDerive(toString=true, equals=true) -@JavaOnlyImmutable -parcelable NativeNetworkConfig { - /** The networkId to create. */ - int netId; - - /** - * The type of network : virtual, physical or physical local network. - */ - NativeNetworkType networkType = NativeNetworkType.PHYSICAL; - - /** - * The permission necessary to use the network. Must be PERMISSION_NONE, PERMISSION_NETWORK - * or PERMISSION_SYSTEM. Ignored for virtual network types. - */ - int permission; - - /** - * For virtual networks. Whether unprivileged apps are allowed to bypass the VPN. Ignored for - * all other network types. - */ - boolean secure; - - /** For virtual networks. The type of VPN to create. Ignored for all other network types. */ - NativeVpnType vpnType = NativeVpnType.PLATFORM; - - /** - * For virtual networks. Whether local traffic is excluded from the VPN. - */ - boolean excludeLocalRoutes = false; -} diff --git a/common/netd/binder/android/net/NativeNetworkType.aidl b/common/netd/binder/android/net/NativeNetworkType.aidl deleted file mode 100644 index 70055357..00000000 --- a/common/netd/binder/android/net/NativeNetworkType.aidl +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -@Backing(type="int") -enum NativeNetworkType { - /** - * Physical network type. - */ - PHYSICAL = 0, - - /** - * Virtual private network type. - */ - VIRTUAL = 1, - - /** - * Physical local network, such as a tethering downstream. - */ - PHYSICAL_LOCAL = 2, -} diff --git a/common/netd/binder/android/net/NativeVpnType.aidl b/common/netd/binder/android/net/NativeVpnType.aidl deleted file mode 100644 index cd1b4474..00000000 --- a/common/netd/binder/android/net/NativeVpnType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -@Backing(type="int") -enum NativeVpnType { - /** - * A VPN created by an app using the VpnService API. - */ - SERVICE = 1, - - /** - * A VPN created using a VpnManager API such as startProvisionedVpnProfile. - */ - PLATFORM = 2, - - /** - * An IPsec VPN created by the built-in LegacyVpnRunner. - */ - LEGACY = 3, - - /** - * An VPN created by OEM code through other means than VpnService or VpnManager. - */ - OEM = 4, -}
\ No newline at end of file diff --git a/common/netd/binder/android/net/RouteInfoParcel.aidl b/common/netd/binder/android/net/RouteInfoParcel.aidl deleted file mode 100644 index fcc86e32..00000000 --- a/common/netd/binder/android/net/RouteInfoParcel.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2020, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -parcelable RouteInfoParcel { - // The destination of the route. - @utf8InCpp String destination; - // The name of interface of the route. This interface should be assigned to the netID. - @utf8InCpp String ifName; - // The route's next hop address, or one of the NEXTHOP_* constants defined in INetd.aidl. - @utf8InCpp String nextHop; - // The MTU of the route. - int mtu; -} diff --git a/common/netd/binder/android/net/TetherConfigParcel.aidl b/common/netd/binder/android/net/TetherConfigParcel.aidl deleted file mode 100644 index 9f371ce1..00000000 --- a/common/netd/binder/android/net/TetherConfigParcel.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * The configuration to start tethering. - * - * {@hide} - */ -parcelable TetherConfigParcel { - // Whether to enable or disable legacy DNS proxy server. - boolean usingLegacyDnsProxy; - // DHCP ranges to set. - // dhcpRanges might contain many addresss {addr1, addr2, addr3, addr4...} - // Netd splits them into ranges: addr1-addr2, addr3-addr4, etc. - // An odd number of addrs will fail. - @utf8InCpp String[] dhcpRanges; -} diff --git a/common/netd/binder/android/net/TetherOffloadRuleParcel.aidl b/common/netd/binder/android/net/TetherOffloadRuleParcel.aidl deleted file mode 100644 index c549e610..00000000 --- a/common/netd/binder/android/net/TetherOffloadRuleParcel.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * Represents a forwarding rule for tethering offload. - * - * {@hide} - */ -parcelable TetherOffloadRuleParcel { - /** The interface index of the input interface. */ - int inputInterfaceIndex; - - /** The interface index of the output interface. */ - int outputInterfaceIndex; - - /** The base IP address of the destination prefix as a byte array. */ - byte[] destination; - - /** The destination prefix length. */ - int prefixLength; - - /** The source link-layer address. Currently, must be a 6-byte MAC address.*/ - byte[] srcL2Address; - - /** The destination link-layer address. Currently, must be a 6-byte MAC address. */ - byte[] dstL2Address; - - /** The outbound path mtu. */ - int pmtu = 1500; -} diff --git a/common/netd/binder/android/net/TetherStatsParcel.aidl b/common/netd/binder/android/net/TetherStatsParcel.aidl deleted file mode 100644 index 6bf60a86..00000000 --- a/common/netd/binder/android/net/TetherStatsParcel.aidl +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * The statistics of tethering interface - * - * {@hide} - */ -parcelable TetherStatsParcel { - /** - * Parcel representing tethering interface statistics. - * - * This parcel is used by tetherGetStats, tetherOffloadGetStats and - * tetherOffloadGetAndClearStats in INetd.aidl. tetherGetStats uses this parcel to return the - * tethering statistics since netd startup and presents the interface via its interface name. - * Both tetherOffloadGetStats and tetherOffloadGetAndClearStats use this parcel to return - * the tethering statistics since tethering was first started. They present the interface via - * its interface index. Note that the interface must be presented by either interface name - * |iface| or interface index |ifIndex| in this parcel. The unused interface name is set to - * an empty string "" by default and the unused interface index is set to 0 by default. - */ - - /** The interface name. */ - @utf8InCpp String iface; - - /** Total number of received bytes. */ - long rxBytes; - - /** Total number of received packets. */ - long rxPackets; - - /** Total number of transmitted bytes. */ - long txBytes; - - /** Total number of transmitted packets. */ - long txPackets; - - /** The interface index. */ - int ifIndex = 0; -} diff --git a/common/netd/binder/android/net/UidRangeParcel.aidl b/common/netd/binder/android/net/UidRangeParcel.aidl deleted file mode 100644 index 8f1fef6f..00000000 --- a/common/netd/binder/android/net/UidRangeParcel.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net; - -/** - * An inclusive range of UIDs. - * - * {@hide} - */ -@JavaOnlyImmutable @JavaDerive(toString=true, equals=true) -parcelable UidRangeParcel { - int start; - int stop; -} diff --git a/common/netd/binder/android/net/mdns/aidl/DiscoveryInfo.aidl b/common/netd/binder/android/net/mdns/aidl/DiscoveryInfo.aidl deleted file mode 100644 index f8273828..00000000 --- a/common/netd/binder/android/net/mdns/aidl/DiscoveryInfo.aidl +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -/** - * Discovery service information. - * This information combine all arguments that used by both request and callback. - * Arguments are used by request: - * - id - * - registrationType - * - interfaceIdx - * - * Arguments are used by callback: - * - id - * - serviceName - * - registrationType - * - domainName - * - interfaceIdx - * - netId - * - result - * - * {@hide} - */ -@JavaOnlyImmutable -@JavaDerive(equals=true, toString=true) -parcelable DiscoveryInfo { - /** - * The operation ID. - * Must be unique among all operations (registration/discovery/resolution/getting address) and - * can't be reused. - * To stop a operation, it needs to use corresponding operation id. - */ - int id; - - /** - * The discovery result. - */ - int result; - - /** - * The discovered service name. - */ - @utf8InCpp String serviceName; - - /** - * The service type being discovered for followed by the protocol, separated by a dot - * (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp". - */ - @utf8InCpp String registrationType; - - /** - * The domain of the discovered service instance. - */ - @utf8InCpp String domainName; - - /** - * The interface index on which to discover services. 0 indicates "all interfaces". - */ - int interfaceIdx; - - /** - * The net id on which the service is advertised. - */ - int netId; -} diff --git a/common/netd/binder/android/net/mdns/aidl/GetAddressInfo.aidl b/common/netd/binder/android/net/mdns/aidl/GetAddressInfo.aidl deleted file mode 100644 index d53174a4..00000000 --- a/common/netd/binder/android/net/mdns/aidl/GetAddressInfo.aidl +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -/** - * Get service address information. - * This information combine all arguments that used by both request and callback. - * Arguments are used by request: - * - id - * - hostname - * - interfaceIdx - * - * Arguments are used by callback: - * - id - * - hostname - * - interfaceIdx - * - netId - * - address - * - result - * - * {@hide} - */ -@JavaOnlyImmutable -@JavaDerive(equals=true, toString=true) -parcelable GetAddressInfo { - /** - * The operation ID. - */ - int id; - - /** - * The getting address result. - */ - int result; - - /** - * The fully qualified domain name of the host to be queried for. - */ - @utf8InCpp String hostname; - - /** - * The service address info, it's IPv4 or IPv6 addres. - */ - @utf8InCpp String address; - - /** - * The interface index on which to issue the query. 0 indicates "all interfaces". - */ - int interfaceIdx; - - /** - * The net id to which the answers pertain. - */ - int netId; -} diff --git a/common/netd/binder/android/net/mdns/aidl/IMDns.aidl b/common/netd/binder/android/net/mdns/aidl/IMDns.aidl deleted file mode 100644 index 255d70ff..00000000 --- a/common/netd/binder/android/net/mdns/aidl/IMDns.aidl +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -import android.net.mdns.aidl.DiscoveryInfo; -import android.net.mdns.aidl.GetAddressInfo; -import android.net.mdns.aidl.IMDnsEventListener; -import android.net.mdns.aidl.RegistrationInfo; -import android.net.mdns.aidl.ResolutionInfo; - -/** {@hide} */ -interface IMDns { - /** - * Start the MDNSResponder daemon. - * - * @throws ServiceSpecificException with unix errno EALREADY if daemon is already running. - */ - void startDaemon(); - - /** - * Stop the MDNSResponder daemon. - * - * @throws ServiceSpecificException with unix errno EBUSY if daemon is still in use. - */ - void stopDaemon(); - - /** - * Start registering a service. - * This operation will send a service registration request to MDNSResponder. Register a listener - * via IMDns#registerEventListener to get the registration result SERVICE_REGISTERED/ - * SERVICE_REGISTRATION_FAILED from callback IMDnsEventListener#onServiceRegistrationStatus. - * - * @param info The service information to register. - * - * @throws ServiceSpecificException with one of the following error values: - * - Unix errno EBUSY if request id is already in use. - * - kDNSServiceErr_* list in dns_sd.h if registration fail. - */ - void registerService(in RegistrationInfo info); - - /** - * Start discovering services. - * This operation will send a request to MDNSResponder to discover services. Register a listener - * via IMDns#registerEventListener to get the discovery result SERVICE_FOUND/SERVICE_LOST/ - * SERVICE_DISCOVERY_FAILED from callback IMDnsEventListener#onServiceDiscoveryStatus. - * - * @param info The service to discover. - * - * @throws ServiceSpecificException with one of the following error values: - * - Unix errno EBUSY if request id is already in use. - * - kDNSServiceErr_* list in dns_sd.h if discovery fail. - */ - void discover(in DiscoveryInfo info); - - /** - * Start resolving the target service. - * This operation will send a request to MDNSResponder to resolve the target service. Register a - * listener via IMDns#registerEventListener to get the resolution result SERVICE_RESOLVED/ - * SERVICE_RESOLUTION_FAILED from callback IMDnsEventListener#onServiceResolutionStatus. - * - * @param info The service to resolve. - * - * @throws ServiceSpecificException with one of the following error values: - * - Unix errno EBUSY if request id is already in use. - * - kDNSServiceErr_* list in dns_sd.h if resolution fail. - */ - void resolve(in ResolutionInfo info); - - /** - * Start getting the target service address. - * This operation will send a request to MDNSResponder to get the target service address. - * Register a listener via IMDns#registerEventListener to get the query result - * SERVICE_GET_ADDR_SUCCESS/SERVICE_GET_ADDR_FAILED from callback - * IMDnsEventListener#onGettingServiceAddressStatus. - * - * @param info the getting service address information. - * - * @throws ServiceSpecificException with one of the following error values: - * - Unix errno EBUSY if request id is already in use. - * - kDNSServiceErr_* list in dns_sd.h if getting address fail. - */ - void getServiceAddress(in GetAddressInfo info); - - /** - * Stop a operation which's requested before. - * - * @param id the operation id to be stopped. - * - * @throws ServiceSpecificException with unix errno ESRCH if request id is not in use. - */ - void stopOperation(int id); - - /** - * Register an event listener. - * - * @param listener The listener to be registered. - * - * @throws ServiceSpecificException with one of the following error values: - * - Unix errno EINVAL if listener is null. - * - Unix errno EEXIST if register duplicated listener. - */ - void registerEventListener(in IMDnsEventListener listener); - - /** - * Unregister an event listener. - * - * @param listener The listener to be unregistered. - * - * @throws ServiceSpecificException with unix errno EINVAL if listener is null. - */ - void unregisterEventListener(in IMDnsEventListener listener); -} - diff --git a/common/netd/binder/android/net/mdns/aidl/IMDnsEventListener.aidl b/common/netd/binder/android/net/mdns/aidl/IMDnsEventListener.aidl deleted file mode 100644 index a202a261..00000000 --- a/common/netd/binder/android/net/mdns/aidl/IMDnsEventListener.aidl +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2022, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -import android.net.mdns.aidl.DiscoveryInfo; -import android.net.mdns.aidl.GetAddressInfo; -import android.net.mdns.aidl.RegistrationInfo; -import android.net.mdns.aidl.ResolutionInfo; - -/** - * MDNS events which are reported by the MDNSResponder. - * This one-way interface defines the asynchronous notifications sent by mdns service to any process - * that registered itself via IMDns.registerEventListener. - * - * {@hide} - */ -oneway interface IMDnsEventListener { - /** - * Types for MDNS operation result. - * These are in sync with frameworks/libs/net/common/netd/libnetdutils/include/netdutils/\ - * ResponseCode.h - */ - const int SERVICE_DISCOVERY_FAILED = 602; - const int SERVICE_FOUND = 603; - const int SERVICE_LOST = 604; - const int SERVICE_REGISTRATION_FAILED = 605; - const int SERVICE_REGISTERED = 606; - const int SERVICE_RESOLUTION_FAILED = 607; - const int SERVICE_RESOLVED = 608; - const int SERVICE_GET_ADDR_FAILED = 611; - const int SERVICE_GET_ADDR_SUCCESS = 612; - - /** - * Notify service registration status. - */ - void onServiceRegistrationStatus(in RegistrationInfo status); - - /** - * Notify service discovery status. - */ - void onServiceDiscoveryStatus(in DiscoveryInfo status); - - /** - * Notify service resolution status. - */ - void onServiceResolutionStatus(in ResolutionInfo status); - - /** - * Notify getting service address status. - */ - void onGettingServiceAddressStatus(in GetAddressInfo status); -} diff --git a/common/netd/binder/android/net/mdns/aidl/RegistrationInfo.aidl b/common/netd/binder/android/net/mdns/aidl/RegistrationInfo.aidl deleted file mode 100644 index 54835594..00000000 --- a/common/netd/binder/android/net/mdns/aidl/RegistrationInfo.aidl +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -/** - * Registration service information. - * This information combine all arguments that used by both request and callback. - * Arguments are used by request: - * - id - * - serviceName - * - registrationType - * - port - * - txtRecord - * - interfaceIdx - * - * Arguments are used by callback: - * - id - * - serviceName - * - registrationType - * - result - * - * {@hide} - */ -@JavaOnlyImmutable -@JavaDerive(equals=true, toString=true) -parcelable RegistrationInfo { - /** - * The operation ID. - */ - int id; - - /** - * The registration result. - */ - int result; - - /** - * The service name to be registered. - */ - @utf8InCpp String serviceName; - - /** - * The service type followed by the protocol, separated by a dot (e.g. "_ftp._tcp"). The service - * type must be an underscore, followed by 1-15 characters, which may be letters, digits, or - * hyphens. The transport protocol must be "_tcp" or "_udp". New service types should be - * registered at <http://www.dns-sd.org/ServiceTypes.html>. - */ - @utf8InCpp String registrationType; - - /** - * The port on which the service accepts connections. - */ - int port; - - /** - * The txt record. - */ - byte[] txtRecord; - - /** - * The interface index on which to register the service. 0 indicates "all interfaces". - */ - int interfaceIdx; -} diff --git a/common/netd/binder/android/net/mdns/aidl/ResolutionInfo.aidl b/common/netd/binder/android/net/mdns/aidl/ResolutionInfo.aidl deleted file mode 100644 index 26e0cee7..00000000 --- a/common/netd/binder/android/net/mdns/aidl/ResolutionInfo.aidl +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.mdns.aidl; - -/** - * Resolution service information. - * This information combine all arguments that used by both request and callback. - * Arguments are used by request: - * - id - * - serviceName - * - registrationType - * - domain - * - interfaceIdx - * - * Arguments are used by callback: - * - id - * - port - * - serviceFullName - * - hostname - * - txtRecord - * - interfaceIdx - * - result - * - * {@hide} - */ -@JavaOnlyImmutable -@JavaDerive(equals=true, toString=true) -parcelable ResolutionInfo { - /** - * The operation ID. - */ - int id; - - /** - * The resolution result. - */ - int result; - - /** - * The service name to be resolved. - */ - @utf8InCpp String serviceName; - - /** - * The service type to be resolved. - */ - @utf8InCpp String registrationType; - - /** - * The service domain to be resolved. - */ - @utf8InCpp String domain; - - /** - * The resolved full service domain name, in the form <servicename>.<protocol>.<domain>. - */ - @utf8InCpp String serviceFullName; - - /** - * The target hostname of the machine providing the service. - */ - @utf8InCpp String hostname; - - /** - * The port on which connections are accepted for this service. - */ - int port; - - /** - * The service's txt record. - */ - byte[] txtRecord; - - /** - * The interface index on which to resolve the service. 0 indicates "all interfaces". - */ - int interfaceIdx; -} diff --git a/common/netd/binder/android/net/metrics/INetdEventListener.aidl b/common/netd/binder/android/net/metrics/INetdEventListener.aidl deleted file mode 100644 index ef1b2cbc..00000000 --- a/common/netd/binder/android/net/metrics/INetdEventListener.aidl +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) 2016, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.metrics; - -/** - * Logs netd events. - * - * {@hide} - */ -oneway interface INetdEventListener { - const int EVENT_GETADDRINFO = 1; - const int EVENT_GETHOSTBYNAME = 2; - const int EVENT_GETHOSTBYADDR = 3; - const int EVENT_RES_NSEND = 4; - - const int REPORTING_LEVEL_NONE = 0; - const int REPORTING_LEVEL_METRICS = 1; - const int REPORTING_LEVEL_FULL = 2; - - // Maximum number of IP addresses logged for DNS lookups before we truncate the full list. - const int DNS_REPORTED_IP_ADDRESSES_LIMIT = 10; - - /** - * Logs a DNS lookup function call (getaddrinfo and gethostbyname). - * - * @param netId the ID of the network the lookup was performed on. - * @param eventType one of the EVENT_* constants in this interface. - * @param returnCode the return value of the function call. - * @param latencyMs the latency of the function call. - * @param hostname the name that was looked up. - * @param ipAddresses (possibly a subset of) the IP addresses returned. - * At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged. - * @param ipAddressesCount the number of IP addresses returned. May be different from the length - * of ipAddresses if there were too many addresses to log. - * @param uid the UID of the application that performed the query. - */ - void onDnsEvent(int netId, int eventType, int returnCode, int latencyMs, - @utf8InCpp String hostname, in @utf8InCpp String[] ipAddresses, - int ipAddressesCount, int uid); - - /** - * Represents a private DNS validation success or failure. - * - * @param netId the ID of the network the validation was performed on. - * @param ipAddress the IP address for which validation was performed. - * @param hostname the hostname for which validation was performed. - * @param validated whether or not validation was successful. - */ - void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, - boolean validated); - - /** - * Logs a single connect library call. - * - * @param netId the ID of the network the connect was performed on. - * @param error 0 if the connect call succeeded, otherwise errno if it failed. - * @param latencyMs the latency of the connect call. - * @param ipAddr destination IP address. - * @param port destination port number. - * @param uid the UID of the application that performed the connection. - */ - void onConnectEvent(int netId, int error, int latencyMs, String ipAddr, int port, int uid); - - /** - * Logs a single RX packet which caused the main CPU to exit sleep state. - * @param prefix arbitrary string provided via wakeupAddInterface() - * @param uid UID of the destination process or -1 if no UID is available. - * @param ethertype of the RX packet encoded in an int in native order, or -1 if not available. - * @param ipNextHeader ip protocol of the RX packet as IPPROTO_* number, - or -1 if the packet was not IPv4 or IPv6. - * @param dstHw destination hardware address, or 0 if not available. - * @param srcIp source IP address, or null if not available. - * @param dstIp destination IP address, or null if not available. - * @param srcPort src port of RX packet in native order, or -1 if the packet was not UDP or TCP. - * @param dstPort dst port of RX packet in native order, or -1 if the packet was not UDP or TCP. - * @param timestampNs receive timestamp for the offending packet. In units of nanoseconds and - * synchronized to CLOCK_MONOTONIC. - */ - void onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader, in byte[] dstHw, - String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs); - - /** - * An event sent after every Netlink sock_diag poll performed by Netd. This reported batch - * groups TCP socket stats aggregated by network id. Per-network data are stored in a - * structure-of-arrays style where networkIds, sentPackets, lostPackets, rttUs, and - * sentAckDiffMs have the same length. Stats for the i-th network is spread across all these - * arrays at index i. - * @param networkIds an array of network ids for which there was tcp socket stats to collect in - * the last sock_diag poll. - * @param sentPackets an array of packet sent across all TCP sockets still alive and new - TCP sockets since the last sock_diag poll, summed per network id. - * @param lostPackets, an array of packet lost across all TCP sockets still alive and new - TCP sockets since the last sock_diag poll, summed per network id. - * @param rttUs an array of smoothed round trip times in microseconds, averaged across all TCP - sockets since the last sock_diag poll for a given network id. - * @param sentAckDiffMs an array of milliseconds duration between the last packet sent and the - last ack received for a socket, averaged across all TCP sockets for a network id. - */ - void onTcpSocketStatsEvent(in int[] networkIds, in int[] sentPackets, - in int[] lostPackets, in int[] rttUs, in int[] sentAckDiffMs); - - /** - * Represents adding or removing a NAT64 prefix. - * - * @param netId the ID of the network the prefix was discovered on. - * @param added true if the NAT64 prefix was added, or false if the NAT64 prefix was removed. - * There is only one prefix at a time for each netId. If a prefix is added, it replaces - * the previous-added prefix. - * @param prefixString the detected NAT64 prefix as a string literal. - * @param prefixLength the prefix length associated with this NAT64 prefix. - */ - void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString, - int prefixLength); -} diff --git a/common/netd/binder/android/net/netd/aidl/NativeUidRangeConfig.aidl b/common/netd/binder/android/net/netd/aidl/NativeUidRangeConfig.aidl deleted file mode 100644 index 99497a86..00000000 --- a/common/netd/binder/android/net/netd/aidl/NativeUidRangeConfig.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.net.netd.aidl; - -import android.net.UidRangeParcel; - -/** - * The configuration to add or remove UID ranges. - * - * {@hide} - */ -@JavaDerive(toString=true, equals=true) -@JavaOnlyImmutable -parcelable NativeUidRangeConfig { - /** The network ID of the network to add/remove the ranges to/from. */ - int netId; - - /** A set of non-overlapping ranges of UIDs. */ - UidRangeParcel[] uidRanges; - - /** - * The priority of this UID range config. 0 is the highest priority; 999 is the lowest priority. - * The function of this parameter is to adjust the priority when the same UID is set to - * different networks for different features. - */ - int subPriority; -}
\ No newline at end of file diff --git a/common/netd/libnetdutils/Android.bp b/common/netd/libnetdutils/Android.bp deleted file mode 100644 index 31690331..00000000 --- a/common/netd/libnetdutils/Android.bp +++ /dev/null @@ -1,73 +0,0 @@ -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -cc_library { - name: "libnetdutils", - srcs: [ - "DumpWriter.cpp", - "Fd.cpp", - "InternetAddresses.cpp", - "Log.cpp", - "Netfilter.cpp", - "Netlink.cpp", - "NetlinkListener.cpp", - "Slice.cpp", - "Socket.cpp", - "SocketOption.cpp", - "Status.cpp", - "Syscalls.cpp", - "UniqueFd.cpp", - "UniqueFile.cpp", - "Utils.cpp", - ], - defaults: ["netd_defaults"], - cflags: ["-Wall", "-Werror"], - shared_libs: [ - "libbase", - "liblog", - ], - export_shared_lib_headers: [ - "libbase", - ], - export_include_dirs: ["include"], - sanitize: { - cfi: true, - }, - - apex_available: [ - "//apex_available:platform", - "com.android.resolv", - "com.android.tethering", - ], - min_sdk_version: "29", -} - -cc_test { - name: "netdutils_test", - srcs: [ - "BackoffSequenceTest.cpp", - "FdTest.cpp", - "InternetAddressesTest.cpp", - "LogTest.cpp", - "MemBlockTest.cpp", - "SliceTest.cpp", - "StatusTest.cpp", - "SyscallsTest.cpp", - "ThreadUtilTest.cpp", - ], - defaults: ["netd_defaults"], - test_suites: ["device-tests"], - static_libs: [ - "libgmock", - "libnetdutils", - ], - shared_libs: [ - "libbase", - ], -} - -cc_library_headers { - name: "libnetd_utils_headers", - export_include_dirs: ["include"], -} diff --git a/common/netd/libnetdutils/BackoffSequenceTest.cpp b/common/netd/libnetdutils/BackoffSequenceTest.cpp deleted file mode 100644 index b6653fe8..00000000 --- a/common/netd/libnetdutils/BackoffSequenceTest.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "netdutils/BackoffSequence.h" - -namespace android { -namespace netdutils { - -TEST(BackoffSequence, defaults) { - BackoffSequence<uint32_t> backoff; - - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(0x00000001U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000002U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000004U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000008U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000010U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000020U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000040U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000080U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000100U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000200U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000400U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000800U, backoff.getNextTimeout()); - EXPECT_EQ(0x00001000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00002000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00004000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00008000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00010000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00020000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00040000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00080000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00100000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00200000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00400000U, backoff.getNextTimeout()); - EXPECT_EQ(0x00800000U, backoff.getNextTimeout()); - EXPECT_EQ(0x01000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x02000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x04000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x08000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x10000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x20000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x40000000U, backoff.getNextTimeout()); - EXPECT_EQ(0x80000000U, backoff.getNextTimeout()); - // Maxes out, and stays there, ad infinitum. - for (int i = 0; i < 10; i++) { - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(0xffffffffU, backoff.getNextTimeout()); - } -} - -TEST(BackoffSequence, backoffToOncePerHour) { - auto backoff = BackoffSequence<uint32_t>::Builder() - .withInitialRetransmissionTime(1) - .withMaximumRetransmissionTime(3600) - .build(); - - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(0x00000001U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000002U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000004U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000008U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000010U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000020U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000040U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000080U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000100U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000200U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000400U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000800U, backoff.getNextTimeout()); - // Maxes out, and stays there, ad infinitum. - for (int i = 0; i < 10; i++) { - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(3600U, backoff.getNextTimeout()); - } -} - -TEST(BackoffSequence, simpleMaxRetransCount) { - auto backoff = BackoffSequence<uint32_t>::Builder() - .withInitialRetransmissionTime(3) - .withMaximumRetransmissionCount(7) - .build(); - - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(0x00000003U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000006U, backoff.getNextTimeout()); - EXPECT_EQ(0x0000000cU, backoff.getNextTimeout()); - EXPECT_EQ(0x00000018U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000030U, backoff.getNextTimeout()); - EXPECT_EQ(0x00000060U, backoff.getNextTimeout()); - EXPECT_EQ(0x000000c0U, backoff.getNextTimeout()); - - for (int i = 0; i < 10; i++) { - EXPECT_FALSE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - } -} - -TEST(BackoffSequence, simpleMaxDuration) { - auto backoff = BackoffSequence<int>::Builder() - .withInitialRetransmissionTime(3) - .withMaximumRetransmissionDuration(7) - .withEndOfSequenceIndicator(-1) - .build(); - - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(0x00000003, backoff.getNextTimeout()); - EXPECT_EQ(0x00000004, backoff.getNextTimeout()); - - for (int i = 0; i < 10; i++) { - EXPECT_FALSE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - EXPECT_EQ(-1, backoff.getNextTimeout()); - } -} - -TEST(PathologicalBackoffSequence, ZeroInitialRetransTime) { - auto backoff = BackoffSequence<std::chrono::seconds>::Builder() - .withInitialRetransmissionTime(std::chrono::seconds(0)) - .build(); - - for (int i = 0; i < 10; i++) { - // TODO: Decide whether this needs fixing, and how. - EXPECT_TRUE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - } -} - -TEST(PathologicalBackoffSequence, MaxRetransDurationGreaterThanInitialRetransTime) { - auto backoff = BackoffSequence<std::chrono::milliseconds>::Builder() - .withInitialRetransmissionTime(std::chrono::milliseconds(5)) - .withMaximumRetransmissionDuration(std::chrono::milliseconds(3)) - .build(); - - EXPECT_EQ(std::chrono::milliseconds(3), backoff.getNextTimeout()); - for (int i = 0; i < 10; i++) { - EXPECT_FALSE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - } -} - -TEST(PathologicalBackoffSequence, MaxRetransDurationEqualsInitialRetransTime) { - auto backoff = BackoffSequence<std::chrono::hours>::Builder() - .withInitialRetransmissionTime(std::chrono::hours(5)) - .withMaximumRetransmissionDuration(std::chrono::hours(5)) - .build(); - - EXPECT_EQ(std::chrono::hours(5), backoff.getNextTimeout()); - for (int i = 0; i < 10; i++) { - EXPECT_FALSE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - } -} - -TEST(PathologicalBackoffSequence, MaxRetransTimeAndDurationGreaterThanInitialRetransTime) { - auto backoff = BackoffSequence<std::chrono::nanoseconds>::Builder() - .withInitialRetransmissionTime(std::chrono::nanoseconds(7)) - .withMaximumRetransmissionTime(std::chrono::nanoseconds(3)) - .withMaximumRetransmissionDuration(std::chrono::nanoseconds(5)) - .build(); - - EXPECT_EQ(std::chrono::nanoseconds(3), backoff.getNextTimeout()); - EXPECT_EQ(std::chrono::nanoseconds(2), backoff.getNextTimeout()); - for (int i = 0; i < 10; i++) { - EXPECT_FALSE(backoff.hasNextTimeout()); - EXPECT_EQ(backoff.getEndOfSequenceIndicator(), backoff.getNextTimeout()); - } -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/DumpWriter.cpp b/common/netd/libnetdutils/DumpWriter.cpp deleted file mode 100644 index 092ddbae..00000000 --- a/common/netd/libnetdutils/DumpWriter.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/DumpWriter.h" - -#include <unistd.h> -#include <limits> - -#include <android-base/stringprintf.h> -#include <utils/String8.h> - -using android::base::StringAppendV; - -namespace android { -namespace netdutils { - -namespace { - -const char kIndentString[] = " "; -const size_t kIndentStringLen = strlen(kIndentString); - -} // namespace - -DumpWriter::DumpWriter(int fd) : mIndentLevel(0), mFd(fd) {} - -void DumpWriter::incIndent() { - if (mIndentLevel < std::numeric_limits<decltype(mIndentLevel)>::max()) { - mIndentLevel++; - } -} - -void DumpWriter::decIndent() { - if (mIndentLevel > std::numeric_limits<decltype(mIndentLevel)>::min()) { - mIndentLevel--; - } -} - -void DumpWriter::println(const std::string& line) { - if (!line.empty()) { - for (int i = 0; i < mIndentLevel; i++) { - ::write(mFd, kIndentString, kIndentStringLen); - } - ::write(mFd, line.c_str(), line.size()); - } - ::write(mFd, "\n", 1); -} - -// NOLINTNEXTLINE(cert-dcl50-cpp): Grandfathered C-style variadic function. -void DumpWriter::println(const char* fmt, ...) { - std::string line; - va_list ap; - va_start(ap, fmt); - StringAppendV(&line, fmt, ap); - va_end(ap); - println(line); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Fd.cpp b/common/netd/libnetdutils/Fd.cpp deleted file mode 100644 index 2651f906..00000000 --- a/common/netd/libnetdutils/Fd.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/Fd.h" - -namespace android { -namespace netdutils { - -std::ostream& operator<<(std::ostream& os, const Fd& fd) { - return os << "Fd[" << fd.get() << "]"; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/FdTest.cpp b/common/netd/libnetdutils/FdTest.cpp deleted file mode 100644 index 7080f831..00000000 --- a/common/netd/libnetdutils/FdTest.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <cstdint> - -#include <gtest/gtest.h> - -#include "netdutils/MockSyscalls.h" -#include "netdutils/Status.h" -#include "netdutils/Syscalls.h" - -using testing::Mock; -using testing::Return; -using testing::StrictMock; - -namespace android { -namespace netdutils { -namespace { - -// Force implicit conversion from UniqueFd -> Fd -inline Fd toFd(const UniqueFd& fd) { - return fd; -} - -} // namespace - -TEST(Fd, smoke) { - // Expect the following lines to compile - Fd fd1(1); - Fd fd2(fd1); - Fd fd3 = fd2; - const Fd fd4(8); - const Fd fd5(fd4); - const Fd fd6 = fd5; - EXPECT_TRUE(isWellFormed(fd3)); - EXPECT_TRUE(isWellFormed(fd6)); - - // Corner case - Fd zero(0); - EXPECT_TRUE(isWellFormed(zero)); - - // Invalid file descriptors - Fd bad(-1); - Fd weird(-9); - EXPECT_FALSE(isWellFormed(bad)); - EXPECT_FALSE(isWellFormed(weird)); - - // Default constructor - EXPECT_EQ(Fd(-1), Fd()); - std::stringstream ss; - ss << fd3 << " " << fd6 << " " << bad << " " << weird; - EXPECT_EQ("Fd[1] Fd[8] Fd[-1] Fd[-9]", ss.str()); -} - -class UniqueFdTest : public testing::Test { - protected: - StrictMock<ScopedMockSyscalls> mSyscalls; -}; - -TEST_F(UniqueFdTest, operatorOstream) { - UniqueFd u(97); - EXPECT_CALL(mSyscalls, close(toFd(u))).WillOnce(Return(status::ok)); - std::stringstream ss; - ss << u; - EXPECT_EQ("UniqueFd[Fd[97]]", ss.str()); - u.reset(); -} - -TEST_F(UniqueFdTest, destructor) { - { - UniqueFd u(98); - EXPECT_CALL(mSyscalls, close(toFd(u))).WillOnce(Return(status::ok)); - } - // Expectation above should be upon leaving nested scope - Mock::VerifyAndClearExpectations(&mSyscalls); -} - -TEST_F(UniqueFdTest, reset) { - UniqueFd u(99); - EXPECT_CALL(mSyscalls, close(toFd(u))).WillOnce(Return(status::ok)); - u.reset(); - - // Expectation above should be upon reset - Mock::VerifyAndClearExpectations(&mSyscalls); -} - -TEST_F(UniqueFdTest, moveConstructor) { - constexpr Fd kFd(101); - UniqueFd u1(kFd); - { - UniqueFd u2(std::move(u1)); - // NOLINTNEXTLINE bugprone-use-after-move - EXPECT_FALSE(isWellFormed(u1)); - EXPECT_TRUE(isWellFormed(u2)); - EXPECT_CALL(mSyscalls, close(kFd)).WillOnce(Return(status::ok)); - } - // Expectation above should be upon leaving nested scope - Mock::VerifyAndClearExpectations(&mSyscalls); -} - -TEST_F(UniqueFdTest, moveAssignment) { - constexpr Fd kFd(102); - UniqueFd u1(kFd); - { - UniqueFd u2 = std::move(u1); - // NOLINTNEXTLINE bugprone-use-after-move - EXPECT_FALSE(isWellFormed(u1)); - EXPECT_TRUE(isWellFormed(u2)); - UniqueFd u3; - u3 = std::move(u2); - // NOLINTNEXTLINE bugprone-use-after-move - EXPECT_FALSE(isWellFormed(u2)); - EXPECT_TRUE(isWellFormed(u3)); - EXPECT_CALL(mSyscalls, close(kFd)).WillOnce(Return(status::ok)); - } - // Expectation above should be upon leaving nested scope - Mock::VerifyAndClearExpectations(&mSyscalls); -} - -TEST_F(UniqueFdTest, constConstructor) { - constexpr Fd kFd(103); - const UniqueFd u(kFd); - EXPECT_CALL(mSyscalls, close(toFd(u))).WillOnce(Return(status::ok)); -} - -TEST_F(UniqueFdTest, closeFailure) { - constexpr Fd kFd(103); - UniqueFd u(kFd); - EXPECT_CALL(mSyscalls, close(toFd(u))).WillOnce(Return(statusFromErrno(EINTR, "test"))); - EXPECT_DEBUG_DEATH(u.reset(), ""); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/InternetAddresses.cpp b/common/netd/libnetdutils/InternetAddresses.cpp deleted file mode 100644 index 322f1b1d..00000000 --- a/common/netd/libnetdutils/InternetAddresses.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/InternetAddresses.h" - -#include <string> - -#include <android-base/stringprintf.h> -#include <arpa/inet.h> -#include <netdb.h> -#include <sys/socket.h> -#include <sys/types.h> - -namespace android { - -using base::StringPrintf; - -namespace netdutils { - -std::string IPAddress::toString() const noexcept { - char repr[INET6_ADDRSTRLEN] = "\0"; - - switch (mData.family) { - case AF_UNSPEC: - return "<unspecified>"; - case AF_INET: { - const in_addr v4 = mData.ip.v4; - inet_ntop(AF_INET, &v4, repr, sizeof(repr)); - break; - } - case AF_INET6: { - const in6_addr v6 = mData.ip.v6; - inet_ntop(AF_INET6, &v6, repr, sizeof(repr)); - break; - } - default: - return "<unknown_family>"; - } - - if (mData.family == AF_INET6 && mData.scope_id > 0) { - return StringPrintf("%s%%%u", repr, mData.scope_id); - } - - return repr; -} - -bool IPAddress::forString(const std::string& repr, IPAddress* ip) { - const addrinfo hints = { - .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV, - }; - addrinfo* res; - const int ret = getaddrinfo(repr.c_str(), nullptr, &hints, &res); - ScopedAddrinfo res_cleanup(res); - if (ret != 0) { - return false; - } - - bool rval = true; - switch (res[0].ai_family) { - case AF_INET: { - sockaddr_in* sin = (sockaddr_in*) res[0].ai_addr; - if (ip) *ip = IPAddress(sin->sin_addr); - break; - } - case AF_INET6: { - sockaddr_in6* sin6 = (sockaddr_in6*) res[0].ai_addr; - if (ip) *ip = IPAddress(sin6->sin6_addr, sin6->sin6_scope_id); - break; - } - default: - rval = false; - break; - } - - return rval; -} - -IPPrefix::IPPrefix(const IPAddress& ip, int length) : IPPrefix(ip) { - // Silently treat CIDR lengths like "-1" as meaning the full bit length - // appropriate to the address family. - if (length < 0) return; - if (length >= mData.cidrlen) return; - - switch (mData.family) { - case AF_UNSPEC: - break; - case AF_INET: { - const in_addr_t mask = (length > 0) ? (~0U) << (IPV4_ADDR_BITS - length) : 0U; - mData.ip.v4.s_addr &= htonl(mask); - mData.cidrlen = static_cast<uint8_t>(length); - break; - } - case AF_INET6: { - // The byte in which this CIDR length falls. - const int which = length / 8; - const int mask = (length % 8 == 0) ? 0 : 0xff << (8 - length % 8); - mData.ip.v6.s6_addr[which] &= mask; - for (int i = which + 1; i < IPV6_ADDR_LEN; i++) { - mData.ip.v6.s6_addr[i] = 0U; - } - mData.cidrlen = static_cast<uint8_t>(length); - break; - } - default: - // TODO: Complain bitterly about possible data corruption? - return; - } -} - -bool IPPrefix::isUninitialized() const noexcept { - static const internal_::compact_ipdata empty{}; - return mData == empty; -} - -bool IPPrefix::forString(const std::string& repr, IPPrefix* prefix) { - size_t index = repr.find('/'); - if (index == std::string::npos) return false; - - // Parse the IP address. - IPAddress ip; - if (!IPAddress::forString(repr.substr(0, index), &ip)) return false; - - // Parse the prefix length. Can't use base::ParseUint because it accepts non-base 10 input. - const char* prefixString = repr.c_str() + index + 1; - if (!isdigit(*prefixString)) return false; - char* endptr; - unsigned long prefixlen = strtoul(prefixString, &endptr, 10); - if (*endptr != '\0') return false; - - uint8_t maxlen = (ip.family() == AF_INET) ? 32 : 128; - if (prefixlen > maxlen) return false; - - *prefix = IPPrefix(ip, prefixlen); - return true; -} - -std::string IPPrefix::toString() const noexcept { - return StringPrintf("%s/%d", ip().toString().c_str(), mData.cidrlen); -} - -std::string IPSockAddr::toString() const noexcept { - switch (mData.family) { - case AF_INET6: - return StringPrintf("[%s]:%u", ip().toString().c_str(), mData.port); - default: - return StringPrintf("%s:%u", ip().toString().c_str(), mData.port); - } -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/InternetAddressesTest.cpp b/common/netd/libnetdutils/InternetAddressesTest.cpp deleted file mode 100644 index 9e37d11f..00000000 --- a/common/netd/libnetdutils/InternetAddressesTest.cpp +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <cstdint> -#include <limits> -#include <sstream> -#include <string> -#include <vector> - -#include <android-base/macros.h> -#include <fmt/format.h> -#include <gtest/gtest.h> - -#include "netdutils/InternetAddresses.h" - -namespace android { -namespace netdutils { -namespace { - -enum Relation { EQ, LT }; - -std::ostream& operator<<(std::ostream& os, Relation relation) { - switch (relation) { - case EQ: os << "eq"; break; - case LT: os << "lt"; break; - default: os << "?!"; break; - } - return os; -} - -template <typename T> -struct OperatorExpectation { - const Relation relation; - const T obj1; - const T obj2; - - std::string toString() const { - std::stringstream output; - output << obj1 << " " << relation << " " << obj2; - return output.str(); - } -}; - -template <typename T> -void testGamutOfOperators(const OperatorExpectation<T>& expectation) { - switch (expectation.relation) { - case EQ: - EXPECT_TRUE(expectation.obj1 == expectation.obj2); - EXPECT_TRUE(expectation.obj1 <= expectation.obj2); - EXPECT_TRUE(expectation.obj1 >= expectation.obj2); - EXPECT_FALSE(expectation.obj1 != expectation.obj2); - EXPECT_FALSE(expectation.obj1 < expectation.obj2); - EXPECT_FALSE(expectation.obj1 > expectation.obj2); - break; - - case LT: - EXPECT_TRUE(expectation.obj1 < expectation.obj2); - EXPECT_TRUE(expectation.obj1 <= expectation.obj2); - EXPECT_TRUE(expectation.obj1 != expectation.obj2); - EXPECT_FALSE(expectation.obj1 > expectation.obj2); - EXPECT_FALSE(expectation.obj1 >= expectation.obj2); - EXPECT_FALSE(expectation.obj1 == expectation.obj2); - break; - - default: - FAIL() << "Unknown relation given in test expectation"; - } -} - -const in_addr IPV4_ANY{htonl(INADDR_ANY)}; -const in_addr IPV4_LOOPBACK{htonl(INADDR_LOOPBACK)}; -const in_addr IPV4_ONES{~0U}; -const in6_addr IPV6_ANY = IN6ADDR_ANY_INIT; -const in6_addr IPV6_LOOPBACK = IN6ADDR_LOOPBACK_INIT; -const in6_addr FE80{{{0xfe,0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}; -const in6_addr FE80_1{{{0xfe,0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}}; -const in6_addr FE80_2{{{0xfe,0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,2}}}; -const uint8_t ff = std::numeric_limits<uint8_t>::max(); -const in6_addr IPV6_ONES{{{ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff}}}; - -TEST(IPAddressTest, GamutOfOperators) { - const std::vector<OperatorExpectation<IPAddress>> kExpectations{ - {EQ, IPAddress(), IPAddress()}, - {EQ, IPAddress(IPV4_ONES), IPAddress(IPV4_ONES)}, - {EQ, IPAddress(IPV6_ONES), IPAddress(IPV6_ONES)}, - {EQ, IPAddress(FE80_1), IPAddress(FE80_1)}, - {EQ, IPAddress(FE80_2), IPAddress(FE80_2)}, - {LT, IPAddress(), IPAddress(IPV4_ANY)}, - {LT, IPAddress(), IPAddress(IPV4_ONES)}, - {LT, IPAddress(), IPAddress(IPV6_ANY)}, - {LT, IPAddress(), IPAddress(IPV6_ONES)}, - {LT, IPAddress(IPV4_ANY), IPAddress(IPV4_ONES)}, - {LT, IPAddress(IPV4_ANY), IPAddress(IPV6_ANY)}, - {LT, IPAddress(IPV4_ONES), IPAddress(IPV6_ANY)}, - {LT, IPAddress(IPV4_ONES), IPAddress(IPV6_ONES)}, - {LT, IPAddress(IPV6_ANY), IPAddress(IPV6_LOOPBACK)}, - {LT, IPAddress(IPV6_ANY), IPAddress(IPV6_ONES)}, - {LT, IPAddress(IPV6_LOOPBACK), IPAddress(IPV6_ONES)}, - {LT, IPAddress(FE80_1), IPAddress(FE80_2)}, - {LT, IPAddress(FE80_1), IPAddress(IPV6_ONES)}, - {LT, IPAddress(FE80_2), IPAddress(IPV6_ONES)}, - // Sort by scoped_id within the same address. - {LT, IPAddress(FE80_1), IPAddress(FE80_1, 1)}, - {LT, IPAddress(FE80_1, 1), IPAddress(FE80_1, 2)}, - // Sort by address first, scope_id second. - {LT, IPAddress(FE80_1, 2), IPAddress(FE80_2, 1)}, - }; - - size_t tests_run = 0; - for (const auto& expectation : kExpectations) { - SCOPED_TRACE(expectation.toString()); - EXPECT_NO_FATAL_FAILURE(testGamutOfOperators(expectation)); - tests_run++; - } - EXPECT_EQ(kExpectations.size(), tests_run); -} - -TEST(IPAddressTest, ScopeIds) { - // Scope IDs ignored for IPv4 addresses. - const IPAddress ones(IPV4_ONES); - EXPECT_EQ(0U, ones.scope_id()); - const IPAddress ones22(ones, 22); - EXPECT_EQ(0U, ones22.scope_id()); - EXPECT_EQ(ones, ones22); - const IPAddress ones23(ones, 23); - EXPECT_EQ(0U, ones23.scope_id()); - EXPECT_EQ(ones22, ones23); - - EXPECT_EQ("fe80::1%22", IPAddress(FE80_1, 22).toString()); - EXPECT_EQ("fe80::2%23", IPAddress(FE80_2, 23).toString()); - - // Verify that given an IPAddress with a scope_id an address without a - // scope_id can be constructed (just in case it's useful). - const IPAddress fe80_intf22(FE80_1, 22); - EXPECT_EQ(22U, fe80_intf22.scope_id()); - EXPECT_EQ(fe80_intf22, IPAddress(fe80_intf22)); - EXPECT_EQ(IPAddress(FE80_1), IPAddress(fe80_intf22, 0)); -} - -TEST(IPAddressTest, forString) { - IPAddress ip; - - EXPECT_FALSE(IPAddress::forString("not_an_ip", &ip)); - EXPECT_FALSE(IPAddress::forString("not_an_ip", nullptr)); - EXPECT_EQ(IPAddress(), IPAddress::forString("not_an_ip")); - - EXPECT_EQ(IPAddress(IPV4_ANY), IPAddress::forString("0.0.0.0")); - EXPECT_EQ(IPAddress(IPV4_ONES), IPAddress::forString("255.255.255.255")); - EXPECT_EQ(IPAddress(IPV4_LOOPBACK), IPAddress::forString("127.0.0.1")); - - EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("::")); - EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("::0")); - EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("0::")); - EXPECT_EQ(IPAddress(IPV6_LOOPBACK), IPAddress::forString("::1")); - EXPECT_EQ(IPAddress(IPV6_LOOPBACK), IPAddress::forString("0::1")); - EXPECT_EQ(IPAddress(FE80_1), IPAddress::forString("fe80::1")); - EXPECT_EQ(IPAddress(FE80_1, 22), IPAddress::forString("fe80::1%22")); - // This relies upon having a loopback interface named "lo" with ifindex 1. - EXPECT_EQ(IPAddress(FE80_1, 1), IPAddress::forString("fe80::1%lo")); -} - -TEST(IPPrefixTest, forString) { - IPPrefix prefix; - - EXPECT_FALSE(IPPrefix::forString("", &prefix)); - EXPECT_FALSE(IPPrefix::forString("invalid", &prefix)); - EXPECT_FALSE(IPPrefix::forString("192.0.2.0", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001::db8::", &prefix)); - - EXPECT_FALSE(IPPrefix::forString("2001:db8::/", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8:://32", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/32z", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/32/", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/0x20", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8:: /32", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/ 32", &prefix)); - EXPECT_FALSE(IPPrefix::forString(" 2001:db8::/32", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/32 ", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/+32", &prefix)); - - EXPECT_FALSE(IPPrefix::forString("192.0.2.0/33", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/129", &prefix)); - EXPECT_FALSE(IPPrefix::forString("192.0.2.0/-1", &prefix)); - EXPECT_FALSE(IPPrefix::forString("2001:db8::/-1", &prefix)); - - EXPECT_TRUE(IPPrefix::forString("2001:db8::/32", &prefix)); - EXPECT_EQ("2001:db8::/32", prefix.toString()); - EXPECT_EQ(IPPrefix(IPAddress::forString("2001:db8::"), 32), prefix); - - EXPECT_EQ(IPPrefix(), IPPrefix::forString("invalid")); - - EXPECT_EQ("0.0.0.0/0", IPPrefix::forString("0.0.0.0/0").toString()); - EXPECT_EQ("::/0", IPPrefix::forString("::/0").toString()); - EXPECT_EQ("192.0.2.128/25", IPPrefix::forString("192.0.2.131/25").toString()); - EXPECT_EQ("2001:db8:1:2:3:4:5:4/126", - IPPrefix::forString("2001:db8:1:2:3:4:5:6/126").toString()); -} - -TEST(IPPrefixTest, IPv4Truncation) { - const auto prefixStr = [](int length) -> std::string { - return IPPrefix(IPAddress(IPV4_ONES), length).toString(); - }; - - EXPECT_EQ("0.0.0.0/0", prefixStr(0)); - - EXPECT_EQ("128.0.0.0/1", prefixStr(1)); - EXPECT_EQ("192.0.0.0/2", prefixStr(2)); - EXPECT_EQ("224.0.0.0/3", prefixStr(3)); - EXPECT_EQ("240.0.0.0/4", prefixStr(4)); - EXPECT_EQ("248.0.0.0/5", prefixStr(5)); - EXPECT_EQ("252.0.0.0/6", prefixStr(6)); - EXPECT_EQ("254.0.0.0/7", prefixStr(7)); - EXPECT_EQ("255.0.0.0/8", prefixStr(8)); - - EXPECT_EQ("255.128.0.0/9", prefixStr(9)); - EXPECT_EQ("255.192.0.0/10", prefixStr(10)); - EXPECT_EQ("255.224.0.0/11", prefixStr(11)); - EXPECT_EQ("255.240.0.0/12", prefixStr(12)); - EXPECT_EQ("255.248.0.0/13", prefixStr(13)); - EXPECT_EQ("255.252.0.0/14", prefixStr(14)); - EXPECT_EQ("255.254.0.0/15", prefixStr(15)); - EXPECT_EQ("255.255.0.0/16", prefixStr(16)); - - EXPECT_EQ("255.255.128.0/17", prefixStr(17)); - EXPECT_EQ("255.255.192.0/18", prefixStr(18)); - EXPECT_EQ("255.255.224.0/19", prefixStr(19)); - EXPECT_EQ("255.255.240.0/20", prefixStr(20)); - EXPECT_EQ("255.255.248.0/21", prefixStr(21)); - EXPECT_EQ("255.255.252.0/22", prefixStr(22)); - EXPECT_EQ("255.255.254.0/23", prefixStr(23)); - EXPECT_EQ("255.255.255.0/24", prefixStr(24)); - - EXPECT_EQ("255.255.255.128/25", prefixStr(25)); - EXPECT_EQ("255.255.255.192/26", prefixStr(26)); - EXPECT_EQ("255.255.255.224/27", prefixStr(27)); - EXPECT_EQ("255.255.255.240/28", prefixStr(28)); - EXPECT_EQ("255.255.255.248/29", prefixStr(29)); - EXPECT_EQ("255.255.255.252/30", prefixStr(30)); - EXPECT_EQ("255.255.255.254/31", prefixStr(31)); - EXPECT_EQ("255.255.255.255/32", prefixStr(32)); -} - -TEST(IPPrefixTest, IPv6Truncation) { - const auto prefixStr = [](int length) -> std::string { - return IPPrefix(IPAddress(IPV6_ONES), length).toString(); - }; - - EXPECT_EQ("::/0", prefixStr(0)); - - EXPECT_EQ("8000::/1", prefixStr(1)); - EXPECT_EQ("c000::/2", prefixStr(2)); - EXPECT_EQ("e000::/3", prefixStr(3)); - EXPECT_EQ("f000::/4", prefixStr(4)); - EXPECT_EQ("f800::/5", prefixStr(5)); - EXPECT_EQ("fc00::/6", prefixStr(6)); - EXPECT_EQ("fe00::/7", prefixStr(7)); - EXPECT_EQ("ff00::/8", prefixStr(8)); - - EXPECT_EQ("ff80::/9", prefixStr(9)); - EXPECT_EQ("ffc0::/10", prefixStr(10)); - EXPECT_EQ("ffe0::/11", prefixStr(11)); - EXPECT_EQ("fff0::/12", prefixStr(12)); - EXPECT_EQ("fff8::/13", prefixStr(13)); - EXPECT_EQ("fffc::/14", prefixStr(14)); - EXPECT_EQ("fffe::/15", prefixStr(15)); - EXPECT_EQ("ffff::/16", prefixStr(16)); - - EXPECT_EQ("ffff:8000::/17", prefixStr(17)); - EXPECT_EQ("ffff:c000::/18", prefixStr(18)); - EXPECT_EQ("ffff:e000::/19", prefixStr(19)); - EXPECT_EQ("ffff:f000::/20", prefixStr(20)); - EXPECT_EQ("ffff:f800::/21", prefixStr(21)); - EXPECT_EQ("ffff:fc00::/22", prefixStr(22)); - EXPECT_EQ("ffff:fe00::/23", prefixStr(23)); - EXPECT_EQ("ffff:ff00::/24", prefixStr(24)); - - EXPECT_EQ("ffff:ff80::/25", prefixStr(25)); - EXPECT_EQ("ffff:ffc0::/26", prefixStr(26)); - EXPECT_EQ("ffff:ffe0::/27", prefixStr(27)); - EXPECT_EQ("ffff:fff0::/28", prefixStr(28)); - EXPECT_EQ("ffff:fff8::/29", prefixStr(29)); - EXPECT_EQ("ffff:fffc::/30", prefixStr(30)); - EXPECT_EQ("ffff:fffe::/31", prefixStr(31)); - EXPECT_EQ("ffff:ffff::/32", prefixStr(32)); - - EXPECT_EQ("ffff:ffff:8000::/33", prefixStr(33)); - EXPECT_EQ("ffff:ffff:c000::/34", prefixStr(34)); - EXPECT_EQ("ffff:ffff:e000::/35", prefixStr(35)); - EXPECT_EQ("ffff:ffff:f000::/36", prefixStr(36)); - EXPECT_EQ("ffff:ffff:f800::/37", prefixStr(37)); - EXPECT_EQ("ffff:ffff:fc00::/38", prefixStr(38)); - EXPECT_EQ("ffff:ffff:fe00::/39", prefixStr(39)); - EXPECT_EQ("ffff:ffff:ff00::/40", prefixStr(40)); - - EXPECT_EQ("ffff:ffff:ff80::/41", prefixStr(41)); - EXPECT_EQ("ffff:ffff:ffc0::/42", prefixStr(42)); - EXPECT_EQ("ffff:ffff:ffe0::/43", prefixStr(43)); - EXPECT_EQ("ffff:ffff:fff0::/44", prefixStr(44)); - EXPECT_EQ("ffff:ffff:fff8::/45", prefixStr(45)); - EXPECT_EQ("ffff:ffff:fffc::/46", prefixStr(46)); - EXPECT_EQ("ffff:ffff:fffe::/47", prefixStr(47)); - EXPECT_EQ("ffff:ffff:ffff::/48", prefixStr(48)); - - EXPECT_EQ("ffff:ffff:ffff:8000::/49", prefixStr(49)); - EXPECT_EQ("ffff:ffff:ffff:c000::/50", prefixStr(50)); - EXPECT_EQ("ffff:ffff:ffff:e000::/51", prefixStr(51)); - EXPECT_EQ("ffff:ffff:ffff:f000::/52", prefixStr(52)); - EXPECT_EQ("ffff:ffff:ffff:f800::/53", prefixStr(53)); - EXPECT_EQ("ffff:ffff:ffff:fc00::/54", prefixStr(54)); - EXPECT_EQ("ffff:ffff:ffff:fe00::/55", prefixStr(55)); - EXPECT_EQ("ffff:ffff:ffff:ff00::/56", prefixStr(56)); - - EXPECT_EQ("ffff:ffff:ffff:ff80::/57", prefixStr(57)); - EXPECT_EQ("ffff:ffff:ffff:ffc0::/58", prefixStr(58)); - EXPECT_EQ("ffff:ffff:ffff:ffe0::/59", prefixStr(59)); - EXPECT_EQ("ffff:ffff:ffff:fff0::/60", prefixStr(60)); - EXPECT_EQ("ffff:ffff:ffff:fff8::/61", prefixStr(61)); - EXPECT_EQ("ffff:ffff:ffff:fffc::/62", prefixStr(62)); - EXPECT_EQ("ffff:ffff:ffff:fffe::/63", prefixStr(63)); - EXPECT_EQ("ffff:ffff:ffff:ffff::/64", prefixStr(64)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:8000::/65", prefixStr(65)); - EXPECT_EQ("ffff:ffff:ffff:ffff:c000::/66", prefixStr(66)); - EXPECT_EQ("ffff:ffff:ffff:ffff:e000::/67", prefixStr(67)); - EXPECT_EQ("ffff:ffff:ffff:ffff:f000::/68", prefixStr(68)); - EXPECT_EQ("ffff:ffff:ffff:ffff:f800::/69", prefixStr(69)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fc00::/70", prefixStr(70)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fe00::/71", prefixStr(71)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ff00::/72", prefixStr(72)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ff80::/73", prefixStr(73)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffc0::/74", prefixStr(74)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffe0::/75", prefixStr(75)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fff0::/76", prefixStr(76)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fff8::/77", prefixStr(77)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fffc::/78", prefixStr(78)); - EXPECT_EQ("ffff:ffff:ffff:ffff:fffe::/79", prefixStr(79)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff::/80", prefixStr(80)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:8000::/81", prefixStr(81)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:c000::/82", prefixStr(82)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:e000::/83", prefixStr(83)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:f000::/84", prefixStr(84)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:f800::/85", prefixStr(85)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fc00::/86", prefixStr(86)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fe00::/87", prefixStr(87)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ff00::/88", prefixStr(88)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ff80::/89", prefixStr(89)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffc0::/90", prefixStr(90)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffe0::/91", prefixStr(91)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fff0::/92", prefixStr(92)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fff8::/93", prefixStr(93)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fffc::/94", prefixStr(94)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:fffe::/95", prefixStr(95)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff::/96", prefixStr(96)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:8000:0/97", prefixStr(97)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:c000:0/98", prefixStr(98)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:e000:0/99", prefixStr(99)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:f000:0/100", prefixStr(100)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:f800:0/101", prefixStr(101)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fc00:0/102", prefixStr(102)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fe00:0/103", prefixStr(103)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ff00:0/104", prefixStr(104)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ff80:0/105", prefixStr(105)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffc0:0/106", prefixStr(106)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffe0:0/107", prefixStr(107)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fff0:0/108", prefixStr(108)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fff8:0/109", prefixStr(109)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fffc:0/110", prefixStr(110)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:fffe:0/111", prefixStr(111)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112", prefixStr(112)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:8000/113", prefixStr(113)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:c000/114", prefixStr(114)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:e000/115", prefixStr(115)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:f000/116", prefixStr(116)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:f800/117", prefixStr(117)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fc00/118", prefixStr(118)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fe00/119", prefixStr(119)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00/120", prefixStr(120)); - - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff80/121", prefixStr(121)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffc0/122", prefixStr(122)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffe0/123", prefixStr(123)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0/124", prefixStr(124)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff8/125", prefixStr(125)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc/126", prefixStr(126)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe/127", prefixStr(127)); - EXPECT_EQ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128", prefixStr(128)); -} - -TEST(IPPrefixTest, TruncationOther) { - const struct { - const char* ip; - const int cidrLen; - const char* ipTruncated; - } testExpectations[] = { - {"192.0.2.0", 24, "192.0.2.0"}, - {"192.0.2.0", 23, "192.0.2.0"}, - {"192.0.2.0", 22, "192.0.0.0"}, - {"192.0.2.0", 1, "128.0.0.0"}, - {"2001:db8:cafe:d00d::", 56, "2001:db8:cafe:d000::"}, - {"2001:db8:cafe:d00d::", 48, "2001:db8:cafe::"}, - {"2001:db8:cafe:d00d::", 47, "2001:db8:cafe::"}, - {"2001:db8:cafe:d00d::", 46, "2001:db8:cafc::"}, - }; - - for (const auto& expectation : testExpectations) { - IPAddress ip; - EXPECT_TRUE(IPAddress::forString(expectation.ip, &ip)) - << "Failed to parse IP address " << expectation.ip; - - IPAddress ipTruncated; - EXPECT_TRUE(IPAddress::forString(expectation.ipTruncated, &ipTruncated)) - << "Failed to parse IP address " << expectation.ipTruncated; - - IPPrefix prefix(ip, expectation.cidrLen); - - EXPECT_EQ(expectation.cidrLen, prefix.length()) - << "Unexpected cidrLen " << expectation.cidrLen; - EXPECT_EQ(ipTruncated, prefix.ip()) - << "Unexpected IP truncation: " << prefix.ip() << ", expected: " << ipTruncated; - } -} - -TEST(IPPrefixTest, containsPrefix) { - const struct { - const char* prefix; - const char* otherPrefix; - const bool expected; - std::string asParameters() const { - return fmt::format("prefix={}, other={}, expect={}", prefix, otherPrefix, expected); - } - } testExpectations[] = { - {"192.0.0.0/8", "192.0.0.0/8", true}, - {"192.1.0.0/16", "192.1.0.0/16", true}, - {"192.1.2.0/24", "192.1.2.0/24", true}, - {"192.1.2.3/32", "192.1.2.3/32", true}, - {"0.0.0.0/0", "192.0.0.0/8", true}, - {"0.0.0.0/0", "192.1.0.0/16", true}, - {"0.0.0.0/0", "192.1.2.0/24", true}, - {"0.0.0.0/0", "192.1.2.3/32", true}, - {"192.0.0.0/8", "192.1.0.0/16", true}, - {"192.0.0.0/8", "192.1.2.0/24", true}, - {"192.0.0.0/8", "192.1.2.5/32", true}, - {"192.1.0.0/16", "192.1.2.0/24", true}, - {"192.1.0.0/16", "192.1.3.6/32", true}, - {"192.5.6.0/24", "192.5.6.7/32", true}, - {"192.1.2.3/32", "192.1.2.0/24", false}, - {"192.1.2.3/32", "192.1.0.0/16", false}, - {"192.1.2.3/32", "192.0.0.0/8", false}, - {"192.1.2.3/32", "0.0.0.0/0", false}, - {"192.1.2.0/24", "192.1.0.0/16", false}, - {"192.1.2.0/24", "192.0.0.0/8", false}, - {"192.1.2.0/24", "0.0.0.0/0", false}, - {"192.9.0.0/16", "192.0.0.0/8", false}, - {"192.9.0.0/16", "0.0.0.0/0", false}, - {"192.0.0.0/8", "0.0.0.0/0", false}, - {"192.0.0.0/8", "191.0.0.0/8", false}, - {"191.0.0.0/8", "192.0.0.0/8", false}, - {"192.8.0.0/16", "192.7.0.0/16", false}, - {"192.7.0.0/16", "192.8.0.0/16", false}, - {"192.8.6.0/24", "192.7.5.0/24", false}, - {"192.7.5.0/24", "192.8.6.0/24", false}, - {"192.8.6.100/32", "192.8.6.200/32", false}, - {"192.8.6.200/32", "192.8.6.100/32", false}, - {"192.0.0.0/8", "192.0.0.0/12", true}, - {"192.0.0.0/12", "192.0.0.0/8", false}, - {"2001::/16", "2001::/16", true}, - {"2001:db8::/32", "2001:db8::/32", true}, - {"2001:db8:cafe::/48", "2001:db8:cafe::/48", true}, - {"2001:db8:cafe:d00d::/64", "2001:db8:cafe:d00d::/64", true}, - {"2001:db8:cafe:d00d:fec0::/80", "2001:db8:cafe:d00d:fec0::/80", true}, - {"2001:db8:cafe:d00d:fec0:de::/96", "2001:db8:cafe:d00d:fec0:de::/96", true}, - {"2001:db8:cafe:d00d:fec0:de:ac::/112", "2001:db8:cafe:d00d:fec0:de:ac::/112", true}, - {"2001:db8::cafe:0:1/128", "2001:db8::cafe:0:1/128", true}, - {"2001::/16", "2001:db8::/32", true}, - {"2001::/16", "2001:db8:cafe::/48", true}, - {"2001::/16", "2001:db8:cafe:d00d::/64", true}, - {"2001::/16", "2001:db8:cafe:d00d:fec0::/80", true}, - {"2001::/16", "2001:db8:cafe:d00d:fec0:de::/96", true}, - {"2001::/16", "2001:db8:cafe:d00d:fec0:de:ac::/112", true}, - {"2001::/16", "2001:db8:cafe:d00d:fec0:de:ac:dd/128", true}, - {"::/0", "2001::/16", true}, - {"::/0", "2001:db8::/32", true}, - {"::/0", "2001:db8:cafe::/48", true}, - {"::/0", "2001:db8:cafe:d00d::/64", true}, - {"::/0", "2001:db8:cafe:d00d:fec0::/80", true}, - {"::/0", "2001:db8:cafe:d00d:fec0:de::/96", true}, - {"::/0", "2001:db8:cafe:d00d:fec0:de:ac::/112", true}, - {"::/0", "2001:db8:cafe:d00d:fec0:de:ac:dd/128", true}, - {"2001:db8::dd/128", "2001::/16", false}, - {"2001:db8::dd/128", "2001:db8::/32", false}, - {"2001:db8::dd/128", "2001:db8:cafe::/48", false}, - {"2001:db8::dd/128", "2001:db8:cafe:d00d::/64", false}, - {"2001:db8::dd/128", "2001:db8:cafe:d00d:fec0::/80", false}, - {"2001:db8::dd/128", "2001:db8:cafe:d00d:fec0:de::/96", false}, - {"2001:db8::dd/128", "2001:db8:cafe:d00d:fec0:de:ac::/112", false}, - {"2001:db7::/32", "2001:db8::/32", false}, - {"2001:db8::/32", "2001:db7::/32", false}, - {"2001:db8:caff::/48", "2001:db8:cafe::/48", false}, - {"2001:db8:cafe::/48", "2001:db8:caff::/48", false}, - {"2001:db8:cafe:a00d::/64", "2001:db8:cafe:d00d::/64", false}, - {"2001:db8:cafe:d00d::/64", "2001:db8:cafe:a00d::/64", false}, - {"2001:db8:cafe:d00d:fec1::/80", "2001:db8:cafe:d00d:fec0::/80", false}, - {"2001:db8:cafe:d00d:fec0::/80", "2001:db8:cafe:d00d:fec1::/80", false}, - {"2001:db8:cafe:d00d:fec0:dd::/96", "2001:db8:cafe:d00d:fec0:ae::/96", false}, - {"2001:db8:cafe:d00d:fec0:ae::/96", "2001:db8:cafe:d00d:fec0:dd::/96", false}, - {"2001:db8:cafe:d00d:fec0:de:aa::/112", "2001:db8:cafe:d00d:fec0:de:ac::/112", false}, - {"2001:db8:cafe:d00d:fec0:de:ac::/112", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - {"2001:db8::cafe:0:123/128", "2001:db8::cafe:0:456/128", false}, - {"2001:db8::cafe:0:456/128", "2001:db8::cafe:0:123/128", false}, - {"2001:db8::/32", "2001:db8::/64", true}, - {"2001:db8::/64", "2001:db8::/32", false}, - {"::/0", "0.0.0.0/0", false}, - {"::/0", "1.0.0.0/8", false}, - {"::/0", "1.2.0.0/16", false}, - {"::/0", "1.2.3.0/24", false}, - {"::/0", "1.2.3.4/32", false}, - {"2001::/16", "1.2.3.4/32", false}, - {"2001::db8::/32", "1.2.3.4/32", false}, - {"2001:db8:cafe::/48", "1.2.3.4/32", false}, - {"2001:db8:cafe:d00d::/64", "1.2.3.4/32", false}, - {"2001:db8:cafe:d00d:fec0::/80", "1.2.3.4/32", false}, - {"2001:db8:cafe:d00d:fec0:ae::/96", "1.2.3.4/32", false}, - {"2001:db8:cafe:d00d:fec0:de:aa::/112", "1.2.3.4/32", false}, - {"0.0.0.0/0", "::/0", false}, - {"0.0.0.0/0", "2001::/16", false}, - {"0.0.0.0/0", "2001::db8::/32", false}, - {"0.0.0.0/0", "2001:db8:cafe::/48", false}, - {"0.0.0.0/0", "2001:db8:cafe:d00d::/64", false}, - {"0.0.0.0/0", "2001:db8:cafe:d00d:fec0::/80", false}, - {"0.0.0.0/0", "2001:db8:cafe:d00d:fec0:ae::/96", false}, - {"0.0.0.0/0", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - {"1.2.3.4/32", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - {"1.2.3.0/24", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - {"1.2.0.0/16", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - {"1.0.0.0/8", "2001:db8:cafe:d00d:fec0:de:aa::/112", false}, - }; - - for (const auto& expectation : testExpectations) { - SCOPED_TRACE(expectation.asParameters()); - IPPrefix a = IPPrefix::forString(expectation.prefix); - IPPrefix b = IPPrefix::forString(expectation.otherPrefix); - EXPECT_EQ(expectation.expected, a.contains(b)); - } -} - -TEST(IPPrefixTest, containsAddress) { - const struct { - const char* prefix; - const char* address; - const bool expected; - std::string asParameters() const { - return fmt::format("prefix={}, address={}, expect={}", prefix, address, expected); - } - } testExpectations[] = { - {"0.0.0.0/0", "255.255.255.255", true}, - {"0.0.0.0/0", "1.2.3.4", true}, - {"0.0.0.0/0", "1.2.3.0", true}, - {"0.0.0.0/0", "1.2.0.0", true}, - {"0.0.0.0/0", "1.0.0.0", true}, - {"0.0.0.0/0", "0.0.0.0", true}, - {"0.0.0.0/0", "2001:4868:4860::8888", false}, - {"0.0.0.0/0", "::/0", false}, - {"192.0.2.0/23", "192.0.2.0", true}, - {"192.0.2.0/23", "192.0.2.43", true}, - {"192.0.2.0/23", "192.0.3.21", true}, - {"192.0.2.0/23", "192.0.0.21", false}, - {"192.0.2.0/23", "8.8.8.8", false}, - {"192.0.2.0/23", "2001:4868:4860::8888", false}, - {"192.0.2.0/23", "::/0", false}, - {"1.2.3.4/32", "1.2.3.4", true}, - {"1.2.3.4/32", "1.2.3.5", false}, - {"10.0.0.0/8", "10.2.0.0", true}, - {"10.0.0.0/8", "10.2.3.5", true}, - {"10.0.0.0/8", "10.0.0.0", true}, - {"10.0.0.0/8", "10.255.255.254", true}, - {"10.0.0.0/8", "11.0.0.0", false}, - {"::/0", "2001:db8:f000::ace:d00c", true}, - {"::/0", "2002:db8:f00::ace:d00d", true}, - {"::/0", "2001:db7:f00::ace:d00e", true}, - {"::/0", "2001:db8:f01::bad:d00d", true}, - {"::/0", "::", true}, - {"::/0", "0.0.0.0", false}, - {"::/0", "1.2.3.4", false}, - {"2001:db8:f00::ace:d00d/127", "2001:db8:f00::ace:d00c", true}, - {"2001:db8:f00::ace:d00d/127", "2001:db8:f00::ace:d00d", true}, - {"2001:db8:f00::ace:d00d/127", "2001:db8:f00::ace:d00e", false}, - {"2001:db8:f00::ace:d00d/127", "2001:db8:f00::bad:d00d", false}, - {"2001:db8:f00::ace:d00d/127", "2001:4868:4860::8888", false}, - {"2001:db8:f00::ace:d00d/127", "8.8.8.8", false}, - {"2001:db8:f00::ace:d00d/127", "0.0.0.0", false}, - {"2001:db8:f00::ace:d00d/128", "2001:db8:f00::ace:d00d", true}, - {"2001:db8:f00::ace:d00d/128", "2001:db8:f00::ace:d00c", false}, - {"2001::/16", "2001::", true}, - {"2001::/16", "2001:db8:f00::ace:d00d", true}, - {"2001::/16", "2001:db8:f00::bad:d00d", true}, - {"2001::/16", "2001::abc", true}, - {"2001::/16", "2001:ffff:ffff:ffff:ffff:ffff:ffff:ffff", true}, - {"2001::/16", "2000::", false}, - }; - - for (const auto& expectation : testExpectations) { - SCOPED_TRACE(expectation.asParameters()); - IPPrefix a = IPPrefix::forString(expectation.prefix); - IPAddress b = IPAddress::forString(expectation.address); - EXPECT_EQ(expectation.expected, a.contains(b)); - } -} - -TEST(IPPrefixTest, GamutOfOperators) { - const std::vector<OperatorExpectation<IPPrefix>> kExpectations{ - {EQ, IPPrefix(), IPPrefix()}, - {EQ, IPPrefix(IPAddress(IPV4_ANY), 0), IPPrefix(IPAddress(IPV4_ANY), 0)}, - {EQ, IPPrefix(IPAddress(IPV4_ANY), IPV4_ADDR_BITS), IPPrefix(IPAddress(IPV4_ANY))}, - {EQ, IPPrefix(IPAddress(IPV6_ANY), 0), IPPrefix(IPAddress(IPV6_ANY), 0)}, - {EQ, IPPrefix(IPAddress(IPV6_ANY), IPV6_ADDR_BITS), IPPrefix(IPAddress(IPV6_ANY))}, - // Needlessly fully-specified IPv6 link-local address. - {EQ, IPPrefix(IPAddress(FE80_1)), IPPrefix(IPAddress(FE80_1, 0), IPV6_ADDR_BITS)}, - // Different IPv6 link-local addresses within the same /64, no scoped_id: same /64. - {EQ, IPPrefix(IPAddress(FE80_1), 64), IPPrefix(IPAddress(FE80_2), 64)}, - // Different IPv6 link-local address within the same /64, same scoped_id: same /64. - {EQ, IPPrefix(IPAddress(FE80_1, 17), 64), IPPrefix(IPAddress(FE80_2, 17), 64)}, - // Unspecified < IPv4. - {LT, IPPrefix(), IPPrefix(IPAddress(IPV4_ANY), 0)}, - // Same IPv4 base address sorts by prefix length. - {LT, IPPrefix(IPAddress(IPV4_ANY), 0), IPPrefix(IPAddress(IPV4_ANY), 1)}, - {LT, IPPrefix(IPAddress(IPV4_ANY), 1), IPPrefix(IPAddress(IPV4_ANY), IPV4_ADDR_BITS)}, - // Truncation means each base IPv4 address is different. - {LT, IPPrefix(IPAddress(IPV4_ONES), 0), IPPrefix(IPAddress(IPV4_ONES), 1)}, - {LT, IPPrefix(IPAddress(IPV4_ONES), 1), IPPrefix(IPAddress(IPV4_ONES), IPV4_ADDR_BITS)}, - // Sort by base IPv4 addresses first. - {LT, IPPrefix(IPAddress(IPV4_ANY), 0), IPPrefix(IPAddress::forString("0.0.0.1"))}, - {LT, IPPrefix(IPAddress(IPV4_ANY), 1), IPPrefix(IPAddress::forString("0.0.0.1"))}, - {LT, IPPrefix(IPAddress(IPV4_ANY), 24), IPPrefix(IPAddress::forString("0.0.0.1"))}, - // IPv4 < IPv6. - {LT, IPPrefix(IPAddress(IPV4_ANY), 0), IPPrefix(IPAddress(IPV6_ANY), 0)}, - {LT, IPPrefix(IPAddress(IPV4_ONES)), IPPrefix(IPAddress(IPV6_ANY))}, - // Unspecified < IPv6. - {LT, IPPrefix(), IPPrefix(IPAddress(IPV6_ANY), 0)}, - // Same IPv6 base address sorts by prefix length. - {LT, IPPrefix(IPAddress(IPV6_ANY), 0), IPPrefix(IPAddress(IPV6_ANY), 1)}, - {LT, IPPrefix(IPAddress(IPV6_ANY), 1), IPPrefix(IPAddress(IPV6_ANY), IPV6_ADDR_BITS)}, - // Truncation means each base IPv6 address is different. - {LT, IPPrefix(IPAddress(IPV6_ONES), 0), IPPrefix(IPAddress(IPV6_ONES), 1)}, - {LT, IPPrefix(IPAddress(IPV6_ONES), 1), IPPrefix(IPAddress(IPV6_ONES), IPV6_ADDR_BITS)}, - // Different IPv6 link-local address in same /64, different scoped_id: different /64. - {LT, IPPrefix(IPAddress(FE80_1, 17), 64), IPPrefix(IPAddress(FE80_2, 22), 64)}, - {LT, IPPrefix(IPAddress(FE80_1, 17), 64), IPPrefix(IPAddress(FE80_1, 18), 64)}, - {LT, IPPrefix(IPAddress(FE80_1, 18), 64), IPPrefix(IPAddress(FE80_1, 19), 64)}, - }; - - size_t tests_run = 0; - for (const auto& expectation : kExpectations) { - SCOPED_TRACE(expectation.toString()); - EXPECT_NO_FATAL_FAILURE(testGamutOfOperators(expectation)); - tests_run++; - } - EXPECT_EQ(kExpectations.size(), tests_run); -} - -TEST(IPSockAddrTest, GamutOfOperators) { - const std::vector<OperatorExpectation<IPSockAddr>> kExpectations{ - {EQ, IPSockAddr(), IPSockAddr()}, - {EQ, IPSockAddr(IPAddress(IPV4_ANY)), IPSockAddr(IPAddress(IPV4_ANY), 0)}, - {EQ, IPSockAddr(IPAddress(IPV6_ANY)), IPSockAddr(IPAddress(IPV6_ANY), 0)}, - {EQ, IPSockAddr(IPAddress(FE80_1), 80), IPSockAddr(IPAddress(FE80_1), 80)}, - {EQ, IPSockAddr(IPAddress(FE80_1, 17)), IPSockAddr(IPAddress(FE80_1, 17), 0)}, - {LT, IPSockAddr(IPAddress(IPV4_ANY), 0), IPSockAddr(IPAddress(IPV4_ANY), 1)}, - {LT, IPSockAddr(IPAddress(IPV4_ANY), 53), IPSockAddr(IPAddress(IPV4_ANY), 123)}, - {LT, IPSockAddr(IPAddress(IPV4_ONES), 123), IPSockAddr(IPAddress(IPV6_ANY), 53)}, - {LT, IPSockAddr(IPAddress(IPV6_ANY), 0), IPSockAddr(IPAddress(IPV6_ANY), 1)}, - {LT, IPSockAddr(IPAddress(IPV6_ANY), 53), IPSockAddr(IPAddress(IPV6_ANY), 123)}, - {LT, IPSockAddr(IPAddress(FE80_1), 80), IPSockAddr(IPAddress(FE80_1, 17), 80)}, - {LT, IPSockAddr(IPAddress(FE80_1, 17), 80), IPSockAddr(IPAddress(FE80_1, 22), 80)}, - }; - - size_t tests_run = 0; - for (const auto& expectation : kExpectations) { - SCOPED_TRACE(expectation.toString()); - EXPECT_NO_FATAL_FAILURE(testGamutOfOperators(expectation)); - tests_run++; - } - EXPECT_EQ(kExpectations.size(), tests_run); -} - -TEST(IPSockAddrTest, toString) { - EXPECT_EQ("<unspecified>:0", IPSockAddr().toString()); - EXPECT_EQ("0.0.0.0:0", IPSockAddr(IPAddress(IPV4_ANY)).toString()); - EXPECT_EQ("255.255.255.255:67", IPSockAddr(IPAddress(IPV4_ONES), 67).toString()); - EXPECT_EQ("[::]:0", IPSockAddr(IPAddress(IPV6_ANY)).toString()); - EXPECT_EQ("[::1]:53", IPSockAddr(IPAddress(IPV6_LOOPBACK), 53).toString()); - EXPECT_EQ("[fe80::1]:0", IPSockAddr(IPAddress(FE80_1)).toString()); - EXPECT_EQ("[fe80::2%17]:123", IPSockAddr(IPAddress(FE80_2, 17), 123).toString()); -} - -TEST(CompatIPDataTest, ConversionsClearUnneededValues) { - const uint32_t idx = 17; - const IPSockAddr linkLocalNtpSockaddr(IPAddress(FE80_2, idx), 123); - EXPECT_EQ(IPAddress(FE80_2, idx), linkLocalNtpSockaddr.ip()); - // IPSockAddr(IPSockaddr.ip()) see the port cleared. - EXPECT_EQ(0, IPSockAddr(linkLocalNtpSockaddr.ip()).port()); - const IPPrefix linkLocalPrefix(linkLocalNtpSockaddr.ip(), 64); - EXPECT_EQ(IPAddress(FE80, idx), linkLocalPrefix.ip()); - // IPPrefix(IPPrefix.ip()) see the CIDR length cleared. - EXPECT_EQ(IPV6_ADDR_BITS, IPPrefix(linkLocalPrefix.ip()).length()); -} - -} // namespace -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Log.cpp b/common/netd/libnetdutils/Log.cpp deleted file mode 100644 index d2ce98f0..00000000 --- a/common/netd/libnetdutils/Log.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/Log.h" -#include "netdutils/Slice.h" - -#include <chrono> -#include <ctime> -#include <iomanip> -#include <mutex> -#include <sstream> - -#include <android-base/strings.h> -#include <log/log.h> - -using ::android::base::Join; -using ::android::base::StringPrintf; - -namespace android { -namespace netdutils { - -namespace { - -std::string makeTimestampedEntry(const std::string& entry) { - using ::std::chrono::duration_cast; - using ::std::chrono::milliseconds; - using ::std::chrono::system_clock; - - std::stringstream tsEntry; - const auto now = system_clock::now(); - const auto time_sec = system_clock::to_time_t(now); - tsEntry << std::put_time(std::localtime(&time_sec), "%m-%d %H:%M:%S.") << std::setw(3) - << std::setfill('0') - << duration_cast<milliseconds>(now - system_clock::from_time_t(time_sec)).count() << " " - << entry; - - return tsEntry.str(); -} - -} // namespace - -std::string LogEntry::toString() const { - std::vector<std::string> text; - - if (!mMsg.empty()) text.push_back(mMsg); - if (!mFunc.empty()) { - text.push_back(StringPrintf("%s(%s)", mFunc.c_str(), Join(mArgs, ", ").c_str())); - } - if (!mReturns.empty()) { - text.push_back("->"); - text.push_back(StringPrintf("(%s)", Join(mReturns, ", ").c_str())); - } - if (!mUid.empty()) text.push_back(mUid); - if (!mDuration.empty()) text.push_back(StringPrintf("(%s)", mDuration.c_str())); - - return Join(text, " "); -} - -LogEntry& LogEntry::message(const std::string& message) { - mMsg = message; - return *this; -} - -LogEntry& LogEntry::function(const std::string& function_name) { - mFunc = function_name; - return *this; -} - -LogEntry& LogEntry::prettyFunction(const std::string& pretty_function) { - // __PRETTY_FUNCTION__ generally seems to be of the form: - // - // qualifed::returnType qualified::function(args...) - // - // where the qualified forms include "(anonymous namespace)" in the - // "::"-delimited list and keywords like "virtual" (where applicable). - // - // Here we try to convert strings like: - // - // virtual binder::Status android::net::NetdNativeService::isAlive(bool *) - // netdutils::LogEntry android::netd::(anonymous namespace)::AAA::BBB::function() - // - // into just "NetdNativeService::isAlive" or "BBB::function". Note that - // without imposing convention, how to easily identify any namespace/class - // name boundary is not obvious. - const size_t endFuncName = pretty_function.rfind('('); - const size_t precedingSpace = pretty_function.rfind(' ', endFuncName); - size_t substrStart = (precedingSpace != std::string::npos) ? precedingSpace + 1 : 0; - - const size_t beginFuncName = pretty_function.rfind("::", endFuncName); - if (beginFuncName != std::string::npos && substrStart < beginFuncName) { - const size_t previousNameBoundary = pretty_function.rfind("::", beginFuncName - 1); - if (previousNameBoundary < beginFuncName && substrStart < previousNameBoundary) { - substrStart = previousNameBoundary + 2; - } else { - substrStart = beginFuncName + 2; - } - } - - mFunc = pretty_function.substr(substrStart, endFuncName - substrStart); - return *this; -} - -LogEntry& LogEntry::arg(const std::string& val) { - mArgs.push_back(val.empty() ? "\"\"" : val); - return *this; -} - -template <> -LogEntry& LogEntry::arg<>(bool val) { - mArgs.push_back(val ? "true" : "false"); - return *this; -} - -LogEntry& LogEntry::arg(const std::vector<int32_t>& val) { - mArgs.push_back(StringPrintf("[%s]", Join(val, ", ").c_str())); - return *this; -} - -LogEntry& LogEntry::arg(const std::vector<uint8_t>& val) { - mArgs.push_back('{' + toHex(makeSlice(val)) + '}'); - return *this; -} - -LogEntry& LogEntry::arg(const std::vector<std::string>& val) { - mArgs.push_back(StringPrintf("[%s]", Join(val, ", ").c_str())); - return *this; -} - -LogEntry& LogEntry::returns(const std::string& rval) { - mReturns.push_back(rval); - return *this; -} - -LogEntry& LogEntry::returns(bool rval) { - mReturns.push_back(rval ? "true" : "false"); - return *this; -} - -LogEntry& LogEntry::returns(const Status& status) { - mReturns.push_back(status.msg()); - return *this; -} - -LogEntry& LogEntry::withUid(uid_t uid) { - mUid = StringPrintf("(uid=%d)", uid); - return *this; -} - -LogEntry& LogEntry::withAutomaticDuration() { - using ms = std::chrono::duration<float, std::ratio<1, 1000>>; - - const std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); - std::stringstream duration; - duration << std::setprecision(1) << std::chrono::duration_cast<ms>(end - mStart).count() - << "ms"; - mDuration = duration.str(); - return *this; -} - -LogEntry& LogEntry::withDuration(const std::string& duration) { - mDuration = duration; - return *this; -} - -Log::~Log() { - // TODO: dump the last N entries to the android log for possible posterity. - info(LogEntry().function(__FUNCTION__)); -} - -void Log::forEachEntry(const std::function<void(const std::string&)>& perEntryFn) const { - // We make a (potentially expensive) copy of the log buffer (including - // all strings), in case the |perEntryFn| takes its sweet time. - std::deque<std::string> entries; - { - std::shared_lock<std::shared_mutex> guard(mLock); - entries.assign(mEntries.cbegin(), mEntries.cend()); - } - - for (const std::string& entry : entries) perEntryFn(entry); -} - -void Log::record(Log::Level lvl, const std::string& entry) { - switch (lvl) { - case Level::LOG: - break; - case Level::INFO: - ALOG(LOG_INFO, mTag.c_str(), "%s", entry.c_str()); - break; - case Level::WARN: - ALOG(LOG_WARN, mTag.c_str(), "%s", entry.c_str()); - break; - case Level::ERROR: - ALOG(LOG_ERROR, mTag.c_str(), "%s", entry.c_str()); - break; - } - - std::lock_guard guard(mLock); - mEntries.push_back(makeTimestampedEntry(entry)); - while (mEntries.size() > mMaxEntries) mEntries.pop_front(); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/LogTest.cpp b/common/netd/libnetdutils/LogTest.cpp deleted file mode 100644 index 12705609..00000000 --- a/common/netd/libnetdutils/LogTest.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> - -#include "netdutils/Log.h" - -android::netdutils::LogEntry globalFunctionName() { - return android::netdutils::LogEntry().function(__FUNCTION__); -} - -android::netdutils::LogEntry globalPrettyFunctionName() { - return android::netdutils::LogEntry().prettyFunction(__PRETTY_FUNCTION__); -} - -namespace android { -namespace netdutils { - -namespace { - -LogEntry functionName() { - return LogEntry().function(__FUNCTION__); -} - -LogEntry prettyFunctionName() { - return LogEntry().prettyFunction(__PRETTY_FUNCTION__); -} - -} // namespace - -class AAA { - public: - AAA() = default; - - LogEntry functionName() { - return LogEntry().function(__FUNCTION__); - } - - LogEntry prettyFunctionName() { - return LogEntry().prettyFunction(__PRETTY_FUNCTION__); - } - - class BBB { - public: - BBB() = default; - - LogEntry functionName() { - return LogEntry().function(__FUNCTION__); - } - - LogEntry prettyFunctionName() { - return LogEntry().prettyFunction(__PRETTY_FUNCTION__); - } - }; -}; - -TEST(LogEntryTest, Empty) { - LogEntry empty; - EXPECT_EQ("", empty.toString()); -} - -TEST(LogEntryTest, GlobalFunction) { - EXPECT_EQ("globalFunctionName()", ::globalFunctionName().toString()); -} - -TEST(LogEntryTest, GlobalPrettyFunction) { - EXPECT_EQ("globalPrettyFunctionName()", ::globalPrettyFunctionName().toString()); -} - -TEST(LogEntryTest, UnnamedNamespaceFunction) { - const LogEntry entry = functionName(); - EXPECT_EQ("functionName()", entry.toString()); -} - -TEST(LogEntryTest, UnnamedNamespacePrettyFunction) { - const LogEntry entry = prettyFunctionName(); - EXPECT_EQ("prettyFunctionName()", entry.toString()); -} - -TEST(LogEntryTest, ClassFunction) { - const LogEntry entry = AAA().functionName(); - EXPECT_EQ("functionName()", entry.toString()); -} - -TEST(LogEntryTest, ClassPrettyFunction) { - const LogEntry entry = AAA().prettyFunctionName(); - EXPECT_EQ("AAA::prettyFunctionName()", entry.toString()); -} - -TEST(LogEntryTest, InnerClassFunction) { - const LogEntry entry = AAA::BBB().functionName(); - EXPECT_EQ("functionName()", entry.toString()); -} - -TEST(LogEntryTest, InnerClassPrettyFunction) { - const LogEntry entry = AAA::BBB().prettyFunctionName(); - EXPECT_EQ("BBB::prettyFunctionName()", entry.toString()); -} - -TEST(LogEntryTest, PrintChainedArguments) { - const LogEntry entry = LogEntry() - .function("testFunc") - .arg("hello") - .arg(42) - .arg(true); - EXPECT_EQ("testFunc(hello, 42, true)", entry.toString()); -} - -TEST(LogEntryTest, PrintIntegralTypes) { - const LogEntry entry = LogEntry() - .function("testFunc") - .arg('A') - .arg(100U) - .arg(-1000LL); - EXPECT_EQ("testFunc(65, 100, -1000)", entry.toString()); -} - -TEST(LogEntryTest, PrintHex) { - const std::vector<uint8_t> buf{0xDE, 0xAD, 0xBE, 0xEF}; - const LogEntry entry = LogEntry().function("testFunc").arg(buf); - EXPECT_EQ("testFunc({deadbeef})", entry.toString()); -} - -TEST(LogEntryTest, PrintArgumentPack) { - const LogEntry entry = LogEntry().function("testFunc").args("hello", 42, false); - EXPECT_EQ("testFunc(hello, 42, false)", entry.toString()); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/MemBlockTest.cpp b/common/netd/libnetdutils/MemBlockTest.cpp deleted file mode 100644 index 6455a7e0..00000000 --- a/common/netd/libnetdutils/MemBlockTest.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <algorithm> -#include <cstdint> -#include <utility> - -#include <gtest/gtest.h> - -#include "netdutils/MemBlock.h" -#include "netdutils/Slice.h" - -namespace android { -namespace netdutils { - -namespace { - -constexpr unsigned DNS_PACKET_SIZE = 512; -constexpr int ARBITRARY_VALUE = 0x55; - -MemBlock makeArbitraryMemBlock(size_t len) { - MemBlock result(len); - // Do some fictional work before returning. - for (Slice slice = result.get(); !slice.empty(); slice = drop(slice, 1)) { - slice.base()[0] = ARBITRARY_VALUE; - } - return result; -} - -void checkAllZeros(Slice slice) { - for (; !slice.empty(); slice = drop(slice, 1)) { - EXPECT_EQ(0U, slice.base()[0]); - } -} - -void checkArbitraryMemBlock(const MemBlock& block, size_t expectedSize) { - Slice slice = block.get(); - EXPECT_EQ(expectedSize, slice.size()); - EXPECT_NE(nullptr, slice.base()); - for (; !slice.empty(); slice = drop(slice, 1)) { - EXPECT_EQ(ARBITRARY_VALUE, slice.base()[0]); - } -} - -void checkHelloMello(Slice dest, Slice src) { - EXPECT_EQ('h', dest.base()[0]); - EXPECT_EQ('e', dest.base()[1]); - EXPECT_EQ('l', dest.base()[2]); - EXPECT_EQ('l', dest.base()[3]); - EXPECT_EQ('o', dest.base()[4]); - - src.base()[0] = 'm'; - EXPECT_EQ('h', dest.base()[0]); -} - -} // namespace - -TEST(MemBlockTest, Empty) { - MemBlock empty; - EXPECT_TRUE(empty.get().empty()); - EXPECT_EQ(nullptr, empty.get().base()); -} - -TEST(MemBlockTest, ExplicitZero) { - MemBlock zero(0); - EXPECT_TRUE(zero.get().empty()); - EXPECT_EQ(nullptr, zero.get().base()); -} - -TEST(MemBlockTest, BasicAllocation) { - MemBlock dnsPacket(DNS_PACKET_SIZE); - Slice slice = dnsPacket.get(); - EXPECT_EQ(DNS_PACKET_SIZE, slice.size()); - // Verify the space is '\0'-initialized. - ASSERT_NO_FATAL_FAILURE(checkAllZeros(slice)); - EXPECT_NE(nullptr, slice.base()); -} - -TEST(MemBlockTest, MoveConstruction) { - MemBlock block(makeArbitraryMemBlock(DNS_PACKET_SIZE)); - ASSERT_NO_FATAL_FAILURE(checkArbitraryMemBlock(block, DNS_PACKET_SIZE)); -} - -TEST(MemBlockTest, MoveAssignmentOrConstruction) { - MemBlock block = makeArbitraryMemBlock(DNS_PACKET_SIZE); - ASSERT_NO_FATAL_FAILURE(checkArbitraryMemBlock(block, DNS_PACKET_SIZE)); -} - -TEST(MemBlockTest, StdMoveAssignment) { - constexpr unsigned SIZE = 10; - - MemBlock block; - EXPECT_TRUE(block.get().empty()); - EXPECT_EQ(nullptr, block.get().base()); - - { - MemBlock block2 = makeArbitraryMemBlock(SIZE); - EXPECT_EQ(SIZE, block2.get().size()); - // More fictional work. - for (unsigned i = 0; i < SIZE; i++) { - block2.get().base()[i] = i; - } - block = std::move(block2); - } - - EXPECT_EQ(SIZE, block.get().size()); - for (unsigned i = 0; i < SIZE; i++) { - EXPECT_EQ(i, block.get().base()[i]); - } -} - -TEST(MemBlockTest, ConstructionFromSlice) { - uint8_t data[] = {'h', 'e', 'l', 'l', 'o'}; - Slice dataSlice(Slice(data, sizeof(data) / sizeof(data[0]))); - - MemBlock dataCopy(dataSlice); - ASSERT_NO_FATAL_FAILURE(checkHelloMello(dataCopy.get(), dataSlice)); -} - -TEST(MemBlockTest, ImplicitCastToSlice) { - uint8_t data[] = {'h', 'e', 'l', 'l', 'o'}; - Slice dataSlice(Slice(data, sizeof(data) / sizeof(data[0]))); - - MemBlock dataCopy(dataSlice.size()); - // NOTE: no explicit MemBlock::get(). - // Verify the space is '\0'-initialized. - ASSERT_NO_FATAL_FAILURE(checkAllZeros(dataCopy)); - copy(dataCopy, dataSlice); - ASSERT_NO_FATAL_FAILURE(checkHelloMello(dataCopy, dataSlice)); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Netfilter.cpp b/common/netd/libnetdutils/Netfilter.cpp deleted file mode 100644 index bb43de0a..00000000 --- a/common/netd/libnetdutils/Netfilter.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <arpa/inet.h> -#include <linux/netfilter.h> -#include <linux/netfilter/nfnetlink.h> -#include <linux/netlink.h> -#include <ios> - -#include "netdutils/Netfilter.h" - -std::ostream& operator<<(std::ostream& os, const nfgenmsg& msg) { - return os << std::hex << "nfgenmsg[" - << "family: 0x" << static_cast<int>(msg.nfgen_family) << ", version: 0x" - << static_cast<int>(msg.version) << ", res_id: 0x" << ntohs(msg.res_id) << "]" - << std::dec; -} diff --git a/common/netd/libnetdutils/Netlink.cpp b/common/netd/libnetdutils/Netlink.cpp deleted file mode 100644 index 824c0f22..00000000 --- a/common/netd/libnetdutils/Netlink.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <ios> -#include <linux/netlink.h> - -#include "netdutils/Math.h" -#include "netdutils/Netlink.h" - -namespace android { -namespace netdutils { - -void forEachNetlinkMessage(const Slice buf, - const std::function<void(const nlmsghdr&, const Slice)>& onMsg) { - Slice tail = buf; - while (tail.size() >= sizeof(nlmsghdr)) { - nlmsghdr hdr = {}; - extract(tail, hdr); - const auto len = std::max<size_t>(hdr.nlmsg_len, sizeof(hdr)); - onMsg(hdr, drop(take(tail, len), sizeof(hdr))); - tail = drop(tail, align(len, 2)); - } -} - -void forEachNetlinkAttribute(const Slice buf, - const std::function<void(const nlattr&, const Slice)>& onAttr) { - Slice tail = buf; - while (tail.size() >= sizeof(nlattr)) { - nlattr hdr = {}; - extract(tail, hdr); - const auto len = std::max<size_t>(hdr.nla_len, sizeof(hdr)); - onAttr(hdr, drop(take(tail, len), sizeof(hdr))); - tail = drop(tail, align(len, 2)); - } -} - -} // namespace netdutils -} // namespace android - -bool operator==(const sockaddr_nl& lhs, const sockaddr_nl& rhs) { - return (lhs.nl_family == rhs.nl_family) && (lhs.nl_pid == rhs.nl_pid) && - (lhs.nl_groups == rhs.nl_groups); -} - -bool operator!=(const sockaddr_nl& lhs, const sockaddr_nl& rhs) { - return !(lhs == rhs); -} - -std::ostream& operator<<(std::ostream& os, const nlmsghdr& hdr) { - return os << std::hex << "nlmsghdr[" - << "len: 0x" << hdr.nlmsg_len << ", type: 0x" << hdr.nlmsg_type << ", flags: 0x" - << hdr.nlmsg_flags << ", seq: 0x" << hdr.nlmsg_seq << ", pid: 0x" << hdr.nlmsg_pid - << "]" << std::dec; -} - -std::ostream& operator<<(std::ostream& os, const nlattr& attr) { - return os << std::hex << "nlattr[" - << "len: 0x" << attr.nla_len << ", type: 0x" << attr.nla_type << "]" << std::dec; -} - -std::ostream& operator<<(std::ostream& os, const sockaddr_nl& addr) { - return os << std::hex << "sockaddr_nl[" - << "family: " << addr.nl_family << ", pid: " << addr.nl_pid - << ", groups: " << addr.nl_groups << "]" << std::dec; -} diff --git a/common/netd/libnetdutils/NetlinkListener.cpp b/common/netd/libnetdutils/NetlinkListener.cpp deleted file mode 100644 index decaa9c8..00000000 --- a/common/netd/libnetdutils/NetlinkListener.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "NetlinkListener" - -#include <sstream> -#include <vector> - -#include <linux/netfilter/nfnetlink.h> - -#include <log/log.h> -#include <netdutils/Misc.h> -#include <netdutils/NetlinkListener.h> -#include <netdutils/Syscalls.h> - -namespace android { -namespace netdutils { - -using netdutils::Fd; -using netdutils::Slice; -using netdutils::Status; -using netdutils::UniqueFd; -using netdutils::findWithDefault; -using netdutils::forEachNetlinkMessage; -using netdutils::makeSlice; -using netdutils::sSyscalls; -using netdutils::status::ok; -using netdutils::statusFromErrno; - -namespace { - -constexpr int kNetlinkMsgErrorType = (NFNL_SUBSYS_NONE << 8) | NLMSG_ERROR; - -constexpr sockaddr_nl kKernelAddr = { - .nl_family = AF_NETLINK, .nl_pad = 0, .nl_pid = 0, .nl_groups = 0, -}; - -const NetlinkListener::DispatchFn kDefaultDispatchFn = [](const nlmsghdr& nlmsg, const Slice) { - std::stringstream ss; - ss << nlmsg; - ALOGE("unhandled netlink message: %s", ss.str().c_str()); -}; - -} // namespace - -NetlinkListener::NetlinkListener(UniqueFd event, UniqueFd sock, const std::string& name) - : mEvent(std::move(event)), mSock(std::move(sock)), mThreadName(name) { - const auto rxErrorHandler = [](const nlmsghdr& nlmsg, const Slice msg) { - std::stringstream ss; - ss << nlmsg << " " << msg << " " << netdutils::toHex(msg, 32); - ALOGE("unhandled netlink message: %s", ss.str().c_str()); - }; - expectOk(NetlinkListener::subscribe(kNetlinkMsgErrorType, rxErrorHandler)); - - mErrorHandler = [& name = mThreadName](const int fd, const int err) { - ALOGE("Error on NetlinkListener(%s) fd=%d: %s", name.c_str(), fd, strerror(err)); - }; - - // Start the thread - mWorker = std::thread([this]() { run().ignoreError(); }); -} - -NetlinkListener::~NetlinkListener() { - const auto& sys = sSyscalls.get(); - const uint64_t data = 1; - // eventfd should never enter an error state unexpectedly - expectOk(sys.write(mEvent, makeSlice(data)).status()); - mWorker.join(); -} - -Status NetlinkListener::send(const Slice msg) { - const auto& sys = sSyscalls.get(); - ASSIGN_OR_RETURN(auto sent, sys.sendto(mSock, msg, 0, kKernelAddr)); - if (sent != msg.size()) { - return statusFromErrno(EMSGSIZE, "unexpect message size"); - } - return ok; -} - -Status NetlinkListener::subscribe(uint16_t type, const DispatchFn& fn) { - std::lock_guard guard(mMutex); - mDispatchMap[type] = fn; - return ok; -} - -Status NetlinkListener::unsubscribe(uint16_t type) { - std::lock_guard guard(mMutex); - mDispatchMap.erase(type); - return ok; -} - -void NetlinkListener::registerSkErrorHandler(const SkErrorHandler& handler) { - mErrorHandler = handler; -} - -Status NetlinkListener::run() { - std::vector<char> rxbuf(4096); - - const auto rxHandler = [this](const nlmsghdr& nlmsg, const Slice& buf) { - std::lock_guard guard(mMutex); - const auto& fn = findWithDefault(mDispatchMap, nlmsg.nlmsg_type, kDefaultDispatchFn); - fn(nlmsg, buf); - }; - - if (mThreadName.length() > 0) { - int ret = pthread_setname_np(pthread_self(), mThreadName.c_str()); - if (ret) { - ALOGE("thread name set failed, name: %s, ret: %s", mThreadName.c_str(), strerror(ret)); - } - } - const auto& sys = sSyscalls.get(); - const std::array<Fd, 2> fds{{{mEvent}, {mSock}}}; - const int events = POLLIN; - const double timeout = 3600; - while (true) { - ASSIGN_OR_RETURN(auto revents, sys.ppoll(fds, events, timeout)); - // After mEvent becomes readable, we should stop servicing mSock and return - if (revents[0] & POLLIN) { - break; - } - if (revents[1] & (POLLIN|POLLERR)) { - auto rx = sys.recvfrom(mSock, makeSlice(rxbuf), 0); - int err = rx.status().code(); - if (err) { - // Ignore errors. The only error we expect to see here is ENOBUFS, and there's - // nothing we can do about that. The recvfrom above will already have cleared the - // error indication and ensured we won't get EPOLLERR again. - // TODO: Consider using NETLINK_NO_ENOBUFS. - mErrorHandler(((Fd) mSock).get(), err); - continue; - } - forEachNetlinkMessage(rx.value(), rxHandler); - } - } - return ok; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Slice.cpp b/common/netd/libnetdutils/Slice.cpp deleted file mode 100644 index 7a07d477..00000000 --- a/common/netd/libnetdutils/Slice.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <sstream> - -#include "netdutils/Slice.h" - -namespace android { -namespace netdutils { -namespace { - -// Convert one byte to a two character hexadecimal string -const std::string toHex(uint8_t byte) { - const std::array<char, 16> kLookup = { - {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}}; - return {kLookup[byte >> 4], kLookup[byte & 0xf]}; -} - -} // namespace - -std::string toString(const Slice s) { - return std::string(reinterpret_cast<char*>(s.base()), s.size()); -} - -std::string toHex(const Slice s, int wrap) { - Slice tail = s; - int count = 0; - std::stringstream ss; - while (!tail.empty()) { - uint8_t byte = 0; - extract(tail, byte); - ss << toHex(byte); - if ((++count % wrap) == 0) { - ss << "\n"; - } - tail = drop(tail, 1); - } - return ss.str(); -} - -std::ostream& operator<<(std::ostream& os, const Slice& slice) { - return os << std::hex << "Slice[base: " << reinterpret_cast<void*>(slice.base()) - << ", limit: " << reinterpret_cast<void*>(slice.limit()) << ", size: 0x" - << slice.size() << "]" << std::dec; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/SliceTest.cpp b/common/netd/libnetdutils/SliceTest.cpp deleted file mode 100644 index a4969331..00000000 --- a/common/netd/libnetdutils/SliceTest.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <array> -#include <cstdint> - -#include <gtest/gtest.h> - -#include "netdutils/Slice.h" -#include "netdutils/Status.h" -#include "netdutils/StatusOr.h" - -namespace android { -namespace netdutils { - -class SliceTest : public testing::Test { - protected: - std::array<char, 256> mRaw = {}; -}; - -TEST_F(SliceTest, smoke) { - Slice s1 = makeSlice(mRaw); - Slice s2 = makeSlice(mRaw); - auto p = split(s1, 14); - s2 = p.first; // avoid warn-unused error - std::stringstream ss; - ss << Slice(); - EXPECT_EQ("Slice[base: 0x0, limit: 0x0, size: 0x0]", ss.str()); - constexpr size_t kBytes = 14; - EXPECT_EQ(s1.base(), take(s1, kBytes).base()); - EXPECT_EQ(kBytes, take(s1, kBytes).size()); - EXPECT_EQ(s1.base() + kBytes, drop(s1, kBytes).base()); - EXPECT_EQ(s1.size() - kBytes, drop(s1, kBytes).size()); - double a = 0; - double b = 0; - int c = 0; - EXPECT_EQ(sizeof(a), extract(s1, a)); - EXPECT_EQ(sizeof(a) + sizeof(b), extract(s1, a, b)); - EXPECT_EQ(sizeof(a) + sizeof(b) + sizeof(c), extract(s1, a, b, c)); -} - -TEST_F(SliceTest, constructor) { - // Expect the following lines to compile - Slice s1 = makeSlice(mRaw); - Slice s2(s1); - Slice s3 = s2; - const Slice s4(s3); - const Slice s5 = s4; - s3 = s5; - Slice s6(mRaw.data(), mRaw.size()); - Slice s7(mRaw.data(), mRaw.data() + mRaw.size()); - struct { - int a; - double b; - float c; - } anon; - makeSlice(anon); - EXPECT_EQ(reinterpret_cast<uint8_t*>(mRaw.data()), s1.base()); - EXPECT_EQ(reinterpret_cast<uint8_t*>(mRaw.data()) + mRaw.size(), s1.limit()); - EXPECT_EQ(mRaw.size(), s1.size()); - EXPECT_FALSE(mRaw.empty()); - EXPECT_TRUE(Slice().empty()); - EXPECT_TRUE(Slice(nullptr, static_cast<size_t>(0)).empty()); - EXPECT_TRUE(Slice(nullptr, nullptr).empty()); -} - -TEST_F(SliceTest, extract) { - struct A { - int a, b; - bool operator==(const A& other) const { return a == other.a && b == other.b; } - }; - struct B { - char str[12]; - bool b; - int i; - bool operator==(const B& other) const { - return b == other.b && i == other.i && 0 == strncmp(str, other.str, 12); - } - }; - - A origA1 = {1, 2}; - A origA2 = {3, 4}; - B origB = {"hello world", true, 1234}; - - // Populate buffer for extracting. - Slice buffer = makeSlice(mRaw); - copy(buffer, makeSlice(origA1)); - copy(drop(buffer, sizeof(origA1)), makeSlice(origB)); - copy(drop(buffer, sizeof(origA1) + sizeof(origB)), makeSlice(origA2)); - - { - // Non-variadic extract - A a1{}; - size_t len = extract(buffer, a1); - EXPECT_EQ(sizeof(A), len); - EXPECT_EQ(origA1, a1); - } - - { - // Variadic extract, 2 destinations - A a1{}; - B b{}; - size_t len = extract(buffer, a1, b); - EXPECT_EQ(sizeof(A) + sizeof(B), len); - EXPECT_EQ(origA1, a1); - EXPECT_EQ(origB, b); - } - - { - // Variadic extract, 3 destinations - A a1{}, a2{}; - B b{}; - size_t len = extract(buffer, a1, b, a2); - EXPECT_EQ(2 * sizeof(A) + sizeof(B), len); - EXPECT_EQ(origA1, a1); - EXPECT_EQ(origB, b); - EXPECT_EQ(origA2, a2); - } -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Socket.cpp b/common/netd/libnetdutils/Socket.cpp deleted file mode 100644 index e962b6e5..00000000 --- a/common/netd/libnetdutils/Socket.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <arpa/inet.h> - -#include "netdutils/Slice.h" -#include "netdutils/Socket.h" - -namespace android { -namespace netdutils { - -StatusOr<std::string> toString(const in6_addr& addr) { - std::array<char, INET6_ADDRSTRLEN> out = {}; - auto* rv = inet_ntop(AF_INET6, &addr, out.data(), out.size()); - if (rv == nullptr) { - return statusFromErrno(errno, "inet_ntop() failed"); - } - return std::string(out.data()); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/SocketOption.cpp b/common/netd/libnetdutils/SocketOption.cpp deleted file mode 100644 index 023df6e8..00000000 --- a/common/netd/libnetdutils/SocketOption.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/SocketOption.h" - -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <sys/socket.h> -#include <utility> - -#include "netdutils/Syscalls.h" - -namespace android { -namespace netdutils { - -Status enableSockopt(Fd sock, int level, int optname) { - auto& sys = sSyscalls.get(); - const int on = 1; - return sys.setsockopt(sock, level, optname, &on, sizeof(on)); -} - -Status enableTcpKeepAlives(Fd sock, unsigned idleTime, unsigned numProbes, unsigned probeInterval) { - RETURN_IF_NOT_OK(enableSockopt(sock, SOL_SOCKET, SO_KEEPALIVE)); - - auto& sys = sSyscalls.get(); - if (idleTime != 0) { - RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, &idleTime, sizeof(idleTime))); - } - if (numProbes != 0) { - RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPCNT, &numProbes, sizeof(numProbes))); - } - if (probeInterval != 0) { - RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, &probeInterval, - sizeof(probeInterval))); - } - - return status::ok; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Status.cpp b/common/netd/libnetdutils/Status.cpp deleted file mode 100644 index acd8f11a..00000000 --- a/common/netd/libnetdutils/Status.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/Status.h" - -#include <sstream> - -#include "android-base/stringprintf.h" - -namespace android { -namespace netdutils { - -Status statusFromErrno(int err, const std::string& msg) { - return Status(err, base::StringPrintf("[%s] : %s", strerror(err), msg.c_str())); -} - -bool equalToErrno(const Status& status, int err) { - return status.code() == err; -} - -std::string toString(const Status& status) { - std::stringstream ss; - ss << status; - return ss.str(); -} - -std::ostream& operator<<(std::ostream& os, const Status& s) { - return os << "Status[code: " << s.code() << ", msg: \"" << s.msg() << "\"]"; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/StatusTest.cpp b/common/netd/libnetdutils/StatusTest.cpp deleted file mode 100644 index 4cfc3bbb..00000000 --- a/common/netd/libnetdutils/StatusTest.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/Status.h" -#include "netdutils/StatusOr.h" - -#include <sstream> - -#include <gtest/gtest.h> - -namespace android { -namespace netdutils { -namespace { - -TEST(StatusTest, valueSemantics) { - // Default constructor - EXPECT_EQ(status::ok, Status()); - - // Copy constructor - Status status1(1); - Status status2(status1); // NOLINT(performance-unnecessary-copy-initialization) - EXPECT_EQ(1, status2.code()); - - // Copy assignment - Status status3; - status3 = status2; - EXPECT_EQ(1, status3.code()); - - // Same with const objects - const Status status4(4); - const Status status5(status4); // NOLINT(performance-unnecessary-copy-initialization) - Status status6; - status6 = status5; - EXPECT_EQ(4, status6.code()); -} - -TEST(StatusTest, errorMessages) { - Status s(42, "for tea too"); - EXPECT_EQ(42, s.code()); - EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.msg(), "for tea too"); -} - -TEST(StatusOrTest, moveSemantics) { - // Status objects should be cheaply movable. - EXPECT_TRUE(std::is_nothrow_move_constructible<Status>::value); - EXPECT_TRUE(std::is_nothrow_move_assignable<Status>::value); - - // Should move from a temporary Status (twice) - Status s(Status(Status(42, "move me"))); - EXPECT_EQ(42, s.code()); - EXPECT_EQ(s.msg(), "move me"); - - Status s2(666, "EDAEMON"); - EXPECT_NE(s, s2); - s = s2; // Invokes the move-assignment operator. - EXPECT_EQ(666, s.code()); - EXPECT_EQ(s.msg(), "EDAEMON"); - EXPECT_EQ(s, s2); - - // A moved-from Status can be re-used. - s2 = s; - - // Now both objects are valid. - EXPECT_EQ(666, s.code()); - EXPECT_EQ(s.msg(), "EDAEMON"); - EXPECT_EQ(s, s2); -} - -TEST(StatusTest, ignoredStatus) { - statusFromErrno(ENOTTY, "Not a typewriter, what did you expect?").ignoreError(); -} - -TEST(StatusOrTest, ostream) { - { - StatusOr<int> so(11); - std::stringstream ss; - ss << so; - // TODO: Fix StatusOr to optionally output "value:". - EXPECT_EQ("StatusOr[status: Status[code: 0, msg: \"\"]]", ss.str()); - } - { - StatusOr<int> err(status::undefined); - std::stringstream ss; - ss << err; - EXPECT_EQ("StatusOr[status: Status[code: 2147483647, msg: \"undefined\"]]", ss.str()); - } -} - -} // namespace -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Syscalls.cpp b/common/netd/libnetdutils/Syscalls.cpp deleted file mode 100644 index 7e1a2426..00000000 --- a/common/netd/libnetdutils/Syscalls.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "netdutils/Syscalls.h" - -#include <atomic> -#include <type_traits> -#include <utility> - -namespace android { -namespace netdutils { -namespace { - -// Retry syscall fn as long as it returns -1 with errno == EINTR -template <typename FnT, typename... Params> -typename std::invoke_result<FnT, Params...>::type syscallRetry(FnT fn, Params&&... params) { - auto rv = fn(std::forward<Params>(params)...); - while ((rv == -1) && (errno == EINTR)) { - rv = fn(std::forward<Params>(params)...); - } - return rv; -} - -} // namespace - -// Production implementation of Syscalls that forwards to libc syscalls. -class RealSyscalls final : public Syscalls { - public: - ~RealSyscalls() override = default; - - StatusOr<UniqueFd> open(const std::string& pathname, int flags, mode_t mode) const override { - UniqueFd fd(::open(pathname.c_str(), flags, mode)); - if (!isWellFormed(fd)) { - return statusFromErrno(errno, "open(\"" + pathname + "\"...) failed"); - } - return fd; - } - - StatusOr<UniqueFd> socket(int domain, int type, int protocol) const override { - UniqueFd sock(::socket(domain, type, protocol)); - if (!isWellFormed(sock)) { - return statusFromErrno(errno, "socket() failed"); - } - return sock; - } - - Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const override { - auto rv = ::getsockname(sock.get(), addr, addrlen); - if (rv == -1) { - return statusFromErrno(errno, "getsockname() failed"); - } - return status::ok; - } - - Status getsockopt(Fd sock, int level, int optname, void* optval, - socklen_t* optlen) const override { - auto rv = ::getsockopt(sock.get(), level, optname, optval, optlen); - if (rv == -1) { - return statusFromErrno(errno, "getsockopt() failed"); - } - return status::ok; - } - - Status setsockopt(Fd sock, int level, int optname, const void* optval, - socklen_t optlen) const override { - auto rv = ::setsockopt(sock.get(), level, optname, optval, optlen); - if (rv == -1) { - return statusFromErrno(errno, "setsockopt() failed"); - } - return status::ok; - } - - Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const override { - auto rv = ::bind(sock.get(), addr, addrlen); - if (rv == -1) { - return statusFromErrno(errno, "bind() failed"); - } - return status::ok; - } - - Status connect(Fd sock, const sockaddr* addr, socklen_t addrlen) const override { - auto rv = syscallRetry(::connect, sock.get(), addr, addrlen); - if (rv == -1) { - return statusFromErrno(errno, "connect() failed"); - } - return status::ok; - } - - StatusOr<ifreq> ioctl(Fd sock, unsigned long request, ifreq* ifr) const override { - auto rv = ::ioctl(sock.get(), request, ifr); - if (rv == -1) { - return statusFromErrno(errno, "ioctl() failed"); - } - return *ifr; - } - - StatusOr<UniqueFd> eventfd(unsigned int initval, int flags) const override { - UniqueFd fd(::eventfd(initval, flags)); - if (!isWellFormed(fd)) { - return statusFromErrno(errno, "eventfd() failed"); - } - return fd; - } - - StatusOr<int> ppoll(pollfd* fds, nfds_t nfds, double timeout) const override { - timespec ts = {}; - ts.tv_sec = timeout; - ts.tv_nsec = (timeout - ts.tv_sec) * 1e9; - auto rv = syscallRetry(::ppoll, fds, nfds, &ts, nullptr); - if (rv == -1) { - return statusFromErrno(errno, "ppoll() failed"); - } - return rv; - } - - StatusOr<size_t> writev(Fd fd, const std::vector<iovec>& iov) const override { - auto rv = syscallRetry(::writev, fd.get(), iov.data(), iov.size()); - if (rv == -1) { - return statusFromErrno(errno, "writev() failed"); - } - return rv; - } - - StatusOr<size_t> write(Fd fd, const Slice buf) const override { - auto rv = syscallRetry(::write, fd.get(), buf.base(), buf.size()); - if (rv == -1) { - return statusFromErrno(errno, "write() failed"); - } - return static_cast<size_t>(rv); - } - - StatusOr<Slice> read(Fd fd, const Slice buf) const override { - auto rv = syscallRetry(::read, fd.get(), buf.base(), buf.size()); - if (rv == -1) { - return statusFromErrno(errno, "read() failed"); - } - return Slice(buf.base(), rv); - } - - StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const sockaddr* dst, - socklen_t dstlen) const override { - auto rv = syscallRetry(::sendto, sock.get(), buf.base(), buf.size(), flags, dst, dstlen); - if (rv == -1) { - return statusFromErrno(errno, "sendto() failed"); - } - return static_cast<size_t>(rv); - } - - StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags, sockaddr* src, - socklen_t* srclen) const override { - auto rv = syscallRetry(::recvfrom, sock.get(), dst.base(), dst.size(), flags, src, srclen); - if (rv == -1) { - return statusFromErrno(errno, "recvfrom() failed"); - } - if (rv == 0) { - return status::eof; - } - return take(dst, rv); - } - - Status shutdown(Fd fd, int how) const override { - auto rv = ::shutdown(fd.get(), how); - if (rv == -1) { - return statusFromErrno(errno, "shutdown() failed"); - } - return status::ok; - } - - Status close(Fd fd) const override { - auto rv = ::close(fd.get()); - if (rv == -1) { - return statusFromErrno(errno, "close() failed"); - } - return status::ok; - } - - StatusOr<UniqueFile> fopen(const std::string& path, const std::string& mode) const override { - UniqueFile file(::fopen(path.c_str(), mode.c_str())); - if (file == nullptr) { - return statusFromErrno(errno, "fopen(\"" + path + "\", \"" + mode + "\") failed"); - } - return file; - } - - StatusOr<pid_t> fork() const override { - pid_t rv = ::fork(); - if (rv == -1) { - return statusFromErrno(errno, "fork() failed"); - } - return rv; - } - - StatusOr<int> vfprintf(FILE* file, const char* format, va_list ap) const override { - auto rv = ::vfprintf(file, format, ap); - if (rv == -1) { - return statusFromErrno(errno, "vfprintf() failed"); - } - return rv; - } - - StatusOr<int> vfscanf(FILE* file, const char* format, va_list ap) const override { - auto rv = ::vfscanf(file, format, ap); - if (rv == -1) { - return statusFromErrno(errno, "vfscanf() failed"); - } - return rv; - } - - Status fclose(FILE* file) const override { - auto rv = ::fclose(file); - if (rv == -1) { - return statusFromErrno(errno, "fclose() failed"); - } - return status::ok; - } -}; - -SyscallsHolder::~SyscallsHolder() { - delete &get(); -} - -Syscalls& SyscallsHolder::get() { - while (true) { - // memory_order_relaxed gives the compiler and hardware more - // freedom. If we get a stale value (this should only happen - // early in the execution of a program) the exchange code below - // will loop until we get the most current value. - auto* syscalls = mSyscalls.load(std::memory_order_relaxed); - // Common case returns existing syscalls - if (syscalls) { - return *syscalls; - } - - // This code will execute on first get() - std::unique_ptr<Syscalls> tmp(new RealSyscalls()); - Syscalls* expected = nullptr; - bool success = mSyscalls.compare_exchange_strong(expected, tmp.get()); - if (success) { - // Ownership was transferred to mSyscalls already, must release() - return *tmp.release(); - } - } -} - -Syscalls& SyscallsHolder::swap(Syscalls& syscalls) { - return *mSyscalls.exchange(&syscalls); -} - -SyscallsHolder sSyscalls; - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/SyscallsTest.cpp b/common/netd/libnetdutils/SyscallsTest.cpp deleted file mode 100644 index 78ffab5e..00000000 --- a/common/netd/libnetdutils/SyscallsTest.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <array> -#include <cstdint> -#include <memory> - -#include <gtest/gtest.h> - -#include "netdutils/Handle.h" -#include "netdutils/Math.h" -#include "netdutils/MockSyscalls.h" -#include "netdutils/Netfilter.h" -#include "netdutils/Netlink.h" -#include "netdutils/Slice.h" -#include "netdutils/Status.h" -#include "netdutils/StatusOr.h" -#include "netdutils/Syscalls.h" - -using testing::_; -using testing::ByMove; -using testing::Invoke; -using testing::Return; -using testing::StrictMock; - -namespace android { -namespace netdutils { - -class SyscallsTest : public testing::Test { - protected: - StrictMock<ScopedMockSyscalls> mSyscalls; -}; - -TEST(syscalls, scopedMock) { - auto& old = sSyscalls.get(); - { - StrictMock<ScopedMockSyscalls> s; - EXPECT_EQ(&s, &sSyscalls.get()); - } - EXPECT_EQ(&old, &sSyscalls.get()); -} - -TEST_F(SyscallsTest, open) { - const char kPath[] = "/test/path/please/ignore"; - constexpr Fd kFd(40); - constexpr int kFlags = 883; - constexpr mode_t kMode = 37373; - const auto& sys = sSyscalls.get(); - EXPECT_CALL(mSyscalls, open(kPath, kFlags, kMode)).WillOnce(Return(ByMove(UniqueFd(kFd)))); - EXPECT_CALL(mSyscalls, close(kFd)).WillOnce(Return(status::ok)); - auto result = sys.open(kPath, kFlags, kMode); - EXPECT_EQ(status::ok, result.status()); - EXPECT_EQ(kFd, result.value()); -} - -TEST_F(SyscallsTest, getsockname) { - constexpr Fd kFd(40); - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, getsockname(kFd, _, _)) - .WillOnce(Invoke([expected](Fd, sockaddr* addr, socklen_t* addrlen) { - memcpy(addr, &expected, sizeof(expected)); - EXPECT_EQ(*addrlen, static_cast<socklen_t>(sizeof(expected))); - return status::ok; - })); - const auto result = sys.getsockname<sockaddr_nl>(kFd); - EXPECT_TRUE(isOk(result)); - EXPECT_EQ(expected, result.value()); - - // Failure - const Status kError = statusFromErrno(EINVAL, "test"); - EXPECT_CALL(mSyscalls, getsockname(kFd, _, _)).WillOnce(Return(kError)); - EXPECT_EQ(kError, sys.getsockname<sockaddr_nl>(kFd).status()); -} - -TEST_F(SyscallsTest, setsockopt) { - constexpr Fd kFd(40); - constexpr int kLevel = 50; - constexpr int kOptname = 70; - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, setsockopt(kFd, kLevel, kOptname, &expected, sizeof(expected))) - .WillOnce(Return(status::ok)); - EXPECT_EQ(status::ok, sys.setsockopt(kFd, kLevel, kOptname, expected)); - - // Failure - const Status kError = statusFromErrno(EINVAL, "test"); - EXPECT_CALL(mSyscalls, setsockopt(kFd, kLevel, kOptname, &expected, sizeof(expected))) - .WillOnce(Return(kError)); - EXPECT_EQ(kError, sys.setsockopt(kFd, kLevel, kOptname, expected)); -} - -TEST_F(SyscallsTest, getsockopt) { - constexpr Fd kFd(40); - constexpr int kLevel = 50; - constexpr int kOptname = 70; - sockaddr_nl expected = {}; - socklen_t optLen = 0; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, getsockopt(kFd, kLevel, kOptname, &expected, &optLen)) - .WillOnce(Return(status::ok)); - EXPECT_EQ(status::ok, sys.getsockopt(kFd, kLevel, kOptname, &expected, &optLen)); - - // Failure - const Status kError = statusFromErrno(EINVAL, "test"); - EXPECT_CALL(mSyscalls, getsockopt(kFd, kLevel, kOptname, &expected, &optLen)) - .WillOnce(Return(kError)); - EXPECT_EQ(kError, sys.getsockopt(kFd, kLevel, kOptname, &expected, &optLen)); -} - -TEST_F(SyscallsTest, bind) { - constexpr Fd kFd(40); - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, bind(kFd, asSockaddrPtr(&expected), sizeof(expected))) - .WillOnce(Return(status::ok)); - EXPECT_EQ(status::ok, sys.bind(kFd, expected)); - - // Failure - const Status kError = statusFromErrno(EINVAL, "test"); - EXPECT_CALL(mSyscalls, bind(kFd, asSockaddrPtr(&expected), sizeof(expected))) - .WillOnce(Return(kError)); - EXPECT_EQ(kError, sys.bind(kFd, expected)); -} - -TEST_F(SyscallsTest, connect) { - constexpr Fd kFd(40); - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, connect(kFd, asSockaddrPtr(&expected), sizeof(expected))) - .WillOnce(Return(status::ok)); - EXPECT_EQ(status::ok, sys.connect(kFd, expected)); - - // Failure - const Status kError = statusFromErrno(EINVAL, "test"); - EXPECT_CALL(mSyscalls, connect(kFd, asSockaddrPtr(&expected), sizeof(expected))) - .WillOnce(Return(kError)); - EXPECT_EQ(kError, sys.connect(kFd, expected)); -} - -TEST_F(SyscallsTest, sendto) { - constexpr Fd kFd(40); - constexpr int kFlags = 0; - std::array<char, 10> payload; - const auto slice = makeSlice(payload); - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, sendto(kFd, slice, kFlags, asSockaddrPtr(&expected), sizeof(expected))) - .WillOnce(Return(slice.size())); - EXPECT_EQ(status::ok, sys.sendto(kFd, slice, kFlags, expected)); -} - -TEST_F(SyscallsTest, recvfrom) { - constexpr Fd kFd(40); - constexpr int kFlags = 0; - std::array<char, 10> payload; - const auto dst = makeSlice(payload); - const auto used = take(dst, 8); - sockaddr_nl expected = {}; - auto& sys = sSyscalls.get(); - - // Success - EXPECT_CALL(mSyscalls, recvfrom(kFd, dst, kFlags, _, _)) - .WillOnce(Invoke( - [expected, used](Fd, const Slice, int, sockaddr* src, socklen_t* srclen) { - *srclen = sizeof(expected); - memcpy(src, &expected, *srclen); - return used; - })); - auto result = sys.recvfrom<sockaddr_nl>(kFd, dst, kFlags); - EXPECT_EQ(status::ok, result.status()); - EXPECT_EQ(used, result.value().first); - EXPECT_EQ(expected, result.value().second); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/ThreadUtilTest.cpp b/common/netd/libnetdutils/ThreadUtilTest.cpp deleted file mode 100644 index 8fad8b8e..00000000 --- a/common/netd/libnetdutils/ThreadUtilTest.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <string> - -#include <android-base/expected.h> -#include <gtest/gtest.h> -#include <netdutils/ThreadUtil.h> - -namespace android::netdutils { - -namespace { - -android::base::expected<std::string, int> getThreadName() { - char name[16] = {}; - if (const int ret = pthread_getname_np(pthread_self(), name, sizeof(name)); ret != 0) { - return android::base::unexpected(ret); - } - return std::string(name); -} - -class NoopRun { - public: - explicit NoopRun(const std::string& name = "") : mName(name) { instanceNum++; } - - // Destructor happens in the thread. - ~NoopRun() { - if (checkName) { - auto expected = getThreadName(); - EXPECT_TRUE(expected.has_value()); - EXPECT_EQ(mExpectedName, expected.value()); - } - instanceNum--; - } - - void run() {} - - std::string threadName() { return mName; } - - // Set the expected thread name which will be used to check if it matches the actual thread - // name which is returned from the system call. The check will happen in the destructor. - void setExpectedName(const std::string& expectedName) { - checkName = true; - mExpectedName = expectedName; - } - - static bool waitForAllReleased(int timeoutMs) { - constexpr int intervalMs = 20; - int limit = timeoutMs / intervalMs; - for (int i = 1; i < limit; i++) { - if (instanceNum == 0) { - return true; - } - usleep(intervalMs * 1000); - } - return false; - } - - // To track how many instances are alive. - static std::atomic<int> instanceNum; - - private: - std::string mName; - std::string mExpectedName; - bool checkName = false; -}; - -std::atomic<int> NoopRun::instanceNum; - -} // namespace - -TEST(ThreadUtilTest, objectReleased) { - NoopRun::instanceNum = 0; - NoopRun* obj = new NoopRun(); - EXPECT_EQ(1, NoopRun::instanceNum); - threadLaunch(obj); - - // Wait for the object released along with the thread exited. - EXPECT_TRUE(NoopRun::waitForAllReleased(1000)); - EXPECT_EQ(0, NoopRun::instanceNum); -} - -TEST(ThreadUtilTest, SetThreadName) { - NoopRun::instanceNum = 0; - - // Test thread name empty. - NoopRun* obj1 = new NoopRun(); - obj1->setExpectedName(""); - - // Test normal case. - NoopRun* obj2 = new NoopRun("TestName"); - obj2->setExpectedName("TestName"); - - // Test thread name too long. - std::string name("TestNameTooooLong"); - NoopRun* obj3 = new NoopRun(name); - obj3->setExpectedName(name.substr(0, 15)); - - // Thread names are examined in their destructors. - EXPECT_EQ(3, NoopRun::instanceNum); - threadLaunch(obj1); - threadLaunch(obj2); - threadLaunch(obj3); - - EXPECT_TRUE(NoopRun::waitForAllReleased(1000)); - EXPECT_EQ(0, NoopRun::instanceNum); -} - -} // namespace android::netdutils diff --git a/common/netd/libnetdutils/UniqueFd.cpp b/common/netd/libnetdutils/UniqueFd.cpp deleted file mode 100644 index 1cb30edd..00000000 --- a/common/netd/libnetdutils/UniqueFd.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <algorithm> - -#include "netdutils/UniqueFd.h" -#include "netdutils/Syscalls.h" - -namespace android { -namespace netdutils { - -void UniqueFd::reset(Fd fd) { - auto& sys = sSyscalls.get(); - std::swap(fd, mFd); - if (isWellFormed(fd)) { - expectOk(sys.close(fd)); - } -} - -std::ostream& operator<<(std::ostream& os, const UniqueFd& fd) { - return os << "UniqueFd[" << static_cast<Fd>(fd) << "]"; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/UniqueFile.cpp b/common/netd/libnetdutils/UniqueFile.cpp deleted file mode 100644 index 21e87798..00000000 --- a/common/netd/libnetdutils/UniqueFile.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <algorithm> - -#include "netdutils/Syscalls.h" -#include "netdutils/UniqueFile.h" - -namespace android { -namespace netdutils { - -void UniqueFileDtor::operator()(FILE* file) const { - const auto& sys = sSyscalls.get(); - sys.fclose(file).ignoreError(); -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/Utils.cpp b/common/netd/libnetdutils/Utils.cpp deleted file mode 100644 index 16ec8825..00000000 --- a/common/netd/libnetdutils/Utils.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <map> - -#include <net/if.h> - -#include "dirent.h" -#include "netdutils/Status.h" -#include "netdutils/Utils.h" - -namespace android { -namespace netdutils { - -StatusOr<std::vector<std::string>> getIfaceNames() { - std::vector<std::string> ifaceNames; - DIR* d; - struct dirent* de; - - if (!(d = opendir("/sys/class/net"))) { - return statusFromErrno(errno, "Cannot open iface directory"); - } - while ((de = readdir(d))) { - if ((de->d_type != DT_DIR) && (de->d_type != DT_LNK)) continue; - if (de->d_name[0] == '.') continue; - ifaceNames.push_back(std::string(de->d_name)); - } - closedir(d); - return ifaceNames; -} - -StatusOr<std::map<std::string, uint32_t>> getIfaceList() { - std::map<std::string, uint32_t> ifacePairs; - - ASSIGN_OR_RETURN(auto ifaceNames, getIfaceNames()); - - for (const auto& name : ifaceNames) { - uint32_t ifaceIndex = if_nametoindex(name.c_str()); - if (ifaceIndex) { - ifacePairs.insert(std::pair<std::string, uint32_t>(name, ifaceIndex)); - } - } - return ifacePairs; -} - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/include/netdutils/BackoffSequence.h b/common/netd/libnetdutils/include/netdutils/BackoffSequence.h deleted file mode 100644 index a52e72d6..00000000 --- a/common/netd/libnetdutils/include/netdutils/BackoffSequence.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_BACKOFFSEQUENCE_H -#define NETDUTILS_BACKOFFSEQUENCE_H - -#include <stdint.h> -#include <algorithm> -#include <chrono> -#include <limits> - -namespace android { -namespace netdutils { - -// Encapsulate some RFC 3315 section 14 -style backoff mechanics. -// -// https://tools.ietf.org/html/rfc3315#section-14 -template<typename time_type = std::chrono::seconds, typename counter_type = uint32_t> -class BackoffSequence { - public: - struct Parameters { - time_type initialRetransTime{TIME_UNITY}; - counter_type maxRetransCount{0U}; - time_type maxRetransTime{TIME_ZERO}; - time_type maxRetransDuration{TIME_ZERO}; - time_type endOfSequenceIndicator{TIME_ZERO}; - }; - - BackoffSequence() : BackoffSequence(Parameters{}) {} - BackoffSequence(const BackoffSequence &) = default; - BackoffSequence(BackoffSequence &&) = default; - BackoffSequence& operator=(const BackoffSequence &) = default; - BackoffSequence& operator=(BackoffSequence &&) = default; - - bool hasNextTimeout() const noexcept { - return !maxRetransCountExceed() && !maxRetransDurationExceeded(); - } - - // Returns 0 when the sequence is exhausted. - time_type getNextTimeout() { - if (!hasNextTimeout()) return getEndOfSequenceIndicator(); - - mRetransTime = getNextTimeoutAfter(mRetransTime); - - mRetransCount++; - mTotalRetransDuration += mRetransTime; - return mRetransTime; - } - - time_type getEndOfSequenceIndicator() const noexcept { - return mParams.endOfSequenceIndicator; - } - - class Builder { - public: - Builder() {} - - constexpr Builder& withInitialRetransmissionTime(time_type irt) { - mParams.initialRetransTime = irt; - return *this; - } - constexpr Builder& withMaximumRetransmissionCount(counter_type mrc) { - mParams.maxRetransCount = mrc; - return *this; - } - constexpr Builder& withMaximumRetransmissionTime(time_type mrt) { - mParams.maxRetransTime = mrt; - return *this; - } - constexpr Builder& withMaximumRetransmissionDuration(time_type mrd) { - mParams.maxRetransDuration = mrd; - return *this; - } - constexpr Builder& withEndOfSequenceIndicator(time_type eos) { - mParams.endOfSequenceIndicator = eos; - return *this; - } - - constexpr BackoffSequence build() const { - return BackoffSequence(mParams); - } - - private: - Parameters mParams; - }; - - private: - static constexpr int PER_ITERATION_SCALING_FACTOR = 2; - static constexpr time_type TIME_ZERO = time_type(); - static constexpr time_type TIME_UNITY = time_type(1); - - constexpr BackoffSequence(const struct Parameters ¶ms) - : mParams(params), - mRetransCount(0), - mRetransTime(TIME_ZERO), - mTotalRetransDuration(TIME_ZERO) {} - - constexpr bool maxRetransCountExceed() const { - return (mParams.maxRetransCount > 0) && (mRetransCount >= mParams.maxRetransCount); - } - - constexpr bool maxRetransDurationExceeded() const { - return (mParams.maxRetransDuration > TIME_ZERO) && - (mTotalRetransDuration >= mParams.maxRetransDuration); - } - - time_type getNextTimeoutAfter(time_type lastTimeout) const { - // TODO: Support proper random jitter. Also, consider supporting some - // per-iteration scaling factor other than doubling. - time_type nextTimeout = (lastTimeout > TIME_ZERO) - ? PER_ITERATION_SCALING_FACTOR * lastTimeout - : mParams.initialRetransTime; - - // Check if overflow occurred. - if (nextTimeout < lastTimeout) { - nextTimeout = std::numeric_limits<time_type>::max(); - } - - // Cap to maximum allowed, if necessary. - if (mParams.maxRetransTime > TIME_ZERO) { - nextTimeout = std::min(nextTimeout, mParams.maxRetransTime); - } - - // Don't overflow the maximum total duration. - if (mParams.maxRetransDuration > TIME_ZERO) { - nextTimeout = std::min(nextTimeout, mParams.maxRetransDuration - lastTimeout); - } - return nextTimeout; - } - - const Parameters mParams; - counter_type mRetransCount; - time_type mRetransTime; - time_type mTotalRetransDuration; -}; - -} // namespace netdutils -} // namespace android - -#endif /* NETDUTILS_BACKOFFSEQUENCE_H */ diff --git a/common/netd/libnetdutils/include/netdutils/DumpWriter.h b/common/netd/libnetdutils/include/netdutils/DumpWriter.h deleted file mode 100644 index a50b5e60..00000000 --- a/common/netd/libnetdutils/include/netdutils/DumpWriter.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_DUMPWRITER_H_ -#define NETDUTILS_DUMPWRITER_H_ - -#include <string> - -namespace android { -namespace netdutils { - -class DumpWriter { - public: - DumpWriter(int fd); - - void incIndent(); - void decIndent(); - - void println(const std::string& line); - template <size_t n> - void println(const char line[n]) { - println(std::string(line)); - } - // Hint to the compiler that it should apply printf validation of - // arguments (beginning at position 3) of the format (specified in - // position 2). Note that position 1 is the implicit "this" argument. - void println(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))); - void blankline() { println(""); } - - private: - uint8_t mIndentLevel; - int mFd; -}; - -class ScopedIndent { - public: - ScopedIndent() = delete; - ScopedIndent(const ScopedIndent&) = delete; - ScopedIndent(ScopedIndent&&) = delete; - explicit ScopedIndent(DumpWriter& dw) : mDw(dw) { mDw.incIndent(); } - ~ScopedIndent() { mDw.decIndent(); } - ScopedIndent& operator=(const ScopedIndent&) = delete; - ScopedIndent& operator=(ScopedIndent&&) = delete; - - // TODO: consider additional {inc,dec}Indent methods and a counter that - // can be used to unwind all pending increments on exit. - - private: - DumpWriter& mDw; -}; - -} // namespace netdutils -} // namespace android - -#endif // NETDUTILS_DUMPWRITER_H_ diff --git a/common/netd/libnetdutils/include/netdutils/Fd.h b/common/netd/libnetdutils/include/netdutils/Fd.h deleted file mode 100644 index 7db40870..00000000 --- a/common/netd/libnetdutils/include/netdutils/Fd.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_FD_H -#define NETUTILS_FD_H - -#include <ostream> - -#include "netdutils/Status.h" - -namespace android { -namespace netdutils { - -// Strongly typed wrapper for file descriptors with value semantics. -// This class should typically hold unowned file descriptors. -class Fd { - public: - constexpr Fd() = default; - - constexpr Fd(int fd) : mFd(fd) {} - - int get() const { return mFd; } - - bool operator==(const Fd& other) const { return get() == other.get(); } - bool operator!=(const Fd& other) const { return get() != other.get(); } - - private: - int mFd = -1; -}; - -// Return true if fd appears valid (non-negative) -inline bool isWellFormed(const Fd fd) { - return fd.get() >= 0; -} - -std::ostream& operator<<(std::ostream& os, const Fd& fd); - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_FD_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Handle.h b/common/netd/libnetdutils/include/netdutils/Handle.h deleted file mode 100644 index 82083d41..00000000 --- a/common/netd/libnetdutils/include/netdutils/Handle.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_HANDLE_H -#define NETUTILS_HANDLE_H - -#include <ostream> - -namespace android { -namespace netdutils { - -// Opaque, strongly typed wrapper for integer-like handles. -// Explicitly avoids implementing arithmetic operations. -// -// This class is intended to avoid common errors when reordering -// arguments to functions, typos and other cases where plain integer -// types would silently cover up the mistake. -// -// usage: -// DEFINE_HANDLE(ProductId, uint64_t); -// DEFINE_HANDLE(ThumbnailHash, uint64_t); -// void foo(ProductId p, ThumbnailHash th) {...} -// -// void test() { -// ProductId p(88); -// ThumbnailHash th1(100), th2(200); -// -// foo(p, th1); <- ok! -// foo(th1, p); <- disallowed! -// th1 += 10; <- disallowed! -// p = th2; <- disallowed! -// assert(th1 != th2); <- ok! -// } -template <typename T, typename TagT> -class Handle { - public: - constexpr Handle() = default; - constexpr Handle(const T& value) : mValue(value) {} - - const T get() const { return mValue; } - - bool operator==(const Handle& that) const { return get() == that.get(); } - bool operator!=(const Handle& that) const { return get() != that.get(); } - - private: - T mValue; -}; - -#define DEFINE_HANDLE(name, type) \ - struct _##name##Tag {}; \ - using name = ::android::netdutils::Handle<type, _##name##Tag>; - -template <typename T, typename TagT> -inline std::ostream& operator<<(std::ostream& os, const Handle<T, TagT>& handle) { - return os << handle.get(); -} - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_HANDLE_H */ diff --git a/common/netd/libnetdutils/include/netdutils/InternetAddresses.h b/common/netd/libnetdutils/include/netdutils/InternetAddresses.h deleted file mode 100644 index d10cec7d..00000000 --- a/common/netd/libnetdutils/include/netdutils/InternetAddresses.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <netdb.h> -#include <netinet/in.h> -#include <stdint.h> -#include <cstring> -#include <limits> -#include <string> - -#include "netdutils/NetworkConstants.h" - -namespace android { -namespace netdutils { - -namespace internal_ { - -// A structure to hold data for dealing with Internet addresses (IPAddress) and -// related types such as IPSockAddr and IPPrefix. -struct compact_ipdata { - uint8_t family{AF_UNSPEC}; - uint8_t cidrlen{0U}; // written and read in host-byte order - in_port_t port{0U}; // written and read in host-byte order - uint32_t scope_id{0U}; - union { - in_addr v4; - in6_addr v6; - } ip{.v6 = IN6ADDR_ANY_INIT}; // written and read in network-byte order - - // Classes that use compact_ipdata and this method should be sure to clear - // (i.e. zero or make uniform) any fields not relevant to the class. - friend bool operator==(const compact_ipdata& a, const compact_ipdata& b) { - if ((a.family != b.family) || (a.cidrlen != b.cidrlen) || (a.port != b.port) || - (a.scope_id != b.scope_id)) { - return false; - } - switch (a.family) { - case AF_UNSPEC: - // After the above checks, two AF_UNSPEC objects can be - // considered equal, for convenience. - return true; - case AF_INET: { - const in_addr v4a = a.ip.v4; - const in_addr v4b = b.ip.v4; - return (v4a.s_addr == v4b.s_addr); - } - case AF_INET6: { - const in6_addr v6a = a.ip.v6; - const in6_addr v6b = b.ip.v6; - return IN6_ARE_ADDR_EQUAL(&v6a, &v6b); - } - } - return false; - } - - // Classes that use compact_ipdata and this method should be sure to clear - // (i.e. zero or make uniform) any fields not relevant to the class. - friend bool operator!=(const compact_ipdata& a, const compact_ipdata& b) { return !(a == b); } - - // Classes that use compact_ipdata and this method should be sure to clear - // (i.e. zero or make uniform) any fields not relevant to the class. - friend bool operator<(const compact_ipdata& a, const compact_ipdata& b) { - if (a.family != b.family) return (a.family < b.family); - switch (a.family) { - case AF_INET: { - const in_addr v4a = a.ip.v4; - const in_addr v4b = b.ip.v4; - if (v4a.s_addr != v4b.s_addr) return (ntohl(v4a.s_addr) < ntohl(v4b.s_addr)); - break; - } - case AF_INET6: { - const in6_addr v6a = a.ip.v6; - const in6_addr v6b = b.ip.v6; - const int cmp = std::memcmp(v6a.s6_addr, v6b.s6_addr, IPV6_ADDR_LEN); - if (cmp != 0) return cmp < 0; - break; - } - } - if (a.cidrlen != b.cidrlen) return (a.cidrlen < b.cidrlen); - if (a.port != b.port) return (a.port < b.port); - return (a.scope_id < b.scope_id); - } -}; - -static_assert(AF_UNSPEC <= std::numeric_limits<uint8_t>::max(), "AF_UNSPEC value too large"); -static_assert(AF_INET <= std::numeric_limits<uint8_t>::max(), "AF_INET value too large"); -static_assert(AF_INET6 <= std::numeric_limits<uint8_t>::max(), "AF_INET6 value too large"); -static_assert(sizeof(compact_ipdata) == 24U, "compact_ipdata unexpectedly large"); - -} // namespace internal_ - -struct AddrinfoDeleter { - void operator()(struct addrinfo* p) const { - if (p != nullptr) { - freeaddrinfo(p); - } - } -}; - -typedef std::unique_ptr<struct addrinfo, struct AddrinfoDeleter> ScopedAddrinfo; - -inline bool usesScopedIds(const in6_addr& ipv6) { - return (IN6_IS_ADDR_LINKLOCAL(&ipv6) || IN6_IS_ADDR_MC_LINKLOCAL(&ipv6)); -} - -class IPPrefix; -class IPSockAddr; - -class IPAddress { - public: - static bool forString(const std::string& repr, IPAddress* ip); - static IPAddress forString(const std::string& repr) { - IPAddress ip; - if (!forString(repr, &ip)) return IPAddress(); - return ip; - } - - IPAddress() = default; - IPAddress(const IPAddress&) = default; - IPAddress(IPAddress&&) = default; - - explicit IPAddress(const in_addr& ipv4) - : mData({AF_INET, IPV4_ADDR_BITS, 0U, 0U, {.v4 = ipv4}}) {} - explicit IPAddress(const in6_addr& ipv6) - : mData({AF_INET6, IPV6_ADDR_BITS, 0U, 0U, {.v6 = ipv6}}) {} - IPAddress(const in6_addr& ipv6, uint32_t scope_id) - : mData({AF_INET6, - IPV6_ADDR_BITS, - 0U, - // Sanity check: scoped_ids only for link-local addresses. - usesScopedIds(ipv6) ? scope_id : 0U, - {.v6 = ipv6}}) {} - IPAddress(const IPAddress& ip, uint32_t scope_id) : IPAddress(ip) { - mData.scope_id = (family() == AF_INET6 && usesScopedIds(mData.ip.v6)) ? scope_id : 0U; - } - - IPAddress& operator=(const IPAddress&) = default; - IPAddress& operator=(IPAddress&&) = default; - - constexpr sa_family_t family() const noexcept { return mData.family; } - constexpr uint32_t scope_id() const noexcept { return mData.scope_id; } - - std::string toString() const noexcept; - - friend std::ostream& operator<<(std::ostream& os, const IPAddress& ip) { - os << ip.toString(); - return os; - } - friend bool operator==(const IPAddress& a, const IPAddress& b) { return (a.mData == b.mData); } - friend bool operator!=(const IPAddress& a, const IPAddress& b) { return (a.mData != b.mData); } - friend bool operator<(const IPAddress& a, const IPAddress& b) { return (a.mData < b.mData); } - friend bool operator>(const IPAddress& a, const IPAddress& b) { return (b.mData < a.mData); } - friend bool operator<=(const IPAddress& a, const IPAddress& b) { return (a < b) || (a == b); } - friend bool operator>=(const IPAddress& a, const IPAddress& b) { return (b < a) || (a == b); } - - private: - friend class IPPrefix; - friend class IPSockAddr; - - explicit IPAddress(const internal_::compact_ipdata& ipdata) : mData(ipdata) { - mData.port = 0U; - switch (mData.family) { - case AF_INET: - mData.cidrlen = IPV4_ADDR_BITS; - mData.scope_id = 0U; - break; - case AF_INET6: - mData.cidrlen = IPV6_ADDR_BITS; - if (usesScopedIds(ipdata.ip.v6)) mData.scope_id = ipdata.scope_id; - break; - default: - mData.cidrlen = 0U; - mData.scope_id = 0U; - break; - } - } - - internal_::compact_ipdata mData{}; -}; - -class IPPrefix { - public: - static bool forString(const std::string& repr, IPPrefix* prefix); - static IPPrefix forString(const std::string& repr) { - IPPrefix prefix; - if (!forString(repr, &prefix)) return IPPrefix(); - return prefix; - } - - IPPrefix() = default; - IPPrefix(const IPPrefix&) = default; - IPPrefix(IPPrefix&&) = default; - - explicit IPPrefix(const IPAddress& ip) : mData(ip.mData) {} - - // Truncate the IP address |ip| at length |length|. Lengths greater than - // the address-family-relevant maximum, along with negative values, are - // interpreted as if the address-family-relevant maximum had been given. - IPPrefix(const IPAddress& ip, int length); - - IPPrefix& operator=(const IPPrefix&) = default; - IPPrefix& operator=(IPPrefix&&) = default; - - constexpr sa_family_t family() const noexcept { return mData.family; } - IPAddress ip() const noexcept { return IPAddress(mData); } - in_addr addr4() const noexcept { return mData.ip.v4; } - in6_addr addr6() const noexcept { return mData.ip.v6; } - constexpr int length() const noexcept { return mData.cidrlen; } - bool contains(const IPPrefix& other) { - return length() <= other.length() && IPPrefix(other.ip(), length()).ip() == ip(); - } - bool contains(const IPAddress& other) { - return IPPrefix(other, length()).ip() == ip(); - } - - bool isUninitialized() const noexcept; - std::string toString() const noexcept; - - friend std::ostream& operator<<(std::ostream& os, const IPPrefix& prefix) { - os << prefix.toString(); - return os; - } - friend bool operator==(const IPPrefix& a, const IPPrefix& b) { return (a.mData == b.mData); } - friend bool operator!=(const IPPrefix& a, const IPPrefix& b) { return (a.mData != b.mData); } - friend bool operator<(const IPPrefix& a, const IPPrefix& b) { return (a.mData < b.mData); } - friend bool operator>(const IPPrefix& a, const IPPrefix& b) { return (b.mData < a.mData); } - friend bool operator<=(const IPPrefix& a, const IPPrefix& b) { return (a < b) || (a == b); } - friend bool operator>=(const IPPrefix& a, const IPPrefix& b) { return (b < a) || (a == b); } - - private: - internal_::compact_ipdata mData{}; -}; - -// An Internet socket address. -// -// Cannot represent other types of socket addresses (e.g. UNIX socket address, et cetera). -class IPSockAddr { - public: - // TODO: static forString - - static IPSockAddr toIPSockAddr(const std::string& repr, in_port_t port) { - return IPSockAddr(IPAddress::forString(repr), port); - } - static IPSockAddr toIPSockAddr(const sockaddr& sa) { - switch (sa.sa_family) { - case AF_INET: - return IPSockAddr(*reinterpret_cast<const sockaddr_in*>(&sa)); - case AF_INET6: - return IPSockAddr(*reinterpret_cast<const sockaddr_in6*>(&sa)); - default: - return IPSockAddr(); - } - } - static IPSockAddr toIPSockAddr(const sockaddr_storage& ss) { - return toIPSockAddr(*reinterpret_cast<const sockaddr*>(&ss)); - } - - IPSockAddr() = default; - IPSockAddr(const IPSockAddr&) = default; - IPSockAddr(IPSockAddr&&) = default; - - explicit IPSockAddr(const IPAddress& ip) : mData(ip.mData) {} - IPSockAddr(const IPAddress& ip, in_port_t port) : mData(ip.mData) { mData.port = port; } - explicit IPSockAddr(const sockaddr_in& ipv4sa) - : IPSockAddr(IPAddress(ipv4sa.sin_addr), ntohs(ipv4sa.sin_port)) {} - explicit IPSockAddr(const sockaddr_in6& ipv6sa) - : IPSockAddr(IPAddress(ipv6sa.sin6_addr, ipv6sa.sin6_scope_id), ntohs(ipv6sa.sin6_port)) {} - - IPSockAddr& operator=(const IPSockAddr&) = default; - IPSockAddr& operator=(IPSockAddr&&) = default; - - constexpr sa_family_t family() const noexcept { return mData.family; } - IPAddress ip() const noexcept { return IPAddress(mData); } - constexpr in_port_t port() const noexcept { return mData.port; } - - // Implicit conversion to sockaddr_storage. - operator sockaddr_storage() const noexcept { - sockaddr_storage ss; - ss.ss_family = mData.family; - switch (mData.family) { - case AF_INET: - reinterpret_cast<sockaddr_in*>(&ss)->sin_addr = mData.ip.v4; - reinterpret_cast<sockaddr_in*>(&ss)->sin_port = htons(mData.port); - break; - case AF_INET6: - reinterpret_cast<sockaddr_in6*>(&ss)->sin6_addr = mData.ip.v6; - reinterpret_cast<sockaddr_in6*>(&ss)->sin6_port = htons(mData.port); - reinterpret_cast<sockaddr_in6*>(&ss)->sin6_scope_id = mData.scope_id; - break; - } - return ss; - } - - std::string toString() const noexcept; - - friend std::ostream& operator<<(std::ostream& os, const IPSockAddr& prefix) { - os << prefix.toString(); - return os; - } - friend bool operator==(const IPSockAddr& a, const IPSockAddr& b) { - return (a.mData == b.mData); - } - friend bool operator!=(const IPSockAddr& a, const IPSockAddr& b) { - return (a.mData != b.mData); - } - friend bool operator<(const IPSockAddr& a, const IPSockAddr& b) { return (a.mData < b.mData); } - friend bool operator>(const IPSockAddr& a, const IPSockAddr& b) { return (b.mData < a.mData); } - friend bool operator<=(const IPSockAddr& a, const IPSockAddr& b) { return (a < b) || (a == b); } - friend bool operator>=(const IPSockAddr& a, const IPSockAddr& b) { return (b < a) || (a == b); } - - private: - internal_::compact_ipdata mData{}; -}; - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/include/netdutils/Log.h b/common/netd/libnetdutils/include/netdutils/Log.h deleted file mode 100644 index 77ae6494..00000000 --- a/common/netd/libnetdutils/include/netdutils/Log.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_LOG_H -#define NETUTILS_LOG_H - -#include <chrono> -#include <deque> -#include <shared_mutex> -#include <string> -#include <type_traits> -#include <vector> - -#include <android-base/stringprintf.h> -#include <android-base/thread_annotations.h> - -#include <netdutils/Status.h> - -namespace android { -namespace netdutils { - -class LogEntry { - public: - LogEntry() = default; - LogEntry(const LogEntry&) = default; - LogEntry(LogEntry&&) = default; - ~LogEntry() = default; - LogEntry& operator=(const LogEntry&) = default; - LogEntry& operator=(LogEntry&&) = default; - - std::string toString() const; - - /// - // Helper methods that make it easy to build up a LogEntry message. - // If performance becomes a factor the implementations could be inlined. - /// - LogEntry& message(const std::string& message); - - // For calling with __FUNCTION__. - LogEntry& function(const std::string& function_name); - // For calling with __PRETTY_FUNCTION__. - LogEntry& prettyFunction(const std::string& pretty_function); - - // Convenience methods for each of the common types of function arguments. - LogEntry& arg(const std::string& val); - // Intended for binary buffers, formats as hex - LogEntry& arg(const std::vector<uint8_t>& val); - LogEntry& arg(const std::vector<int32_t>& val); - LogEntry& arg(const std::vector<std::string>& val); - template <typename IntT, typename = std::enable_if_t<std::is_arithmetic_v<IntT>>> - LogEntry& arg(IntT val) { - mArgs.push_back(std::to_string(val)); - return *this; - } - // Not using a plain overload here to avoid the implicit conversion from - // any pointer to bool, which causes string literals to print as 'true'. - template <> - LogEntry& arg<>(bool val); - - template <typename... Args> - LogEntry& args(const Args&... a) { - // Cleverness ahead: we throw away the initializer_list filled with - // zeroes, all we care about is calling arg() for each argument. - (void) std::initializer_list<int>{(arg(a), 0)...}; - return *this; - } - - // Some things can return more than one value, or have multiple output - // parameters, so each of these adds to the mReturns vector. - LogEntry& returns(const std::string& rval); - LogEntry& returns(const Status& status); - LogEntry& returns(bool rval); - template <class T> - LogEntry& returns(T val) { - mReturns.push_back(std::to_string(val)); - return *this; - } - - LogEntry& withUid(uid_t uid); - - // Append the duration computed since the creation of this instance. - LogEntry& withAutomaticDuration(); - // Append the string-ified duration computed by some other means. - LogEntry& withDuration(const std::string& duration); - - private: - std::chrono::steady_clock::time_point mStart = std::chrono::steady_clock::now(); - std::string mMsg{}; - std::string mFunc{}; - std::vector<std::string> mArgs{}; - std::vector<std::string> mReturns{}; - std::string mUid{}; - std::string mDuration{}; -}; - -class Log { - public: - Log() = delete; - Log(const std::string& tag) : Log(tag, MAX_ENTRIES) {} - Log(const std::string& tag, size_t maxEntries) : mTag(tag), mMaxEntries(maxEntries) {} - Log(const Log&) = delete; - Log(Log&&) = delete; - ~Log(); - Log& operator=(const Log&) = delete; - Log& operator=(Log&&) = delete; - - LogEntry newEntry() const { return LogEntry(); } - - // Record a log entry in internal storage only. - void log(const std::string& entry) { record(Level::LOG, entry); } - template <size_t n> - void log(const char entry[n]) { log(std::string(entry)); } - void log(const LogEntry& entry) { log(entry.toString()); } - void log(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) { - using ::android::base::StringAppendV; - std::string result; - va_list ap; - va_start(ap, fmt); - StringAppendV(&result, fmt, ap); - va_end(ap); - log(result); - } - - // Record a log entry in internal storage and to ALOGI as well. - void info(const std::string& entry) { record(Level::INFO, entry); } - template <size_t n> - void info(const char entry[n]) { info(std::string(entry)); } - void info(const LogEntry& entry) { info(entry.toString()); } - void info(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) { - using ::android::base::StringAppendV; - std::string result; - va_list ap; - va_start(ap, fmt); - StringAppendV(&result, fmt, ap); - va_end(ap); - info(result); - } - - // Record a log entry in internal storage and to ALOGW as well. - void warn(const std::string& entry) { record(Level::WARN, entry); } - template <size_t n> - void warn(const char entry[n]) { warn(std::string(entry)); } - void warn(const LogEntry& entry) { warn(entry.toString()); } - void warn(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) { - using ::android::base::StringAppendV; - std::string result; - va_list ap; - va_start(ap, fmt); - StringAppendV(&result, fmt, ap); - va_end(ap); - warn(result); - } - - // Record a log entry in internal storage and to ALOGE as well. - void error(const std::string& entry) { record(Level::ERROR, entry); } - template <size_t n> - void error(const char entry[n]) { error(std::string(entry)); } - void error(const LogEntry& entry) { error(entry.toString()); } - void error(const char* fmt, ...) __attribute__((__format__(__printf__, 2, 3))) { - using ::android::base::StringAppendV; - std::string result; - va_list ap; - va_start(ap, fmt); - StringAppendV(&result, fmt, ap); - va_end(ap); - error(result); - } - - // Iterates over every entry in the log in chronological order. Operates - // on a copy of the log entries, and so perEntryFn may itself call one of - // the logging functions if needed. - void forEachEntry(const std::function<void(const std::string&)>& perEntryFn) const; - - private: - static constexpr const size_t MAX_ENTRIES = 750U; - const std::string mTag; - const size_t mMaxEntries; - - // The LOG level adds an entry to mEntries but does not output the message - // to the system log. All other levels append to mEntries and output to the - // the system log. - enum class Level { - LOG, - INFO, - WARN, - ERROR, - }; - - void record(Level lvl, const std::string& entry); - - mutable std::shared_mutex mLock; - std::deque<const std::string> mEntries; // GUARDED_BY(mLock), when supported -}; - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_LOG_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Math.h b/common/netd/libnetdutils/include/netdutils/Math.h deleted file mode 100644 index c41fbf58..00000000 --- a/common/netd/libnetdutils/include/netdutils/Math.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_MATH_H -#define NETUTILS_MATH_H - -#include <algorithm> -#include <cstdint> - -namespace android { -namespace netdutils { - -template <class T> -inline constexpr const T mask(const int shift) { - return (1 << shift) - 1; -} - -// Align x up to the nearest integer multiple of 2^shift -template <class T> -inline constexpr const T align(const T& x, const int shift) { - return (x + mask<T>(shift)) & ~mask<T>(shift); -} - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_MATH_H */ diff --git a/common/netd/libnetdutils/include/netdutils/MemBlock.h b/common/netd/libnetdutils/include/netdutils/MemBlock.h deleted file mode 100644 index fd4d612d..00000000 --- a/common/netd/libnetdutils/include/netdutils/MemBlock.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_MEMBLOCK_H -#define NETUTILS_MEMBLOCK_H - -#include <memory> -#include "netdutils/Slice.h" - -namespace android { -namespace netdutils { - -// A class to encapsulate self-deleting byte arrays while preserving access -// to the underlying length (without the length being part of the type, e.g. -// std::array<>). By design, the only interface to the underlying bytes is -// via Slice, to encourage safer memory access usage. -// -// No thread-safety guarantees whatsoever. -class MemBlock { - public: - MemBlock() : MemBlock(0U) {} - explicit MemBlock(size_t len) - : mData((len > 0U) ? new uint8_t[len]{} : nullptr), - mLen(len) {} - // Allocate memory of size src.size() and copy src into this MemBlock. - explicit MemBlock(Slice src) : MemBlock(src.size()) { - copy(get(), src); - } - - // No copy construction or assignment. - MemBlock(const MemBlock&) = delete; - MemBlock& operator=(const MemBlock&) = delete; - - // Move construction and assignment are okay. - MemBlock(MemBlock&&) = default; - MemBlock& operator=(MemBlock&&) = default; - - // Even though this method is const, the memory wrapped by the - // returned Slice is mutable. - Slice get() const noexcept { return Slice(mData.get(), mLen); } - - // Implicit cast to Slice. - // NOLINTNEXTLINE(google-explicit-constructor) - operator const Slice() const noexcept { return get(); } - - private: - std::unique_ptr<uint8_t[]> mData; - size_t mLen; -}; - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_MEMBLOCK_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Misc.h b/common/netd/libnetdutils/include/netdutils/Misc.h deleted file mode 100644 index d344f81f..00000000 --- a/common/netd/libnetdutils/include/netdutils/Misc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_MISC_H -#define NETUTILS_MISC_H - -#include <map> - -namespace android { -namespace netdutils { - -// Lookup key in map, returing a default value if key is not found -template <typename U, typename V> -inline const V& findWithDefault(const std::map<U, V>& map, const U& key, const V& dflt) { - auto it = map.find(key); - return (it == map.end()) ? dflt : it->second; -} - -// Movable, copiable, scoped lambda (or std::function) runner. Useful -// for running arbitrary cleanup or logging code when exiting a scope. -// -// Compare to defer in golang. -template <typename FnT> -class Cleanup { - public: - Cleanup() = delete; - explicit Cleanup(FnT fn) : mFn(fn) {} - ~Cleanup() { if (!mReleased) mFn(); } - - void release() { mReleased = true; } - - private: - bool mReleased{false}; - FnT mFn; -}; - -// Helper to make a new Cleanup. Avoids complex or impossible syntax -// when wrapping lambdas. -// -// Usage: -// auto cleanup = makeCleanup([](){ your_code_here; }); -template <typename FnT> -Cleanup<FnT> makeCleanup(FnT fn) { - return Cleanup<FnT>(fn); -} - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_MISC_H */ diff --git a/common/netd/libnetdutils/include/netdutils/MockSyscalls.h b/common/netd/libnetdutils/include/netdutils/MockSyscalls.h deleted file mode 100644 index f57b55ca..00000000 --- a/common/netd/libnetdutils/include/netdutils/MockSyscalls.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_MOCK_SYSCALLS_H -#define NETUTILS_MOCK_SYSCALLS_H - -#include <atomic> -#include <cassert> -#include <memory> - -#include <gmock/gmock.h> -#include <gtest/gtest.h> - -#include "netdutils/Syscalls.h" - -namespace android { -namespace netdutils { - -class MockSyscalls : public Syscalls { - public: - virtual ~MockSyscalls() = default; - // Use Return(ByMove(...)) to deal with movable return types. - MOCK_CONST_METHOD3(open, - StatusOr<UniqueFd>(const std::string& pathname, int flags, mode_t mode)); - MOCK_CONST_METHOD3(socket, StatusOr<UniqueFd>(int domain, int type, int protocol)); - MOCK_CONST_METHOD3(getsockname, Status(Fd sock, sockaddr* addr, socklen_t* addrlen)); - MOCK_CONST_METHOD5(getsockopt, Status(Fd sock, int level, int optname, void* optval, - socklen_t *optlen)); - MOCK_CONST_METHOD5(setsockopt, Status(Fd sock, int level, int optname, const void* optval, - socklen_t optlen)); - - MOCK_CONST_METHOD3(bind, Status(Fd sock, const sockaddr* addr, socklen_t addrlen)); - MOCK_CONST_METHOD3(connect, Status(Fd sock, const sockaddr* addr, socklen_t addrlen)); - MOCK_CONST_METHOD3(ioctl, StatusOr<ifreq>(Fd sock, unsigned long request, ifreq* ifr)); - - // Use Return(ByMove(...)) to deal with movable return types. - MOCK_CONST_METHOD2(eventfd, StatusOr<UniqueFd>(unsigned int initval, int flags)); - MOCK_CONST_METHOD3(ppoll, StatusOr<int>(pollfd* fds, nfds_t nfds, double timeout)); - - MOCK_CONST_METHOD2(writev, StatusOr<size_t>(Fd fd, const std::vector<iovec>& iov)); - MOCK_CONST_METHOD2(write, StatusOr<size_t>(Fd fd, const Slice buf)); - MOCK_CONST_METHOD2(read, StatusOr<Slice>(Fd fd, const Slice buf)); - MOCK_CONST_METHOD5(sendto, StatusOr<size_t>(Fd sock, const Slice buf, int flags, - const sockaddr* dst, socklen_t dstlen)); - MOCK_CONST_METHOD5(recvfrom, StatusOr<Slice>(Fd sock, const Slice dst, int flags, sockaddr* src, - socklen_t* srclen)); - MOCK_CONST_METHOD2(shutdown, Status(Fd fd, int how)); - MOCK_CONST_METHOD1(close, Status(Fd fd)); - - MOCK_CONST_METHOD2(fopen, - StatusOr<UniqueFile>(const std::string& path, const std::string& mode)); - MOCK_CONST_METHOD3(vfprintf, StatusOr<int>(FILE* file, const char* format, va_list ap)); - MOCK_CONST_METHOD3(vfscanf, StatusOr<int>(FILE* file, const char* format, va_list ap)); - MOCK_CONST_METHOD1(fclose, Status(FILE* file)); - MOCK_CONST_METHOD0(fork, StatusOr<pid_t>()); -}; - -// For the lifetime of this mock, replace the contents of sSyscalls -// with a pointer to this mock. Behavior is undefined if multiple -// ScopedMockSyscalls instances exist concurrently. -class ScopedMockSyscalls : public MockSyscalls { - public: - ScopedMockSyscalls() : mOld(sSyscalls.swap(*this)) { assert((mRefcount++) == 1); } - virtual ~ScopedMockSyscalls() { - sSyscalls.swap(mOld); - assert((mRefcount--) == 0); - } - - private: - std::atomic<int> mRefcount{0}; - Syscalls& mOld; -}; - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_MOCK_SYSCALLS_H */ diff --git a/common/netd/libnetdutils/include/netdutils/NetNativeTestBase.h b/common/netd/libnetdutils/include/netdutils/NetNativeTestBase.h deleted file mode 100644 index c8b30c62..00000000 --- a/common/netd/libnetdutils/include/netdutils/NetNativeTestBase.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#pragma once - -#include <android-base/format.h> -#include <android-base/logging.h> -#include "gtest/gtest.h" - -using ::testing::TestInfo; -using ::testing::UnitTest; - -#define DBG 1 - -/* - * Test base class for net native tests to support common usage. - */ -class NetNativeTestBase : public ::testing::Test { - public: - // TODO: update the logging when gtest supports logging the life cycle on each test. - NetNativeTestBase() { - if (DBG) LOG(INFO) << getTestCaseLog(true); - } - ~NetNativeTestBase() { - if (DBG) LOG(INFO) << getTestCaseLog(false); - } - - std::string getTestCaseLog(bool running) { - const TestInfo* const test_info = UnitTest::GetInstance()->current_test_info(); - return fmt::format("{}: {}#{}", (running ? "started" : "finished"), - test_info->test_suite_name(), test_info->name()); - } -}; diff --git a/common/netd/libnetdutils/include/netdutils/Netfilter.h b/common/netd/libnetdutils/include/netdutils/Netfilter.h deleted file mode 100644 index 22736f19..00000000 --- a/common/netd/libnetdutils/include/netdutils/Netfilter.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_NETFILTER_H -#define NETUTILS_NETFILTER_H - -#include <ostream> - -#include <linux/netfilter.h> -#include <linux/netfilter/nfnetlink.h> -#include <linux/netlink.h> - -std::ostream& operator<<(std::ostream& os, const nfgenmsg& msg); - -#endif /* NETUTILS_NETFILTER_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Netlink.h b/common/netd/libnetdutils/include/netdutils/Netlink.h deleted file mode 100644 index ee5183ab..00000000 --- a/common/netd/libnetdutils/include/netdutils/Netlink.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_NETLINK_H -#define NETUTILS_NETLINK_H - -#include <functional> -#include <ostream> -#include <linux/netlink.h> - -#include "netdutils/Slice.h" - -namespace android { -namespace netdutils { - -// Invoke onMsg once for each netlink message in buf. onMsg will be -// invoked with an aligned and deserialized header along with a Slice -// containing the message payload. -// -// Assume that the first message begins at offset zero within buf. -void forEachNetlinkMessage(const Slice buf, - const std::function<void(const nlmsghdr&, const Slice)>& onMsg); - -// Invoke onAttr once for each netlink attribute in buf. onAttr will be -// invoked with an aligned and deserialized header along with a Slice -// containing the attribute payload. -// -// Assume that the first attribute begins at offset zero within buf. -void forEachNetlinkAttribute(const Slice buf, - const std::function<void(const nlattr&, const Slice)>& onAttr); - -} // namespace netdutils -} // namespace android - -bool operator==(const sockaddr_nl& lhs, const sockaddr_nl& rhs); -bool operator!=(const sockaddr_nl& lhs, const sockaddr_nl& rhs); - -std::ostream& operator<<(std::ostream& os, const nlmsghdr& hdr); -std::ostream& operator<<(std::ostream& os, const nlattr& attr); -std::ostream& operator<<(std::ostream& os, const sockaddr_nl& addr); - -#endif /* NETUTILS_NETLINK_H */ diff --git a/common/netd/libnetdutils/include/netdutils/NetlinkListener.h b/common/netd/libnetdutils/include/netdutils/NetlinkListener.h deleted file mode 100644 index 97f7bb23..00000000 --- a/common/netd/libnetdutils/include/netdutils/NetlinkListener.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETLINK_LISTENER_H -#define NETLINK_LISTENER_H - -#include <functional> -#include <map> -#include <mutex> -#include <thread> - -#include <android-base/thread_annotations.h> -#include <netdutils/Netlink.h> -#include <netdutils/Slice.h> -#include <netdutils/Status.h> -#include <netdutils/UniqueFd.h> - -namespace android { -namespace netdutils { - -class NetlinkListenerInterface { - public: - using DispatchFn = std::function<void(const nlmsghdr& nlmsg, const netdutils::Slice msg)>; - - using SkErrorHandler = std::function<void(const int fd, const int err)>; - - virtual ~NetlinkListenerInterface() = default; - - // Send message to the kernel using the underlying netlink socket - virtual netdutils::Status send(const netdutils::Slice msg) = 0; - - // Deliver future messages with nlmsghdr.nlmsg_type == type to fn. - // - // Threadsafe. - // All dispatch functions invoked on a single service thread. - // subscribe() and join() must not be called from the stack of fn(). - virtual netdutils::Status subscribe(uint16_t type, const DispatchFn& fn) = 0; - - // Halt delivery of future messages with nlmsghdr.nlmsg_type == type. - // Threadsafe. - virtual netdutils::Status unsubscribe(uint16_t type) = 0; - - virtual void registerSkErrorHandler(const SkErrorHandler& handler) = 0; -}; - -// NetlinkListener manages a netlink socket and associated blocking -// service thread. -// -// This class is written in a generic way to allow multiple different -// netlink subsystems to share this common infrastructure. If multiple -// subsystems share the same message delivery requirements (drops ok, -// no drops) they may share a single listener by calling subscribe() -// with multiple types. -// -// This class is suitable for moderate performance message -// processing. In particular it avoids extra copies of received -// message data and allows client code to control which message -// attributes are processed. -// -// Note that NetlinkListener is capable of processing multiple batched -// netlink messages in a single system call. This is useful to -// netfilter extensions that allow batching of events like NFLOG. -class NetlinkListener : public NetlinkListenerInterface { - public: - NetlinkListener(netdutils::UniqueFd event, netdutils::UniqueFd sock, const std::string& name); - - ~NetlinkListener() override; - - netdutils::Status send(const netdutils::Slice msg) override; - - netdutils::Status subscribe(uint16_t type, const DispatchFn& fn) override EXCLUDES(mMutex); - - netdutils::Status unsubscribe(uint16_t type) override EXCLUDES(mMutex); - - void registerSkErrorHandler(const SkErrorHandler& handler) override; - - private: - netdutils::Status run(); - - const netdutils::UniqueFd mEvent; - const netdutils::UniqueFd mSock; - const std::string mThreadName; - std::mutex mMutex; - std::map<uint16_t, DispatchFn> mDispatchMap GUARDED_BY(mMutex); - std::thread mWorker; - SkErrorHandler mErrorHandler; -}; - -} // namespace netdutils -} // namespace android - -#endif /* NETLINK_LISTENER_H */ diff --git a/common/netd/libnetdutils/include/netdutils/NetworkConstants.h b/common/netd/libnetdutils/include/netdutils/NetworkConstants.h deleted file mode 100644 index dead9a17..00000000 --- a/common/netd/libnetdutils/include/netdutils/NetworkConstants.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -namespace android { -namespace netdutils { - -// See also NetworkConstants.java in frameworks/base. -constexpr int IPV4_ADDR_LEN = 4; -constexpr int IPV4_ADDR_BITS = 32; -constexpr int IPV6_ADDR_LEN = 16; -constexpr int IPV6_ADDR_BITS = 128; - -// Referred from SHA256_DIGEST_LENGTH in boringssl -constexpr size_t SHA256_SIZE = 32; - -} // namespace netdutils -} // namespace android diff --git a/common/netd/libnetdutils/include/netdutils/ResponseCode.h b/common/netd/libnetdutils/include/netdutils/ResponseCode.h deleted file mode 100644 index c170684c..00000000 --- a/common/netd/libnetdutils/include/netdutils/ResponseCode.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_RESPONSECODE_H -#define NETDUTILS_RESPONSECODE_H - -namespace android { -namespace netdutils { - -class ResponseCode { - // Keep in sync with - // frameworks/base/services/java/com/android/server/NetworkManagementService.java - public: - // 100 series - Requestion action was initiated; expect another reply - // before proceeding with a new command. - // clang-format off - static constexpr int ActionInitiated = 100; - static constexpr int InterfaceListResult = 110; - static constexpr int TetherInterfaceListResult = 111; - static constexpr int TetherDnsFwdTgtListResult = 112; - static constexpr int TtyListResult = 113; - static constexpr int TetheringStatsListResult = 114; - static constexpr int TetherDnsFwdNetIdResult = 115; - - // 200 series - Requested action has been successfully completed - static constexpr int CommandOkay = 200; - static constexpr int TetherStatusResult = 210; - static constexpr int IpFwdStatusResult = 211; - static constexpr int InterfaceGetCfgResult = 213; - // Formerly: int SoftapStatusResult = 214; - static constexpr int UsbRNDISStatusResult = 215; - static constexpr int InterfaceRxCounterResult = 216; - static constexpr int InterfaceTxCounterResult = 217; - static constexpr int InterfaceRxThrottleResult = 218; - static constexpr int InterfaceTxThrottleResult = 219; - static constexpr int QuotaCounterResult = 220; - static constexpr int TetheringStatsResult = 221; - // NOTE: keep synced with bionic/libc/dns/net/gethnamaddr.c - static constexpr int DnsProxyQueryResult = 222; - static constexpr int ClatdStatusResult = 223; - - // 400 series - The command was accepted but the requested action - // did not take place. - static constexpr int OperationFailed = 400; - static constexpr int DnsProxyOperationFailed = 401; - static constexpr int ServiceStartFailed = 402; - static constexpr int ServiceStopFailed = 403; - - // 500 series - The command was not accepted and the requested - // action did not take place. - static constexpr int CommandSyntaxError = 500; - static constexpr int CommandParameterError = 501; - - // 600 series - Unsolicited broadcasts - static constexpr int InterfaceChange = 600; - static constexpr int BandwidthControl = 601; - static constexpr int ServiceDiscoveryFailed = 602; - static constexpr int ServiceDiscoveryServiceAdded = 603; - static constexpr int ServiceDiscoveryServiceRemoved = 604; - static constexpr int ServiceRegistrationFailed = 605; - static constexpr int ServiceRegistrationSucceeded = 606; - static constexpr int ServiceResolveFailed = 607; - static constexpr int ServiceResolveSuccess = 608; - static constexpr int ServiceSetHostnameFailed = 609; - static constexpr int ServiceSetHostnameSuccess = 610; - static constexpr int ServiceGetAddrInfoFailed = 611; - static constexpr int ServiceGetAddrInfoSuccess = 612; - static constexpr int InterfaceClassActivity = 613; - static constexpr int InterfaceAddressChange = 614; - static constexpr int InterfaceDnsInfo = 615; - static constexpr int RouteChange = 616; - static constexpr int StrictCleartext = 617; - // clang-format on -}; - -} // namespace netdutils -} // namespace android - -#endif // NETDUTILS_RESPONSECODE_H diff --git a/common/netd/libnetdutils/include/netdutils/Slice.h b/common/netd/libnetdutils/include/netdutils/Slice.h deleted file mode 100644 index 717fbd1f..00000000 --- a/common/netd/libnetdutils/include/netdutils/Slice.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_SLICE_H -#define NETUTILS_SLICE_H - -#include <algorithm> -#include <array> -#include <cstring> -#include <ostream> -#include <tuple> -#include <vector> - -namespace android { -namespace netdutils { - -// Immutable wrapper for a linear region of unowned bytes. -// Slice represents memory as a half-closed interval [base, limit). -// -// Note that without manually invoking the Slice() constructor, it is -// impossible to increase the size of a slice. This guarantees that -// applications that properly use the slice API will never access -// memory outside of a slice. -// -// Note that const Slice still wraps mutable memory, however copy -// assignment and move assignment to slice are disabled. -class Slice { - public: - Slice() = default; - - // Create a slice beginning at base and continuing to but not including limit - Slice(void* base, void* limit) : mBase(toUint8(base)), mLimit(toUint8(limit)) {} - - // Create a slice beginning at base and continuing for size bytes - Slice(void* base, size_t size) : Slice(base, toUint8(base) + size) {} - - // Return the address of the first byte in this slice - uint8_t* base() const { return mBase; } - - // Return the address of the first byte following this slice - uint8_t* limit() const { return mLimit; } - - // Return the size of this slice in bytes - size_t size() const { return limit() - base(); } - - // Return true if size() == 0 - bool empty() const { return base() == limit(); } - - private: - static uint8_t* toUint8(void* ptr) { return reinterpret_cast<uint8_t*>(ptr); } - - uint8_t* mBase = nullptr; - uint8_t* mLimit = nullptr; -}; - -// Return slice representation of ref which must be a POD type -template <typename T> -inline const Slice makeSlice(const T& ref) { - static_assert(std::is_pod<T>::value, "value must be a POD type"); - static_assert(!std::is_pointer<T>::value, "value must not be a pointer type"); - return {const_cast<T*>(&ref), sizeof(ref)}; -} - -// Return slice representation of string data() -inline const Slice makeSlice(const std::string& s) { - using ValueT = std::string::value_type; - return {const_cast<ValueT*>(s.data()), s.size() * sizeof(ValueT)}; -} - -// Return slice representation of vector data() -template <typename T> -inline const Slice makeSlice(const std::vector<T>& v) { - return {const_cast<T*>(v.data()), v.size() * sizeof(T)}; -} - -// Return slice representation of array data() -template <typename U, size_t V> -inline const Slice makeSlice(const std::array<U, V>& a) { - return {const_cast<U*>(a.data()), a.size() * sizeof(U)}; -} - -// Return prefix and suffix of Slice s ending and starting at position cut -inline std::pair<const Slice, const Slice> split(const Slice s, size_t cut) { - const size_t tmp = std::min(cut, s.size()); - return {{s.base(), s.base() + tmp}, {s.base() + tmp, s.limit()}}; -} - -// Return prefix of Slice s ending at position cut -inline const Slice take(const Slice s, size_t cut) { - return std::get<0>(split(s, cut)); -} - -// Return suffix of Slice s starting at position cut -inline const Slice drop(const Slice s, size_t cut) { - return std::get<1>(split(s, cut)); -} - -// Copy from src into dst. Bytes copied is the lesser of dst.size() and src.size() -inline size_t copy(const Slice dst, const Slice src) { - const auto min = std::min(dst.size(), src.size()); - memcpy(dst.base(), src.base(), min); - return min; -} - -// Base case for variadic extract below -template <typename Head> -inline size_t extract(const Slice src, Head& head) { - return copy(makeSlice(head), src); -} - -// Copy from src into one or more pointers to POD data. If src.size() -// is less than the sum of all data pointers a suffix of data will be -// left unmodified. Return the number of bytes copied. -template <typename Head, typename... Tail> -inline size_t extract(const Slice src, Head& head, Tail&... tail) { - const auto extracted = extract(src, head); - return extracted + extract(drop(src, extracted), tail...); -} - -// Return a string containing a copy of the contents of s -std::string toString(const Slice s); - -// Return a string containing a hexadecimal representation of the contents of s. -// This function inserts a newline into its output every wrap bytes. -std::string toHex(const Slice s, int wrap = INT_MAX); - -inline bool operator==(const Slice& lhs, const Slice& rhs) { - return (lhs.base() == rhs.base()) && (lhs.limit() == rhs.limit()); -} - -inline bool operator!=(const Slice& lhs, const Slice& rhs) { - return !(lhs == rhs); -} - -std::ostream& operator<<(std::ostream& os, const Slice& slice); - -// Return suffix of Slice s starting at the first match of byte c. If no matched -// byte, return an empty Slice. -inline const Slice findFirstMatching(const Slice s, uint8_t c) { - uint8_t* match = (uint8_t*)memchr(s.base(), c, s.size()); - if (!match) return Slice(); - return drop(s, match - s.base()); -} - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_SLICE_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Socket.h b/common/netd/libnetdutils/include/netdutils/Socket.h deleted file mode 100644 index e5aaab9c..00000000 --- a/common/netd/libnetdutils/include/netdutils/Socket.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_SOCKET_H -#define NETDUTILS_SOCKET_H - -#include <netinet/in.h> -#include <sys/socket.h> -#include <string> - -#include "netdutils/StatusOr.h" - -namespace android { -namespace netdutils { - -inline sockaddr* asSockaddrPtr(void* addr) { - return reinterpret_cast<sockaddr*>(addr); -} - -inline const sockaddr* asSockaddrPtr(const void* addr) { - return reinterpret_cast<const sockaddr*>(addr); -} - -// Return a string representation of addr or Status if there was a -// failure during conversion. -StatusOr<std::string> toString(const in6_addr& addr); - -} // namespace netdutils -} // namespace android - -#endif /* NETDUTILS_SOCKET_H */ diff --git a/common/netd/libnetdutils/include/netdutils/SocketOption.h b/common/netd/libnetdutils/include/netdutils/SocketOption.h deleted file mode 100644 index 3b0aab75..00000000 --- a/common/netd/libnetdutils/include/netdutils/SocketOption.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_SOCKETOPTION_H -#define NETDUTILS_SOCKETOPTION_H - -#include <netinet/in.h> -#include <sys/socket.h> -#include <string> - -#include "netdutils/Fd.h" -#include "netdutils/Status.h" - -namespace android { -namespace netdutils { - -// Turn on simple "boolean" socket options. -// -// This is simple wrapper for options that are enabled via code of the form: -// -// int on = 1; -// setsockopt(..., &on, sizeof(on)); -Status enableSockopt(Fd sock, int level, int optname); - -// Turn on TCP keepalives, and set keepalive parameters for this socket. -// -// A parameter value of zero does not set that parameter. -// -// Typical system defaults are: -// -// idleTime (in seconds) -// $ cat /proc/sys/net/ipv4/tcp_keepalive_time -// 7200 -// -// numProbes -// $ cat /proc/sys/net/ipv4/tcp_keepalive_probes -// 9 -// -// probeInterval (in seconds) -// $ cat /proc/sys/net/ipv4/tcp_keepalive_intvl -// 75 -Status enableTcpKeepAlives(Fd sock, unsigned idleTime, unsigned numProbes, unsigned probeInterval); - -} // namespace netdutils -} // namespace android - -#endif /* NETDUTILS_SOCKETOPTION_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Status.h b/common/netd/libnetdutils/include/netdutils/Status.h deleted file mode 100644 index 7b0bd472..00000000 --- a/common/netd/libnetdutils/include/netdutils/Status.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_STATUS_H -#define NETUTILS_STATUS_H - -#include <cassert> -#include <limits> -#include <ostream> - -#include <android-base/result.h> - -namespace android { -namespace netdutils { - -// Simple status implementation suitable for use on the stack in low -// or moderate performance code. This can definitely be improved but -// for now short string optimization is expected to keep the common -// success case fast. -// -// Status is implicitly movable via the default noexcept move constructor -// and noexcept move-assignment operator. -class [[nodiscard]] Status { - public: - Status() = default; - explicit Status(int code) : mCode(code) {} - - // Constructs an error Status, |code| must be non-zero. - Status(int code, std::string msg) : mCode(code), mMsg(std::move(msg)) { assert(!ok()); } - - Status(android::base::Result<void> result) - : mCode(result.ok() ? 0 : static_cast<int>(result.error().code())), - mMsg(result.ok() ? "" : result.error().message()) {} - - int code() const { return mCode; } - - bool ok() const { return code() == 0; } - - const std::string& msg() const { return mMsg; } - - // Explicitly ignores the Status without triggering [[nodiscard]] errors. - void ignoreError() const {} - - bool operator==(const Status& other) const { return code() == other.code(); } - bool operator!=(const Status& other) const { return !(*this == other); } - - private: - int mCode = 0; - std::string mMsg; -}; - -namespace status { - -const Status ok{0}; -// EOF is not part of errno space, we'll place it far above the -// highest existing value. -const Status eof{0x10001, "end of file"}; -const Status undefined{std::numeric_limits<int>::max(), "undefined"}; - -} // namespace status - -// Return true if status is "OK". This is sometimes preferable to -// status.ok() when we want to check the state of Status-like objects -// that implicitly cast to Status. -inline bool isOk(const Status& status) { - return status.ok(); -} - -// For use only in tests. Used for both Status and Status-like objects. See also isOk(). -#define EXPECT_OK(status) EXPECT_TRUE(isOk(status)) -#define ASSERT_OK(status) ASSERT_TRUE(isOk(status)) - -// Documents that status is expected to be ok. This function may log -// (or assert when running in debug mode) if status has an unexpected value. -inline void expectOk(const Status& /*status*/) { - // TODO: put something here, for now this function serves solely as documentation. -} - -// Convert POSIX errno to a Status object. -// If Status is extended to have more features, this mapping may -// become more complex. -Status statusFromErrno(int err, const std::string& msg); - -// Helper that checks Status-like object (notably StatusOr) against a -// value in the errno space. -bool equalToErrno(const Status& status, int err); - -// Helper that converts Status-like object (notably StatusOr) to a -// message. -std::string toString(const Status& status); - -std::ostream& operator<<(std::ostream& os, const Status& s); - -// Evaluate 'stmt' to a Status object and if it results in an error, return that -// error. Use 'tmp' as a variable name to avoid shadowing any variables named -// tmp. -#define RETURN_IF_NOT_OK_IMPL(tmp, stmt) \ - do { \ - ::android::netdutils::Status tmp = (stmt); \ - if (!isOk(tmp)) { \ - return tmp; \ - } \ - } while (false) - -// Create a unique variable name to avoid shadowing local variables. -#define RETURN_IF_NOT_OK_CONCAT(line, stmt) RETURN_IF_NOT_OK_IMPL(__CONCAT(_status_, line), stmt) - -// Macro to allow exception-like handling of error return values. -// -// If the evaluation of stmt results in an error, return that error -// from current function. -// -// Example usage: -// Status bar() { ... } -// -// RETURN_IF_NOT_OK(status); -// RETURN_IF_NOT_OK(bar()); -#define RETURN_IF_NOT_OK(stmt) RETURN_IF_NOT_OK_CONCAT(__LINE__, stmt) - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_STATUS_H */ diff --git a/common/netd/libnetdutils/include/netdutils/StatusOr.h b/common/netd/libnetdutils/include/netdutils/StatusOr.h deleted file mode 100644 index c7aa4e4a..00000000 --- a/common/netd/libnetdutils/include/netdutils/StatusOr.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_STATUSOR_H -#define NETUTILS_STATUSOR_H - -#include <cassert> -#include "netdutils/Status.h" - -namespace android { -namespace netdutils { - -// Wrapper around a combination of Status and application value type. -// T may be any copyable or movable type. -template <typename T> -class [[nodiscard]] StatusOr { - public: - // Constructs a new StatusOr with status::undefined status. - // This is marked 'explicit' to try to catch cases like 'return {};', - // where people think StatusOr<std::vector<int>> will be initialized - // with an empty vector, instead of a status::undefined. - explicit StatusOr() = default; - - // Implicit copy constructor and construction from T. - // NOLINTNEXTLINE(google-explicit-constructor) - StatusOr(Status status) : mStatus(std::move(status)) { assert(!isOk(mStatus)); } - - // Implicit construction from T. It is convenient and sensible to be able - // to do 'return T()' when the return type is StatusOr<T>. - // NOLINTNEXTLINE(google-explicit-constructor) - StatusOr(const T& value) : mStatus(status::ok), mValue(value) {} - // NOLINTNEXTLINE(google-explicit-constructor) - StatusOr(T&& value) : mStatus(status::ok), mValue(std::move(value)) {} - - // Move constructor ok (if T supports move) - StatusOr(StatusOr&&) noexcept = default; - // Move assignment ok (if T supports move) - StatusOr& operator=(StatusOr&&) noexcept = default; - // Copy constructor ok (if T supports copy) - StatusOr(const StatusOr&) = default; - // Copy assignment ok (if T supports copy) - StatusOr& operator=(const StatusOr&) = default; - - // Returns a const reference to wrapped type. - // It is an error to call value() when !isOk(status()) - const T& value() const & { return mValue; } - const T&& value() const && { return mValue; } - - // Returns an rvalue reference to wrapped type - // It is an error to call value() when !isOk(status()) - // - // If T is expensive to copy but supports efficient move, it can be moved - // out of a StatusOr as follows: - // T value = std::move(statusor).value(); - T& value() & { return mValue; } - T&& value() && { return mValue; } - - // Returns the Status object assigned at construction time. - const Status status() const { return mStatus; } - - // Explicitly ignores the Status without triggering [[nodiscard]] errors. - void ignoreError() const {} - - // Implicit cast to Status. - // NOLINTNEXTLINE(google-explicit-constructor) - operator Status() const { return status(); } - - private: - Status mStatus = status::undefined; - T mValue; -}; - -template <typename T> -inline std::ostream& operator<<(std::ostream& os, const StatusOr<T>& s) { - return os << "StatusOr[status: " << s.status() << "]"; -} - -#define ASSIGN_OR_RETURN_IMPL(tmp, lhs, stmt) \ - auto tmp = (stmt); \ - RETURN_IF_NOT_OK(tmp); \ - lhs = std::move(tmp.value()); - -#define ASSIGN_OR_RETURN_CONCAT(line, lhs, stmt) \ - ASSIGN_OR_RETURN_IMPL(__CONCAT(_status_or_, line), lhs, stmt) - -// Macro to allow exception-like handling of error return values. -// -// If the evaluation of stmt results in an error, return that error -// from the current function. Otherwise, assign the result to lhs. -// -// This macro supports both move and copy assignment operators. lhs -// may be either a new local variable or an existing non-const -// variable accessible in the current scope. -// -// Example usage: -// StatusOr<MyType> foo() { ... } -// -// ASSIGN_OR_RETURN(auto myVar, foo()); -// ASSIGN_OR_RETURN(myExistingVar, foo()); -// ASSIGN_OR_RETURN(myMemberVar, foo()); -#define ASSIGN_OR_RETURN(lhs, stmt) ASSIGN_OR_RETURN_CONCAT(__LINE__, lhs, stmt) - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_STATUSOR_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Stopwatch.h b/common/netd/libnetdutils/include/netdutils/Stopwatch.h deleted file mode 100644 index e7b43264..00000000 --- a/common/netd/libnetdutils/include/netdutils/Stopwatch.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_STOPWATCH_H -#define NETDUTILS_STOPWATCH_H - -#include <chrono> - -namespace android { -namespace netdutils { - -class Stopwatch { - private: - using clock = std::chrono::steady_clock; - using time_point = std::chrono::time_point<clock>; - - public: - Stopwatch() : mStart(clock::now()) {} - virtual ~Stopwatch() = default; - - int64_t timeTakenUs() const { return getElapsedUs(clock::now()); } - int64_t getTimeAndResetUs() { - const auto& now = clock::now(); - int64_t elapsed = getElapsedUs(now); - mStart = now; - return elapsed; - } - - private: - time_point mStart; - - int64_t getElapsedUs(const time_point& now) const { - return (std::chrono::duration_cast<std::chrono::microseconds>(now - mStart)).count(); - } -}; - -} // namespace netdutils -} // namespace android - -#endif // NETDUTILS_STOPWATCH_H diff --git a/common/netd/libnetdutils/include/netdutils/Syscalls.h b/common/netd/libnetdutils/include/netdutils/Syscalls.h deleted file mode 100644 index 36fcd853..00000000 --- a/common/netd/libnetdutils/include/netdutils/Syscalls.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_SYSCALLS_H -#define NETDUTILS_SYSCALLS_H - -#include <memory> - -#include <net/if.h> -#include <poll.h> -#include <sys/eventfd.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> - -#include "netdutils/Fd.h" -#include "netdutils/Slice.h" -#include "netdutils/Socket.h" -#include "netdutils/Status.h" -#include "netdutils/StatusOr.h" -#include "netdutils/UniqueFd.h" -#include "netdutils/UniqueFile.h" - -namespace android { -namespace netdutils { - -class Syscalls { - public: - virtual ~Syscalls() = default; - - virtual StatusOr<UniqueFd> open(const std::string& pathname, int flags, - mode_t mode = 0) const = 0; - - virtual StatusOr<UniqueFd> socket(int domain, int type, int protocol) const = 0; - - virtual Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const = 0; - - virtual Status getsockopt(Fd sock, int level, int optname, void *optval, - socklen_t *optlen) const = 0; - - virtual Status setsockopt(Fd sock, int level, int optname, const void* optval, - socklen_t optlen) const = 0; - - virtual Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0; - - virtual Status connect(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0; - - virtual StatusOr<ifreq> ioctl(Fd sock, unsigned long request, ifreq* ifr) const = 0; - - virtual StatusOr<UniqueFd> eventfd(unsigned int initval, int flags) const = 0; - - virtual StatusOr<int> ppoll(pollfd* fds, nfds_t nfds, double timeout) const = 0; - - virtual StatusOr<size_t> writev(Fd fd, const std::vector<iovec>& iov) const = 0; - - virtual StatusOr<size_t> write(Fd fd, const Slice buf) const = 0; - - virtual StatusOr<Slice> read(Fd fd, const Slice buf) const = 0; - - virtual StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const sockaddr* dst, - socklen_t dstlen) const = 0; - - virtual StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags, sockaddr* src, - socklen_t* srclen) const = 0; - - virtual Status shutdown(Fd fd, int how) const = 0; - - virtual Status close(Fd fd) const = 0; - - virtual StatusOr<UniqueFile> fopen(const std::string& path, const std::string& mode) const = 0; - - virtual StatusOr<int> vfprintf(FILE* file, const char* format, va_list ap) const = 0; - - virtual StatusOr<int> vfscanf(FILE* file, const char* format, va_list ap) const = 0; - - virtual Status fclose(FILE* file) const = 0; - - virtual StatusOr<pid_t> fork() const = 0; - - // va_args helpers - // va_start doesn't work when the preceding argument is a reference - // type so we're forced to use const char*. - StatusOr<int> fprintf(FILE* file, const char* format, ...) const { - va_list ap; - va_start(ap, format); - auto result = vfprintf(file, format, ap); - va_end(ap); - return result; - } - - // va_start doesn't work when the preceding argument is a reference - // type so we're forced to use const char*. - StatusOr<int> fscanf(FILE* file, const char* format, ...) const { - va_list ap; - va_start(ap, format); - auto result = vfscanf(file, format, ap); - va_end(ap); - return result; - } - - // Templated helpers that forward directly to methods declared above - template <typename SockaddrT> - StatusOr<SockaddrT> getsockname(Fd sock) const { - SockaddrT addr = {}; - socklen_t addrlen = sizeof(addr); - RETURN_IF_NOT_OK(getsockname(sock, asSockaddrPtr(&addr), &addrlen)); - return addr; - } - - template <typename SockoptT> - Status getsockopt(Fd sock, int level, int optname, void* optval, socklen_t* optlen) const { - return getsockopt(sock, level, optname, optval, optlen); - } - - template <typename SockoptT> - Status setsockopt(Fd sock, int level, int optname, const SockoptT& opt) const { - return setsockopt(sock, level, optname, &opt, sizeof(opt)); - } - - template <typename SockaddrT> - Status bind(Fd sock, const SockaddrT& addr) const { - return bind(sock, asSockaddrPtr(&addr), sizeof(addr)); - } - - template <typename SockaddrT> - Status connect(Fd sock, const SockaddrT& addr) const { - return connect(sock, asSockaddrPtr(&addr), sizeof(addr)); - } - - template <size_t size> - StatusOr<std::array<uint16_t, size>> ppoll(const std::array<Fd, size>& fds, uint16_t events, - double timeout) const { - std::array<pollfd, size> tmp; - for (size_t i = 0; i < size; ++i) { - tmp[i].fd = fds[i].get(); - tmp[i].events = events; - tmp[i].revents = 0; - } - RETURN_IF_NOT_OK(ppoll(tmp.data(), tmp.size(), timeout).status()); - std::array<uint16_t, size> out; - for (size_t i = 0; i < size; ++i) { - out[i] = tmp[i].revents; - } - return out; - } - - template <typename SockaddrT> - StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const SockaddrT& dst) const { - return sendto(sock, buf, flags, asSockaddrPtr(&dst), sizeof(dst)); - } - - // Ignore src sockaddr - StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags) const { - return recvfrom(sock, dst, flags, nullptr, nullptr); - } - - template <typename SockaddrT> - StatusOr<std::pair<Slice, SockaddrT>> recvfrom(Fd sock, const Slice dst, int flags) const { - SockaddrT addr = {}; - socklen_t addrlen = sizeof(addr); - ASSIGN_OR_RETURN(auto used, recvfrom(sock, dst, flags, asSockaddrPtr(&addr), &addrlen)); - return std::make_pair(used, addr); - } -}; - -// Specialized singleton that supports zero initialization and runtime -// override of contained pointer. -class SyscallsHolder { - public: - ~SyscallsHolder(); - - // Return a pointer to an unowned instance of Syscalls. - Syscalls& get(); - - // Testing only: set the value returned by getSyscalls. Return the old value. - // Callers are responsible for restoring the previous value returned - // by getSyscalls to avoid leaks. - Syscalls& swap(Syscalls& syscalls); - - private: - std::atomic<Syscalls*> mSyscalls{nullptr}; -}; - -// Syscalls instance used throughout netdutils -extern SyscallsHolder sSyscalls; - -} // namespace netdutils -} // namespace android - -#endif /* NETDUTILS_SYSCALLS_H */ diff --git a/common/netd/libnetdutils/include/netdutils/ThreadUtil.h b/common/netd/libnetdutils/include/netdutils/ThreadUtil.h deleted file mode 100644 index 62e6f70c..00000000 --- a/common/netd/libnetdutils/include/netdutils/ThreadUtil.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_THREADUTIL_H -#define NETDUTILS_THREADUTIL_H - -#include <pthread.h> -#include <memory> - -#include <android-base/logging.h> - -namespace android { -namespace netdutils { - -struct scoped_pthread_attr { - scoped_pthread_attr() { pthread_attr_init(&attr); } - ~scoped_pthread_attr() { pthread_attr_destroy(&attr); } - - int detach() { return -pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); } - - pthread_attr_t attr; -}; - -inline void setThreadName(std::string name) { - // MAX_TASK_COMM_LEN=16 is not exported by bionic. - const size_t MAX_TASK_COMM_LEN = 16; - - // Crop name to 16 bytes including the NUL byte, as required by pthread_setname_np() - if (name.size() >= MAX_TASK_COMM_LEN) name.resize(MAX_TASK_COMM_LEN - 1); - - if (int ret = pthread_setname_np(pthread_self(), name.c_str()); ret != 0) { - LOG(WARNING) << "Unable to set thread name to " << name << ": " << strerror(ret); - } -} - -template <typename T> -inline void* runAndDelete(void* obj) { - std::unique_ptr<T> handler(reinterpret_cast<T*>(obj)); - setThreadName(handler->threadName().c_str()); - handler->run(); - return nullptr; -} - -template <typename T> -inline int threadLaunch(T* obj) { - if (obj == nullptr) { - return -EINVAL; - } - - scoped_pthread_attr scoped_attr; - - int rval = scoped_attr.detach(); - if (rval != 0) { - return rval; - } - - pthread_t thread; - rval = pthread_create(&thread, &scoped_attr.attr, &runAndDelete<T>, obj); - if (rval != 0) { - LOG(WARNING) << __func__ << ": pthread_create failed: " << rval; - return -rval; - } - - return rval; -} - -} // namespace netdutils -} // namespace android - -#endif // NETDUTILS_THREADUTIL_H diff --git a/common/netd/libnetdutils/include/netdutils/UidConstants.h b/common/netd/libnetdutils/include/netdutils/UidConstants.h deleted file mode 100644 index 42c10908..00000000 --- a/common/netd/libnetdutils/include/netdutils/UidConstants.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_UID_CONSTANTS_H -#define NETDUTILS_UID_CONSTANTS_H - -// These are used by both eBPF kernel programs and netd, we cannot put them in NetdConstant.h since -// we have to minimize the number of headers included by the BPF kernel program. -#define MIN_SYSTEM_UID 0 -#define MAX_SYSTEM_UID 9999 - -#define PER_USER_RANGE 100000 - -#endif // NETDUTILS_UID_CONSTANTS_H diff --git a/common/netd/libnetdutils/include/netdutils/UniqueFd.h b/common/netd/libnetdutils/include/netdutils/UniqueFd.h deleted file mode 100644 index 61101f95..00000000 --- a/common/netd/libnetdutils/include/netdutils/UniqueFd.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_UNIQUEFD_H -#define NETUTILS_UNIQUEFD_H - -#include <unistd.h> -#include <ostream> - -#include "netdutils/Fd.h" - -namespace android { -namespace netdutils { - -// Stricter unique_fd implementation that: -// *) Does not implement release() -// *) Does not implicitly cast to int -// *) Uses a strongly typed wrapper (Fd) for the underlying file descriptor -// -// Users of UniqueFd should endeavor to treat this as a completely -// opaque object. The only code that should interpret the wrapped -// value is in Syscalls.h -class UniqueFd { - public: - UniqueFd() = default; - - UniqueFd(Fd fd) : mFd(fd) {} - - ~UniqueFd() { reset(); } - - // Disallow copy - UniqueFd(const UniqueFd&) = delete; - UniqueFd& operator=(const UniqueFd&) = delete; - - // Allow move - UniqueFd(UniqueFd&& other) { std::swap(mFd, other.mFd); } - UniqueFd& operator=(UniqueFd&& other) { - std::swap(mFd, other.mFd); - return *this; - } - - // Cleanup any currently owned Fd, replacing it with the optional - // parameter fd - void reset(Fd fd = Fd()); - - // Implict cast to Fd - operator const Fd &() const { return mFd; } - - private: - Fd mFd; -}; - -std::ostream& operator<<(std::ostream& os, const UniqueFd& fd); - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_UNIQUEFD_H */ diff --git a/common/netd/libnetdutils/include/netdutils/UniqueFile.h b/common/netd/libnetdutils/include/netdutils/UniqueFile.h deleted file mode 100644 index 6dd6d672..00000000 --- a/common/netd/libnetdutils/include/netdutils/UniqueFile.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETDUTILS_UNIQUEFILE_H -#define NETDUTILS_UNIQUEFILE_H - -#include <stdio.h> -#include <memory> - -namespace android { -namespace netdutils { - -struct UniqueFileDtor { - void operator()(FILE* file) const; -}; - -using UniqueFile = std::unique_ptr<FILE, UniqueFileDtor>; - -} // namespace netdutils -} // namespace android - -#endif /* NETDUTILS_UNIQUEFILE_H */ diff --git a/common/netd/libnetdutils/include/netdutils/Utils.h b/common/netd/libnetdutils/include/netdutils/Utils.h deleted file mode 100644 index 83c583b2..00000000 --- a/common/netd/libnetdutils/include/netdutils/Utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef NETUTILS_UTILS_H -#define NETUTILS_UTILS_H - -#include "netdutils/StatusOr.h" - -namespace android { -namespace netdutils { - -StatusOr<std::vector<std::string>> getIfaceNames(); - -StatusOr<std::map<std::string, uint32_t>> getIfaceList(); - -} // namespace netdutils -} // namespace android - -#endif /* NETUTILS_UTILS_H */ |