Seungjae Yoo | 529d53c | 2024-05-14 14:36:18 +0900 | [diff] [blame] | 1 | // Copyright 2024, The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | //! Implementation of the AIDL interface of Vmnic. |
| 16 | |
| 17 | use anyhow::anyhow; |
| 18 | use android_system_virtualizationservice_internal::aidl::android::system::virtualizationservice_internal::IVmnic::IVmnic; |
| 19 | use binder::{self, ExceptionCode, Interface, IntoBinderResult, ParcelFileDescriptor}; |
| 20 | |
| 21 | #[derive(Debug, Default)] |
| 22 | pub struct Vmnic {} |
| 23 | |
| 24 | impl Vmnic { |
| 25 | pub fn init() -> Vmnic { |
| 26 | Vmnic::default() |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | impl Interface for Vmnic {} |
| 31 | |
| 32 | impl IVmnic for Vmnic { |
| 33 | fn createTapInterface(&self, _cid: i32) -> binder::Result<ParcelFileDescriptor> { |
| 34 | Err(anyhow!("Creating TAP network interface is not supported yet")) |
| 35 | .or_binder_exception(ExceptionCode::UNSUPPORTED_OPERATION) |
| 36 | } |
| 37 | } |