blob: 26a0eff7bffbc0cef530385947b57b5f49850251 [file] [log] [blame]
Seungjae Yoo529d53c2024-05-14 14:36:18 +09001// 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
17use anyhow::anyhow;
18use android_system_virtualizationservice_internal::aidl::android::system::virtualizationservice_internal::IVmnic::IVmnic;
19use binder::{self, ExceptionCode, Interface, IntoBinderResult, ParcelFileDescriptor};
20
21#[derive(Debug, Default)]
22pub struct Vmnic {}
23
24impl Vmnic {
25 pub fn init() -> Vmnic {
26 Vmnic::default()
27 }
28}
29
30impl Interface for Vmnic {}
31
32impl 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}