Remove dependencies in wproc, use wproc_run_callback

Designing the system to keep as few dependencies between the modules
in the system as low as possible is generally a good thing. That
makes each module do it's own thing without knowledge of the other
parts of the system. That means, each functionality has its own
distinct border, and debugging is mostly easier.

One part in this cleanup is wproc:s. wproc handles job types as
integers, and each job type can only be called from one other module.
But the wproc needs to have knowledege of the other module, because
it should be able to call back to that module depending on job type,
by using a switch statement in the wproc result handler.

Better structure is to use function pointers, and design a generic
callback, because then, the wproc module doesn't know anything at all
about the caller, and the explicit dependencies to other modules can
be reamoved.

Using function callbacks makes it having fewer special cases, and
makes it easier to set up test cases for.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Fix memory leak when running callback worker job

Destroying a callback job didn't free the callback storage, causing a
memory leak. Fix that!

This wasn't an issue earlier, when callbacks wasn't used much at all
(only some broker modules used that on some user interactions)

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Notifications: Use wproc_run_callback

By using wproc_run_callback instead of a notify-specific job type, we
can loose the dependency from workers.c to notifications.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Convert OCSP and OCHP to wproc_run_callback

Continue to reduce dependencies from wproc to other parts of the system.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Convert event handlers to wproc_run_callback

This reduces the knowledege of the surrounding environment in the wproc
module further. That makes it easier to write tests for later.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Convert perfdata to wproc_run_callback

performance data doesn't need to handle the result, but convert it to
wproc_run_callback, so that's the only used interface for wproc.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Cleanup wproc, when we don't use types anymore

Since the earlier cleanup, all worker calls results in callback jobs,
there's no need to have any job types anymore. Cleanup all type-related
code in wproc, and merge structs, so job contains callback and data
pointers directly

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Make error messages actually contain the error (wproc timeout)

When rewriting the wproc, a redundant timeout time output was removed.
But appearently to hasty, because the message that it timed out was
also removed. Re-add the message that the command timed out.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Merge branch 'jbop-dev/wproc_callback'

Minor conflict from 86055d61, which has been ported over.

Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>

Conflicts:
	naemon/workers.c
checks: Remove out-commented code

It didn't do anything there, now, did it.

Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>