]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ntp: support AppLayerTxData
authorVictor Julien <victor@inliniac.net>
Sun, 7 Jun 2020 18:12:46 +0000 (20:12 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 11 Jul 2020 06:37:40 +0000 (08:37 +0200)
rust/src/ntp/ntp.rs

index 71d8277f4287ca786f26cb801225506b9bd9a289..837ccb4bc2416c4dc091155edc69edabaa4905cf 100644 (file)
@@ -74,7 +74,7 @@ pub struct NTPTransaction {
     /// The events associated with this transaction
     events: *mut core::AppLayerDecoderEvents,
 
-    logged: applayer::LoggerFlags,
+    tx_data: applayer::AppLayerTxData,
 }
 
 
@@ -158,7 +158,7 @@ impl NTPTransaction {
             id: id,
             de_state: None,
             events: std::ptr::null_mut(),
-            logged: applayer::LoggerFlags::new(),
+            tx_data: applayer::AppLayerTxData::new(),
         }
     }
 
@@ -175,11 +175,6 @@ impl Drop for NTPTransaction {
     }
 }
 
-
-
-
-
-
 /// Returns *mut NTPState
 #[no_mangle]
 pub extern "C" fn rs_ntp_state_new() -> *mut std::os::raw::c_void {
@@ -273,27 +268,6 @@ pub extern "C" fn rs_ntp_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void,
     1
 }
 
-
-
-
-
-#[no_mangle]
-pub extern "C" fn rs_ntp_tx_set_logged(_state: &mut NTPState,
-                                       tx: &mut NTPTransaction,
-                                       logged: u32)
-{
-    tx.logged.set(logged);
-}
-
-#[no_mangle]
-pub extern "C" fn rs_ntp_tx_get_logged(_state: &mut NTPState,
-                                       tx: &mut NTPTransaction)
-                                       -> u32
-{
-    return tx.logged.get();
-}
-
-
 #[no_mangle]
 pub extern "C" fn rs_ntp_state_set_tx_detect_state(
     tx: *mut std::os::raw::c_void,
@@ -399,6 +373,8 @@ pub extern "C" fn ntp_probing_parser(_flow: *const Flow,
     }
 }
 
+export_tx_data_get!(rs_ntp_get_tx_data, NTPTransaction);
+
 const PARSER_NAME : &'static [u8] = b"ntp\0";
 
 #[no_mangle]
@@ -434,7 +410,7 @@ pub unsafe extern "C" fn rs_register_ntp_parser() {
         get_tx_iterator    : None,
         get_tx_detect_flags: None,
         set_tx_detect_flags: None,
-        get_tx_data        : None,
+        get_tx_data        : Some(rs_ntp_get_tx_data),
         apply_tx_config    : None,
     };