mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
detect/engine: helper to know if a transform happens in-place
This commit is contained in:
parent
7bf48b02be
commit
4c42998feb
3 changed files with 11 additions and 0 deletions
|
|
@ -720,6 +720,9 @@ extern "C" {
|
|||
det_ctx: *mut DetectEngineThreadCtx, list_id: ::std::os::raw::c_int,
|
||||
) -> *mut InspectionBuffer;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn SCInspectionBufferInPlace(buffer: *const InspectionBuffer) -> bool;
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct SigMatchCtx_ {
|
||||
|
|
|
|||
|
|
@ -255,3 +255,10 @@ void InspectionBufferCopy(InspectionBuffer *buffer, uint8_t *buf, uint32_t buf_l
|
|||
buffer->initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns wether the inspection buffer will make the transform run in-place
|
||||
// Especially useful for transforms that produces an output longer than the input
|
||||
bool SCInspectionBufferInPlace(const InspectionBuffer *buffer)
|
||||
{
|
||||
return buffer->inspect == buffer->buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,6 @@ void InspectionBufferSetupMulti(DetectEngineThreadCtx *det_ctx, InspectionBuffer
|
|||
const DetectEngineTransforms *transforms, const uint8_t *data, const uint32_t data_len);
|
||||
InspectionBuffer *InspectionBufferMultipleForListGet(
|
||||
DetectEngineThreadCtx *det_ctx, const int list_id, uint32_t local_id);
|
||||
bool SCInspectionBufferInPlace(const InspectionBuffer *buffer);
|
||||
|
||||
#endif /* SURICATA_DETECT_ENGINE_INSPECT_BUFFER_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue