idmef-criteria: libprelude Reference Manual

## idmef-criteria idmef-criteria |

## Functions

int | idmef_criterion_new ()
int | idmef_criteria_new ()
idmef_criteria_t * | idmef_criteria_ref ()
void | idmef_criteria_destroy ()
int | idmef_criteria_clone ()
int | idmef_criteria_print ()
int | idmef_criteria_to_string ()
prelude_bool_t | idmef_criteria_is_criterion ()
int | idmef_criteria_or_criteria ()
int | idmef_criteria_and_criteria ()
int | idmef_criteria_match ()
int | idmef_criteria_new_from_string ()

## Types and Values

enum | idmef_criterion_operator_t
typedef | idmef_criteria_t

## Description

## Functions

### idmef_criterion_new ()

    int
    idmef_criterion_new (idmef_criteria_t **criterion,
                         idmef_path_t *path,
                         idmef_criterion_value_t *value,
                         idmef_criterion_operator_t op);

Creates a new idmef_criteria_t object and store it in `criterion` . Matching this criterion will result in comparing the object value pointed by `path` against the provided `value` , using `op` .

#### Parameters

criterion | Address where to store the created idmef_criteria_t object. |
path | Pointer to an idmef_path_t object. |
value | Pointer to an idmef_criterion_value_t object. |
op | idmef_criterion_operator_t to use for matching this criterion. |

#### Returns

0 on success, a negative value if an error occured.

### idmef_criteria_new ()

    int
    idmef_criteria_new (idmef_criteria_t **criteria);

Creates a new idmef_criteria_t object and store it into `criteria` .

#### Parameters

criteria | Address where to store the created idmef_criteria_t object. |

#### Returns

0 on success, a negative value if an error occured.

### idmef_criteria_ref ()

    idmef_criteria_t *
    idmef_criteria_ref (idmef_criteria_t *criteria);

Increases `criteria` reference count.

idmef_criteria_destroy() will decrease the refcount until it reaches 0, at which point `criteria` will be destroyed.

#### Parameters

criteria | Pointer to a idmef_criteria_t object to reference. |

#### Returns

`criteria` .

### idmef_criteria_destroy ()

    void
    idmef_criteria_destroy (idmef_criteria_t *criteria);

Destroys `criteria` and its content.

#### Parameters

criteria | Pointer to a idmef_criteria_t object. |

### idmef_criteria_clone ()

    int
    idmef_criteria_clone (idmef_criteria_t *src,
                          idmef_criteria_t **dst);

Clones `src` and stores the cloned criteria within `dst` .

#### Parameters

src | Pointer to a idmef_criteria_t object to clone. |
dst | Address where to store the cloned idmef_criteria_t object. |

#### Returns

0 on success, a negative value if an error occured.

### idmef_criteria_print ()

    int
    idmef_criteria_print (const idmef_criteria_t *criteria,
                          prelude_io_t *fd);

### idmef_criteria_to_string ()

    int
    idmef_criteria_to_string (const idmef_criteria_t *criteria,
                              prelude_string_t *out);

### idmef_criteria_is_criterion ()

    prelude_bool_t
    idmef_criteria_is_criterion (const idmef_criteria_t *criteria);

### idmef_criteria_or_criteria ()

    int
    idmef_criteria_or_criteria (idmef_criteria_t *criteria,
                                idmef_criteria_t *criteria2);

### idmef_criteria_and_criteria ()

    int
    idmef_criteria_and_criteria (idmef_criteria_t *criteria,
                                 idmef_criteria_t *criteria2);

### idmef_criteria_match ()

    int
    idmef_criteria_match (const idmef_criteria_t *criteria,
                          void *object);

Matches `object` against the provided criteria.

#### Parameters

criteria | Pointer to a idmef_criteria_t object. |
object | Pointer to a idmef_object_t object. |

#### Returns

1 if criteria match, 0 if it did not, a negative value if an error occured.

### idmef_criteria_new_from_string ()

    int
    idmef_criteria_new_from_string (idmef_criteria_t **criteria,
                                    const char *str);

## Types and Values

### enum idmef_criterion_operator_t

#### Members

IDMEF_CRITERION_OPERATOR_NOT |  |
IDMEF_CRITERION_OPERATOR_NOCASE |  |
IDMEF_CRITERION_OPERATOR_EQUAL |  |
IDMEF_CRITERION_OPERATOR_EQUAL_NOCASE |  |
IDMEF_CRITERION_OPERATOR_NOT_EQUAL |  |
IDMEF_CRITERION_OPERATOR_NOT_EQUAL_NOCASE |  |
IDMEF_CRITERION_OPERATOR_LESSER |  |
IDMEF_CRITERION_OPERATOR_LESSER_OR_EQUAL |  |
IDMEF_CRITERION_OPERATOR_GREATER |  |
IDMEF_CRITERION_OPERATOR_GREATER_OR_EQUAL |  |
IDMEF_CRITERION_OPERATOR_SUBSTR |  |
IDMEF_CRITERION_OPERATOR_SUBSTR_NOCASE |  |
IDMEF_CRITERION_OPERATOR_NOT_SUBSTR |  |
IDMEF_CRITERION_OPERATOR_NOT_SUBSTR_NOCASE |  |
IDMEF_CRITERION_OPERATOR_REGEX |  |
IDMEF_CRITERION_OPERATOR_REGEX_NOCASE |  |
IDMEF_CRITERION_OPERATOR_NOT_REGEX |  |
IDMEF_CRITERION_OPERATOR_NOT_REGEX_NOCASE |  |
IDMEF_CRITERION_OPERATOR_NULL |  |
IDMEF_CRITERION_OPERATOR_NOT_NULL |  |

### idmef_criteria_t

    typedef struct idmef_criteria idmef_criteria_t;