From: Shivani Bhardwaj Date: Thu, 12 Aug 2021 13:22:13 +0000 (+0530) Subject: sip: use Direction enum X-Git-Tag: suricata-7.0.0-beta1~1218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f9f78c2d0865fde1d82d257cd34220d3be5d972;p=thirdparty%2Fsuricata.git sip: use Direction enum --- diff --git a/rust/src/sip/detect.rs b/rust/src/sip/detect.rs index 7d987e6ed8..7098ea54a3 100644 --- a/rust/src/sip/detect.rs +++ b/rust/src/sip/detect.rs @@ -17,7 +17,7 @@ // written by Giuseppe Longo -use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER}; +use crate::core::Direction; use crate::sip::sip::SIPTransaction; use std::ptr; @@ -70,8 +70,8 @@ pub unsafe extern "C" fn rs_sip_tx_get_protocol( buffer_len: *mut u32, direction: u8, ) -> u8 { - match direction { - STREAM_TOSERVER => { + match direction.into() { + Direction::ToServer => { if let Some(ref r) = tx.request { let v = &r.version; if v.len() > 0 { @@ -81,7 +81,7 @@ pub unsafe extern "C" fn rs_sip_tx_get_protocol( } } } - STREAM_TOCLIENT => { + Direction::ToClient => { if let Some(ref r) = tx.response { let v = &r.version; if v.len() > 0 { @@ -91,7 +91,6 @@ pub unsafe extern "C" fn rs_sip_tx_get_protocol( } } } - _ => {} } *buffer = ptr::null();