From 4a02641a86b40e0d57eb00cdbcf9e8a65e96d674 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 1 Jun 2015 13:57:22 +0200 Subject: [PATCH] MEDIUM: init: DeviceAtlas initialization This diff initialises few DeviceAtlas struct fields member with their inherent default values. Furthermore, the specific DeviceAtlas configuration keywords are registered and the module is initialised and all necessary resources are freed during the deinit phase. --- src/haproxy.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index 1b77475810..a8ea22eeb9 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -111,6 +111,10 @@ #include #endif +#ifdef USE_DEVICEATLAS +#include +#endif + /*********************************************************************/ extern const struct comp_algo comp_algos[]; @@ -169,6 +173,14 @@ struct global global = { #ifdef DEFAULT_MAXSSLCONN .maxsslconn = DEFAULT_MAXSSLCONN, #endif +#endif +#ifdef USE_DEVICEATLAS + .deviceatlas = { + .loglevel = DA_SEV_INFO, + .useragentid = 0, + .jsonpath = 0, + .separator = '|', + }, #endif /* others NULL OK */ }; @@ -571,6 +583,10 @@ void init(int argc, char **argv) /* Initialise lua. */ hlua_init(); +#if defined(USE_DEVICEATLAS) + /* Register deviceatlas config keywords */ + da_register_cfgkeywords(); +#endif global.tune.options |= GTUNE_USE_SELECT; /* select() is always available */ #if defined(ENABLE_POLL) @@ -785,6 +801,9 @@ void init(int argc, char **argv) /* now we know the buffer size, we can initialize the channels and buffers */ init_buffer(); +#if defined(USE_DEVICEATLAS) + init_deviceatlas(); +#endif if (have_appsession) appsession_init(); @@ -1415,6 +1434,10 @@ void deinit(void) protocol_unbind_all(); +#if defined(USE_DEVICEATLAS) + deinit_deviceatlas(); +#endif + free(global.log_send_hostname); global.log_send_hostname = NULL; free(global.log_tag); global.log_tag = NULL; free(global.chroot); global.chroot = NULL; -- 2.47.3