Stop reserving nebcallbacks we aren't using

Since we're controlling the sources, we can easily add callbacks
needed later, without tagging and reserving a bunch of them for no
reason what so ever.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2227 5f96b256-904b-4d8d-8c98-d829582c6739
core: Promote the _3x versions of functions by removing _3x suffix

It makes little sense to have a _3x version when we don't have
another version of the functions, so we remove them. While at it,
we remove run_sync_host_check_3x() completely, which was essentially
only called from perform_on_demand_host_check(), which was just a
stub wrapping run_sync_host_check_3x().

While at it, we remove the "host or service check?" logic from our
worker management code and call out to process_check_result() instead,
which does exactly that but serves as an entry point where we can do
mangling, logging and broker callbacks.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2228 5f96b256-904b-4d8d-8c98-d829582c6739
core: Restructure the code a bit

The command file and command worker process management code really
belongs in base/commands.c, and by moving it there we can make the
command_file* variables file-scoped instead of global-scoped, which
is a neat bonus.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2229 5f96b256-904b-4d8d-8c98-d829582c6739
Add check source determination capabilities

Since the introduction of mod_gearman, dnx, Merlin and worker
processes it's no longer so clear where checks come from, and users
of such systems are left pretty much in the dark about where a
certain check happened, which can be crucial to know when attempting
to find problems in a network.

With this patch, we add a "struct check_engine" which is added to
the checkresult struct, and also add a "void *source" member to the
same struct. The system is quite easy, but a bit more convoluted
than it has to be, since redundancy modules will want to know where
checks came quickly in order to know if they should send the checks
onwards or not.

With this patch that becomes both simple and efficient, and we can
provide const strings for each of our workers, and we can utilize
the same functionality to identify external special-purpose workers
when we get those, which is likely to be an amazing help during the
debugging of those.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2230 5f96b256-904b-4d8d-8c98-d829582c6739
process_passive_service_check(): Take description of looked-up service

It makes little sense to use a pointer into the iocache from the
external command buffer, as it gets overwritten from time to time.
With this patch we make things more future-proof in case things
want to stash a pointer to the service_description from the check
result struct later.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2231 5f96b256-904b-4d8d-8c98-d829582c6739
core: Refactor event handling loop somewhat

Previously we used to remove the event structure before we checked
if we were supposed to run the event, which caused the event_runtime
fetched from squeue_get_runtime() to point to invalid memory and
sometimes be filled with random crap, causing latency calculations
to be waaay off (like 50 billion years or so).

With this patch we avoid most of the if()'s and move on quicker if
we're not supposed to run the check, removing it explicitly where
needed.

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

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2232 5f96b256-904b-4d8d-8c98-d829582c6739
base/events: Fix parameter ordering for latency calculation

The event's actual runtime is the "start", and when we really run it
is the "stop", since that's supposed to come after the time the
event was supposed to run.

This patch fixes it, making latency calculation work properly again.

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

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