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

index 18048b2dc1f6f96d9141ddecafa78d5c5605a3cd..e9dc49faa29165e13ff53212f578955b3940e869 100644 (file)
@@ -50,6 +50,12 @@ pub struct KRB5State {
     tx_id: u64,
 }
 
+impl State<KRB5Transaction> for KRB5State {
+    fn get_transactions(&self) -> &[KRB5Transaction] {
+        &self.transactions
+    }
+}
+
 pub struct KRB5Transaction {
     /// The message type: AS-REQ, AS-REP, etc.
     pub msg_type: MessageType,
@@ -79,6 +85,12 @@ pub struct KRB5Transaction {
     tx_data: applayer::AppLayerTxData,
 }
 
+impl Transaction for KRB5Transaction {
+    fn id(&self) -> u64 {
+        self.id
+    }
+}
+
 pub fn to_hex_string(bytes: &[u8]) -> String {
     let mut s = String::new();
     for &b in bytes {
@@ -589,7 +601,7 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
         localstorage_new   : None,
         localstorage_free  : None,
         get_files          : None,
-        get_tx_iterator    : None,
+        get_tx_iterator    : Some(applayer::state_get_tx_iterator::<KRB5State, KRB5Transaction>),
         get_tx_data        : rs_krb5_get_tx_data,
         apply_tx_config    : None,
         flags              : APP_LAYER_PARSER_OPT_UNIDIR_TXS,