/// attempt failed.
pub type_data: Option<NFSTransactionTypeData>,
+ detect_flags_ts: u64,
+ detect_flags_tc: u64,
+
pub logged: LoggerFlags,
pub de_state: Option<*mut DetectEngineState>,
pub events: *mut AppLayerDecoderEvents,
file_tx_direction: 0,
file_handle:Vec::new(),
type_data: None,
+ detect_flags_ts: 0,
+ detect_flags_tc: 0,
logged: LoggerFlags::new(),
de_state: None,
events: std::ptr::null_mut(),
}
}
+#[no_mangle]
+pub extern "C" fn rs_nfs_tx_set_detect_flags(
+ tx: &mut NFSTransaction,
+ direction: libc::uint8_t,
+ flags: libc::uint64_t)
+{
+ if (direction & STREAM_TOSERVER) != 0 {
+ tx.detect_flags_ts = flags as u64;
+ } else {
+ tx.detect_flags_tc = 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
+{
+ if (direction & STREAM_TOSERVER) != 0 {
+ return tx.detect_flags_ts as libc::uint64_t;
+ } else {
+ return tx.detect_flags_tc as libc::uint64_t;
+ }
+}
+
#[no_mangle]
pub extern "C" fn rs_nfs_state_has_events(state: &mut NFSState) -> u8 {
if state.events > 0 {
return rs_nfs3_getfiles(direction, state);
}
+static void NFSTCPSetDetectFlags(void *tx, uint8_t dir, uint64_t flags)
+{
+ rs_nfs_tx_set_detect_flags(tx, dir, flags);
+}
+
+static uint64_t NFSTCPGetDetectFlags(void *tx, uint8_t dir)
+{
+ return rs_nfs_tx_get_detect_flags(tx, dir);
+}
+
static StreamingBufferConfig sbcfg = STREAMING_BUFFER_CONFIG_INITIALIZER;
static SuricataFileContext sfc = { &sbcfg };
AppLayerParserRegisterGetEventsFunc(IPPROTO_TCP, ALPROTO_NFS,
NFSTCPGetEvents);
+ AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_TCP, ALPROTO_NFS,
+ NFSTCPGetDetectFlags, NFSTCPSetDetectFlags);
+
/* This parser accepts gaps. */
AppLayerParserRegisterOptionFlags(IPPROTO_TCP, ALPROTO_NFS,
APP_LAYER_PARSER_OPT_ACCEPT_GAPS);
return rs_nfs3_getfiles(direction, state);
}
+static void NFSSetDetectFlags(void *tx, uint8_t dir, uint64_t flags)
+{
+ rs_nfs_tx_set_detect_flags(tx, dir, flags);
+}
+
+static uint64_t NFSGetDetectFlags(void *tx, uint8_t dir)
+{
+ return rs_nfs_tx_get_detect_flags(tx, dir);
+}
+
static StreamingBufferConfig sbcfg = STREAMING_BUFFER_CONFIG_INITIALIZER;
static SuricataFileContext sfc = { &sbcfg };
NFSStateGetEventInfo);
AppLayerParserRegisterGetEventsFunc(IPPROTO_UDP, ALPROTO_NFS,
NFSGetEvents);
+
+ AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_UDP, ALPROTO_NFS,
+ NFSGetDetectFlags, NFSSetDetectFlags);
+
}
else {
SCLogNotice("NFS protocol parsing disabled.");