logthrdestdrv: New low-level destination driver class

The LogThrDestDriver class implements the bulk of the code needed to
create a threaded destination driver.

What a derived driver needs to implement, are the following:

 * Thread init / deinit functions (LogThrDestDriver->worker.init and
   ->worker.deinit): both of which receive the object itself. These
   functions - if not NULL - can be used to do custom, driver-specific
   initialisation/deinitalisation within the worker thread.

 * Disconnecting the worker thread (LogThrDestDriver->worker.disconnect).

 * Inserting into the destination (LogThrDestDriver->worker.insert).

 * Custom queue-time commands (->queue_method), which is called whenever
   pushing an item towards the worker queue.

One also needs to implement the LogDestDriver class' init, deinit and
free methods. Functions are provided to help init, deinit and free the
LogThrDestDriver instance: _init_method(), _deinit_method() and _free().

Two other functions are available:
log_threaded_dest_driver_init_instance(), which should be called from
the derived driver's _new() function, and _start(), which should be
called from the same function, at the end.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
mongodb: Convert to LogThrDestDriver

This converts the MongoDB destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
amqp: Convert to LogThrDestDriver

This converts the AMQP destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
smtp: Convert to LogThrDestDriver

This converts the SMTP destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
stomp: Made stomp driver inherit from LogThreadedDestDriver
stomp: Removed routing key from stomp driver.

Because routing_key is an amqp idiom, in stomp this is called
destination. It is used only in stomp, when one wants to interop
with amqp, but in this case, it is rarely used on the publisher side.
If somebody wants to use it, it can be achieved by using a rewrite rule,
setting routing_key there, and using value-pairs in the stomp driver.
stomp: Fixed several memory leaks.

Scratch buffer wasn't released, when driver was not connected,
and we leaked strings during header parsing.
stomp: Fix a few compile-time warnings

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
redis: New destination driver

Based on the work of Tihamer Petrovics during the Google Summer of Code
2013, this driver implements a new destination driver that allows
syslog-ng to send events to a Redis key-value sture.

destination d_redis {
 redis(
  host("localhost")
  port(6369)

  command("HINCRBY", "hosts", "$HOST", "1")
 );
};

The driver requires the hiredis library, and will try to detect it
during configure-time.

Signed-off-by: Tihamer Petrovics <tihameri@gmail.com>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
.travis.yml: Install libhiredis-dev too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Require LogTemplateOptions to be passed at run-time

Instead of storing a borrowed LogTemplateOptions copy, require passing
one in at run-time (via value_pairs_foreach() or value_pairs_walk()).
This provides more flexibility, and can guarantee thread safety too.

All drivers that use value-pairs have been updated accordingly.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
format-json: Support acting on type hints

With this patch, $(format-json) becomes able to act on type hints, and
store ints as ints and so on and so forth.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>