now_proto_pdu/session/
window_rec_stop.rs

1use ironrdp_core::{Decode, DecodeResult, Encode, EncodeResult, ReadCursor, WriteCursor};
2
3use crate::{NowHeader, NowMessage, NowMessageClass, NowSessionMessage, NowSessionMessageKind};
4
5/// The NOW_SESSION_WINDOW_REC_STOP_MSG message is used to stop window recording.
6///
7/// NOW_PROTO: NOW_SESSION_WINDOW_REC_STOP_MSG
8#[derive(Debug, Clone, PartialEq, Eq, Default)]
9#[non_exhaustive]
10pub struct NowSessionWindowRecStopMsg;
11
12impl NowSessionWindowRecStopMsg {
13    const NAME: &'static str = "NOW_SESSION_WINDOW_REC_STOP_MSG";
14}
15
16impl Encode for NowSessionWindowRecStopMsg {
17    fn encode(&self, dst: &mut WriteCursor<'_>) -> EncodeResult<()> {
18        let header = NowHeader {
19            size: 0,
20            class: NowMessageClass::SESSION,
21            kind: NowSessionMessageKind::WINDOW_REC_STOP.0,
22            flags: 0,
23        };
24
25        header.encode(dst)?;
26
27        Ok(())
28    }
29
30    fn name(&self) -> &'static str {
31        Self::NAME
32    }
33
34    fn size(&self) -> usize {
35        NowHeader::FIXED_PART_SIZE
36    }
37}
38
39impl Decode<'_> for NowSessionWindowRecStopMsg {
40    fn decode(src: &mut ReadCursor<'_>) -> DecodeResult<Self> {
41        let header = NowHeader::decode(src)?;
42
43        match (header.class, NowSessionMessageKind(header.kind)) {
44            (NowMessageClass::SESSION, NowSessionMessageKind::WINDOW_REC_STOP) => Ok(Self::default()),
45            _ => Err(unsupported_message_err!(class: header.class.0, kind: header.kind)),
46        }
47    }
48}
49
50impl From<NowSessionWindowRecStopMsg> for NowMessage<'_> {
51    fn from(value: NowSessionWindowRecStopMsg) -> Self {
52        Self::Session(NowSessionMessage::WindowRecStop(value))
53    }
54}