]> git.ipfire.org Git - people/ms/suricata.git/blobdiff - rust/src/rdp/rdp.rs
rdp: add tx iterator
[people/ms/suricata.git] / rust / src / rdp / rdp.rs
index 8b197b598299d9fcef5b25fe082c8dc8f79759da..75d7500fa8857bc7797ac8c6427c9f774138fd33 100644 (file)
@@ -19,7 +19,7 @@
 
 //! RDP application layer
 
-use crate::applayer::*;
+use crate::applayer::{self, *};
 use crate::core::{self, AppProto, DetectEngineState, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP};
 use crate::rdp::parser::*;
 use nom;
@@ -55,6 +55,12 @@ pub struct RdpTransaction {
     tx_data: AppLayerTxData,
 }
 
+impl Transaction for RdpTransaction {
+    fn id(&self) -> u64 {
+        self.id
+    }
+}
+
 impl RdpTransaction {
     fn new(id: u64, item: RdpTransactionItem) -> Self {
         Self {
@@ -120,6 +126,12 @@ pub struct RdpState {
     bypass_parsing: bool,
 }
 
+impl State<RdpTransaction> for RdpState {
+    fn get_transactions(&self) -> &[RdpTransaction] {
+        &self.transactions
+    }
+}
+
 impl RdpState {
     fn new() -> Self {
         Self {
@@ -492,7 +504,7 @@ pub unsafe extern "C" fn rs_rdp_register_parser() {
         localstorage_new: None,
         localstorage_free: None,
         get_files: None,
-        get_tx_iterator: None,
+        get_tx_iterator: Some(applayer::state_get_tx_iterator::<RdpState, RdpTransaction>),
         get_tx_data: rs_rdp_get_tx_data,
         apply_tx_config: None,
         flags: APP_LAYER_PARSER_OPT_UNIDIR_TXS,