summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc03739)
raw | patch | inline | side by side (parent: dc03739)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 28 Oct 2014 07:32:53 +0000 (08:32 +0100) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 28 Oct 2014 07:32:53 +0000 (08:32 +0100) |
src/varnish.c | patch | blob | history |
diff --git a/src/varnish.c b/src/varnish.c
index 3a8dddd78ac05bbf2633c362dda2f90a350e0d8a..f349bf5af0a6965863cb1f4c5c858c50011bfcfc 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
#include "plugin.h"
#include "configfile.h"
-#include <varnish/varnishapi.h>
+#if HAVE_VARNISH_V4
+#include <varnish/vapi/vsm.h>
+#include <varnish/vapi/vsc.h>
+typedef struct VSC_C_main c_varnish_stats_t;
+#endif
#if HAVE_VARNISH_V3
-# include <varnish/vsc.h>
+#include <varnish/varnishapi.h>
+#include <varnish/vsc.h>
typedef struct VSC_C_main c_varnish_stats_t;
#endif
#if HAVE_VARNISH_V2
+#include <varnish/varnishapi.h>
typedef struct varnish_stats c_varnish_stats_t;
#endif
}
} /* }}} void varnish_monitor */
-#if HAVE_VARNISH_V3
+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
static int varnish_read (user_data_t *ud) /* {{{ */
{
struct VSM_data *vd;
conf = ud->data;
vd = VSM_New();
+#if HAVE_VARNISH_V3
VSC_Setup(vd);
+#endif
if (conf->instance != NULL)
{
}
}
+#if HAVE_VARNISH_V3
if (VSC_Open (vd, /* diag = */ 1))
+#else /* if HAVE_VARNISH_V4 */
+ if (VSM_Open (vd))
+#endif
{
ERROR ("varnish plugin: Unable to load statistics.");
return (-1);
}
+#if HAVE_VARNISH_V3
stats = VSC_Main(vd);
+#else /* if HAVE_VARNISH_V4 */
+ stats = VSC_Main(vd, NULL);
+#endif
varnish_monitor (conf, stats);
VSM_Close (vd);