1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Network backend support.
//!
//! This module re-exports the `NetBackend` trait from the devices crate,
//! allowing users to implement custom network backends for their VMs.
//!
//! # Example
//!
//! ```rust,no_run
//! use std::os::fd::RawFd;
//! use krun::backends::net::{NetBackend, ReadError, WriteError};
//!
//! struct MyNetBackend {
//! // ... your implementation
//! }
//!
//! impl NetBackend for MyNetBackend {
//! fn read_frame(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> {
//! // Read an ethernet frame from the backend
//! todo!()
//! }
//!
//! fn write_frame(&mut self, hdr_len: usize, buf: &mut [u8]) -> Result<(), WriteError> {
//! // Write an ethernet frame to the backend
//! todo!()
//! }
//!
//! fn has_unfinished_write(&self) -> bool {
//! false
//! }
//!
//! fn try_finish_write(&mut self, hdr_len: usize, buf: &[u8]) -> Result<(), WriteError> {
//! Ok(())
//! }
//!
//! fn raw_socket_fd(&self) -> RawFd {
//! // Return the raw fd for epoll registration
//! todo!()
//! }
//! }
//! ```
//--------------------------------------------------------------------------------------------------
// Re-Exports
//--------------------------------------------------------------------------------------------------
pub use ;
pub use Unixgram;
pub use Unixstream;