add udata to monitor hook

This commit is contained in:
Jan-Piet Mens
2015-08-15 10:46:46 +02:00
parent d408e6f6a8
commit 204dfb8cc7
5 changed files with 18 additions and 4 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ base64.o: base64.h base64.c
ghash.o: ghash.h ghash.c config.h udata.h
safewrite.o: safewrite.h safewrite.c
jget.o: jget.c jget.h json.h
misc.o: misc.c misc.h
misc.o: misc.c misc.h udata.h
+10 -1
View File
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include "utstring.h"
#include "ctype.h"
#include "udata.h"
#include "misc.h"
char *bindump(char *buf, long buflen)
@@ -28,6 +29,14 @@ char *bindump(char *buf, long buflen)
* a monitoring hoook.
*/
void monitorhook(time_t now, char *topic)
void monitorhook(struct udata *userdata, time_t now, char *topic)
{
struct udata *ud = (struct udata *)userdata;
#ifdef HAVE_REDIS
if (ud->useredis) {
}
#endif
if (ud->usefiles) {
}
}
+1 -1
View File
@@ -3,6 +3,6 @@
#include <time.h>
char *bindump(char *buf, long buflen);
void monitorhook(time_t now, char *topic);
void monitorhook(struct udata *ud, time_t now, char *topic);
#endif
+1 -1
View File
@@ -388,7 +388,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
time(&now);
monitorhook(now, m->topic);
monitorhook(ud, now, m->topic);
/* FIXME: handle null leading topic `/` */
utstring_printf(basetopic, "%s/%s/%s", topics[0], topics[1], topics[2]);
+5
View File
@@ -1,3 +1,6 @@
#ifndef UDATA_H_INCLUDED
# define UDATA_H_INCLUDED
#include "config.h"
#include "utarray.h"
#ifdef HAVE_REDIS
@@ -16,3 +19,5 @@ struct udata {
int skipdemo; /* True if _demo users are to be skipped */
int useredis; /* True if we should do Redis (if we have it) */
};
#endif