1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use arrayvec::ArrayVec;

use crate::datastructures::{common::ClockIdentity, messages::MAX_DATA_LEN};

/// A concrete implementation of the PTP Path Trace dataset
/// (IEEE1588-2019 section 16.2.2)
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PathTraceDS {
    /// See *IEEE1588-2019 section 16.2.2.2.1*.
    pub list: ArrayVec<ClockIdentity, { MAX_DATA_LEN / 8 }>,
    /// See *IEEE1588-2019 section 16.2.2.3.1*.
    pub enable: bool,
}

impl PathTraceDS {
    pub(crate) fn new(enable: bool) -> Self {
        PathTraceDS {
            list: Default::default(),
            enable,
        }
    }
}