1 /***** 2 * 3 * Copyright (C) 2004-2015 CS-SI. All Rights Reserved. 4 * Author: Nicolas Delon <nicolas.delon@prelude-ids.com> 5 * 6 * This file is part of the Prelude library. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2, or (at your option) 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along 19 * with this program; if not, write to the Free Software Foundation, Inc., 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 *****/ 23 24 #ifndef _LIBPRELUDE_IDMEF_CRITERION_VALUE_H 25 #define _LIBPRELUDE_IDMEF_CRITERION_VALUE_H 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 typedef struct idmef_criterion_value idmef_criterion_value_t; 32 33 typedef enum { 34 IDMEF_CRITERION_VALUE_TYPE_ERROR = -1, 35 IDMEF_CRITERION_VALUE_TYPE_VALUE = 0, 36 IDMEF_CRITERION_VALUE_TYPE_REGEX = 1, 37 IDMEF_CRITERION_VALUE_TYPE_BROKEN_DOWN_TIME = 2 38 } idmef_criterion_value_type_t; 39 40 41 #include "idmef-criteria.h" 42 #include "idmef-value.h" 43 44 45 int idmef_criterion_value_new(idmef_criterion_value_t **cv); 46 47 int idmef_criterion_value_new_regex(idmef_criterion_value_t **cv, const char *regex, idmef_criterion_operator_t op); 48 49 int idmef_criterion_value_new_value(idmef_criterion_value_t **cv, idmef_value_t *value, 50 idmef_criterion_operator_t op); 51 52 int idmef_criterion_value_new_from_string(idmef_criterion_value_t **cv, idmef_path_t *path, 53 const char *value, idmef_criterion_operator_t op); 54 55 int idmef_criterion_value_new_broken_down_time(idmef_criterion_value_t **cv, const char *time, idmef_criterion_operator_t op); 56 57 int idmef_criterion_value_clone(const idmef_criterion_value_t *src, idmef_criterion_value_t **dst); 58 59 void idmef_criterion_value_destroy(idmef_criterion_value_t *value); 60 61 int idmef_criterion_value_print(idmef_criterion_value_t *value, prelude_io_t *fd); 62 63 int idmef_criterion_value_to_string(idmef_criterion_value_t *value, prelude_string_t *out); 64 65 int idmef_criterion_value_match(idmef_criterion_value_t *cv, idmef_value_t *value, idmef_criterion_operator_t op); 66 67 const idmef_value_t *idmef_criterion_value_get_value(idmef_criterion_value_t *cv); 68 69 const char *idmef_criterion_value_get_regex(idmef_criterion_value_t *cv); 70 71 const struct tm *idmef_criterion_value_get_broken_down_time(idmef_criterion_value_t *cv); 72 73 idmef_criterion_value_type_t idmef_criterion_value_get_type(idmef_criterion_value_t *cv); 74 75 #ifdef __cplusplus 76 } 77 #endif 78 79 80 #endif /* _LIBPRELUDE_IDMEF_CRITERION_VALUE_H */ 81