output: add output helper functions

There is too much repetative confusing maths near printouts.  Move that
stuff to a function.

This change also fixes --snet-alarms option counting issue in range that
were not part of any shared network were ignored.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-05 15:05:35 +00:00
parent 05f8208518
commit 48962004b8
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
3 changed files with 184 additions and 126 deletions

View file

@ -121,6 +121,27 @@ struct range_t {
double touched;
double backups;
};
/*! \enum count_status_t
* \brief Enumeration of possible range and shared net statuses.
*/
enum count_status_t {
STATUS_OK,
STATUS_WARN,
STATUS_CRIT,
STATUS_IGNORED,
STATUS_SUPPRESSED
};
/*! \struct output_helper_t
* \brief Various per range and shared net temporary calculation results.
*/
struct output_helper_t {
int status;
double range_size;
double percent;
double tc;
double tcp;
double bup;
};
/*! \enum isc_conf_parser
* \brief Configuration file parsing state flags.
*/