lib/iocache: Add method for moving iocache offset pointer backwards

A common pattern in serialized data is to start a message with a header
that specify the message size. To make iocache more suitable for that
kind of use, we want to be able to first read the header, then see if
a body is available, and if things muck up, put the header back where we
found it. That means we have to be able to subtract the offset, which is
what this patch enables.

Patched-by: Robin Sonefors <robin.sonefors@op5.com>
Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2066 5f96b256-904b-4d8d-8c98-d829582c6739
Add 'id' variable to first-class objects

First-class objects are timeperiod, command, contact, host, service,
escalations, dependencies and all kinds of groups.

This makes it trivial to do future object extensions without
breaking the object ABI, since we can now allocate arrays for
ancillary data and look up that data in constant-time without
even bothering with hashes. It's also extremely trivial to do
bitvector operations, allowing ridiculously fine-tuned
filtering.

The id variable will be recreated for each restart and is not
persistent. Persistent data should keep using uniquely identifying
strings (contact_name, host_name+service_description, etc) for
data that needs to be kept persistent.

As a nifty bonus, we keep the object count used to set the id
variables and thereby get an unambiguous object count of all
object types, and not only the ones that get scheduled.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2067 5f96b256-904b-4d8d-8c98-d829582c6739
Expunge embedded perl from all kinds of configuration files

The sample config shouldn't mention it anymore since it's obsoleted.
Same goes for test-configurations.

Original-patch-by: Daniel Wittenberg <dwittenberg2008@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2068 5f96b256-904b-4d8d-8c98-d829582c6739
Fix update-version script to work with new specfile

We forgot this when the specfile was updated. With this patch it
will properly change value when we go to 4.0.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2069 5f96b256-904b-4d8d-8c98-d829582c6739
Add 'install-devel' as a top-level make target

This patch provides Naigos with a devel package (which is intended
to grow over time). The idea is to let module and addon authors use
this in order to access Nagios' data rapidly with a minimum of code
duplication.

Modules should *not* link to libnagios however, as it's only
provided as a static library and is already linked into Nagios
itself.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2070 5f96b256-904b-4d8d-8c98-d829582c6739
Regenerate configure to support install-devel

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2071 5f96b256-904b-4d8d-8c98-d829582c6739
Remove empty lines and comments from test configs

People who are savvy enough to write tests for Nagios are savvy
enough to know what settings they want to test, so this patch
just makes it possible to remove variables from a huge amount of
files without also having to fiddle with taking out the comments
too.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2072 5f96b256-904b-4d8d-8c98-d829582c6739
Remove "Last Modified" and copyright years from source files

A quick scan over them showed a whopping 94% inaccuracy, which is
quite obviously pretty bad, and since they were a frequent source
of merge, rebase and patch errors we're far better off without
them.

Copyright notices now live in the LEGAL file instead, where we can
expect it will be noticed by people who actually care about the
legal ramifications of copying, distributing or modifying Nagios.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2073 5f96b256-904b-4d8d-8c98-d829582c6739
Fix doxygen errors in lib/kvvec.h and lib/iobroker.h

Since we're shipping a doxygen file we might as well make sure it
works as intended and without warnings.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2074 5f96b256-904b-4d8d-8c98-d829582c6739
Makefile: Add 'dox' target

This just wipes out the old documentation and regenerates it using
doxygen.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2075 5f96b256-904b-4d8d-8c98-d829582c6739
Remove include/epn_nagios.h and other embedded perl leftovers

I missed these when removing embedded perl from the sources, so it
was allowed to endure, like the might of Sauron when whatshisname
didn't destroy the ring of power.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2076 5f96b256-904b-4d8d-8c98-d829582c6739
Add t-utils

This is like a short version of libtap, but niftier since we don't
have to run configure and can get prettier output.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2077 5f96b256-904b-4d8d-8c98-d829582c6739
Add lib/lnag-utils.h

Since libnagios can't use anything from core nagios although the
other way around works fine, we're forced to move everything we
want to have in the library to somewhere where we can use it. The
things we want to move includes a few macros that are generally
useful, so we introduce the "lnag-utils.h" header file, which can
keep track of declarations for small inline functions, various
micro-helpers and the above-mentioned useful macros for us, while
updating everything else to be able to make use of it.

This means the CGI's can now use header-files from libnagios exactly
like the core daemon can, which paves the way for linking the cgi's
against libnagios too.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2078 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Include the skiplist API in libnagios and link cgi's to it

This means we no longer have to link the skiplist object file
explicitly with either nagios core or the cgi's, so we tuck in the
build infrastructure to make that happen. We also move a few more
Nagios-centrict macros to lnag-utils (TRUE, FALSE, ERROR and OK) to
prevent the skiplist library having to depend on files outside the
lib directory.

While we're at it, we improve a bit on the library and make two
private helpers static and removing their prototypes from the header
file.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2079 5f96b256-904b-4d8d-8c98-d829582c6739
lib/skiplist: Make types opaque

It's a good design paradigm to hide the types used to implement
a certain library, since that leaves one free to make large design
changes to the structures constituting the engine of the algorithm.
Since the types' data was only accessed in two places, and even
those places were fortunately made accidentally redundant a few days
ago, leaving us completely free to make the skiplist types opaque
by simply removing a few lines of code.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2080 5f96b256-904b-4d8d-8c98-d829582c6739
Add bitmap library to libnagios

This is insanely useful for calculating dependency graphs now that
each object has a unique id, and will briefly be used to do exactly
that.

Actually, it's insanely useful to flag just about anything with an
id in constant time and very little space, but we'll initially be
using it to check for circular paths in service dependencies.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2081 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Add dkhash, the dual-keyed hash api

Since most objects in Nagios are uniquely identified by two keys
(as opposed to just one), it's prudent to make it easy to give
quick access to such objects with simple API calls, both to Nagios
and to all its modules.

This library will be used as the basis for object lookups in the
near future, as it provides O(1) lookup time, to be compared with
the O(n lg n) time provided by skiplists.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2082 5f96b256-904b-4d8d-8c98-d829582c6739
core workers: Make sure we never free() any object names

Previously we used to copy service_description by assignment and
all other (well, contact_name and host_name) by strdup()'ing them,
but we free()'d all three.

Object names are seriously written in stone. Anything that changes
them or their pointers will mess with all sorts of interesting
containers (such as skiplists and hashtables), so we might as well
avoid strdup()'ing them and save ourselves the previously wasted
cycles while fixing the bug at the same time.

Reported-by: Robin Sonefors <robin.sonefors@op5.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2083 5f96b256-904b-4d8d-8c98-d829582c6739
core workers: Remove an unused variable

Just kill the gcc warnings so we once again compile warning-free.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2084 5f96b256-904b-4d8d-8c98-d829582c6739
lib/bitmap: Fix some compiler warnings

We include string.h for memcpy() and remove the debug printf()s.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2085 5f96b256-904b-4d8d-8c98-d829582c6739