Skip to main content

ace_doip/payload/
entity_status.rs

1use ace_macros::FrameCodec;
2use ace_proto::doip::constants::{
3    DOIP_ENTITY_STATUS_RESPONSE_MCTS_LEN, DOIP_ENTITY_STATUS_RESPONSE_MDS_LEN,
4    DOIP_ENTITY_STATUS_RESPONSE_NCTS_LEN,
5};
6
7use crate::error::DoipError;
8
9#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
10#[frame(error = DoipError)]
11pub struct EntityStatusRequest {}
12
13#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
14#[frame(error = DoipError)]
15pub struct EntityStatusResponse {
16    pub node_type: NodeType,
17    pub max_concurrent_sockets: [u8; DOIP_ENTITY_STATUS_RESPONSE_MCTS_LEN],
18    pub currently_open_sockets: [u8; DOIP_ENTITY_STATUS_RESPONSE_NCTS_LEN],
19    pub max_data_size: [u8; DOIP_ENTITY_STATUS_RESPONSE_MDS_LEN],
20}
21
22#[repr(u8)]
23#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, FrameCodec)]
24#[frame(error = DoipError)]
25pub enum NodeType {
26    #[frame(id = 0x00)]
27    DoipGateway,
28    #[frame(id = 0x01)]
29    DoipNode,
30    #[frame(id_pat = "0x02..=0xFF")]
31    Reserved(u8),
32}