pub unsafe extern "C" fn ddwaf_context_eval(
context: ddwaf_context,
data: *mut ddwaf_object,
alloc: ddwaf_allocator,
result: *mut ddwaf_object,
timeout: u64,
) -> DDWAF_RET_CODEExpand description
Perform a matching operation on the provided data
@param context WAF context to be used in this run, this will determine the ruleset which will be used and it will also ensure that parameters are taken into account across runs (nonnull)
@param data (nonnull) Data on which to perform the pattern matching. This
data will be stored by the context and used across multiple calls to this
function or ddwaf_subcontext_eval. Once the context is destroyed, the user
defined allocator will be used to free the data provided. Note that the
data passed must be valid until the destruction of the context. The object
must be a map of {string,
@param alloc (nullable) Allocator used to free the data provided. If NULL, the data will not be freed.
@param result (nullable) Object map containing the following items:
- events: an array of the generated events.
- actions: a map of the generated actions in the format:
“{action type: {
@return Return code of the operation. @retval DDWAF_ERR_INVALID_ARGUMENT The context is invalid, the data will not be freed. @retval DDWAF_ERR_INVALID_OBJECT The data provided didn’t match the desired structure or contained invalid objects, the data will be freed by this function. @retval DDWAF_ERR_INTERNAL There was an unexpected error and the operation did not succeed. The state of the WAF is undefined if this error is produced and the ownership of the data is unknown. The result structure will not be filled if this error occurs.
Notes on addresses:
- Within a single run, addresses provided should be unique.
If duplicate addresses are provided:
- Within the same batch, the latest one in the structure will be the one used for evaluation.
- Within two different batches, the second batch will only use the new data.