vsh_rust_proto/
vm_tools.vsh.rs

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