use crate::traits::{SEList, SEResource, Validate};
use sep2_common_derive::{SEList, SEResource};
use super::{
links::{
IPAddrListLink, LlinterfaceListLink, NeighborListLink, RplinstanceListLink,
RplsourceRoutesListLink,
},
primitives::{
HexBinary128, HexBinary64, HexBinary8, Int64, String16, String192, Uint16, Uint32, Uint8,
},
};
use yaserde::{YaDeserialize, YaSerialize};
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize)]
#[yaserde(rename = "IEEE_802_15_4")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct IEEE802154 {
#[yaserde(rename = "capabilityInfo")]
pub capability_info: HexBinary8,
#[yaserde(rename = "NeighborListLink")]
pub neighbor_list_link: Option<NeighborListLink>,
#[yaserde(rename = "shortAddress")]
pub short_address: Uint16,
}
impl Validate for IEEE802154 {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "IPAddr")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct IPAddr {
#[yaserde(rename = "address")]
pub address: HexBinary128,
#[yaserde(rename = "RPLInstanceListLink")]
pub rpl_instance_list_link: Option<RplinstanceListLink>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for IPAddr {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for IPAddr {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.address.cmp(&other.address)
}
}
impl Validate for IPAddr {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "IPAddrList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct IPAddrList {
#[yaserde(rename = "IPAddr")]
pub ip_addr: Vec<IPAddr>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for IPAddrList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "IPInterface")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct IPInterface {
#[yaserde(rename = "ifDescr")]
pub if_descr: Option<String192>,
#[yaserde(rename = "ifHighSpeed")]
pub if_high_speed: Option<Uint32>,
#[yaserde(rename = "ifInBroadcastPkts")]
pub if_in_broadcast_pkts: Option<Uint32>,
#[yaserde(rename = "ifIndex")]
pub if_index: Option<Uint32>,
#[yaserde(rename = "ifInDiscards")]
pub if_in_discards: Option<Uint32>,
#[yaserde(rename = "ifInErrors")]
pub if_in_errors: Option<Uint32>,
#[yaserde(rename = "ifInMulticastPkts")]
pub if_in_multicast_pkts: Option<Uint32>,
#[yaserde(rename = "ifInOctets")]
pub if_in_octets: Option<Uint32>,
#[yaserde(rename = "ifInUcastPkts")]
pub if_in_ucast_pkts: Option<Uint32>,
#[yaserde(rename = "ifInUnknownProtos")]
pub if_in_unknown_protos: Option<Uint32>,
#[yaserde(rename = "ifMtu")]
pub if_mtu: Option<Uint32>,
#[yaserde(rename = "ifName")]
pub if_name: Option<String16>,
#[yaserde(rename = "ifOperStatus")]
pub if_oper_status: Option<Uint8>,
#[yaserde(rename = "ifOutBroadcastPkts")]
pub if_out_broadcast_pkts: Option<Uint32>,
#[yaserde(rename = "ifOutDiscards")]
pub if_out_discards: Option<Uint32>,
#[yaserde(rename = "ifOutErrors")]
pub if_out_errors: Option<Uint32>,
#[yaserde(rename = "ifOutMulticastPkts")]
pub if_out_multicast_pkts: Option<Uint32>,
#[yaserde(rename = "ifOutOctets")]
pub if_out_octets: Option<Uint32>,
#[yaserde(rename = "ifOutUcastPkts")]
pub if_out_ucast_pkts: Option<Uint32>,
#[yaserde(rename = "ifPromiscuousMode")]
pub if_promiscuous_mode: Option<bool>,
#[yaserde(rename = "ifSpeed")]
pub if_speed: Option<Uint32>,
#[yaserde(rename = "ifType")]
pub if_type: Option<Uint16>,
#[yaserde(rename = "IPAddrListLink")]
pub ip_addr_list_link: Option<IPAddrListLink>,
#[yaserde(rename = "lastResetTime")]
pub last_reset_time: Option<Int64>,
#[yaserde(rename = "lastUpdatedTime")]
pub last_updated_time: Option<Int64>,
#[yaserde(rename = "LLInterfaceListLink")]
pub ll_interface_list_link: Option<LlinterfaceListLink>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for IPInterface {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for IPInterface {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.if_index.cmp(&other.if_index)
}
}
impl Validate for IPInterface {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "IPInterfaceList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct IPInterfaceList {
#[yaserde(rename = "IPInterface")]
pub ip_interface: Vec<IPInterface>,
#[yaserde(attribute, rename = "pollRate")]
pub poll_rate: Option<Uint32>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for IPInterfaceList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "LLInterface")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct LLInterface {
#[yaserde(rename = "CRCerrors")]
pub cr_cerrors: Uint32,
#[yaserde(rename = "EUI64")]
pub eui64: HexBinary64,
#[yaserde(rename = "IEEE_802_15_4")]
pub ieee_802_15_4: Option<IEEE802154>,
#[yaserde(rename = "linkLayerType")]
pub link_layer_type: Uint8,
#[yaserde(rename = "LLAckNotRx")]
pub ll_ack_not_rx: Option<Uint32>,
#[yaserde(rename = "LLCSMAFail")]
pub llcsma_fail: Option<Uint32>,
#[yaserde(rename = "LLFramesDropRx")]
pub ll_frames_drop_rx: Option<Uint32>,
#[yaserde(rename = "LLFramesDropTx")]
pub ll_frames_drop_tx: Option<Uint32>,
#[yaserde(rename = "LLFramesRx")]
pub ll_frames_rx: Option<Uint32>,
#[yaserde(rename = "LLFramesTx")]
pub ll_frames_tx: Option<Uint32>,
#[yaserde(rename = "LLMediaAccessFail")]
pub ll_media_access_fail: Option<Uint32>,
#[yaserde(rename = "LLOctetsRx")]
pub ll_octets_rx: Option<Uint32>,
#[yaserde(rename = "LLOctetsTx")]
pub ll_octets_tx: Option<Uint32>,
#[yaserde(rename = "LLRetryCount")]
pub ll_retry_count: Option<Uint32>,
#[yaserde(rename = "LLSecurityErrorRx")]
pub ll_security_error_rx: Option<Uint32>,
#[yaserde(rename = "loWPAN")]
pub lo_wpan: Option<LoWPAN>,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for LLInterface {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for LLInterface {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.eui64.cmp(&other.eui64)
}
}
impl Validate for LLInterface {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "LLInterfaceList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct LlinterfaceList {
#[yaserde(rename = "LLInterface")]
pub ll_interface: Vec<LLInterface>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for LlinterfaceList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize)]
#[yaserde(rename = "loWPAN")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct LoWPAN {
#[yaserde(rename = "octetsRx")]
pub octets_rx: Option<Uint32>,
#[yaserde(rename = "octetsTx")]
pub octets_tx: Option<Uint32>,
#[yaserde(rename = "packetsRx")]
pub packets_rx: Uint32,
#[yaserde(rename = "packetsTx")]
pub packets_tx: Uint32,
#[yaserde(rename = "rxFragError")]
pub rx_frag_error: Uint32,
}
impl Validate for LoWPAN {}
#[derive(
Default, PartialEq, PartialOrd, Eq, Ord, Debug, Clone, YaSerialize, YaDeserialize, SEResource,
)]
#[yaserde(rename = "Neighbor")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct Neighbor {
#[yaserde(rename = "isChild")]
pub is_child: bool,
#[yaserde(rename = "linkQuality")]
pub link_quality: Uint8,
#[yaserde(rename = "shortAddress")]
pub short_address: Uint16,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for Neighbor {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "NeighborList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct NeighborList {
#[yaserde(rename = "Neighbor")]
pub neighbor: Vec<Neighbor>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for NeighborList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "RPLInstance")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct RPLInstance {
#[yaserde(rename = "DODAGid")]
pub doda_gid: Uint8,
#[yaserde(rename = "DODAGroot")]
pub doda_groot: bool,
#[yaserde(rename = "flags")]
pub flags: Uint8,
#[yaserde(rename = "groundedFlag")]
pub grounded_flag: bool,
#[yaserde(rename = "MOP")]
pub mop: Uint8,
#[yaserde(rename = "PRF")]
pub prf: Uint8,
#[yaserde(rename = "rank")]
pub rank: Uint16,
#[yaserde(rename = "RPLInstanceID")]
pub rpl_instance_id: Uint8,
#[yaserde(rename = "RPLSourceRoutesListLink")]
pub rpl_source_routes_list_link: Option<RplsourceRoutesListLink>,
#[yaserde(rename = "versionNumber")]
pub version_number: Uint8,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for RPLInstance {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for RPLInstance {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.doda_gid.cmp(&other.doda_gid) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.rpl_instance_id.cmp(&other.rpl_instance_id)
}
}
impl Validate for RPLInstance {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "RPLInstanceList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct RPLInstanceList {
#[yaserde(rename = "RPLInstance")]
pub rpl_instance: Vec<RPLInstance>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for RPLInstanceList {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEResource)]
#[yaserde(rename = "RPLSourceRoutes")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct RPLSourceRoutes {
#[yaserde(rename = "DestAddress")]
pub dest_address: HexBinary128,
#[yaserde(rename = "SourceRoute")]
pub source_route: HexBinary128,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl PartialOrd for RPLSourceRoutes {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for RPLSourceRoutes {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.source_route.cmp(&other.source_route) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.dest_address.cmp(&other.dest_address)
}
}
impl Validate for RPLSourceRoutes {}
#[derive(Default, PartialEq, Eq, Debug, Clone, YaSerialize, YaDeserialize, SEList, SEResource)]
#[yaserde(rename = "RPLSourceRoutesList")]
#[yaserde(namespace = "urn:ieee:std:2030.5:ns")]
pub struct RPLSourceRoutesList {
#[yaserde(rename = "RPLSourceRoutes")]
pub rpl_source_routes: Vec<RPLSourceRoutes>,
#[yaserde(attribute, rename = "all")]
pub all: Uint32,
#[yaserde(attribute, rename = "results")]
pub results: Uint32,
#[yaserde(attribute, rename = "href")]
pub href: Option<String>,
}
impl Validate for RPLSourceRoutesList {}