rust/snmp: fix libc deprecation warnings for int types

pull/3926/head
Pierre Chifflier 6 years ago
parent bc07656ce7
commit c1b30fe9fd

@ -17,29 +17,28 @@
// written by Pierre Chifflier <chifflier@wzdftpd.net> // written by Pierre Chifflier <chifflier@wzdftpd.net>
use libc;
use snmp::snmp::SNMPTransaction; use snmp::snmp::SNMPTransaction;
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_tx_get_version(tx: &mut SNMPTransaction, 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"); debug_assert!(tx.version != 0, "SNMP version is 0");
unsafe { unsafe {
*version = tx.version as libc::uint32_t; *version = tx.version as u32;
} }
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_tx_get_community(tx: &mut SNMPTransaction, pub extern "C" fn rs_snmp_tx_get_community(tx: &mut SNMPTransaction,
buf: *mut *const libc::uint8_t, buf: *mut *const u8,
len: *mut libc::uint32_t) len: *mut u32)
{ {
match tx.community { match tx.community {
Some(ref c) => { Some(ref c) => {
unsafe { unsafe {
*buf = (&c).as_ptr(); *buf = (&c).as_ptr();
*len = c.len() as libc::uint32_t; *len = c.len() as u32;
} }
}, },
None => () None => ()
@ -48,12 +47,12 @@ pub extern "C" fn rs_snmp_tx_get_community(tx: &mut SNMPTransaction,
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction, pub extern "C" fn rs_snmp_tx_get_pdu_type(tx: &mut SNMPTransaction,
pdu_type: *mut libc::uint32_t) pdu_type: *mut u32)
{ {
unsafe { unsafe {
match tx.info { match tx.info {
Some(ref info) => { Some(ref info) => {
*pdu_type = info.pdu_type.0 as libc::uint32_t; *pdu_type = info.pdu_type.0 as u32;
}, },
None => { None => {
*pdu_type = 0xffffffff; *pdu_type = 0xffffffff;

@ -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, pub extern "C" fn rs_snmp_parse_request(_flow: *const core::Flow,
state: *mut libc::c_void, state: *mut libc::c_void,
_pstate: *mut libc::c_void, _pstate: *mut libc::c_void,
input: *const libc::uint8_t, input: *const u8,
input_len: u32, input_len: u32,
_data: *const libc::c_void, _data: *const libc::c_void,
_flags: u8) -> i32 { _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, pub extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow,
state: *mut libc::c_void, state: *mut libc::c_void,
_pstate: *mut libc::c_void, _pstate: *mut libc::c_void,
input: *const libc::uint8_t, input: *const u8,
input_len: u32, input_len: u32,
_data: *const libc::c_void, _data: *const libc::c_void,
_flags: u8) -> i32 { _flags: u8) -> i32 {
@ -343,7 +343,7 @@ pub extern "C" fn rs_snmp_parse_response(_flow: *const core::Flow,
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_state_get_tx(state: *mut libc::c_void, 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 -> *mut libc::c_void
{ {
let state = cast_pointer!(state,SNMPState); 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] #[no_mangle]
pub extern "C" fn rs_snmp_state_get_tx_count(state: *mut libc::c_void) 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); let state = cast_pointer!(state,SNMPState);
state.tx_id state.tx_id
@ -363,7 +363,7 @@ pub extern "C" fn rs_snmp_state_get_tx_count(state: *mut libc::c_void)
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_state_tx_free(state: *mut libc::c_void, 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); let state = cast_pointer!(state,SNMPState);
state.free_tx(tx_id); 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] #[no_mangle]
pub extern "C" fn rs_snmp_state_progress_completion_status( pub extern "C" fn rs_snmp_state_progress_completion_status(
_direction: libc::uint8_t) _direction: u8)
-> libc::c_int -> libc::c_int
{ {
return 1; return 1;
@ -379,7 +379,7 @@ pub extern "C" fn rs_snmp_state_progress_completion_status(
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut libc::c_void, pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut libc::c_void,
_direction: libc::uint8_t) _direction: u8)
-> libc::c_int -> libc::c_int
{ {
1 1
@ -392,7 +392,7 @@ pub extern "C" fn rs_snmp_tx_get_alstate_progress(_tx: *mut libc::c_void,
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_tx_set_logged(_state: *mut libc::c_void, pub extern "C" fn rs_snmp_tx_set_logged(_state: *mut libc::c_void,
tx: *mut libc::c_void, tx: *mut libc::c_void,
logged: libc::uint32_t) logged: u32)
{ {
let tx = cast_pointer!(tx,SNMPTransaction); let tx = cast_pointer!(tx,SNMPTransaction);
tx.logged.set(logged); tx.logged.set(logged);
@ -433,7 +433,7 @@ pub extern "C" fn rs_snmp_state_get_tx_detect_state(
#[no_mangle] #[no_mangle]
pub extern "C" fn rs_snmp_state_get_events(state: *mut libc::c_void, 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 -> *mut core::AppLayerDecoderEvents
{ {
let state = cast_pointer!(state,SNMPState); 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] #[no_mangle]
pub extern "C" fn rs_snmp_state_get_tx_iterator( pub extern "C" fn rs_snmp_state_get_tx_iterator(
state: &mut SNMPState, state: &mut SNMPState,
min_tx_id: libc::uint64_t, min_tx_id: u64,
istate: &mut libc::uint64_t) istate: &mut u64)
-> applayer::AppLayerGetTxIterTuple -> applayer::AppLayerGetTxIterTuple
{ {
match state.get_tx_iterator(min_tx_id, istate) { 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] #[no_mangle]
pub extern "C" fn rs_snmp_probing_parser(_flow: *const Flow, pub extern "C" fn rs_snmp_probing_parser(_flow: *const Flow,
_direction: u8, _direction: u8,
input:*const libc::uint8_t, input:*const u8,
input_len: u32, input_len: u32,
_rdir: *mut u8) -> AppProto { _rdir: *mut u8) -> AppProto {
let slice = build_slice!(input,input_len as usize); let slice = build_slice!(input,input_len as usize);

Loading…
Cancel
Save