pub const APP_LAYER_PARSER_BYPASS_READY : u16 = BIT_U16!(4);
pub const APP_LAYER_PARSER_EOF_TS : u16 = BIT_U16!(5);
pub const APP_LAYER_PARSER_EOF_TC : u16 = BIT_U16!(6);
+pub const APP_LAYER_PARSER_TRUNC_TS : u16 = BIT_U16!(7);
+pub const APP_LAYER_PARSER_TRUNC_TC : u16 = BIT_U16!(8);
pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0);
pub const APP_LAYER_PARSER_OPT_UNIDIR_TXS: u32 = BIT_U32!(1);
return f->alparser->frames;
}
+static inline void AppLayerParserStreamTruncated(AppLayerParserState *pstate, const uint8_t ipproto,
+ const AppProto alproto, void *alstate, const uint8_t direction);
+
#ifdef UNITTESTS
void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min)
{
if (!(p->option_flags & APP_LAYER_PARSER_OPT_ACCEPT_GAPS)) {
SCLogDebug("app-layer parser does not accept gaps");
if (f->alstate != NULL && !FlowChangeProto(f)) {
- AppLayerParserStreamTruncated(f->proto, alproto, f->alstate,
- flags);
+ AppLayerParserStreamTruncated(pstate, f->proto, alproto, f->alstate, flags);
}
AppLayerIncGapErrorCounter(tv, f);
goto error;
/* stream truncated, inform app layer */
if (flags & STREAM_DEPTH)
- AppLayerParserStreamTruncated(f->proto, alproto, alstate, flags);
+ AppLayerParserStreamTruncated(pstate, f->proto, alproto, f->alstate, flags);
end:
/* update app progress */
SCReturnUInt(pstate->flags & flag);
}
-
-void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
- uint8_t direction)
+static inline void AppLayerParserStreamTruncated(AppLayerParserState *pstate, const uint8_t ipproto,
+ const AppProto alproto, void *alstate, const uint8_t direction)
{
SCEnter();
- if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate != NULL)
+ if (direction & STREAM_TOSERVER) {
+ AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_TRUNC_TS);
+ } else {
+ AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_TRUNC_TC);
+ }
+
+ if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate != NULL) {
alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate(alstate, direction);
+ }
SCReturn;
}
#define APP_LAYER_PARSER_BYPASS_READY BIT_U16(4)
#define APP_LAYER_PARSER_EOF_TS BIT_U16(5)
#define APP_LAYER_PARSER_EOF_TC BIT_U16(6)
+#define APP_LAYER_PARSER_TRUNC_TS BIT_U16(7)
+#define APP_LAYER_PARSER_TRUNC_TC BIT_U16(8)
/* Flags for AppLayerParserProtoCtx. */
#define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U32(0)
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag);
uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag);
-void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
- uint8_t direction);
-
AppLayerParserState *AppLayerParserStateAlloc(void);
void AppLayerParserStateFree(AppLayerParserState *pstate);