pub type GetEventInfoByIdFn = unsafe extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> i8;
pub type LocalStorageNewFn = extern "C" fn () -> *mut c_void;
pub type LocalStorageFreeFn = extern "C" fn (*mut c_void);
-pub type GetTxFilesFn = unsafe extern "C" fn (*mut c_void, *mut c_void, u8) -> AppLayerGetFileState;
+pub type GetTxFilesFn = unsafe extern "C" fn (*mut c_void, u8) -> AppLayerGetFileState;
pub type GetTxIteratorFn = unsafe extern "C" fn (ipproto: u8, alproto: AppProto,
state: *mut c_void,
min_tx_id: u64,
#[no_mangle]
pub unsafe extern "C" fn rs_http2_getfiles(
- _state: *mut std::os::raw::c_void,
tx: *mut std::os::raw::c_void, direction: u8,
) -> AppLayerGetFileState {
let tx = cast_pointer!(tx, HTTP2Transaction);
}
#[no_mangle]
-pub unsafe extern "C" fn rs_nfs_gettxfiles(_state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState {
+pub unsafe extern "C" fn rs_nfs_gettxfiles(tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState {
let tx = cast_pointer!(tx, NFSTransaction);
if let Some(NFSTransactionTypeData::FILE(ref mut tdf)) = tx.type_data {
let tx_dir : u8 = tdf.direction.into();
use crate::applayer::AppLayerGetFileState;
#[no_mangle]
-pub unsafe extern "C" fn rs_smb_gettxfiles(_state: *mut std::ffi::c_void, tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState {
+pub unsafe extern "C" fn rs_smb_gettxfiles(tx: *mut std::ffi::c_void, direction: u8) -> AppLayerGetFileState {
let tx = cast_pointer!(tx, SMBTransaction);
if let Some(SMBTransactionTypeData::FILE(ref mut tdf)) = tx.type_data {
let tx_dir : u8 = tdf.direction.into();
return FTPDATA_STATE_FINISHED;
}
-static AppLayerGetFileState FTPDataStateGetTxFiles(void *_state, void *tx, uint8_t direction)
+static AppLayerGetFileState FTPDataStateGetTxFiles(void *tx, uint8_t direction)
{
FtpDataState *ftpdata_state = (FtpDataState *)tx;
AppLayerGetFileState files = { .fc = NULL, .cfg = &sbcfg };
* \param direction flow direction
* \retval files files ptr
*/
-static AppLayerGetFileState HTPGetTxFiles(void *state, void *txv, uint8_t direction)
+static AppLayerGetFileState HTPGetTxFiles(void *txv, uint8_t direction)
{
AppLayerGetFileState files = { .fc = NULL, .cfg = &htp_sbcfg };
htp_tx_t *tx = (htp_tx_t *)txv;
void *tx_ptr = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP1, http_state, 0);
FAIL_IF_NULL(tx_ptr);
- AppLayerGetFileState files = HTPGetTxFiles(http_state, tx_ptr, STREAM_TOCLIENT);
+ AppLayerGetFileState files = HTPGetTxFiles(tx_ptr, STREAM_TOCLIENT);
FileContainer *ffc = files.fc;
FAIL_IF_NULL(ffc);
/** get FileContainer reference from the TX. MUST return a non-NULL reference if the TX
* has or may have files in the requested direction at some point. */
- AppLayerGetFileState (*GetTxFiles)(void *, void *, uint8_t);
+ AppLayerGetFileState (*GetTxFiles)(void *, uint8_t);
int (*StateGetProgress)(void *alstate, uint8_t direction);
uint64_t (*StateGetTxCnt)(void *alstate);
SCReturn;
}
-void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto,
- AppLayerGetFileState (*GetTxFiles)(void *, void *, uint8_t))
+void AppLayerParserRegisterGetTxFilesFunc(
+ uint8_t ipproto, AppProto alproto, AppLayerGetFileState (*GetTxFiles)(void *, uint8_t))
{
SCEnter();
SCReturnPtr(ptr, "AppLayerDecoderEvents *");
}
-AppLayerGetFileState AppLayerParserGetTxFiles(
- const Flow *f, void *state, void *tx, const uint8_t direction)
+AppLayerGetFileState AppLayerParserGetTxFiles(const Flow *f, void *tx, const uint8_t direction)
{
SCEnter();
if (alp_ctx.ctxs[f->protomap][f->alproto].GetTxFiles != NULL) {
- return alp_ctx.ctxs[f->protomap][f->alproto].GetTxFiles(state, tx, direction);
+ return alp_ctx.ctxs[f->protomap][f->alproto].GetTxFiles(tx, direction);
}
AppLayerGetFileState files = { .fc = NULL, .cfg = NULL };
static void AppLayerParserFileTxHousekeeping(
const Flow *f, void *tx, const uint8_t pkt_dir, const bool trunc)
{
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, FlowGetAppState(f), tx, pkt_dir);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, tx, pkt_dir);
if (files.fc) {
FilesPrune(files.fc, files.cfg, trunc);
}
void *(*LocalStorageAlloc)(void), void (*LocalStorageFree)(void *));
// void AppLayerParserRegisterGetEventsFunc(uint8_t ipproto, AppProto proto,
// AppLayerDecoderEvents *(*StateGetEvents)(void *) __attribute__((nonnull)));
-void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto,
- AppLayerGetFileState (*GetTxFiles)(void *, void *, uint8_t));
+void AppLayerParserRegisterGetTxFilesFunc(
+ uint8_t ipproto, AppProto alproto, AppLayerGetFileState (*GetTxFiles)(void *, uint8_t));
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits);
void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate);
AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx);
-AppLayerGetFileState AppLayerParserGetTxFiles(
- const Flow *f, void *state, void *tx, const uint8_t direction);
+AppLayerGetFileState AppLayerParserGetTxFiles(const Flow *f, void *tx, const uint8_t direction);
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
void *alstate, uint8_t direction);
uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate);
void *(*LocalStorageAlloc)(void);
void (*LocalStorageFree)(void *);
- AppLayerGetFileState (*GetTxFiles)(void *, void *, uint8_t);
+ AppLayerGetFileState (*GetTxFiles)(void *, uint8_t);
AppLayerGetTxIterTuple (*GetTxIterator)(const uint8_t ipproto,
const AppProto alproto, void *alstate, uint64_t min_tx_id,
return tx->done;
}
-static AppLayerGetFileState SMTPGetTxFiles(void *state, void *txv, uint8_t direction)
+static AppLayerGetFileState SMTPGetTxFiles(void *txv, uint8_t direction)
{
AppLayerGetFileState files = { .fc = NULL, .cfg = &smtp_config.sbcfg };
SMTPTransaction *tx = (SMTPTransaction *)txv;
DEBUG_VALIDATE_BUG_ON(f->alstate != alstate);
const uint8_t direction = flags & (STREAM_TOSERVER|STREAM_TOCLIENT);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, alstate, tx, direction);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, tx, direction);
FileContainer *ffc = files.fc;
SCLogDebug("tx %p tx_id %" PRIu64 " ffc %p ffc->head %p sid %u", tx, tx_id, ffc,
ffc ? ffc->head : NULL, s->id);
SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
FAIL_IF(!(PacketAlertCheck(p, 1)));
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
fc = files.fc;
FAIL_IF_NULL(fc);
file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
fc = files.fc;
FAIL_IF_NULL(fc);
file = fc->head;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
FileContainer *fc = files.fc;
FAIL_IF_NULL(fc);
File *file = fc->head;
tx_ud = htp_tx_get_user_data(tx);
FAIL_IF_NULL(tx_ud);
- files = AppLayerParserGetTxFiles(p->flow, http_state, tx, STREAM_TOSERVER);
+ files = AppLayerParserGetTxFiles(p->flow, tx, STREAM_TOSERVER);
fc = files.fc;
FAIL_IF_NULL(fc);
file = fc->head;
transforms = engine->v2.transforms;
}
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc == NULL) {
return DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES;
const MpmCtx *mpm_ctx = ctx->mpm_ctx;
const int list_id = ctx->list_id;
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, f->alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc != NULL) {
int local_file_id = 0;
transforms = engine->v2.transforms;
}
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc == NULL) {
return DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES;
const MpmCtx *mpm_ctx = ctx->mpm_ctx;
const int list_id = ctx->list_id;
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, f->alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc != NULL) {
int local_file_id = 0;
transforms = engine->v2.transforms;
}
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc == NULL) {
return DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES;
const MpmCtx *mpm_ctx = ctx->mpm_ctx;
const int list_id = ctx->list_id;
- AppLayerGetFileState files = AppLayerParserGetTxFiles(f, f->alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(f, txv, flags);
FileContainer *ffc = files.fc;
if (ffc != NULL) {
int local_file_id = 0;
p->flow->proto, p->flow->alproto, alstate, det_ctx->filestore[u].tx_id);
DEBUG_VALIDATE_BUG_ON(txv == NULL);
if (txv) {
- AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, alstate, txv, flags);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, txv, flags);
FileContainer *ffc_tx = files.fc;
DEBUG_VALIDATE_BUG_ON(ffc_tx == NULL);
if (ffc_tx) {
if (p->flow->alstate != NULL) {
void *tx = AppLayerParserGetTx(p->flow->proto, p->flow->alproto, p->flow->alstate, tx_id);
if (tx) {
- AppLayerGetFileState files =
- AppLayerParserGetTxFiles(p->flow, p->flow->alstate, tx, direction);
+ AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, direction);
ffc = files.fc;
}
}
opposing_dir == STREAM_TOSERVER ? "TOSERVER" : "TOCLIENT", packet_dir_ready,
opposing_dir_ready);
- AppLayerGetFileState app_files =
- AppLayerParserGetTxFiles(f, FlowGetAppState(f), tx, packet_dir);
+ AppLayerGetFileState app_files = AppLayerParserGetTxFiles(f, tx, packet_dir);
FileContainer *ffc = app_files.fc;
- AppLayerGetFileState app_files_opposing =
- AppLayerParserGetTxFiles(f, FlowGetAppState(f), tx, opposing_dir);
+ AppLayerGetFileState app_files_opposing = AppLayerParserGetTxFiles(f, tx, opposing_dir);
FileContainer *ffc_opposing = app_files_opposing.fc;
/* see if opposing side is finished: if no file support in this direction, of is not