#############################################################################*/
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char* collecty_module_name(collecty_module* self) {
return self->methods->name;
}
+
+/*
+ Called when a module has some data to submit
+*/
+int collecty_module_submit(collecty_module* self,
+ const char* object, const char* format, ...) {
+ char* value = NULL;
+ va_list args;
+ int r;
+
+ // Format the arguments
+ va_start(args, format);
+ r = vasprintf(&value, format, args);
+ va_end(args);
+
+ // Handle errors
+ if (r < 0)
+ return -errno;
+
+ DEBUG(self->ctx, "%s(%s) submitted: %s\n",
+ collecty_module_name(self), (object) ? object : "", value);
+
+ // TODO
+
+ if (value)
+ free(value);
+
+ return 0;
+}
const char* collecty_module_name(collecty_module* self);
+int collecty_module_submit(collecty_module* self, const char* object,
+ const char* format, ...) __attribute__((format(printf, 3, 4)));
+
#endif /* COLLECTY_MODULE_H */