insim/insim/
ssh.rs

1use insim_core::{
2    binrw::{self, binrw},
3    string::{binrw_parse_codepage_string, binrw_write_codepage_string},
4};
5
6use crate::identifiers::RequestId;
7
8#[binrw]
9#[derive(Debug, Default, Clone)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize))]
11#[repr(u8)]
12#[brw(repr(u8))]
13#[non_exhaustive]
14/// Errors occurred during a [Ssh] request.
15pub enum SshError {
16    #[default]
17    /// No error
18    Ok = 0,
19
20    /// This is a dedicated server. Screenshot unavailable.
21    Dedicated = 1,
22
23    /// Screenshot corrupted.
24    Corrupted = 2,
25
26    /// Could not save.
27    NoSave = 3,
28}
29
30#[binrw]
31#[derive(Debug, Clone, Default)]
32#[cfg_attr(feature = "serde", derive(serde::Serialize))]
33/// Send Screenshot - instructional and informational.
34pub struct Ssh {
35    /// Non-zero if the packet is a packet request or a reply to a request
36    pub reqi: RequestId,
37
38    /// Result code
39    #[brw(pad_after = 4)]
40    pub error: SshError,
41
42    /// Screenshot file path.
43    #[br(parse_with = binrw_parse_codepage_string::<32, _>)]
44    #[bw(write_with = binrw_write_codepage_string::<32, _>)]
45    pub name: String,
46}