firecracker_rs_sdk/models/
vsock.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5/// Defines a vsock device, backed by a set of Unix Domain Sockets, on the host side.
6/// For host-initiated connections, Firecracker will be listening on the Unix socket
7/// identified by the path `uds_path`. Firecracker will create this socket, bind and
8/// listen on it. Host-initiated connections will be performed by connection to this
9/// socket and issuing a connection forwarding request to the desired guest-side vsock
10/// port (i.e. `CONNECT 52\n`, to connect to port 52).
11/// For guest-initiated connections, Firecracker will expect host software to be
12/// bound and listening on Unix sockets at `uds_path_<PORT>`.
13/// E.g. "/path/to/host_vsock.sock_52" for port number 52.
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
15pub struct Vsock {
16    /// Guest Vsock CID
17    /// Required: true
18    /// Minimum: 3
19    /// CID defines the 32-bit Context Identifier for the vsock device.  See
20    /// the vsock(7) manual page for more information.
21    #[serde(rename = "guest_cid")]
22    pub guest_cid: u32,
23
24    /// Path to UNIX domain socket, used to proxy vsock connections.
25    /// Required: true
26    /// Path defines the filesystem path of the vsock device on the host.
27    #[serde(rename = "uds_path")]
28    pub uds_path: PathBuf,
29
30    /// vsock id
31    /// Required: true
32    /// ID defines the vsock's device ID for firecracker.
33    /// This parameter has been deprecated and it will be removed in future
34    /// Firecracker release.
35    #[serde(rename = "vsock_id", skip_serializing_if = "Option::is_none")]
36    pub vsock_id: Option<String>,
37}