netlink_packet_route/tc/qdiscs/
ingress.rs1use anyhow::Context;
7use netlink_packet_utils::{
8 nla::{DefaultNla, Nla, NlaBuffer},
9 DecodeError, Parseable,
10};
11
12#[derive(Debug, PartialEq, Eq, Clone)]
13#[non_exhaustive]
14pub struct TcQdiscIngress {}
15
16#[derive(Debug, PartialEq, Eq, Clone)]
17#[non_exhaustive]
18pub enum TcQdiscIngressOption {
19 Other(DefaultNla),
20}
21
22impl TcQdiscIngress {
23 pub(crate) const KIND: &'static str = "ingress";
24}
25
26impl Nla for TcQdiscIngressOption {
27 fn value_len(&self) -> usize {
28 match self {
29 Self::Other(attr) => attr.value_len(),
30 }
31 }
32
33 fn emit_value(&self, buffer: &mut [u8]) {
34 match self {
35 Self::Other(attr) => attr.emit_value(buffer),
36 }
37 }
38
39 fn kind(&self) -> u16 {
40 match self {
41 Self::Other(attr) => attr.kind(),
42 }
43 }
44}
45
46impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>>
47 for TcQdiscIngressOption
48{
49 fn parse(buf: &NlaBuffer<&'a T>) -> Result<Self, DecodeError> {
50 Ok(Self::Other(
51 DefaultNla::parse(buf).context("failed to parse ingress nla")?,
52 ))
53 }
54}