pub type ch_match_event_handler = Option<unsafe extern "C" fn(id: c_uint, from: c_ulonglong, to: c_ulonglong, flags: c_uint, size: c_uint, captured: *const ch_capture_t, ctx: *mut c_void) -> ch_callback_t>;
Expand description

Definition of the match event callback function type.

A callback function matching the defined type must be provided by the application calling the @ref ch_scan()

This callback function will be invoked whenever a match is located in the target data during the execution of a scan. The details of the match are passed in as parameters to the callback function, and the callback function should return a value indicating whether or not matching should continue on the target data. If no callbacks are desired from a scan call, NULL may be provided in order to suppress match production.

@param id The ID number of the expression that matched. If the expression was a single expression compiled with @ref ch_compile(), this value will be zero.

@param from The offset of the first byte that matches the expression.

@param to The offset after the last byte that matches the expression.

@param flags This is provided for future use and is unused at present.

@param size The number of valid entries pointed to by the captured parameter.

@param captured A pointer to an array of @ref ch_capture_t structures that contain the start and end offsets of entire pattern match and each captured subexpression.

@param ctx The pointer supplied by the user to the @ref ch_scan() function.

@return The callback can return @ref CH_CALLBACK_TERMINATE to stop matching. Otherwise, a return value of @ref CH_CALLBACK_CONTINUE will continue, with the current pattern if configured to produce multiple matches per pattern, while a return value of @ref CH_CALLBACK_SKIP_PATTERN will cease matching this pattern but continue matching the next pattern.