/// Function returning the current transaction progress
pub tx_get_progress: StateGetProgressFn,
- /// Logged transaction getter function
- pub get_tx_logged: Option<GetTxLoggedFn>,
- /// Logged transaction setter function
- pub set_tx_logged: Option<SetTxLoggedFn>,
-
/// Function called to get a detection state
pub get_de_state: GetDetectStateFn,
/// Function called to set a detection state
pub type GetEventInfoFn = extern "C" fn (*const c_char, *mut c_int, *mut AppLayerEventType) -> c_int;
pub type GetEventInfoByIdFn = extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> i8;
pub type GetEventsFn = extern "C" fn (*mut c_void) -> *mut AppLayerDecoderEvents;
-pub type GetTxLoggedFn = extern "C" fn (*mut c_void, *mut c_void) -> u32;
-pub type SetTxLoggedFn = extern "C" fn (*mut c_void, *mut c_void, u32);
pub type LocalStorageNewFn = extern "C" fn () -> *mut c_void;
pub type LocalStorageFreeFn = extern "C" fn (*mut c_void);
pub type GetFilesFn = extern "C" fn (*mut c_void, u8) -> *mut FileContainer;
get_tx: rs_template_state_get_tx,
tx_get_comp_st: rs_template_state_progress_completion_status,
tx_get_progress: rs_template_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_de_state: rs_template_tx_get_detect_state,
set_de_state: rs_template_tx_set_detect_state,
get_events: Some(rs_template_state_get_events),
get_tx : rs_dhcp_state_get_tx,
tx_get_comp_st : rs_dhcp_state_progress_completion_status,
tx_get_progress : rs_dhcp_tx_get_alstate_progress,
- get_tx_logged : None,
- set_tx_logged : None,
get_de_state : rs_dhcp_tx_get_detect_state,
set_de_state : rs_dhcp_tx_set_detect_state,
get_events : Some(rs_dhcp_state_get_events),
get_tx: rs_dns_state_get_tx,
tx_get_comp_st: rs_dns_state_progress_completion_status,
tx_get_progress: rs_dns_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_events: Some(rs_dns_state_get_events),
get_eventinfo: Some(rs_dns_state_get_event_info),
get_eventinfo_byid: Some(rs_dns_state_get_event_info_by_id),
get_tx: rs_dns_state_get_tx,
tx_get_comp_st: rs_dns_state_progress_completion_status,
tx_get_progress: rs_dns_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_events: Some(rs_dns_state_get_events),
get_eventinfo: Some(rs_dns_state_get_event_info),
get_eventinfo_byid: Some(rs_dns_state_get_event_info_by_id),
get_tx : rs_ikev2_state_get_tx,
tx_get_comp_st : rs_ikev2_state_progress_completion_status,
tx_get_progress : rs_ikev2_tx_get_alstate_progress,
- get_tx_logged : None,
- set_tx_logged : None,
get_de_state : rs_ikev2_state_get_tx_detect_state,
set_de_state : rs_ikev2_state_set_tx_detect_state,
get_events : Some(rs_ikev2_state_get_events),
get_tx : rs_krb5_state_get_tx,
tx_get_comp_st : rs_krb5_state_progress_completion_status,
tx_get_progress : rs_krb5_tx_get_alstate_progress,
- get_tx_logged : None,
- set_tx_logged : None,
get_de_state : rs_krb5_state_get_tx_detect_state,
set_de_state : rs_krb5_state_set_tx_detect_state,
get_events : Some(rs_krb5_state_get_events),
get_tx : rs_ntp_state_get_tx,
tx_get_comp_st : rs_ntp_state_progress_completion_status,
tx_get_progress : rs_ntp_tx_get_alstate_progress,
- get_tx_logged : None,
- set_tx_logged : None,
get_de_state : rs_ntp_state_get_tx_detect_state,
set_de_state : rs_ntp_state_set_tx_detect_state,
get_events : Some(rs_ntp_state_get_events),
get_tx: rs_rdp_state_get_tx,
tx_get_comp_st: rs_rdp_tx_get_progress_complete,
tx_get_progress: rs_rdp_tx_get_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_de_state: rs_rdp_tx_get_detect_state,
set_de_state: rs_rdp_tx_set_detect_state,
get_events: None,
get_tx: rs_rfb_state_get_tx,
tx_get_comp_st: rs_rfb_state_progress_completion_status,
tx_get_progress: rs_rfb_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_de_state: rs_rfb_tx_get_detect_state,
set_de_state: rs_rfb_tx_set_detect_state,
get_events: Some(rs_rfb_state_get_events),
get_tx: rs_sip_state_get_tx,
tx_get_comp_st: rs_sip_state_progress_completion_status,
tx_get_progress: rs_sip_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_de_state: rs_sip_state_get_tx_detect_state,
set_de_state: rs_sip_state_set_tx_detect_state,
get_events: Some(rs_sip_state_get_events),
get_tx : rs_snmp_state_get_tx,
tx_get_comp_st : rs_snmp_state_progress_completion_status,
tx_get_progress : rs_snmp_tx_get_alstate_progress,
- get_tx_logged : None,
- set_tx_logged : None,
get_de_state : rs_snmp_state_get_tx_detect_state,
set_de_state : rs_snmp_state_set_tx_detect_state,
get_events : Some(rs_snmp_state_get_events),
get_tx: rs_ssh_state_get_tx,
tx_get_comp_st: rs_ssh_state_progress_completion_status,
tx_get_progress: rs_ssh_tx_get_alstate_progress,
- get_tx_logged: None,
- set_tx_logged: None,
get_de_state: rs_ssh_tx_get_detect_state,
set_de_state: rs_ssh_tx_set_detect_state,
get_events: Some(rs_ssh_state_get_events),
int (*StateGetEventInfo)(const char *event_name,
int *event_id, AppLayerEventType *event_type);
- LoggerId (*StateGetTxLogged)(void *alstate, void *tx);
- void (*StateSetTxLogged)(void *alstate, void *tx, LoggerId logger);
-
DetectEngineState *(*GetTxDetectState)(void *tx);
int (*SetTxDetectState)(void *tx, DetectEngineState *);
SCReturn;
}
-void AppLayerParserRegisterLoggerFuncs(uint8_t ipproto, AppProto alproto,
- LoggerId (*StateGetTxLogged)(void *, void *),
- void (*StateSetTxLogged)(void *, void *, LoggerId))
-{
- SCEnter();
-
- alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].StateGetTxLogged =
- StateGetTxLogged;
-
- alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].StateSetTxLogged =
- StateSetTxLogged;
-
- SCReturn;
-}
-
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits)
{
SCEnter();
return Func ? Func : AppLayerDefaultGetTxIterator;
}
-void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto,
- void *alstate, void *tx, LoggerId logger)
-{
- SCEnter();
-
- if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
- StateSetTxLogged != NULL) {
- alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
- StateSetTxLogged(alstate, tx, logger);
- }
-
- SCReturn;
-}
-
-LoggerId AppLayerParserGetTxLogged(const Flow *f,
- void *alstate, void *tx)
-{
- SCEnter();
-
- LoggerId r = 0;
- if (alp_ctx.ctxs[f->protomap][f->alproto].StateGetTxLogged != NULL) {
- r = alp_ctx.ctxs[f->protomap][f->alproto].
- StateGetTxLogged(alstate, tx);
- }
-
- SCReturnUInt(r);
-}
-
uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate)
{
SCEnter();
AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, tx);
if (txd) {
return txd->logged.flags;
- } else {
- return AppLayerParserGetTxLogged(f, alstate, tx);
}
+ return 0;
}
void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate,
printf("- GetTxDetectState %p SetTxDetectState %p\n", ctx->GetTxDetectState, ctx->SetTxDetectState);
printf("Optional:\n");
printf("- LocalStorageAlloc %p LocalStorageFree %p\n", ctx->LocalStorageAlloc, ctx->LocalStorageFree);
- printf("- StateGetTxLogged %p StateSetTxLogged %p\n", ctx->StateGetTxLogged, ctx->StateSetTxLogged);
printf("- StateGetEvents %p StateGetEventInfo %p StateGetEventInfoById %p\n", ctx->StateGetEvents, ctx->StateGetEventInfo,
ctx->StateGetEventInfoById);
}
if (!(BOTH_SET_OR_BOTH_UNSET(ctx->LocalStorageAlloc, ctx->LocalStorageFree))) {
goto bad;
}
- if (!(BOTH_SET_OR_BOTH_UNSET(ctx->StateGetTxLogged, ctx->StateSetTxLogged))) {
- goto bad;
- }
if (!(BOTH_SET(ctx->GetTxDetectState, ctx->SetTxDetectState))) {
goto bad;
}
uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate);
void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id);
-void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate,
- void *tx, LoggerId logged);
-LoggerId AppLayerParserGetTxLogged(const Flow *f, void *alstate, void *tx);
-
uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate,
void *alstate, const uint8_t flags, bool tag_txs_as_inspected);
-/* Copyright (C) 2017 Open Information Security Foundation
+/* Copyright (C) 2017-2020 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
AppLayerParserRegisterGetTx(p->ip_proto, alproto,
p->StateGetTx);
- if (p->StateGetTxLogged && p->StateSetTxLogged) {
- AppLayerParserRegisterLoggerFuncs(p->ip_proto, alproto,
- p->StateGetTxLogged, p->StateSetTxLogged);
- }
-
/* What is this being registered for? */
AppLayerParserRegisterDetectStateFuncs(p->ip_proto, alproto,
p->GetTxDetectState, p->SetTxDetectState);
int (*StateGetProgressCompletionStatus)(uint8_t direction);
int (*StateGetProgress)(void *alstate, uint8_t direction);
- uint32_t (*StateGetTxLogged)(void *alstate, void *tx);
- void (*StateSetTxLogged)(void *alstate, void *tx, uint32_t logger);
-
DetectEngineState *(*GetTxDetectState)(void *tx);
int (*SetTxDetectState)(void *tx, DetectEngineState *);
goto next_tx;
}
- LoggerId tx_logged = txd ? txd->logged.flags : AppLayerParserGetTxLogged(f, alstate, tx);
+ LoggerId tx_logged = txd ? txd->logged.flags : 0;
const LoggerId tx_logged_old = tx_logged;
SCLogDebug("logger: expect %08x, have %08x", logger_expectation, tx_logged);
if (tx_logged == logger_expectation) {
tx_logged, tx_logged_old);
if (txd != NULL) {
txd->logged.flags |= tx_logged;
- } else {
- AppLayerParserSetTxLogged(p->proto, alproto, alstate, tx,
- tx_logged);
}
}