dhcpd-pools
3.0
ISC dhcpd lease usage analyser
|
All about output formats. More...
#include <config.h>
#include <arpa/inet.h>
#include <errno.h>
#include <inttypes.h>
#include <langinfo.h>
#include <locale.h>
#include <math.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "close-stream.h"
#include "error.h"
#include "progname.h"
#include "strftime.h"
#include "dhcpd-pools.h"
Enumerations | |
enum | colored_formats { OUT_FORM_TEXT, OUT_FORM_HTML, NUM_OF_OUT_FORMS } |
Enumeration of output formats. More... | |
enum | count_status_t { STATUS_OK, STATUS_WARN, STATUS_CRIT, STATUS_IGNORED, STATUS_SUPPRESSED, COLOR_RESET } |
Enumeration of possible range and shared net statuses. More... | |
Functions | |
int | range_output_helper (struct conf_t *state, struct output_helper_t *oh, struct range_t *range_p) |
Calculate range percentages and such. More... | |
int | shnet_output_helper (struct conf_t *state, struct output_helper_t *oh, struct shared_network_t *shared_p) |
Calculate shared network percentages and such. More... | |
static int | start_color (struct conf_t *state, struct output_helper_t *oh, FILE *outfile) |
Output a color based on output_helper_t status. More... | |
static FILE * | open_outfile (struct conf_t *state) |
Helper function to open a output file. More... | |
static void | close_outfile (FILE *outfile) |
Helper function to close outfile. More... | |
static int | output_txt (struct conf_t *state) |
Text output format, which is the default. More... | |
static int | output_xml (struct conf_t *state, const int print_mac_addreses) |
The xml output formats. More... | |
static int | output_json (struct conf_t *state, const int print_mac_addreses) |
The json output formats. More... | |
static void | html_header (struct conf_t *state, FILE *restrict f) |
Header for full html output format. More... | |
static void | html_footer (FILE *restrict f) |
Footer for full html output format. More... | |
static void | start_tag (FILE *restrict f, char const *restrict tag) |
Start a html tag. More... | |
static void | end_tag (FILE *restrict f, char const *restrict tag) |
End a html tag. More... | |
static void | output_line (FILE *restrict f, char const *restrict type, char const *restrict text) |
Line with text in html output format. More... | |
static void | output_double (FILE *restrict f, char const *restrict type, double d) |
Line with digit in html output format. More... | |
static void | output_double_color (struct conf_t *state, struct output_helper_t *oh, FILE *restrict f, char const *restrict type) |
Line with a potentially colored digit in html output format. More... | |
static void | output_float (FILE *restrict f, char const *restrict type, float fl) |
Line with float in html output format. More... | |
static void | table_start (FILE *restrict f, char const *restrict id, char const *restrict summary) |
Begin table in html output format. More... | |
static void | table_end (FILE *restrict f) |
End table in html output format. More... | |
static void | newsection (FILE *restrict f, char const *restrict title) |
New section in html output format. More... | |
static int | output_html (struct conf_t *state) |
Output html format. More... | |
static int | output_csv (struct conf_t *state) |
Output cvs format. More... | |
static int | output_alarming (struct conf_t *state) |
Output alarm text, and return program exit value. More... | |
int | output_analysis (struct conf_t *state, const char output_format) |
Return output_format_names enum based on single char input. More... | |
Variables | |
static const char * | color_tags [][NUM_OF_OUT_FORMS] |
Array of stings that make colors to start and end in different schemas per array column. More... | |
All about output formats.
enum colored_formats |
enum count_status_t |
|
static |
Helper function to close outfile.
Referenced by output_alarming(), output_csv(), output_html(), output_json(), output_txt(), and output_xml().
|
static |
Footer for full html output format.
f | Output file descriptor. |
Referenced by output_html().
Header for full html output format.
f | Output file descriptor. |
Referenced by output_html().
New section in html output format.
f | Output file descriptor. |
title | Table title. |
Referenced by output_html().
|
static |
Helper function to open a output file.
Referenced by output_alarming(), output_csv(), output_html(), output_json(), output_txt(), and output_xml().
|
static |
Output alarm text, and return program exit value.
Referenced by output_analysis().
int output_analysis | ( | struct conf_t * | state, |
const char | output_format | ||
) |
Return output_format_names enum based on single char input.
Referenced by main().
|
static |
Line with digit in html output format.
f | Output file descriptor. |
type | HMTL tag name. |
d | Actual payload of the printout. |
Referenced by output_html().
|
static |
Line with a potentially colored digit in html output format.
state | Runtime configuration state. |
f | Output file descriptor. |
type | HMTL tag name. |
d | Actual payload of the printout. |
Referenced by output_html().
Line with float in html output format.
f | Output file descriptor. |
type | HTML tag name. |
fl | Actual payload of the printout. |
Referenced by output_html().
|
static |
|
static |
|
static |
Line with text in html output format.
f | Output file descriptor. |
type | HTML tag name. |
class | How the data is aligned. |
text | Actual payload of the printout. |
Referenced by newsection(), and output_html().
|
static |
Text output format, which is the default.
Referenced by output_analysis().
|
static |
int range_output_helper | ( | struct conf_t * | state, |
struct output_helper_t * | oh, | ||
struct range_t * | range_p | ||
) |
Calculate range percentages and such.
Referenced by must_next_range(), output_alarming(), output_csv(), output_html(), output_json(), output_txt(), and output_xml().
int shnet_output_helper | ( | struct conf_t * | state, |
struct output_helper_t * | oh, | ||
struct shared_network_t * | shared_p | ||
) |
Calculate shared network percentages and such.
Referenced by must_enter(), must_next_shnet(), output_alarming(), output_csv(), output_html(), output_json(), output_txt(), and output_xml().
|
static |
Output a color based on output_helper_t status.
Referenced by output_double_color(), and output_txt().
|
static |
|
static |
Array of stings that make colors to start and end in different schemas per array column.
Referenced by output_txt(), and start_color().