add (empty for now) monitoring hook

This commit is contained in:
Jan-Piet Mens 2015-08-15 10:42:55 +02:00
parent 38711713b6
commit d408e6f6a8
3 changed files with 19 additions and 0 deletions

10
misc.c
View File

@ -21,3 +21,13 @@ char *bindump(char *buf, long buflen)
} }
return (utstring_body(out)); return (utstring_body(out));
} }
/*
* At each received message, the recorder invokes this function with the
* current epoch time and the topic being handled. Use this to update
* a monitoring hoook.
*/
void monitorhook(time_t now, char *topic)
{
}

7
misc.h
View File

@ -1 +1,8 @@
#ifndef MISC_H_INCLUDED
# define MISC_H_INCLUDED
#include <time.h>
char *bindump(char *buf, long buflen); char *bindump(char *buf, long buflen);
void monitorhook(time_t now, char *topic);
#endif

View File

@ -388,6 +388,8 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
time(&now); time(&now);
monitorhook(now, m->topic);
/* FIXME: handle null leading topic `/` */ /* FIXME: handle null leading topic `/` */
utstring_printf(basetopic, "%s/%s/%s", topics[0], topics[1], topics[2]); utstring_printf(basetopic, "%s/%s/%s", topics[0], topics[1], topics[2]);
utstring_printf(username, "%s", topics[1]); utstring_printf(username, "%s", topics[1]);