use serde::Deserialize;
#[derive(Deserialize, Debug, Clone)]
#[allow(clippy::upper_case_acronyms)]
pub enum TableMatchTypes {
LPM,
Exact,
Range,
Ternary,
}
#[derive(Deserialize, Debug, Clone)]
pub struct BFRTFieldType {
pub(crate) r#type: String,
pub(crate) width: Option<u32>,
}
impl BFRTFieldType {
pub fn get_width(&self) -> u32 {
match self.r#type.as_str() {
"uint64" => 64,
"uint32" => 32,
"uint16" => 16,
"uint8" => 8,
"bytes" => self.width.unwrap(),
"bool" => 1,
"string" => 32, _ => panic!("Unknown width type: {}", self.r#type.as_str()),
}
}
}
#[derive(Deserialize, Debug, Clone)]
pub enum TableType {
#[serde(alias = "MatchAction_Direct")]
MatchActionDirect,
Register,
Meter,
SnapshotCfg,
SnapshotTrigger,
SnapshotData,
SnapshotLiveness,
PortMetadata,
PreMgid,
PreNode,
PreEcmp,
PreLag,
PrePrune,
PrePort,
PortConfigure,
PortStat,
PortHdlInfo,
PktgenAppCfg,
PktgenPktBufferCfg,
#[serde(other)]
Unknown,
}