json output: use defined output file for all printing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: add json tests, and make fail output loud

Gilles reported the full-json is currently broken, which the new check
demonstrates.  Luckily the issue occurs only when active leases details
are being queried, leaving the count to be correct.  That said bug is a
bug, and that should be corrected.

Reported-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
ouput format: fix active lease printing

Earlier ethernet address collection did not remove duplicated.  Basically
the problem was the same as in problem fixed in commit
ae7747db876a6c2aaaaa2f1815d9f41b89c28826, but this time affecting only
the ethernet addresses.  The fix is, as one can see, to make ethernet
collection to share structure with the lease, so that if one is wrong
both are wrong the same way.

Reported-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
output ethernet: do not crash if ethernet is missing

Real dhcpd.leases file should always have ethernet address markup, but
test data or malformed files might not have.  Even if the check is 99.99%
useless there are the corner cases, and crashing at them is not good.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
docs: add doxygen tags, configuration file, and autotooling

When ./configure --enable-doxygen is used one can browse internal api
documentation from docs/html directory.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
backup counting: fix output regression

The backup count was not printed at all.  This bug was introduced in
version 2.17 (May 2012) when the uthash was taken in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: remove unused functions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: move code to more proper location

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
hash: make delete to use HASH_ITER if it is available

This commit also makes the functions ansi C compliant by adding void to
function argument list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: move global variables to config structure

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: use enum as symbolic bit masks

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: convert parsing magic numbers to symbolic values

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: rename get_order() to merge() and mark static

No other function than mergesort_ranges() can use the merge(), so calling
it with rather generic name and making it static seems right to me.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up: fix few indentation slips

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
getdata: be consistant with symbolic numbers

The program counts quotes, which is never true/false value, and one of
the symbolic parse state values was missed in bd5ee58.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
smatch scan: fix few warnings

dhcpd-pools.h:79:17: warning: comma at end of enumerator list [-pedantic]
hash.c:85 delete_lease() info: redundant null check on lease->ethernet calling free()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use a comparer instead of returner.

This resolves the FIXME of sorting ranges according to first_ip in IPv6 mode.