]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/snmp: fix libc deprecation warnings for int types 3926/head
authorPierre Chifflier <chifflier@wzdftpd.net>
Thu, 6 Jun 2019 08:24:20 +0000 (10:24 +0200)
committerPierre Chifflier <chifflier@wzdftpd.net>
Thu, 6 Jun 2019 08:24:20 +0000 (10:24 +0200)
rust/src/snmp/detect.rs
rust/src/snmp/snmp.rs

index ceefecb153daf1eb522c3c47d61ebb455dd79155..caa3e27c8f8b452c66e145d3ab99d1f2779dd5e8 100644 (file)
 
 // written by Pierre Chifflier  <chifflier@wzdftpd.net>
 
-use libc;
 use snmp::snmp::SNMPTransaction;
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_tx_get_version(tx: &mut SNMPTransaction,
-                                         version: *mut libc::uint32_t)
+                                         version: *mut u32)
 {
     debug_assert!(tx.version != 0, "SNMP version is 0");
     unsafe {
-        *version = tx.version as libc::uint32_t;
+        *version = tx.version as u32;
     }
 }
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_tx_get_community(tx: &mut SNMPTransaction,
-                                           buf: *mut *const libc::uint8_t,
-                                           len: *mut libc::uint32_t)
+                                           buf: *mut *const u8,
+                                           len: *mut u32)
 {
     match tx.community {
         Some(ref c) => {
             unsafe {
                 *buf = (&c).as_ptr();
-                *len = c.len() as libc::uint32_t;
+                *len = c.len() as u32;
             }
         },
         None        => ()
@@ -48,12 +47,12 @@ pub extern "C" fn rs_snmp_tx_get_community(tx: &mut SNMPTransaction,
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction,
-                                          pdu_type: *mut libc::uint32_t)
+                                          pdu_type: *mut u32)
 {
     unsafe {
         match tx.info {
             Some(ref info) => {
-                *pdu_type = info.pdu_type.0 as libc::uint32_t;
+                *pdu_type = info.pdu_type.0 as u32;
             },
             None           => {
                 *pdu_type = 0xffffffff;
index 5c8ff053393656527eb96441ab2bf920ad1a71c0..7a5c75ef7337b8e2f70d619c5b1dffc2dcbd265a 100644 (file)
@@ -319,7 +319,7 @@ pub extern "C" fn rs_snmp_state_free(state: *mut libc::c_void) {
 pub extern "C" fn rs_snmp_parse_request(_flow: *const core::Flow,
                                        state: *mut libc::c_void,
                                        _pstate: *mut libc::c_void,
-                                       input: *const libc::uint8_t,
+                                       input: *const u8,
                                        input_len: u32,
                                        _data: *const libc::c_void,
                                        _flags: u8) -> i32 {
@@ -332,7 +332,7 @@ pub extern "C" fn rs_snmp_parse_request(_flow: *const core::Flow,
 pub extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow,
                                        state: *mut libc::c_void,
                                        _pstate: *mut libc::c_void,
-                                       input: *const libc::uint8_t,
+                                       input: *const u8,
                                        input_len: u32,
                                        _data: *const libc::c_void,
                                        _flags: u8) -> i32 {
@@ -343,7 +343,7 @@ pub extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow,
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_get_tx(state: *mut libc::c_void,
-                                      tx_id: libc::uint64_t)
+                                      tx_id: u64)
                                       -> *mut libc::c_void
 {
     let state = cast_pointer!(state,SNMPState);
@@ -355,7 +355,7 @@ pub extern "C" fn rs_snmp_state_get_tx(state: *mut libc::c_void,
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_get_tx_count(state: *mut libc::c_void)
-                                            -> libc::uint64_t
+                                            -> u64
 {
     let state = cast_pointer!(state,SNMPState);
     state.tx_id
@@ -363,7 +363,7 @@ pub extern "C" fn rs_snmp_state_get_tx_count(state: *mut libc::c_void)
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_tx_free(state: *mut libc::c_void,
-                                       tx_id: libc::uint64_t)
+                                       tx_id: u64)
 {
     let state = cast_pointer!(state,SNMPState);
     state.free_tx(tx_id);
@@ -371,7 +371,7 @@ pub extern "C" fn rs_snmp_state_tx_free(state: *mut libc::c_void,
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_progress_completion_status(
-    _direction: libc::uint8_t)
+    _direction: u8)
     -> libc::c_int
 {
     return 1;
@@ -379,7 +379,7 @@ pub extern "C" fn rs_snmp_state_progress_completion_status(
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut libc::c_void,
-                                                 _direction: libc::uint8_t)
+                                                 _direction: u8)
                                                  -> libc::c_int
 {
     1
@@ -392,7 +392,7 @@ pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut libc::c_void,
 #[no_mangle]
 pub extern "C" fn rs_snmp_tx_set_logged(_state: *mut libc::c_void,
                                        tx: *mut libc::c_void,
-                                       logged: libc::uint32_t)
+                                       logged: u32)
 {
     let tx = cast_pointer!(tx,SNMPTransaction);
     tx.logged.set(logged);
@@ -433,7 +433,7 @@ pub extern "C" fn rs_snmp_state_get_tx_detect_state(
 
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_get_events(state: *mut libc::c_void,
-                                          tx_id: libc::uint64_t)
+                                          tx_id: u64)
                                           -> *mut core::AppLayerDecoderEvents
 {
     let state = cast_pointer!(state,SNMPState);
@@ -472,8 +472,8 @@ pub extern "C" fn rs_snmp_state_get_event_info(event_name: *const libc::c_char,
 #[no_mangle]
 pub extern "C" fn rs_snmp_state_get_tx_iterator(
                                       state: &mut SNMPState,
-                                      min_tx_id: libc::uint64_t,
-                                      istate: &mut libc::uint64_t)
+                                      min_tx_id: u64,
+                                      istate: &mut u64)
                                       -> applayer::AppLayerGetTxIterTuple
 {
     match state.get_tx_iterator(min_tx_id, istate) {
@@ -543,7 +543,7 @@ fn parse_pdu_enveloppe_version(i:&[u8]) -> IResult<&[u8],u32> {
 #[no_mangle]
 pub extern "C" fn rs_snmp_probing_parser(_flow: *const Flow,
                                          _direction: u8,
-                                         input:*const libc::uint8_t,
+                                         input:*const u8,
                                          input_len: u32,
                                          _rdir: *mut u8) -> AppProto {
     let slice = build_slice!(input,input_len as usize);