misc: move couple enums from global scope to file scope

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-13 21:43:37 +00:00
parent 74b697321f
commit 887845df2a
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
3 changed files with 43 additions and 45 deletions

View file

@ -75,14 +75,6 @@ union ipaddr_t {
unsigned char v6[16]; unsigned char v6[16];
}; };
/*! \enum dhcpd_magic_numbers
* \brief MAXLEN is maximum expected line length in dhcpd.conf and
* dhcpd.leases.
*/
enum dhcpd_magic_numbers {
MAXLEN = 1024
};
/*! \enum dhcp_version /*! \enum dhcp_version
* \brief The IP version, IPv4 or IPv6, served by the dhcpd. * \brief The IP version, IPv4 or IPv6, served by the dhcpd.
*/ */
@ -108,28 +100,6 @@ enum prefix_t {
NUM_OF_PREFIX NUM_OF_PREFIX
}; };
/*! \enum output_formats
* \brief Enumeration of output formats. Keep the text and html first, they
* are used color array selector.
*/
enum output_formats {
OUT_FORM_TEXT,
OUT_FORM_HTML,
NUM_OF_OUT_FORMS
};
/*! \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,
COLOR_RESET
};
enum color_mode { enum color_mode {
color_unknown, color_unknown,
color_off, color_off,
@ -174,19 +144,6 @@ struct output_helper_t {
double bup; double bup;
}; };
/*! \enum isc_conf_parser
* \brief Configuration file parsing state flags.
*/
enum isc_conf_parser {
ITS_NOTHING_INTERESTING,
ITS_A_RANGE_FIRST_IP,
ITS_A_RANGE_SECOND_IP,
ITS_A_SHAREDNET,
ITS_AN_INCLUDE,
ITS_A_SUBNET,
ITS_A_NETMASK
};
/*! \enum ltype /*! \enum ltype
* \brief Lease state types. * \brief Lease state types.
*/ */

View file

@ -55,6 +55,27 @@
#include "dhcpd-pools.h" #include "dhcpd-pools.h"
/*! \enum dhcpd_magic_numbers
* \brief MAXLEN is maximum expected line length in dhcpd.conf and
* dhcpd.leases.
*/
enum dhcpd_magic_numbers {
MAXLEN = 1024
};
/*! \enum isc_conf_parser
* \brief Configuration file parsing state flags.
*/
enum isc_conf_parser {
ITS_NOTHING_INTERESTING,
ITS_A_RANGE_FIRST_IP,
ITS_A_RANGE_SECOND_IP,
ITS_A_SHAREDNET,
ITS_AN_INCLUDE,
ITS_A_SUBNET,
ITS_A_NETMASK
};
/*! \brief Lease file parser. The parser can only read ISC DHCPD /*! \brief Lease file parser. The parser can only read ISC DHCPD
* dhcpd.leases file format. */ * dhcpd.leases file format. */
int parse_leases(struct conf_t *state, const int print_mac_addreses) int parse_leases(struct conf_t *state, const int print_mac_addreses)

View file

@ -59,6 +59,28 @@
#include "dhcpd-pools.h" #include "dhcpd-pools.h"
/*! \enum colored_formats
* \brief Enumeration of output formats. Keep the text and html first, they
* are used color array selector.
*/
enum colored_formats {
OUT_FORM_TEXT,
OUT_FORM_HTML,
NUM_OF_OUT_FORMS
};
/*! \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,
COLOR_RESET
};
static const char *color_tags[][NUM_OF_OUT_FORMS] = { static const char *color_tags[][NUM_OF_OUT_FORMS] = {
[STATUS_OK] = { "", "" }, [STATUS_OK] = { "", "" },
[STATUS_WARN] = { "\033[1;33m", " style=\"color:magenta;font-style:italic\"" }, [STATUS_WARN] = { "\033[1;33m", " style=\"color:magenta;font-style:italic\"" },
@ -68,8 +90,6 @@ static const char *color_tags[][NUM_OF_OUT_FORMS] = {
[COLOR_RESET] = { "\033[0m", "" } [COLOR_RESET] = { "\033[0m", "" }
}; };
/*! \brief Calculate range percentages and such. */ /*! \brief Calculate range percentages and such. */
int range_output_helper(struct conf_t *state, struct output_helper_t *oh, int range_output_helper(struct conf_t *state, struct output_helper_t *oh,
struct range_t *range_p) struct range_t *range_p)