ipmi_rs/connection/
response.rs1use crate::NetFn;
2
3use super::Message;
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct Response {
7 seq: i64,
8 message: Message,
9}
10
11impl Response {
12 pub fn new(message: Message, seq: i64) -> Option<Self> {
13 if !message.data().is_empty() {
14 Some(Self { message, seq })
15 } else {
16 None
17 }
18 }
19
20 pub fn netfn(&self) -> NetFn {
21 self.message.netfn()
22 }
23
24 pub fn netfn_raw(&self) -> u8 {
25 self.message.netfn_raw()
26 }
27
28 pub fn cmd(&self) -> u8 {
29 self.message.cmd
30 }
31
32 pub fn seq(&self) -> i64 {
33 self.seq
34 }
35
36 pub fn cc(&self) -> u8 {
37 self.message.data[0]
38 }
39
40 pub fn data(&self) -> &[u8] {
41 &self.message.data[1..]
42 }
43}