]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: add tx detect flags function to registration struct
authorJason Ish <jason.ish@oisf.net>
Tue, 19 Nov 2019 19:44:31 +0000 (13:44 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 27 Nov 2019 19:05:17 +0000 (13:05 -0600)
rust/src/applayertemplate/template.rs
rust/src/dhcp/dhcp.rs
rust/src/ikev2/ikev2.rs
rust/src/krb/krb5.rs
rust/src/ntp/ntp.rs
rust/src/parser.rs
rust/src/rdp/rdp.rs
rust/src/sip/sip.rs
rust/src/snmp/snmp.rs

index a254f303935937a40565e7bf99b20829ae5c94c4..bb02267f6c2ab3017bbe40f05fac060dd74896f2 100644 (file)
@@ -544,6 +544,8 @@ pub unsafe extern "C" fn rs_template_register_parser() {
         set_tx_mpm_id: None,
         get_files: None,
         get_tx_iterator: Some(rs_template_state_get_tx_iterator),
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
 
     let ip_proto_str = CString::new("tcp").unwrap();
index 891b9b5d777c9a3d75a4682e1d6ce8845e0a1864..6aa576669dca2fb029b028e959cb8c6af3929444 100644 (file)
@@ -452,6 +452,8 @@ pub unsafe extern "C" fn rs_dhcp_register_parser() {
         set_tx_mpm_id      : None,
         get_files          : None,
         get_tx_iterator    : Some(rs_dhcp_state_get_tx_iterator),
+        set_tx_detect_flags: None,
+        get_tx_detect_flags: None,
     };
 
     let ip_proto_str = CString::new("udp").unwrap();
index 89f1acfe10ad84016b3846f02350772952355e94..0eaf9bcf9d504982a957c7ca41e940100d3f4af0 100644 (file)
@@ -730,6 +730,8 @@ pub unsafe extern "C" fn rs_register_ikev2_parser() {
         set_tx_mpm_id      : None,
         get_files          : None,
         get_tx_iterator    : None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
 
     let ip_proto_str = CString::new("udp").unwrap();
index 64c377418fa24a71628ea309478e05d469093e9e..7cb911a72da94e71c27fa5acc581d9177a6c9a7c 100644 (file)
@@ -669,6 +669,8 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
         set_tx_mpm_id      : None,
         get_files          : None,
         get_tx_iterator    : None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
     // register UDP parser
     let ip_proto_str = CString::new("udp").unwrap();
index c6bcbfc4a1313f706e4e73cfa0beb953c71b5be0..ad3b519e9ce1fc98c55f89ac6afe1551179f52a7 100644 (file)
@@ -429,6 +429,8 @@ pub unsafe extern "C" fn rs_register_ntp_parser() {
         set_tx_mpm_id      : None,
         get_files          : None,
         get_tx_iterator    : None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
 
     let ip_proto_str = CString::new("udp").unwrap();
index 1704bb20649fc99bd433478a0bc499fb217d0190..5dec9f2c32a3fef31b2bd6372dbf772601004d84 100644 (file)
@@ -100,6 +100,12 @@ pub struct RustParser {
 
     /// Function to get the TX iterator
     pub get_tx_iterator:    Option<GetTxIteratorFn>,
+
+    // Function to set TX detect flags.
+    pub set_tx_detect_flags: Option<SetTxDetectFlagsFn>,
+
+    // Function to get TX detect flags.
+    pub get_tx_detect_flags: Option<GetTxDetectFlagsFn>,
 }
 
 
@@ -154,6 +160,8 @@ pub type GetTxIteratorFn    = extern "C" fn (ipproto: u8, alproto: AppProto,
                                              max_tx_id: u64,
                                              istate: &mut u64)
                                              -> AppLayerGetTxIterTuple;
+pub type GetTxDetectFlagsFn = unsafe extern "C" fn(*mut c_void, u8) -> u64;
+pub type SetTxDetectFlagsFn = unsafe extern "C" fn(*mut c_void, u8, u64);
 
 // Defined in app-layer-register.h
 extern {
@@ -185,4 +193,10 @@ extern {
     pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u8) -> c_int;
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
     pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn);
+    pub fn AppLayerParserRegisterDetectFlagsFuncs(
+        ipproto: u8,
+        alproto: AppProto,
+        GetTxDetectFlats: GetTxDetectFlagsFn,
+        SetTxDetectFlags: SetTxDetectFlagsFn,
+    );
 }
index 2867485b47230c9f8881d831cc75a90f54000d2e..3b66935413330d955886a32c2f9a09d35cd97c8e 100644 (file)
@@ -531,6 +531,8 @@ pub unsafe extern "C" fn rs_rdp_register_parser() {
         set_tx_mpm_id: None,
         get_files: None,
         get_tx_iterator: None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
 
     /* For 5.0 we want this disabled by default, so check that it
index 39be7c66ba4b6f9053b942906e34abb57994767f..b33526003d060574c483c84ee5dbc10317a809ed 100755 (executable)
@@ -422,6 +422,8 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
         set_tx_mpm_id: None,
         get_files: None,
         get_tx_iterator: None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
 
     /* For 5.0 we want this disabled by default, so check that it
index 01c2fa97ba917efae077056294d8083f0fd76d98..ebd4d266414e0768f1f82dd48767e6bb8698e99b 100644 (file)
@@ -607,6 +607,8 @@ pub unsafe extern "C" fn rs_register_snmp_parser() {
         set_tx_mpm_id      : None,
         get_files          : None,
         get_tx_iterator    : None,
+        get_tx_detect_flags: None,
+        set_tx_detect_flags: None,
     };
     let ip_proto_str = CString::new("udp").unwrap();
     if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {