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 {
#[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);
_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,
_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,
#[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) {
#[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;
#[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);
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);
#[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) {
#[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) {
#[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;
#[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;
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);
/// 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 {
#[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
{
#[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) => {
}
#[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;
}
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 {
#[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);
#[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);
#[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);
#[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);
}
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
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
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{
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{
#[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");
#[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.
#[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;
#[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);
}
#[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;
#[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) {
#[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) {
#[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;
//
/// 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()
}
/// 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() {
}
#[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)
}
#[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)
#[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;
#[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 {
#[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;
#[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;
#[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)) => {
);
#[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)) => {
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 {
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 {
#[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);
#[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
#[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);
#[no_mangle]
pub extern "C" fn rs_ikev2_state_progress_completion_status(
- _direction: libc::uint8_t)
+ _direction: u8)
-> libc::c_int
{
return 1;
#[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
#[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);
#[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);
#[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);
// 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;
}
/// 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) => {
#[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() {
#[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() {
#[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);
#[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
#[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);
#[no_mangle]
pub extern "C" fn rs_krb5_state_progress_completion_status(
- _direction: libc::uint8_t)
+ _direction: u8)
-> libc::c_int
{
return 1;
#[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
#[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);
#[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);
#[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);
#[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);
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 {
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 {
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 {
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 {
#[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
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);
#[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;
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)};
#[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;
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);
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)};
#[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;
#[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) {
#[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) {
#[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;
#[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");
#[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);
}
#[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;
#[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) {
/// 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;
}
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;
}
#[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;
}
}
/// 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);
}
#[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");
/// 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);
/// 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);
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 {
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 {
#[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);
#[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
#[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);
#[no_mangle]
pub extern "C" fn rs_ntp_state_progress_completion_status(
- _direction: libc::uint8_t)
+ _direction: u8)
-> libc::c_int
{
return 1;
#[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
#[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);
}
#[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);
#[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)) => {
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;
}
}
#[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)) => {
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;
}
}
#[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)) => {
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;
}
}
#[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;
}
}
#[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 },
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);
#[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;
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)};
#[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;
// 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) {
#[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;
#[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) {
#[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) {
#[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);
#[no_mangle]
pub extern "C" fn rs_smb_state_progress_completion_status(
- _direction: libc::uint8_t)
+ _direction: u8)
-> libc::c_int
{
return 1;
#[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);
#[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);
}
#[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;
#[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;
}
}
#[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();
#[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) {
#[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(),
#[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);
}
#[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)) => {