summaryrefslogtreecommitdiff
path: root/customquery.h
diff options
context:
space:
mode:
Diffstat (limited to 'customquery.h')
-rw-r--r--customquery.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/customquery.h b/customquery.h
new file mode 100644
index 0000000..d9ce461
--- /dev/null
+++ b/customquery.h
@@ -0,0 +1,47 @@
+#ifndef CUSTHANDLER_H
+#define CUSTHANDLER_H
+
+#include "pgsnmpd.h"
+
+void init_custom_queries(void);
+
+typedef struct pgsnmpd_query pgsnmpd_query;
+
+extern char *custom_query_config_file;
+
+struct pgsnmpd_query {
+ char *table_name;
+ char *query_text;
+ oid *table_oid;
+ size_t oid_len;
+
+ int num_indexes;
+ int min_colnum;
+ u_char *types;
+ int typeslen;
+
+ /* Number of rows and columns returned by the query */
+ int rowcount;
+ int colcount;
+
+ PGresult *result;
+
+ /* How long (sec) before I need to refresh this result */
+ int cache_timeout;
+ /* When the result was last refreshed */
+ time_t last_refresh;
+
+ netsnmp_table_array_callbacks cb;
+ netsnmp_handler_registration *my_handler;
+
+ pgsnmpd_query *next;
+};
+
+pgsnmpd_query *alloc_custom_query(char *table_name, char *query_text,
+ oid *table_oid, int oid_len);
+
+void init_types_array(u_char *types, int start, int end);
+
+oid *parse_oid(const char *oid_str_orig, int *oid_len);
+
+#endif /* CUSTHANDLER_H */