Skip to content

Commit 390b94b

Browse files
committed
feat(pkt-io): allow naming pkt-io instances
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
1 parent f8424e2 commit 390b94b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkt-io/src/nf.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ trace_target!(PKT_IO, LevelFilter::TRACE, &["pipeline"]);
2828
// For the same reason, the two queues are optional to accommodate for the case that only injection
2929
// or punting are used.
3030
pub struct PktIo<Buf: PacketBufferMut> {
31+
name: String,
3132
injectq: Option<Arc<ArrayQueue<Box<Packet<Buf>>>>>,
3233
puntq: Option<Arc<ArrayQueue<Box<Packet<Buf>>>>>,
3334
}
@@ -43,10 +44,15 @@ impl<Buf: PacketBufferMut> PktIo<Buf> {
4344
#[must_use]
4445
pub fn new(inject_capacity: usize, punt_capacity: usize) -> Self {
4546
Self {
47+
name: "".to_string(),
4648
injectq: Self::create_queue(inject_capacity),
4749
puntq: Self::create_queue(punt_capacity),
4850
}
4951
}
52+
pub fn set_name(mut self, name: &str) -> Self {
53+
self.name = name.to_owned();
54+
self
55+
}
5056
pub fn set_injectq(&mut self, queue: Arc<ArrayQueue<Box<Packet<Buf>>>>) {
5157
self.injectq = Some(queue)
5258
}

0 commit comments

Comments
 (0)