]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
sip: add tx iterator
authorJason Ish <jason.ish@oisf.net>
Wed, 10 Nov 2021 19:30:04 +0000 (13:30 -0600)
committerVictor Julien <vjulien@oisf.net>
Mon, 22 Nov 2021 09:20:23 +0000 (10:20 +0100)
rust/src/sip/sip.rs

index f5a86cfc39604c730d02343e853fbe5d5ef060e2..da47c7e262bdd9f885f237365143b3d6075a3b4e 100755 (executable)
@@ -36,6 +36,12 @@ pub struct SIPState {
     tx_id: u64,
 }
 
+impl State<SIPTransaction> for SIPState {
+    fn get_transactions(&self) -> &[SIPTransaction] {
+        &self.transactions
+    }
+}
+
 pub struct SIPTransaction {
     id: u64,
     pub request: Option<Request>,
@@ -47,6 +53,12 @@ pub struct SIPTransaction {
     tx_data: applayer::AppLayerTxData,
 }
 
+impl Transaction for SIPTransaction {
+    fn id(&self) -> u64 {
+        self.id
+    }
+}
+
 impl SIPState {
     pub fn new() -> SIPState {
         SIPState {
@@ -326,7 +338,7 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
         localstorage_new: None,
         localstorage_free: None,
         get_files: None,
-        get_tx_iterator: None,
+        get_tx_iterator: Some(applayer::state_get_tx_iterator::<SIPState, SIPTransaction>),
         get_tx_data: rs_sip_get_tx_data,
         apply_tx_config: None,
         flags: APP_LAYER_PARSER_OPT_UNIDIR_TXS,