diff options
Diffstat (limited to 'src/protocol/commands/_QCatchSyscalls.rs')
-rw-r--r-- | src/protocol/commands/_QCatchSyscalls.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/protocol/commands/_QCatchSyscalls.rs b/src/protocol/commands/_QCatchSyscalls.rs new file mode 100644 index 0000000..26a27a1 --- /dev/null +++ b/src/protocol/commands/_QCatchSyscalls.rs @@ -0,0 +1,26 @@ +use super::prelude::*; + +use crate::protocol::common::lists::ArgListHex; + +#[derive(Debug)] +pub enum QCatchSyscalls<'a> { + Disable, + Enable(ArgListHex<'a>), + EnableAll, +} + +impl<'a> ParseCommand<'a> for QCatchSyscalls<'a> { + #[inline(always)] + fn from_packet(buf: PacketBuf<'a>) -> Option<Self> { + let body = buf.into_body(); + + match body { + [b':', b'0'] => Some(QCatchSyscalls::Disable), + [b':', b'1', b';', sysno @ ..] => { + Some(QCatchSyscalls::Enable(ArgListHex::from_packet(sysno)?)) + } + [b':', b'1'] => Some(QCatchSyscalls::EnableAll), + _ => None, + } + } +} |