rust: fix libc deprecation warnings for int types

pull/3906/head
Victor Julien 6 years ago
parent cdd061ba37
commit bf1bd407dd

@ -258,7 +258,7 @@ export_tx_set_detect_state!(
pub extern "C" fn rs_template_probing_parser(
_flow: *const Flow,
_direction: u8,
input: *const libc::uint8_t,
input: *const u8,
input_len: u32,
_rdir: *mut u8
) -> AppProto {
@ -288,7 +288,7 @@ pub extern "C" fn rs_template_state_free(state: *mut libc::c_void) {
#[no_mangle]
pub extern "C" fn rs_template_state_tx_free(
state: *mut libc::c_void,
tx_id: libc::uint64_t,
tx_id: u64,
) {
let state = cast_pointer!(state, TemplateState);
state.free_tx(tx_id);
@ -299,7 +299,7 @@ pub extern "C" fn rs_template_parse_request(
_flow: *const 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,
@ -329,7 +329,7 @@ pub extern "C" fn rs_template_parse_response(
_flow: *const 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,
@ -352,7 +352,7 @@ pub extern "C" fn rs_template_parse_response(
#[no_mangle]
pub extern "C" fn rs_template_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, TemplateState);
match state.get_tx(tx_id) {
@ -368,14 +368,14 @@ pub extern "C" fn rs_template_state_get_tx(
#[no_mangle]
pub extern "C" fn rs_template_state_get_tx_count(
state: *mut libc::c_void,
) -> libc::uint64_t {
) -> u64 {
let state = cast_pointer!(state, TemplateState);
return state.tx_id;
}
#[no_mangle]
pub extern "C" fn rs_template_state_progress_completion_status(
_direction: libc::uint8_t,
_direction: u8,
) -> libc::c_int {
// This parser uses 1 to signal transaction completion status.
return 1;
@ -384,7 +384,7 @@ pub extern "C" fn rs_template_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_template_tx_get_alstate_progress(
tx: *mut libc::c_void,
_direction: libc::uint8_t,
_direction: u8,
) -> libc::c_int {
let tx = cast_pointer!(tx, TemplateTransaction);
@ -408,7 +408,7 @@ pub extern "C" fn rs_template_tx_get_logged(
pub extern "C" fn rs_template_tx_set_logged(
_state: *mut libc::c_void,
tx: *mut libc::c_void,
logged: libc::uint32_t,
logged: u32,
) {
let tx = cast_pointer!(tx, TemplateTransaction);
tx.logged.set(logged);
@ -417,7 +417,7 @@ pub extern "C" fn rs_template_tx_set_logged(
#[no_mangle]
pub extern "C" fn rs_template_state_get_events(
state: *mut libc::c_void,
tx_id: libc::uint64_t,
tx_id: u64,
) -> *mut core::AppLayerDecoderEvents {
let state = cast_pointer!(state, TemplateState);
match state.get_tx(tx_id) {
@ -437,12 +437,12 @@ pub extern "C" fn rs_template_state_get_event_info(
#[no_mangle]
pub extern "C" fn rs_template_state_get_tx_iterator(
_ipproto: libc::uint8_t,
_ipproto: u8,
_alproto: AppProto,
state: *mut libc::c_void,
min_tx_id: libc::uint64_t,
_max_tx_id: libc::uint64_t,
istate: &mut libc::uint64_t,
min_tx_id: u64,
_max_tx_id: u64,
istate: &mut u64,
) -> applayer::AppLayerGetTxIterTuple {
let state = cast_pointer!(state, TemplateState);
match state.tx_iterator(min_tx_id, istate) {
@ -468,15 +468,15 @@ pub extern "C" fn rs_template_state_get_tx_iterator(
#[no_mangle]
pub extern "C" fn rs_template_get_request_buffer(
tx: *mut libc::c_void,
buf: *mut *const libc::uint8_t,
len: *mut libc::uint32_t,
) -> libc::uint8_t
buf: *mut *const u8,
len: *mut u32,
) -> u8
{
let tx = cast_pointer!(tx, TemplateTransaction);
if let Some(ref request) = tx.request {
if request.len() > 0 {
unsafe {
*len = request.len() as libc::uint32_t;
*len = request.len() as u32;
*buf = request.as_ptr();
}
return 1;
@ -489,15 +489,15 @@ pub extern "C" fn rs_template_get_request_buffer(
#[no_mangle]
pub extern "C" fn rs_template_get_response_buffer(
tx: *mut libc::c_void,
buf: *mut *const libc::uint8_t,
len: *mut libc::uint32_t,
) -> libc::uint8_t
buf: *mut *const u8,
len: *mut u32,
) -> u8
{
let tx = cast_pointer!(tx, TemplateTransaction);
if let Some(ref response) = tx.response {
if response.len() > 0 {
unsafe {
*len = response.len() as libc::uint32_t;
*len = response.len() as u32;
*buf = response.as_ptr();
}
return 1;

@ -76,7 +76,7 @@ pub type DetectEngineStateFreeFunc =
pub type AppLayerDecoderEventsSetEventRawFunc =
extern "C" fn (events: *mut *mut AppLayerDecoderEvents,
event: libc::uint8_t);
event: u8);
pub type AppLayerDecoderEventsFreeEventsFunc =
extern "C" fn (events: *mut *mut AppLayerDecoderEvents);
@ -165,7 +165,7 @@ pub fn sc_detect_engine_state_free(state: *mut DetectEngineState)
/// AppLayerDecoderEventsSetEventRaw wrapper.
pub fn sc_app_layer_decoder_events_set_event_raw(
events: *mut *mut AppLayerDecoderEvents, event: libc::uint8_t)
events: *mut *mut AppLayerDecoderEvents, event: u8)
{
unsafe {
if let Some(c) = SC {

@ -220,7 +220,7 @@ impl DHCPState {
#[no_mangle]
pub extern "C" fn rs_dhcp_probing_parser(_flow: *const Flow,
_direction: u8,
input: *const libc::uint8_t,
input: *const u8,
input_len: u32,
_rdir: *mut u8) -> AppProto
{
@ -241,21 +241,21 @@ pub extern "C" fn rs_dhcp_probing_parser(_flow: *const Flow,
#[no_mangle]
pub extern "C" fn rs_dhcp_tx_get_alstate_progress(_tx: *mut libc::c_void,
_direction: libc::uint8_t) -> libc::c_int {
_direction: u8) -> libc::c_int {
// As this is a stateless parser, simply use 1.
return 1;
}
#[no_mangle]
pub extern "C" fn rs_dhcp_state_progress_completion_status(
_direction: libc::uint8_t) -> libc::c_int {
_direction: u8) -> libc::c_int {
// The presence of a transaction means we are complete.
return 1;
}
#[no_mangle]
pub extern "C" fn rs_dhcp_state_get_tx(state: *mut libc::c_void,
tx_id: libc::uint64_t) -> *mut libc::c_void {
tx_id: u64) -> *mut libc::c_void {
let state = cast_pointer!(state, DHCPState);
match state.get_tx(tx_id) {
Some(tx) => {
@ -268,7 +268,7 @@ pub extern "C" fn rs_dhcp_state_get_tx(state: *mut libc::c_void,
}
#[no_mangle]
pub extern "C" fn rs_dhcp_state_get_tx_count(state: *mut libc::c_void) -> libc::uint64_t {
pub extern "C" fn rs_dhcp_state_get_tx_count(state: *mut libc::c_void) -> u64 {
let state = cast_pointer!(state, DHCPState);
return state.tx_id;
}
@ -277,7 +277,7 @@ pub extern "C" fn rs_dhcp_state_get_tx_count(state: *mut libc::c_void) -> libc::
pub extern "C" fn rs_dhcp_parse(_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 {
@ -292,7 +292,7 @@ pub extern "C" fn rs_dhcp_parse(_flow: *const core::Flow,
#[no_mangle]
pub extern "C" fn rs_dhcp_state_tx_free(
state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
{
let state = cast_pointer!(state, DHCPState);
state.free_tx(tx_id);
@ -322,14 +322,14 @@ pub extern "C" fn rs_dhcp_tx_get_logged(_state: *mut libc::c_void, tx: *mut libc
#[no_mangle]
pub extern "C" fn rs_dhcp_tx_set_logged(_state: *mut libc::c_void,
tx: *mut libc::c_void,
logged: libc::uint32_t) {
logged: u32) {
let tx = cast_pointer!(tx, DHCPTransaction);
tx.logged.set(logged);
}
#[no_mangle]
pub extern "C" fn rs_dhcp_state_get_events(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut core::AppLayerDecoderEvents
{
let state = cast_pointer!(state, DHCPState);
@ -369,12 +369,12 @@ pub extern "C" fn rs_dhcp_state_get_event_info(
#[no_mangle]
pub extern "C" fn rs_dhcp_state_get_tx_iterator(
_ipproto: libc::uint8_t,
_ipproto: u8,
_alproto: AppProto,
state: *mut libc::c_void,
min_tx_id: libc::uint64_t,
_max_tx_id: libc::uint64_t,
istate: &mut libc::uint64_t)
min_tx_id: u64,
_max_tx_id: u64,
istate: &mut u64)
-> applayer::AppLayerGetTxIterTuple
{
let state = cast_pointer!(state, DHCPState);

@ -561,7 +561,7 @@ pub extern "C" fn rs_dns_state_free(state: *mut libc::c_void) {
#[no_mangle]
pub extern "C" fn rs_dns_state_tx_free(state: &mut DNSState,
tx_id: libc::uint64_t)
tx_id: u64)
{
state.free_tx(tx_id);
}
@ -571,10 +571,10 @@ pub extern "C" fn rs_dns_state_tx_free(state: &mut DNSState,
pub extern "C" fn rs_dns_parse_request(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t {
-> i8 {
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
if state.parse_request(buf) {
1
@ -587,10 +587,10 @@ pub extern "C" fn rs_dns_parse_request(_flow: *mut core::Flow,
pub extern "C" fn rs_dns_parse_response(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t {
-> i8 {
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
if state.parse_response(buf) {
1
@ -604,10 +604,10 @@ pub extern "C" fn rs_dns_parse_response(_flow: *mut core::Flow,
pub extern "C" fn rs_dns_parse_request_tcp(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t {
-> i8 {
if input_len > 0 {
if input != std::ptr::null_mut() {
let buf = unsafe{
@ -623,10 +623,10 @@ pub extern "C" fn rs_dns_parse_request_tcp(_flow: *mut core::Flow,
pub extern "C" fn rs_dns_parse_response_tcp(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t {
-> i8 {
if input_len > 0 {
if input != std::ptr::null_mut() {
let buf = unsafe{
@ -640,7 +640,7 @@ pub extern "C" fn rs_dns_parse_response_tcp(_flow: *mut core::Flow,
#[no_mangle]
pub extern "C" fn rs_dns_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
SCLogDebug!("rs_dns_state_progress_completion_status");
@ -649,8 +649,8 @@ pub extern "C" fn rs_dns_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_alstate_progress(_tx: &mut DNSTransaction,
_direction: libc::uint8_t)
-> libc::uint8_t
_direction: u8)
-> u8
{
// This is a stateless parser, just the existence of a transaction
// means its complete.
@ -660,8 +660,8 @@ pub extern "C" fn rs_dns_tx_get_alstate_progress(_tx: &mut DNSTransaction,
#[no_mangle]
pub extern "C" fn rs_dns_tx_set_detect_flags(tx: &mut DNSTransaction,
dir: libc::uint8_t,
flags: libc::uint64_t)
dir: u8,
flags: u64)
{
if dir & core::STREAM_TOSERVER != 0 {
tx.detect_flags_ts = flags as u64;
@ -672,20 +672,20 @@ pub extern "C" fn rs_dns_tx_set_detect_flags(tx: &mut DNSTransaction,
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_detect_flags(tx: &mut DNSTransaction,
dir: libc::uint8_t)
-> libc::uint64_t
dir: u8)
-> u64
{
if dir & core::STREAM_TOSERVER != 0 {
return tx.detect_flags_ts as libc::uint64_t;
return tx.detect_flags_ts as u64;
} else {
return tx.detect_flags_tc as libc::uint64_t;
return tx.detect_flags_tc as u64;
}
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_set_logged(_state: &mut DNSState,
tx: &mut DNSTransaction,
logged: libc::uint32_t)
logged: u32)
{
tx.logged.set(logged);
}
@ -700,7 +700,7 @@ pub extern "C" fn rs_dns_tx_get_logged(_state: &mut DNSState,
#[no_mangle]
pub extern "C" fn rs_dns_state_get_tx_count(state: &mut DNSState)
-> libc::uint64_t
-> u64
{
SCLogDebug!("rs_dns_state_get_tx_count: returning {}", state.tx_id);
return state.tx_id;
@ -708,7 +708,7 @@ pub extern "C" fn rs_dns_state_get_tx_count(state: &mut DNSState)
#[no_mangle]
pub extern "C" fn rs_dns_state_get_tx(state: &mut DNSState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut DNSTransaction
{
match state.get_tx(tx_id) {
@ -746,7 +746,7 @@ pub extern "C" fn rs_dns_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_dns_state_get_events(state: &mut DNSState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut core::AppLayerDecoderEvents
{
match state.get_tx(tx_id) {
@ -761,17 +761,17 @@ pub extern "C" fn rs_dns_state_get_events(state: &mut DNSState,
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_query_name(tx: &mut DNSTransaction,
i: libc::uint16_t,
buf: *mut *const libc::uint8_t,
len: *mut libc::uint32_t)
-> libc::uint8_t
i: u16,
buf: *mut *const u8,
len: *mut u32)
-> u8
{
if let &Some(ref request) = &tx.request {
if (i as usize) < request.queries.len() {
let query = &request.queries[i as usize];
if query.name.len() > 0 {
unsafe {
*len = query.name.len() as libc::uint32_t;
*len = query.name.len() as u32;
*buf = query.name.as_ptr();
}
return 1;
@ -785,7 +785,7 @@ pub extern "C" fn rs_dns_tx_get_query_name(tx: &mut DNSTransaction,
//
/// extern uint16_t rs_dns_tx_get_tx_id(RSDNSTransaction *);
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> libc::uint16_t
pub extern "C" fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> u16
{
return tx.tx_id()
}
@ -795,16 +795,16 @@ pub extern "C" fn rs_dns_tx_get_tx_id(tx: &mut DNSTransaction) -> libc::uint16_t
/// extern uint16_t rs_dns_tx_get_response_flags(RSDNSTransaction *);
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_response_flags(tx: &mut DNSTransaction)
-> libc::uint16_t
-> u16
{
return tx.rcode();
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_query_rrtype(tx: &mut DNSTransaction,
i: libc::uint16_t,
rrtype: *mut libc::uint16_t)
-> libc::uint8_t
i: u16,
rrtype: *mut u16)
-> u8
{
if let &Some(ref request) = &tx.request {
if (i as usize) < request.queries.len() {
@ -821,8 +821,8 @@ pub extern "C" fn rs_dns_tx_get_query_rrtype(tx: &mut DNSTransaction,
}
#[no_mangle]
pub extern "C" fn rs_dns_probe(input: *const libc::uint8_t, len: libc::uint32_t)
-> libc::uint8_t
pub extern "C" fn rs_dns_probe(input: *const u8, len: u32)
-> u8
{
let slice: &[u8] = unsafe {
std::slice::from_raw_parts(input as *mut u8, len as usize)
@ -834,9 +834,9 @@ pub extern "C" fn rs_dns_probe(input: *const libc::uint8_t, len: libc::uint32_t)
}
#[no_mangle]
pub extern "C" fn rs_dns_probe_tcp(input: *const libc::uint8_t,
len: libc::uint32_t)
-> libc::uint8_t
pub extern "C" fn rs_dns_probe_tcp(input: *const u8,
len: u32)
-> u8
{
let slice: &[u8] = unsafe {
std::slice::from_raw_parts(input as *mut u8, len as usize)

@ -560,8 +560,8 @@ fn dns_log_json_answer(response: &DNSResponse, flags: u64) -> Json
#[no_mangle]
pub extern "C" fn rs_dns_log_json_query(tx: &mut DNSTransaction,
i: libc::uint16_t,
flags: libc::uint64_t)
i: u16,
flags: u64)
-> *mut JsonT
{
let index = i as usize;
@ -585,7 +585,7 @@ pub extern "C" fn rs_dns_log_json_query(tx: &mut DNSTransaction,
#[no_mangle]
pub extern "C" fn rs_dns_log_json_answer(tx: &mut DNSTransaction,
flags: libc::uint64_t)
flags: u64)
-> *mut JsonT
{
if let &Some(ref response) = &tx.response {
@ -675,8 +675,8 @@ fn dns_log_json_failure_v1(r: &DNSResponse, index: usize, flags: u64)
#[no_mangle]
pub extern "C" fn rs_dns_log_json_answer_v1(tx: &mut DNSTransaction,
i: libc::uint16_t,
flags: libc::uint64_t)
i: u16,
flags: u64)
-> *mut JsonT
{
let index = i as usize;
@ -703,8 +703,8 @@ pub extern "C" fn rs_dns_log_json_answer_v1(tx: &mut DNSTransaction,
#[no_mangle]
pub extern "C" fn rs_dns_log_json_authority_v1(tx: &mut DNSTransaction,
i: libc::uint16_t,
flags: libc::uint64_t)
i: u16,
flags: u64)
-> *mut JsonT
{
let index = i as usize;

@ -58,7 +58,7 @@ named!(pub ftp_pasv_response<u16>,
#[no_mangle]
pub extern "C" fn rs_ftp_pasv_response(input: *const libc::uint8_t, len: libc::uint32_t) -> u16 {
pub extern "C" fn rs_ftp_pasv_response(input: *const u8, len: u32) -> u16 {
let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
match ftp_pasv_response(buf) {
Ok((_, dport)) => {
@ -90,7 +90,7 @@ named!(pub ftp_epsv_response<u16>,
);
#[no_mangle]
pub extern "C" fn rs_ftp_epsv_response(input: *const libc::uint8_t, len: libc::uint32_t) -> u16 {
pub extern "C" fn rs_ftp_epsv_response(input: *const u8, len: u32) -> u16 {
let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
match ftp_epsv_response(buf) {
Ok((_, dport)) => {

@ -450,7 +450,7 @@ pub extern "C" fn rs_ikev2_state_free(state: *mut libc::c_void) {
pub extern "C" fn rs_ikev2_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 {
@ -463,7 +463,7 @@ pub extern "C" fn rs_ikev2_parse_request(_flow: *const core::Flow,
pub extern "C" fn rs_ikev2_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 {
@ -482,7 +482,7 @@ pub extern "C" fn rs_ikev2_parse_response(_flow: *const core::Flow,
#[no_mangle]
pub extern "C" fn rs_ikev2_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,IKEV2State);
@ -494,7 +494,7 @@ pub extern "C" fn rs_ikev2_state_get_tx(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ikev2_state_get_tx_count(state: *mut libc::c_void)
-> libc::uint64_t
-> u64
{
let state = cast_pointer!(state,IKEV2State);
state.tx_id
@ -502,7 +502,7 @@ pub extern "C" fn rs_ikev2_state_get_tx_count(state: *mut libc::c_void)
#[no_mangle]
pub extern "C" fn rs_ikev2_state_tx_free(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
{
let state = cast_pointer!(state,IKEV2State);
state.free_tx(tx_id);
@ -510,7 +510,7 @@ pub extern "C" fn rs_ikev2_state_tx_free(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ikev2_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
return 1;
@ -518,7 +518,7 @@ pub extern "C" fn rs_ikev2_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_ikev2_tx_get_alstate_progress(_tx: *mut libc::c_void,
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
1
@ -531,7 +531,7 @@ pub extern "C" fn rs_ikev2_tx_get_alstate_progress(_tx: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ikev2_tx_set_logged(_state: *mut libc::c_void,
tx: *mut libc::c_void,
logged: libc::uint32_t)
logged: u32)
{
let tx = cast_pointer!(tx,IKEV2Transaction);
tx.logged.set(logged);
@ -572,7 +572,7 @@ pub extern "C" fn rs_ikev2_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_ikev2_state_get_events(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut core::AppLayerDecoderEvents
{
let state = cast_pointer!(state,IKEV2State);
@ -621,7 +621,7 @@ static mut ALPROTO_IKEV2 : AppProto = ALPROTO_UNKNOWN;
#[no_mangle]
pub extern "C" fn rs_ikev2_probing_parser(_flow: *const Flow,
_direction: u8,
input:*const libc::uint8_t, input_len: u32,
input:*const u8, input_len: u32,
_rdir: *mut u8) -> AppProto
{
let slice = build_slice!(input,input_len as usize);

@ -17,13 +17,11 @@
// written by Pierre Chifflier <chifflier@wzdftpd.net>
use libc;
use krb::krb5::KRB5Transaction;
#[no_mangle]
pub unsafe extern "C" fn rs_krb5_tx_get_msgtype(tx: &mut KRB5Transaction,
ptr: *mut libc::uint32_t)
ptr: *mut u32)
{
*ptr = tx.msg_type.0;
}
@ -32,7 +30,7 @@ pub unsafe extern "C" fn rs_krb5_tx_get_msgtype(tx: &mut KRB5Transaction,
/// Return 0 if error code was filled, else 1
#[no_mangle]
pub unsafe extern "C" fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction,
ptr: *mut libc::int32_t) -> u32
ptr: *mut i32) -> u32
{
match tx.error_code {
Some(ref e) => {
@ -45,10 +43,10 @@ pub unsafe extern "C" fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction,
#[no_mangle]
pub unsafe extern "C" fn rs_krb5_tx_get_cname(tx: &mut KRB5Transaction,
i: libc::uint16_t,
buffer: *mut *const libc::uint8_t,
buffer_len: *mut libc::uint32_t)
-> libc::uint8_t
i: u16,
buffer: *mut *const u8,
buffer_len: *mut u32)
-> u8
{
if let Some(ref s) = tx.cname {
if (i as usize) < s.name_string.len() {
@ -63,10 +61,10 @@ pub unsafe extern "C" fn rs_krb5_tx_get_cname(tx: &mut KRB5Transaction,
#[no_mangle]
pub unsafe extern "C" fn rs_krb5_tx_get_sname(tx: &mut KRB5Transaction,
i: libc::uint16_t,
buffer: *mut *const libc::uint8_t,
buffer_len: *mut libc::uint32_t)
-> libc::uint8_t
i: u16,
buffer: *mut *const u8,
buffer_len: *mut u32)
-> u8
{
if let Some(ref s) = tx.sname {
if (i as usize) < s.name_string.len() {

@ -282,7 +282,7 @@ pub extern "C" fn rs_krb5_state_free(state: *mut libc::c_void) {
#[no_mangle]
pub extern "C" fn rs_krb5_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,KRB5State);
@ -294,7 +294,7 @@ pub extern "C" fn rs_krb5_state_get_tx(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_krb5_state_get_tx_count(state: *mut libc::c_void)
-> libc::uint64_t
-> u64
{
let state = cast_pointer!(state,KRB5State);
state.tx_id
@ -302,7 +302,7 @@ pub extern "C" fn rs_krb5_state_get_tx_count(state: *mut libc::c_void)
#[no_mangle]
pub extern "C" fn rs_krb5_state_tx_free(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
{
let state = cast_pointer!(state,KRB5State);
state.free_tx(tx_id);
@ -310,7 +310,7 @@ pub extern "C" fn rs_krb5_state_tx_free(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_krb5_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
return 1;
@ -318,7 +318,7 @@ pub extern "C" fn rs_krb5_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_krb5_tx_get_alstate_progress(_tx: *mut libc::c_void,
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
1
@ -327,7 +327,7 @@ pub extern "C" fn rs_krb5_tx_get_alstate_progress(_tx: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_krb5_tx_set_logged(_state: *mut libc::c_void,
tx: *mut libc::c_void,
logged: libc::uint32_t)
logged: u32)
{
let tx = cast_pointer!(tx,KRB5Transaction);
tx.logged.set(logged);
@ -368,7 +368,7 @@ pub extern "C" fn rs_krb5_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_krb5_state_get_events(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut core::AppLayerDecoderEvents
{
let state = cast_pointer!(state,KRB5State);
@ -407,7 +407,7 @@ static mut ALPROTO_KRB5 : AppProto = ALPROTO_UNKNOWN;
#[no_mangle]
pub extern "C" fn rs_krb5_probing_parser(_flow: *const Flow,
_direction: u8,
input:*const libc::uint8_t, input_len: u32,
input:*const u8, input_len: u32,
_rdir: *mut u8) -> AppProto
{
let slice = build_slice!(input,input_len as usize);
@ -445,7 +445,7 @@ pub extern "C" fn rs_krb5_probing_parser(_flow: *const Flow,
#[no_mangle]
pub extern "C" fn rs_krb5_probing_parser_tcp(_flow: *const Flow,
direction: u8,
input:*const libc::uint8_t, input_len: u32,
input:*const u8, input_len: u32,
rdir: *mut u8) -> AppProto
{
let slice = build_slice!(input,input_len as usize);
@ -470,7 +470,7 @@ pub extern "C" fn rs_krb5_probing_parser_tcp(_flow: *const Flow,
pub extern "C" fn rs_krb5_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 {
@ -483,7 +483,7 @@ pub extern "C" fn rs_krb5_parse_request(_flow: *const core::Flow,
pub extern "C" fn rs_krb5_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 {
@ -496,7 +496,7 @@ pub extern "C" fn rs_krb5_parse_response(_flow: *const core::Flow,
pub extern "C" fn rs_krb5_parse_request_tcp(_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 {
@ -554,7 +554,7 @@ pub extern "C" fn rs_krb5_parse_request_tcp(_flow: *const core::Flow,
pub extern "C" fn rs_krb5_parse_response_tcp(_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 {

@ -26,7 +26,7 @@ use crc::crc32;
#[no_mangle]
pub extern "C" fn rs_nfs_tx_logging_is_filtered(state: &mut NFSState,
tx: &mut NFSTransaction)
-> libc::uint8_t
-> u8
{
// TODO probably best to make this configurable

@ -1349,10 +1349,10 @@ pub extern "C" fn rs_nfs_state_free(state: *mut libc::c_void) {
pub extern "C" fn rs_nfs_parse_request(_flow: *mut Flow,
state: &mut NFSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t
-> i8
{
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
SCLogDebug!("parsing {} bytes of request data", input_len);
@ -1367,8 +1367,8 @@ pub extern "C" fn rs_nfs_parse_request(_flow: *mut Flow,
#[no_mangle]
pub extern "C" fn rs_nfs_parse_request_tcp_gap(
state: &mut NFSState,
input_len: libc::uint32_t)
-> libc::int8_t
input_len: u32)
-> i8
{
if state.parse_tcp_data_ts_gap(input_len as u32) == 0 {
return 1;
@ -1380,10 +1380,10 @@ pub extern "C" fn rs_nfs_parse_request_tcp_gap(
pub extern "C" fn rs_nfs_parse_response(_flow: *mut Flow,
state: &mut NFSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t
-> i8
{
SCLogDebug!("parsing {} bytes of response data", input_len);
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
@ -1398,8 +1398,8 @@ pub extern "C" fn rs_nfs_parse_response(_flow: *mut Flow,
#[no_mangle]
pub extern "C" fn rs_nfs_parse_response_tcp_gap(
state: &mut NFSState,
input_len: libc::uint32_t)
-> libc::int8_t
input_len: u32)
-> i8
{
if state.parse_tcp_data_tc_gap(input_len as u32) == 0 {
return 1;
@ -1412,10 +1412,10 @@ pub extern "C" fn rs_nfs_parse_response_tcp_gap(
pub extern "C" fn rs_nfs_parse_request_udp(_flow: *mut Flow,
state: &mut NFSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t
-> i8
{
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
SCLogDebug!("parsing {} bytes of request data", input_len);
@ -1431,10 +1431,10 @@ pub extern "C" fn rs_nfs_parse_request_udp(_flow: *mut Flow,
pub extern "C" fn rs_nfs_parse_response_udp(_flow: *mut Flow,
state: &mut NFSState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void)
-> libc::int8_t
-> i8
{
SCLogDebug!("parsing {} bytes of response data", input_len);
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
@ -1448,7 +1448,7 @@ pub extern "C" fn rs_nfs_parse_response_udp(_flow: *mut Flow,
#[no_mangle]
pub extern "C" fn rs_nfs_state_get_tx_count(state: &mut NFSState)
-> libc::uint64_t
-> u64
{
SCLogDebug!("rs_nfs_state_get_tx_count: returning {}", state.tx_id);
return state.tx_id;
@ -1456,7 +1456,7 @@ pub extern "C" fn rs_nfs_state_get_tx_count(state: &mut NFSState)
#[no_mangle]
pub extern "C" fn rs_nfs_state_get_tx(state: &mut NFSState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut NFSTransaction
{
match state.get_tx_by_id(tx_id) {
@ -1473,8 +1473,8 @@ pub extern "C" fn rs_nfs_state_get_tx(state: &mut NFSState,
#[no_mangle]
pub extern "C" fn rs_nfs_state_get_tx_iterator(
state: &mut NFSState,
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) {
@ -1491,14 +1491,14 @@ pub extern "C" fn rs_nfs_state_get_tx_iterator(
#[no_mangle]
pub extern "C" fn rs_nfs_state_tx_free(state: &mut NFSState,
tx_id: libc::uint64_t)
tx_id: u64)
{
state.free_tx(tx_id);
}
#[no_mangle]
pub extern "C" fn rs_nfs_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
return 1;
@ -1506,8 +1506,8 @@ pub extern "C" fn rs_nfs_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_nfs_tx_get_alstate_progress(tx: &mut NFSTransaction,
direction: libc::uint8_t)
-> libc::uint8_t
direction: u8)
-> u8
{
if direction == STREAM_TOSERVER && tx.request_done {
//SCLogNotice!("TOSERVER progress 1");
@ -1524,7 +1524,7 @@ pub extern "C" fn rs_nfs_tx_get_alstate_progress(tx: &mut NFSTransaction,
#[no_mangle]
pub extern "C" fn rs_nfs_tx_set_logged(_state: &mut NFSState,
tx: &mut NFSTransaction,
logged: libc::uint32_t)
logged: u32)
{
tx.logged.set(logged);
}
@ -1565,8 +1565,8 @@ pub extern "C" fn rs_nfs_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_nfs_tx_set_detect_flags(
tx: &mut NFSTransaction,
direction: libc::uint8_t,
flags: libc::uint64_t)
direction: u8,
flags: u64)
{
if (direction & STREAM_TOSERVER) != 0 {
tx.detect_flags_ts = flags as u64;
@ -1578,19 +1578,19 @@ pub extern "C" fn rs_nfs_tx_set_detect_flags(
#[no_mangle]
pub extern "C" fn rs_nfs_tx_get_detect_flags(
tx: &mut NFSTransaction,
direction: libc::uint8_t)
-> libc::uint64_t
direction: u8)
-> u64
{
if (direction & STREAM_TOSERVER) != 0 {
return tx.detect_flags_ts as libc::uint64_t;
return tx.detect_flags_ts as u64;
} else {
return tx.detect_flags_tc as libc::uint64_t;
return tx.detect_flags_tc as u64;
}
}
#[no_mangle]
pub extern "C" fn rs_nfs_state_get_events(state: &mut NFSState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut AppLayerDecoderEvents
{
match state.get_tx_by_id(tx_id) {
@ -1634,13 +1634,13 @@ pub extern "C" fn rs_nfs_state_get_event_info(event_name: *const libc::c_char,
/// Keep calling until 0 is returned.
#[no_mangle]
pub extern "C" fn rs_nfs_tx_get_procedures(tx: &mut NFSTransaction,
i: libc::uint16_t,
procedure: *mut libc::uint32_t)
-> libc::uint8_t
i: u16,
procedure: *mut u32)
-> u8
{
if i == 0 {
unsafe {
*procedure = tx.procedure as libc::uint32_t;
*procedure = tx.procedure as u32;
}
return 1;
}
@ -1656,7 +1656,7 @@ pub extern "C" fn rs_nfs_tx_get_procedures(tx: &mut NFSTransaction,
if idx < tdf.file_additional_procs.len() {
let p = tdf.file_additional_procs[idx];
unsafe {
*procedure = p as libc::uint32_t;
*procedure = p as u32;
}
return 1;
}
@ -1666,10 +1666,10 @@ pub extern "C" fn rs_nfs_tx_get_procedures(tx: &mut NFSTransaction,
#[no_mangle]
pub extern "C" fn rs_nfs_tx_get_version(tx: &mut NFSTransaction,
version: *mut libc::uint32_t)
version: *mut u32)
{
unsafe {
*version = tx.nfs_version as libc::uint32_t;
*version = tx.nfs_version as u32;
}
}
@ -1795,8 +1795,8 @@ pub fn nfs_probe_udp(i: &[u8], direction: u8) -> i8 {
/// MIDSTREAM
#[no_mangle]
pub extern "C" fn rs_nfs_probe_ms(
direction: libc::uint8_t, input: *const libc::uint8_t,
len: libc::uint32_t, rdir: *mut u8) -> libc::int8_t
direction: u8, input: *const u8,
len: u32, rdir: *mut u8) -> i8
{
let slice: &[u8] = build_slice!(input, len as usize);
SCLogDebug!("rs_nfs_probe_ms: probing direction {:02x}", direction);
@ -1828,9 +1828,9 @@ pub extern "C" fn rs_nfs_probe_ms(
}
#[no_mangle]
pub extern "C" fn rs_nfs_probe(direction: libc::uint8_t,
input: *const libc::uint8_t, len: libc::uint32_t)
-> libc::int8_t
pub extern "C" fn rs_nfs_probe(direction: u8,
input: *const u8, len: u32)
-> i8
{
let slice: &[u8] = build_slice!(input, len as usize);
SCLogDebug!("rs_nfs_probe: running probe");
@ -1839,8 +1839,8 @@ pub extern "C" fn rs_nfs_probe(direction: libc::uint8_t,
/// TOSERVER probe function
#[no_mangle]
pub extern "C" fn rs_nfs_probe_udp_ts(input: *const libc::uint8_t, len: libc::uint32_t)
-> libc::int8_t
pub extern "C" fn rs_nfs_probe_udp_ts(input: *const u8, len: u32)
-> i8
{
let slice: &[u8] = build_slice!(input, len as usize);
return nfs_probe_udp(slice, STREAM_TOSERVER);
@ -1848,8 +1848,8 @@ pub extern "C" fn rs_nfs_probe_udp_ts(input: *const libc::uint8_t, len: libc::ui
/// TOCLIENT probe function
#[no_mangle]
pub extern "C" fn rs_nfs_probe_udp_tc(input: *const libc::uint8_t, len: libc::uint32_t)
-> libc::int8_t
pub extern "C" fn rs_nfs_probe_udp_tc(input: *const u8, len: u32)
-> i8
{
let slice: &[u8] = build_slice!(input, len as usize);
return nfs_probe_udp(slice, STREAM_TOCLIENT);

@ -193,7 +193,7 @@ pub extern "C" fn rs_ntp_state_free(state: *mut libc::c_void) {
pub extern "C" fn rs_ntp_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 {
@ -206,7 +206,7 @@ pub extern "C" fn rs_ntp_parse_request(_flow: *const core::Flow,
pub extern "C" fn rs_ntp_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 {
@ -217,7 +217,7 @@ pub extern "C" fn rs_ntp_parse_response(_flow: *const core::Flow,
#[no_mangle]
pub extern "C" fn rs_ntp_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,NTPState);
@ -229,7 +229,7 @@ pub extern "C" fn rs_ntp_state_get_tx(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ntp_state_get_tx_count(state: *mut libc::c_void)
-> libc::uint64_t
-> u64
{
let state = cast_pointer!(state,NTPState);
state.tx_id
@ -237,7 +237,7 @@ pub extern "C" fn rs_ntp_state_get_tx_count(state: *mut libc::c_void)
#[no_mangle]
pub extern "C" fn rs_ntp_state_tx_free(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
{
let state = cast_pointer!(state,NTPState);
state.free_tx(tx_id);
@ -245,7 +245,7 @@ pub extern "C" fn rs_ntp_state_tx_free(state: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ntp_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
return 1;
@ -253,7 +253,7 @@ pub extern "C" fn rs_ntp_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_ntp_tx_get_alstate_progress(_tx: *mut libc::c_void,
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
1
@ -266,7 +266,7 @@ pub extern "C" fn rs_ntp_tx_get_alstate_progress(_tx: *mut libc::c_void,
#[no_mangle]
pub extern "C" fn rs_ntp_tx_set_logged(_state: &mut NTPState,
tx: &mut NTPTransaction,
logged: libc::uint32_t)
logged: u32)
{
tx.logged.set(logged);
}
@ -305,7 +305,7 @@ pub extern "C" fn rs_ntp_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_ntp_state_get_events(state: *mut libc::c_void,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut core::AppLayerDecoderEvents
{
let state = cast_pointer!(state,NTPState);

@ -25,9 +25,9 @@ use smb::smb::*;
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_share(tx: &mut SMBTransaction,
buffer: *mut *const libc::uint8_t,
buffer_len: *mut libc::uint32_t)
-> libc::uint8_t
buffer: *mut *const u8,
buffer_len: *mut u32)
-> u8
{
match tx.type_data {
Some(SMBTransactionTypeData::TREECONNECT(ref x)) => {
@ -35,7 +35,7 @@ pub extern "C" fn rs_smb_tx_get_share(tx: &mut SMBTransaction,
if !x.is_pipe {
unsafe {
*buffer = x.share_name.as_ptr();
*buffer_len = x.share_name.len() as libc::uint32_t;
*buffer_len = x.share_name.len() as u32;
return 1;
}
}
@ -53,9 +53,9 @@ pub extern "C" fn rs_smb_tx_get_share(tx: &mut SMBTransaction,
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_named_pipe(tx: &mut SMBTransaction,
buffer: *mut *const libc::uint8_t,
buffer_len: *mut libc::uint32_t)
-> libc::uint8_t
buffer: *mut *const u8,
buffer_len: *mut u32)
-> u8
{
match tx.type_data {
Some(SMBTransactionTypeData::TREECONNECT(ref x)) => {
@ -63,7 +63,7 @@ pub extern "C" fn rs_smb_tx_get_named_pipe(tx: &mut SMBTransaction,
if x.is_pipe {
unsafe {
*buffer = x.share_name.as_ptr();
*buffer_len = x.share_name.len() as libc::uint32_t;
*buffer_len = x.share_name.len() as u32;
return 1;
}
}
@ -82,9 +82,9 @@ pub extern "C" fn rs_smb_tx_get_named_pipe(tx: &mut SMBTransaction,
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_stub_data(tx: &mut SMBTransaction,
direction: u8,
buffer: *mut *const libc::uint8_t,
buffer_len: *mut libc::uint32_t)
-> libc::uint8_t
buffer: *mut *const u8,
buffer_len: *mut u32)
-> u8
{
match tx.type_data {
Some(SMBTransactionTypeData::DCERPC(ref x)) => {
@ -96,7 +96,7 @@ pub extern "C" fn rs_smb_tx_get_stub_data(tx: &mut SMBTransaction,
if vref.len() > 0 {
unsafe {
*buffer = vref.as_ptr();
*buffer_len = vref.len() as libc::uint32_t;
*buffer_len = vref.len() as u32;
return 1;
}
}
@ -114,15 +114,15 @@ pub extern "C" fn rs_smb_tx_get_stub_data(tx: &mut SMBTransaction,
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_dce_opnum(tx: &mut SMBTransaction,
opnum: *mut libc::uint16_t)
-> libc::uint8_t
opnum: *mut u16)
-> u8
{
SCLogDebug!("rs_smb_tx_get_dce_opnum: start");
match tx.type_data {
Some(SMBTransactionTypeData::DCERPC(ref x)) => {
if x.req_cmd == 1 { // REQUEST
unsafe {
*opnum = x.opnum as libc::uint16_t;
*opnum = x.opnum as u16;
return 1;
}
}
@ -178,11 +178,11 @@ fn match_version(op: u8, them: u16, us: u16) -> bool {
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_dce_iface(state: &mut SMBState,
tx: &mut SMBTransaction,
uuid_ptr: *mut libc::uint8_t,
uuid_len: libc::uint16_t,
ver_op: libc::uint8_t,
ver_check: libc::uint16_t)
-> libc::uint8_t
uuid_ptr: *mut u8,
uuid_len: u16,
ver_op: u8,
ver_check: u16)
-> u8
{
let is_dcerpc_request = match tx.type_data {
Some(SMBTransactionTypeData::DCERPC(ref x)) => { x.req_cmd == 1 },

@ -1796,11 +1796,11 @@ pub extern "C" fn rs_smb_state_free(state: *mut libc::c_void) {
pub extern "C" fn rs_smb_parse_request_tcp(_flow: *mut Flow,
state: &mut SMBState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void,
flags: u8)
-> libc::int8_t
-> i8
{
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
SCLogDebug!("parsing {} bytes of request data", input_len);
@ -1820,8 +1820,8 @@ pub extern "C" fn rs_smb_parse_request_tcp(_flow: *mut Flow,
#[no_mangle]
pub extern "C" fn rs_smb_parse_request_tcp_gap(
state: &mut SMBState,
input_len: libc::uint32_t)
-> libc::int8_t
input_len: u32)
-> i8
{
if state.parse_tcp_data_ts_gap(input_len as u32) == 0 {
return 1;
@ -1834,11 +1834,11 @@ pub extern "C" fn rs_smb_parse_request_tcp_gap(
pub extern "C" fn rs_smb_parse_response_tcp(_flow: *mut Flow,
state: &mut SMBState,
_pstate: *mut libc::c_void,
input: *mut libc::uint8_t,
input_len: libc::uint32_t,
input: *mut u8,
input_len: u32,
_data: *mut libc::c_void,
flags: u8)
-> libc::int8_t
-> i8
{
SCLogDebug!("parsing {} bytes of response data", input_len);
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
@ -1858,8 +1858,8 @@ pub extern "C" fn rs_smb_parse_response_tcp(_flow: *mut Flow,
#[no_mangle]
pub extern "C" fn rs_smb_parse_response_tcp_gap(
state: &mut SMBState,
input_len: libc::uint32_t)
-> libc::int8_t
input_len: u32)
-> i8
{
if state.parse_tcp_data_tc_gap(input_len as u32) == 0 {
return 1;
@ -1870,10 +1870,10 @@ pub extern "C" fn rs_smb_parse_response_tcp_gap(
// probing parser
// return 1 if found, 0 is not found
#[no_mangle]
pub extern "C" fn rs_smb_probe_tcp(direction: libc::uint8_t,
input: *const libc::uint8_t, len: libc::uint32_t,
rdir: *mut libc::uint8_t)
-> libc::int8_t
pub extern "C" fn rs_smb_probe_tcp(direction: u8,
input: *const u8, len: u32,
rdir: *mut u8)
-> i8
{
let slice = build_slice!(input, len as usize);
match search_smb_record(slice) {
@ -1952,7 +1952,7 @@ pub extern "C" fn rs_smb_probe_tcp(direction: libc::uint8_t,
#[no_mangle]
pub extern "C" fn rs_smb_state_get_tx_count(state: &mut SMBState)
-> libc::uint64_t
-> u64
{
SCLogDebug!("rs_smb_state_get_tx_count: returning {}", state.tx_id);
return state.tx_id;
@ -1960,7 +1960,7 @@ pub extern "C" fn rs_smb_state_get_tx_count(state: &mut SMBState)
#[no_mangle]
pub extern "C" fn rs_smb_state_get_tx(state: &mut SMBState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut SMBTransaction
{
match state.get_tx_by_id(tx_id) {
@ -1977,8 +1977,8 @@ pub extern "C" fn rs_smb_state_get_tx(state: &mut SMBState,
#[no_mangle]
pub extern "C" fn rs_smb_state_get_tx_iterator(
state: &mut SMBState,
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) {
@ -1995,7 +1995,7 @@ pub extern "C" fn rs_smb_state_get_tx_iterator(
#[no_mangle]
pub extern "C" fn rs_smb_state_tx_free(state: &mut SMBState,
tx_id: libc::uint64_t)
tx_id: u64)
{
SCLogDebug!("freeing tx {}", tx_id as u64);
state.free_tx(tx_id);
@ -2003,7 +2003,7 @@ pub extern "C" fn rs_smb_state_tx_free(state: &mut SMBState,
#[no_mangle]
pub extern "C" fn rs_smb_state_progress_completion_status(
_direction: libc::uint8_t)
_direction: u8)
-> libc::c_int
{
return 1;
@ -2011,8 +2011,8 @@ pub extern "C" fn rs_smb_state_progress_completion_status(
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_alstate_progress(tx: &mut SMBTransaction,
direction: libc::uint8_t)
-> libc::uint8_t
direction: u8)
-> u8
{
if direction == STREAM_TOSERVER && tx.request_done {
SCLogDebug!("tx {} TOSERVER progress 1 => {:?}", tx.id, tx);
@ -2029,7 +2029,7 @@ pub extern "C" fn rs_smb_tx_get_alstate_progress(tx: &mut SMBTransaction,
#[no_mangle]
pub extern "C" fn rs_smb_tx_set_logged(_state: &mut SMBState,
tx: &mut SMBTransaction,
bits: libc::uint32_t)
bits: u32)
{
tx.logged.set(bits);
}
@ -2045,8 +2045,8 @@ pub extern "C" fn rs_smb_tx_get_logged(_state: &mut SMBState,
#[no_mangle]
pub extern "C" fn rs_smb_tx_set_detect_flags(
tx: &mut SMBTransaction,
direction: libc::uint8_t,
flags: libc::uint64_t)
direction: u8,
flags: u64)
{
if (direction & STREAM_TOSERVER) != 0 {
tx.detect_flags_ts = flags as u64;
@ -2058,13 +2058,13 @@ pub extern "C" fn rs_smb_tx_set_detect_flags(
#[no_mangle]
pub extern "C" fn rs_smb_tx_get_detect_flags(
tx: &mut SMBTransaction,
direction: libc::uint8_t)
-> libc::uint64_t
direction: u8)
-> u64
{
if (direction & STREAM_TOSERVER) != 0 {
return tx.detect_flags_ts as libc::uint64_t;
return tx.detect_flags_ts as u64;
} else {
return tx.detect_flags_tc as libc::uint64_t;
return tx.detect_flags_tc as u64;
}
}
@ -2094,7 +2094,7 @@ pub extern "C" fn rs_smb_state_get_tx_detect_state(
#[no_mangle]
pub extern "C" fn rs_smb_state_truncate(
state: &mut SMBState,
direction: libc::uint8_t)
direction: u8)
{
if (direction & STREAM_TOSERVER) != 0 {
state.trunc_ts();
@ -2105,7 +2105,7 @@ pub extern "C" fn rs_smb_state_truncate(
#[no_mangle]
pub extern "C" fn rs_smb_state_get_events(state: &mut SMBState,
tx_id: libc::uint64_t)
tx_id: u64)
-> *mut AppLayerDecoderEvents
{
match state.get_tx_by_id(tx_id) {

@ -87,13 +87,13 @@ pub extern "C" fn rs_tftp_state_free(state: *mut libc::c_void) {
#[no_mangle]
pub extern "C" fn rs_tftp_state_tx_free(state: &mut TFTPState,
tx_id: libc::uint64_t) {
tx_id: u64) {
state.free_tx(tx_id);
}
#[no_mangle]
pub extern "C" fn rs_tftp_get_tx(state: &mut TFTPState,
tx_id: libc::uint64_t) -> *mut libc::c_void {
tx_id: u64) -> *mut libc::c_void {
match state.get_tx_by_id(tx_id) {
Some(tx) => unsafe{std::mem::transmute(tx)},
None => std::ptr::null_mut(),
@ -110,7 +110,7 @@ pub extern "C" fn rs_tftp_get_tx_logged(_state: &mut TFTPState,
#[no_mangle]
pub extern "C" fn rs_tftp_set_tx_logged(_state: &mut TFTPState,
tx: &mut TFTPTransaction,
logged: libc::uint32_t) {
logged: u32) {
tx.logged.set(logged);
}
@ -141,8 +141,8 @@ named!(pub tftp_request<TFTPTransaction>,
#[no_mangle]
pub extern "C" fn rs_tftp_request(state: &mut TFTPState,
input: *const libc::uint8_t,
len: libc::uint32_t) -> i64 {
input: *const u8,
len: u32) -> i64 {
let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
return match tftp_request(buf) {
Ok((_, mut rqst)) => {

Loading…
Cancel
Save