#include <pthread.h>
-#define PLUGIN_FLAGS_GLOBAL 0x0001
-
-#ifndef DATA_MAX_NAME_LEN
-#define DATA_MAX_NAME_LEN 128
-#endif
-
#define DS_TYPE_COUNTER 0
#define DS_TYPE_GAUGE 1
#define DS_TYPE_DERIVE 2
#define DS_TYPE_ABSOLUTE 3
#define DS_TYPE_TO_STRING(t) \
- (t == DS_TYPE_COUNTER) ? "counter" : (t == DS_TYPE_GAUGE) \
- ? "gauge" \
- : (t == DS_TYPE_DERIVE) \
- ? "derive" \
- : (t == DS_TYPE_ABSOLUTE) \
- ? "absolute" \
- : "unknown"
+ (t == DS_TYPE_COUNTER) \
+ ? "counter" \
+ : (t == DS_TYPE_GAUGE) \
+ ? "gauge" \
+ : (t == DS_TYPE_DERIVE) \
+ ? "derive" \
+ : (t == DS_TYPE_ABSOLUTE) ? "absolute" : "unknown"
#ifndef LOG_ERR
#define LOG_ERR 3
/*
* Public data types
*/
+struct identifier_s {
+ char *host;
+ char *plugin;
+ char *plugin_instance;
+ char *type;
+ char *type_instance;
+};
+typedef struct identifier_s identifier_t;
+
typedef unsigned long long counter_t;
typedef double gauge_t;
typedef int64_t derive_t;
typedef struct value_list_s value_list_t;
#define VALUE_LIST_INIT \
- { NULL, 0, 0, plugin_get_interval(), "localhost", "", "", "", "", NULL }
-#define VALUE_LIST_STATIC \
- { NULL, 0, 0, 0, "localhost", "", "", "", "", NULL }
+ { .values = NULL, .meta = NULL }
struct data_source_s {
char name[DATA_MAX_NAME_LEN];
int64_t nm_signed_int;
uint64_t nm_unsigned_int;
double nm_double;
- _Bool nm_boolean;
+ bool nm_boolean;
} nm_value;
struct notification_meta_s *next;
} notification_meta_t;
*
* ARGUMENTS
* `name' Name of the plugin to load.
- * `flags' Hints on how to handle this plugin.
+ * `global' Make this plugins symbols available for other shared libraries.
*
* RETURN VALUE
* Returns zero upon success, a value greater than zero if no plugin was found
* Re-loading an already loaded module is detected and zero is returned in
* this case.
*/
-int plugin_load(const char *name, uint32_t flags);
+int plugin_load(const char *name, bool global);
int plugin_init_all(void);
void plugin_read_all(void);
* plugin_dispatch_multivalue
*
* SYNOPSIS
- * plugin_dispatch_multivalue (vl, 1, DS_TYPE_GAUGE,
+ * plugin_dispatch_multivalue (vl, true, DS_TYPE_GAUGE,
* "free", 42.0,
* "used", 58.0,
* NULL);
* The number of values it failed to dispatch (zero on success).
*/
__attribute__((sentinel)) int plugin_dispatch_multivalue(value_list_t const *vl,
- _Bool store_percentage,
+ bool store_percentage,
int store_type, ...);
int plugin_dispatch_missing(const value_list_t *vl);
int plugin_notification_meta_add_double(notification_t *n, const char *name,
double value);
int plugin_notification_meta_add_boolean(notification_t *n, const char *name,
- _Bool value);
+ bool value);
int plugin_notification_meta_copy(notification_t *dst,
const notification_t *src);
*/
int plugin_thread_create(pthread_t *thread, const pthread_attr_t *attr,
- void *(*start_routine)(void *), void *arg);
+ void *(*start_routine)(void *), void *arg,
+ char const *name);
/*
* Plugins need to implement this