From 8f9e0f719055487e4a352f5da74cae063bbcdbcc Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Tue, 12 Sep 2023 16:11:32 +0800 Subject: [feature] Support GTPv1-U Decode --- src/plugin/example.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/plugin/example.rs') diff --git a/src/plugin/example.rs b/src/plugin/example.rs index 6819d75..bce1724 100644 --- a/src/plugin/example.rs +++ b/src/plugin/example.rs @@ -78,19 +78,19 @@ impl EventHandle for ExamplePulgin { packet: Option<&Packet>, session: Option>>, ) { + self.plugin_ctx.borrow_mut().clear(); + self.plugin_ctx.borrow_mut().push_str("1"); + if session.is_none() { return; } - let length = packet.unwrap().orig_len; - let flow_id = packet.unwrap().get_flow_id(); - println!( - "{} handle Packet: {:?} {:?}", - self.plugin_name, length, flow_id - ); - - self.plugin_ctx.borrow_mut().clear(); - self.plugin_ctx.borrow_mut().push_str("1"); + if packet.is_some() { + let flow_id = packet.unwrap().get_flow_id(); + println!("{} handle Packet: {:?}", self.plugin_name, flow_id); + } else { + println!("{} handle Packet: None", self.plugin_name); + } let session = session.unwrap(); if index == self.tcp_opening_event { -- cgit v1.2.3