xref: /aosp_15_r20/external/crosvm/net_util/src/sys/linux.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2022 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 pub mod tap;
6 use base::FileReadWriteVolatile;
7 pub use tap::Tap;
8 
9 use crate::TapTCommon;
10 
11 /// Linux-specific TAP functions
12 pub trait TapTLinux {
13     /// Set the size of the vnet hdr.
set_vnet_hdr_size(&self, size: usize) -> Result<(), crate::Error>14     fn set_vnet_hdr_size(&self, size: usize) -> Result<(), crate::Error>;
15 
16     /// Get the interface flags
if_flags(&self) -> u3217     fn if_flags(&self) -> u32;
18 }
19 
20 // TODO(b/159159958) implement FileReadWriteVolatile for slirp
21 pub trait TapT: FileReadWriteVolatile + TapTCommon + TapTLinux {}
22 
23 pub mod fakes {
24     pub use super::tap::fakes::FakeTap;
25 }
26