/*- * Copyright (c) 2005 Andrey Simonenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)$Id: ipastat_thresholds.h,v 1.1 2005/12/03 10:28:00 simon Exp $ */ #ifndef IPASTAT_THRESHOLDS_H #define IPASTAT_THRESHOLDS_H #ifdef WITH_THRESHOLDS #ifndef THRESHOLD_NSIZE # define THRESHOLD_NSIZE 30 #endif #ifndef THRESHOLD_NALLOC # define THRESHOLD_NALLOC 20 #endif struct rule; struct opt_rule; #define THRESHOLD_FREE_NAME 0x01 /* Free threshold_name in struct threshold{} */ /* * threshold{} section. */ struct threshold { STAILQ_ENTRY(threshold) link; /* Link for list of thresholds. */ char *threshold_name;/* Name of this threshold. */ char *threshold_info;/* Info for this threshold. */ u_int thresholdno; /* Number of this threshold. */ const struct st_list *st_list; /* threshold { st_list } */ u_int free_mask; /* THRESHOLD_FREE_xxx bits. */ int inited; /* Non-zero if threshold was inited. */ }; /* * List of all thresholds in one rule. */ STAILQ_HEAD(thresholds_list, threshold); /* * Threshold in query: -q ... -t */ struct opt_threshold { STAILQ_ENTRY(opt_threshold) link; /* For list building. */ const char *threshold_name;/* -t */ struct threshold *threshold; /* Corresponding threshold structure. */ const struct opt_st *opt_st; /* Corresponding -s ... */ struct ipa_threshold_state data;/* Threshold state. */ }; /* * Several thresholds in query: -q ... -t -t ... */ STAILQ_HEAD(opt_thresholds, opt_threshold); extern int dynamic_thresholds; extern ipa_mzone *threshold_mzone; extern struct threshold *alloc_threshold(void); extern int init_thresholds(const struct opt_rule *); extern int deinit_thresholds(const struct opt_rule *); extern void free_thresholds(struct thresholds_list *); extern int copy_thresholds(struct rule *, const struct thresholds_list *); extern int add_opt_threshold(const char *); extern int parse_opt_thresholds(const struct opt_rule *); extern void free_opt_thresholds(const struct opt_thresholds *); extern struct threshold *threshold_by_name(const struct rule *, const char *); #endif /* WITH_THRESHOLDS */ extern int has_opt_thresholds; #endif /* !IPASTAT_THRESHOLDS_H */