docs: improve doxygen documentation

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-13 23:27:12 +00:00
parent 887845df2a
commit c687f38ed6
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
7 changed files with 111 additions and 58 deletions

View file

@ -61,7 +61,11 @@
# define unlikely(x) (x)
# endif
/* The attribute __hot__ was added in gcc 4.3. */
/*! \def _DP_ATTRIBUTE_HOT
* \brief The function attribute __hot__ was added in gcc 4.3. See gnu
* documentation for further information.
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-hot-function-attribute
*/
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
# define _DP_ATTRIBUTE_HOT __attribute__ ((__hot__))
# else
@ -85,8 +89,9 @@ enum dhcp_version {
};
/*! \enum prefix_t
* \brief Enumeration of interesting data in dhcpd.leases file, that has
* to be further examined, and saved.
* \brief Enumeration of interesting data in dhcpd.leases file, that has to
* be further examined, and saved. Functions xstrstr_v4() and xstrstr_v6()
* return one of these values to parse_leases().
*/
enum prefix_t {
PREFIX_LEASE,
@ -100,15 +105,19 @@ enum prefix_t {
NUM_OF_PREFIX
};
/*! \enum color_mode
* \brief Enumeration whether to use or not color output.
*/
enum color_mode {
color_unknown,
color_off,
color_on,
color_auto /* default */
color_auto /*!< Default, use colors when output terminal is interactive. */
};
/*! \struct shared_network_t
* \brief Counters for an individual shared network.
* \brief Counters for an individual shared network. This data entry is
* also used for 'all networks' counting.
*/
struct shared_network_t {
char *name;
@ -145,7 +154,7 @@ struct output_helper_t {
};
/*! \enum ltype
* \brief Lease state types.
* \brief Lease state types. These are the possible values in struct leases_t.
*/
enum ltype {
ACTIVE,
@ -154,7 +163,7 @@ enum ltype {
};
/*! \struct leases_t
* \brief An individual lease. The leaases are hashed.
* \brief An individual lease. These leaases are hashed.
*/
struct leases_t {
union ipaddr_t ip; /* ip as key */
@ -164,16 +173,16 @@ struct leases_t {
};
/*! \enum limbits
* \brief Output limit bits: R_BIT ranges, S_BIT shared networks, A_BIT all.
* \brief Output limit bits.
*/
enum limbits {
R_BIT = (1 << 0),
S_BIT = (1 << 1),
A_BIT = (1 << 2)
R_BIT = (1 << 0), /*!< Range limit. */
S_BIT = (1 << 1), /*!< Shared networks limit. */
A_BIT = (1 << 2) /*!< All networks summary limit. */
};
/*! \def STATE_OK
* \brief Nagios alarm exit values.
* \brief Nagios alarm exit value.
*/
# define STATE_OK 0
# define STATE_WARNING 1
@ -196,39 +205,38 @@ struct output_sort {
* \brief Runtime configuration state.
*/
struct conf_t {
struct shared_network_t *shared_net_root;
struct shared_network_t *shared_net_head;
struct range_t *ranges;
unsigned int num_ranges;
size_t ranges_size;
struct leases_t *leases;
char dhcpv6;
enum dhcp_version ip_version;
const char *dhcpdconf_file;
const char *dhcpdlease_file;
int output_format;
struct output_sort *sorts;
const char *output_file;
const char *mustach_template;
double warning;
double critical;
double warn_count;
double crit_count;
double minsize;
struct shared_network_t *shared_net_root; /*!< First entry in shared network linked list, that is the 'all networks', */
struct shared_network_t *shared_net_head; /*!< Last entry in shared network linked list. */
struct range_t *ranges; /*!< Array of ranges. */
unsigned int num_ranges; /*!< Number of ranges in the ranges array. */
size_t ranges_size; /*!< Size of the ranges array. */
struct leases_t *leases; /*!< An array of individual leases from dhcpd.leases file. */
enum dhcp_version ip_version; /*!< Designator if the dhcpd is running in IPv4 or IPv6 mode. */
const char *dhcpdconf_file; /*!< Path to dhcpd.conf file. */
const char *dhcpdlease_file; /*!< Path to dhcpd.leases file. */
int output_format; /*!< Column to use in color_tags array. */
struct output_sort *sorts; /*!< Linked list how to sort ranges. */
const char *output_file; /*!< Output file path. */
const char *mustach_template; /*!< Mustach template file path. */
double warning; /*!< Warning percent threshold. */
double critical; /*!< Critical percent threshold. */
double warn_count; /*!< Maximum number of free IP's before warning. */
double crit_count; /*!< Maximum number of free IP's before critical. */
double minsize; /*!< Minimum size of range or shared network to be considered exceeding threshold. */
unsigned int
reverse_order:1,
backups_found:1,
snet_alarms:1,
perfdata:1,
all_as_shared:1,
header_limit:4,
number_limit:3,
skip_ok:1,
skip_warning:1,
skip_critical:1,
skip_minsize:1,
skip_suppressed:1,
color_mode:2;
reverse_order:1, /*!< Reverse sort order. */
backups_found:1, /*!< Indicator if dhcpd.leases file has leases in backup state. */
snet_alarms:1, /*!< Suppress alarming thresholds for ranges that are part of a shared network. */
perfdata:1, /*!< Include performance statistics when using Nagios alarm output format. */
all_as_shared:1, /*!< Treat stand-alone subnets as a shared network. */
header_limit:4, /*!< Bits to suppress header output. */
number_limit:3, /*!< Bits to suppress value output. */
skip_ok:1, /*!< Skip none-alarming values from output. */
skip_warning:1, /*!< Skip warning values from output. */
skip_critical:1, /*!< Skip critical values from output. */
skip_minsize:1, /*!< Skip alarming values that are below minsize from output. */
skip_suppressed:1, /*!< Skip alarming values that are suppressed with --snet-alarms option, or they are shared networks without IP availability. */
color_mode:2; /*!< Indicator if colors should be used in output. */
};
/* Function prototypes */