mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
clean up: move code to more proper location
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
2008e1a047
commit
a9d2d9c82f
3 changed files with 25 additions and 37 deletions
|
|
@ -41,6 +41,8 @@
|
||||||
#ifndef DEFAULTS_H
|
#ifndef DEFAULTS_H
|
||||||
# define DEFAULTS_H 1
|
# define DEFAULTS_H 1
|
||||||
|
|
||||||
|
#include "dhcpd-pools.h"
|
||||||
|
|
||||||
/*! \var MAXLEN
|
/*! \var MAXLEN
|
||||||
* \brief Maximum expected line length in dhcpd.conf and dhcpd.leases
|
* \brief Maximum expected line length in dhcpd.conf and dhcpd.leases
|
||||||
* files. */
|
* files. */
|
||||||
|
|
@ -50,9 +52,26 @@ static const size_t MAXLEN = 1024;
|
||||||
* \brief Maximum number of different shared networks in dhcpd.conf file. */
|
* \brief Maximum number of different shared networks in dhcpd.conf file. */
|
||||||
static const unsigned int SHARED_NETWORKS = 8192;
|
static const unsigned int SHARED_NETWORKS = 8192;
|
||||||
|
|
||||||
/*! \var RANGES
|
/*! \var prefixes[2][NUM_OF_PREFIX]
|
||||||
* \brief Maximum number of ranges
|
* \brief ISC lease file formats for IPv4 and IPv6.
|
||||||
* \xrefitem FIXME RANGES "Move this variable to dhcpd-pools.h"*/
|
*
|
||||||
unsigned int RANGES;
|
* The .indent.pro in use will mess formatting of array below.
|
||||||
|
* Please do not commit less readable indentation. */
|
||||||
|
static const char *prefixes[2][NUM_OF_PREFIX] = {
|
||||||
|
[VERSION_4] = {
|
||||||
|
[PREFIX_LEASE] = "lease ",
|
||||||
|
[PREFIX_BINDING_STATE_FREE] = " binding state free",
|
||||||
|
[PREFIX_BINDING_STATE_ACTIVE] = " binding state active",
|
||||||
|
[PREFIX_BINDING_STATE_BACKUP] = " binding state backup",
|
||||||
|
[PREFIX_HARDWARE_ETHERNET] = " hardware ethernet"
|
||||||
|
},
|
||||||
|
[VERSION_6] = {
|
||||||
|
[PREFIX_LEASE] = " iaaddr ",
|
||||||
|
[PREFIX_BINDING_STATE_FREE] = " binding state free",
|
||||||
|
[PREFIX_BINDING_STATE_ACTIVE] = " binding state active",
|
||||||
|
[PREFIX_BINDING_STATE_BACKUP] = " binding state backup",
|
||||||
|
[PREFIX_HARDWARE_ETHERNET] = " hardware ethernet"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* DEFAULTS_H */
|
#endif /* DEFAULTS_H */
|
||||||
|
|
|
||||||
|
|
@ -146,8 +146,6 @@ struct leases_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
/* \var prefixes An array holding dhcpd.leases lines that are wanted to examine.*/
|
|
||||||
const char *prefixes[2][NUM_OF_PREFIX];
|
|
||||||
/* \var prefix_length Length of each prefix. */
|
/* \var prefix_length Length of each prefix. */
|
||||||
int prefix_length[2][NUM_OF_PREFIX];
|
int prefix_length[2][NUM_OF_PREFIX];
|
||||||
/* \var config Runtime configuration. */
|
/* \var config Runtime configuration. */
|
||||||
|
|
@ -175,6 +173,8 @@ struct range_t *ranges;
|
||||||
unsigned int num_ranges;
|
unsigned int num_ranges;
|
||||||
/* \var leases Pointer holding all leases. */
|
/* \var leases Pointer holding all leases. */
|
||||||
struct leases_t *leases;
|
struct leases_t *leases;
|
||||||
|
/*! \var RANGES Maximum number of ranges. */
|
||||||
|
unsigned int RANGES;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
int prepare_memory(void);
|
int prepare_memory(void);
|
||||||
|
|
|
||||||
|
|
@ -57,37 +57,6 @@
|
||||||
#include "dhcpd-pools.h"
|
#include "dhcpd-pools.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
/*! \var prefixes[2][NUM_OF_PREFIX]
|
|
||||||
* \brief ISC lease file formats for IPv4 and IPv6.
|
|
||||||
*
|
|
||||||
* The .indent.pro in use will mess formatting of array below.
|
|
||||||
* Please do not commit less readable indentation.
|
|
||||||
*
|
|
||||||
* FIXME: The prefixes should be moved to defaults.h */
|
|
||||||
const char *prefixes[2][NUM_OF_PREFIX] = {
|
|
||||||
[VERSION_4] = {
|
|
||||||
[PREFIX_LEASE] = "lease ",
|
|
||||||
[PREFIX_BINDING_STATE_FREE] = " binding state free",
|
|
||||||
[PREFIX_BINDING_STATE_ACTIVE] = " binding state active",
|
|
||||||
[PREFIX_BINDING_STATE_BACKUP] = " binding state backup",
|
|
||||||
[PREFIX_HARDWARE_ETHERNET] = " hardware ethernet"
|
|
||||||
},
|
|
||||||
[VERSION_6] = {
|
|
||||||
[PREFIX_LEASE] = " iaaddr ",
|
|
||||||
[PREFIX_BINDING_STATE_FREE] = " binding state free",
|
|
||||||
[PREFIX_BINDING_STATE_ACTIVE] = " binding state active",
|
|
||||||
[PREFIX_BINDING_STATE_BACKUP] = " binding state backup",
|
|
||||||
[PREFIX_HARDWARE_ETHERNET] = " hardware ethernet"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! \var prefix_length[2][NUM_OF_PREFIX]
|
|
||||||
* \brief Expected configuration string length, that varies for IPv4 and
|
|
||||||
* IPv6. See also prefixes.
|
|
||||||
*
|
|
||||||
* FIXME: The prefix_length should be moved to dhcpd-pools.h */
|
|
||||||
int prefix_length[2][NUM_OF_PREFIX] = { };
|
|
||||||
|
|
||||||
/*! \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(void)
|
int parse_leases(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue