Function hyperscan_sys::hs_reset_stream
source · [−]pub unsafe extern "C" fn hs_reset_stream(
id: *mut hs_stream_t,
flags: c_uint,
scratch: *mut hs_scratch_t,
onEvent: match_event_handler,
context: *mut c_void
) -> hs_error_t
Expand description
Reset a stream to an initial state.
Conceptually, this is equivalent to performing @ref hs_close_stream() on the given stream, followed by a @ref hs_open_stream(). This new stream replaces the original stream in memory, avoiding the overhead of freeing the old stream and allocating the new one.
Note: This operation may result in matches being returned (via calls to the
match event callback) for expressions anchored to the end of the original
data stream (for example, via the use of the $
meta-character). If these
matches are not desired, NULL may be provided as the @ref match_event_handler
callback.
Note: the stream will also be tied to the same database.
@param id The stream (as created by @ref hs_open_stream()) to be replaced.
@param flags Flags modifying the behaviour of the stream. This parameter is provided for future use and is unused at present.
@param scratch A per-thread scratch space allocated by @ref hs_alloc_scratch(). This is allowed to be NULL only if the @p onEvent callback is also NULL.
@param onEvent Pointer to a match event callback function. If a NULL pointer is given, no matches will be returned.
@param context The user defined pointer which will be passed to the callback function when a match occurs.
@return @ref HS_SUCCESS on success, other values on failure.