vsh_rust_proto/
vm_tools.vsh.rs

1/// Request to set up a connection to a container. This must be the first
2/// message sent to the server from the client.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct SetupConnectionRequest {
5    /// Target container. "vm_shell" is a special value to get a VM shell.
6    #[prost(string, tag="1")]
7    pub target: ::prost::alloc::string::String,
8    /// User to execute the target program.
9    #[prost(string, tag="2")]
10    pub user: ::prost::alloc::string::String,
11    /// Map of environment variables to forward.
12    #[prost(map="string, string", tag="3")]
13    pub env: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
14    /// Deprecated. Target command. Empty indicates a login shell.
15    #[prost(string, tag="4")]
16    pub command: ::prost::alloc::string::String,
17    /// Argv of the target program to run. Empty indicates a login shell.
18    #[prost(string, repeated, tag="5")]
19    pub argv: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
20    /// Initial window size (rows) of the pty.
21    #[prost(int32, tag="6")]
22    pub window_rows: i32,
23    /// Initial window size (cols) of the pty.
24    #[prost(int32, tag="7")]
25    pub window_cols: i32,
26    /// True if using a noninteractive client and a pty should not be allocated.
27    /// The logic here is inverted to keep backwards compatibility with the
28    /// current behavior (always allocate a pty).
29    #[prost(bool, tag="8")]
30    pub nopty: bool,
31    /// Optional: directory to set for current working directory.
32    #[prost(string, tag="9")]
33    pub cwd: ::prost::alloc::string::String,
34    /// Optional: use /proc/<cwd_pid>/cwd for current working directory.
35    #[prost(int32, tag="10")]
36    pub cwd_pid: i32,
37}
38/// Response to a SetupConnectionRequest.
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct SetupConnectionResponse {
41    /// Status of the connection.
42    #[prost(enumeration="ConnectionStatus", tag="1")]
43    pub status: i32,
44    /// Short description of any error encountered when setting up the
45    /// connection.
46    #[prost(string, tag="2")]
47    pub description: ::prost::alloc::string::String,
48    /// Process ID of new shell.
49    #[prost(int32, tag="3")]
50    pub pid: i32,
51}
52/// A message that indicates to either the server or the client a change
53/// in connection status.
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct ConnectionStatusMessage {
56    /// New connection status. If the connection status is changed to anything
57    /// except READY, the recipient must shut down.
58    #[prost(enumeration="ConnectionStatus", tag="1")]
59    pub status: i32,
60    /// Short description of any error that triggered the status change.
61    #[prost(string, tag="2")]
62    pub description: ::prost::alloc::string::String,
63    /// Return code of the command, if any.
64    #[prost(sint32, tag="3")]
65    pub code: i32,
66}
67/// DataMessages encapsulate stdio to be forwarded between the server and client.
68#[derive(Clone, PartialEq, ::prost::Message)]
69pub struct DataMessage {
70    /// Type of stream in this message.
71    #[prost(enumeration="StdioStream", tag="1")]
72    pub stream: i32,
73    /// Data to be forwarded.
74    #[prost(bytes="vec", tag="2")]
75    pub data: ::prost::alloc::vec::Vec<u8>,
76}
77/// Indicates that the server should resize its pseudoterminal to the given
78/// dimensions. Sent by the client in response to SIGWINCH.
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct WindowResizeMessage {
81    /// New number of rows for the tty.
82    #[prost(int32, tag="1")]
83    pub rows: i32,
84    /// New number of cols for the tty.
85    #[prost(int32, tag="2")]
86    pub cols: i32,
87}
88/// Wrapper message for all messages that can be sent to the host/client.
89#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct HostMessage {
91    #[prost(oneof="host_message::Msg", tags="1, 2")]
92    pub msg: ::core::option::Option<host_message::Msg>,
93}
94/// Nested message and enum types in `HostMessage`.
95pub mod host_message {
96    #[derive(Clone, PartialEq, ::prost::Oneof)]
97    pub enum Msg {
98        #[prost(message, tag="1")]
99        DataMessage(super::DataMessage),
100        #[prost(message, tag="2")]
101        StatusMessage(super::ConnectionStatusMessage),
102    }
103}
104/// Wrapper message for all messages that can be sent to the guest/server.
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct GuestMessage {
107    #[prost(oneof="guest_message::Msg", tags="1, 2, 3, 4")]
108    pub msg: ::core::option::Option<guest_message::Msg>,
109}
110/// Nested message and enum types in `GuestMessage`.
111pub mod guest_message {
112    #[derive(Clone, PartialEq, ::prost::Oneof)]
113    pub enum Msg {
114        #[prost(message, tag="1")]
115        DataMessage(super::DataMessage),
116        #[prost(message, tag="2")]
117        StatusMessage(super::ConnectionStatusMessage),
118        #[prost(message, tag="3")]
119        ResizeMessage(super::WindowResizeMessage),
120        #[prost(enumeration="super::Signal", tag="4")]
121        Signal(i32),
122    }
123}
124/// Indicates the status of a connection.
125#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
126#[repr(i32)]
127pub enum ConnectionStatus {
128    /// Connection status is unknown.
129    Unknown = 0,
130    /// Connection was set up successfully. Server and client may now exchange
131    /// messages.
132    Ready = 1,
133    /// The server's target program has exited. The server will immediately close
134    /// the connection, and the client is expected to exit after its cleanup.
135    Exited = 2,
136    /// A fatal error was encountered. The connection will be closed.
137    Failed = 3,
138}
139impl ConnectionStatus {
140    /// String value of the enum field names used in the ProtoBuf definition.
141    ///
142    /// The values are not transformed in any way and thus are considered stable
143    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
144    pub fn as_str_name(&self) -> &'static str {
145        match self {
146            ConnectionStatus::Unknown => "UNKNOWN",
147            ConnectionStatus::Ready => "READY",
148            ConnectionStatus::Exited => "EXITED",
149            ConnectionStatus::Failed => "FAILED",
150        }
151    }
152}
153/// Type of stdio stream that is being sent.
154#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
155#[repr(i32)]
156pub enum StdioStream {
157    /// The stream is invalid.
158    InvalidStream = 0,
159    /// This is a stdin stream, flowing from client to server.
160    StdinStream = 1,
161    /// This is a stdout stream, flowing from server to client.
162    StdoutStream = 2,
163    /// This is a stderr stream, flowing from server to client.
164    StderrStream = 3,
165}
166impl StdioStream {
167    /// String value of the enum field names used in the ProtoBuf definition.
168    ///
169    /// The values are not transformed in any way and thus are considered stable
170    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
171    pub fn as_str_name(&self) -> &'static str {
172        match self {
173            StdioStream::InvalidStream => "INVALID_STREAM",
174            StdioStream::StdinStream => "STDIN_STREAM",
175            StdioStream::StdoutStream => "STDOUT_STREAM",
176            StdioStream::StderrStream => "STDERR_STREAM",
177        }
178    }
179}
180/// Encapsulates a POSIX signal to be sent to the target program.
181#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
182#[repr(i32)]
183pub enum Signal {
184    Unknown = 0,
185    Hup = 1,
186    Int = 2,
187    Quit = 3,
188    Term = 15,
189}
190impl Signal {
191    /// String value of the enum field names used in the ProtoBuf definition.
192    ///
193    /// The values are not transformed in any way and thus are considered stable
194    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
195    pub fn as_str_name(&self) -> &'static str {
196        match self {
197            Signal::Unknown => "SIGNAL_UNKNOWN",
198            Signal::Hup => "SIGNAL_HUP",
199            Signal::Int => "SIGNAL_INT",
200            Signal::Quit => "SIGNAL_QUIT",
201            Signal::Term => "SIGNAL_TERM",
202        }
203    }
204}