1 //! Driver for VirtIO socket devices. 2 //! 3 //! To use the driver, you should first create a [`VirtIOSocket`] instance with your VirtIO 4 //! transport, and then create a [`VsockConnectionManager`] wrapping it to keep track of 5 //! connections. If you want to manage connections yourself you can use the `VirtIOSocket` directly 6 //! for a lower-level interface. 7 //! 8 //! See [`VsockConnectionManager`] for a usage example. 9 10 #[cfg(feature = "alloc")] 11 mod connectionmanager; 12 mod error; 13 mod protocol; 14 #[cfg(feature = "alloc")] 15 mod vsock; 16 17 #[cfg(feature = "alloc")] 18 pub use connectionmanager::VsockConnectionManager; 19 pub use error::SocketError; 20 pub use protocol::{StreamShutdown, VsockAddr, VMADDR_CID_HOST}; 21 #[cfg(feature = "alloc")] 22 pub use vsock::{ConnectionInfo, DisconnectReason, VirtIOSocket, VsockEvent, VsockEventType}; 23 24 /// The size in bytes of each buffer used in the RX virtqueue. This must be bigger than 25 /// `size_of::<VirtioVsockHdr>()`. 26 const DEFAULT_RX_BUFFER_SIZE: usize = 512; 27