When a parser is queried and one is not found within the ones that we
have already registered, try loading a plugin with that name. If
parser plugins are available, the parser might be available after the
plugin has been loaded.
The project is now fully compatible with having parsers as plugins.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
+CFLAGS=-Wall -O2 -g -fPIC
RRDD_OBJS= main.o process.o rrdtool.o parser.o built_in_parsers.o string.o \
debug.o config.o onewire_parser.o plugin_manager.o
RRDD_OBJS= main.o process.o rrdtool.o parser.o built_in_parsers.o string.o \
debug.o config.o onewire_parser.o plugin_manager.o
$(QUIET_LINK)$(CC) -o rrdd $(RRDD_OBJS) -lconfig -lownet -ldl -rdynamic
clean:
$(QUIET_LINK)$(CC) -o rrdd $(RRDD_OBJS) -lconfig -lownet -ldl -rdynamic
clean:
- rm -vf rrdd *~ *.o .*.d
+ rm -vf rrdd *~ *.o .*.d *.so
.c.o:
$(QUIET_CC)$(CC) -MMD -MF .$@.d $(CFLAGS) -c $< -o $@
.c.o:
$(QUIET_CC)$(CC) -MMD -MF .$@.d $(CFLAGS) -c $< -o $@
#include "parser.h"
#include "debug.h"
#include "parser.h"
#include "debug.h"
+#include "plugin_manager.h"
static struct parser_info *parser_list;
static struct parser_info *parser_list;
-struct parser_info *str_to_parser(const char *str)
+static struct parser_info *_str_to_parser(const char *str)
{
struct parser_info *parser;
{
struct parser_info *parser;
+
+struct parser_info *str_to_parser(const char *str)
+{
+ struct parser_info *parser;
+ int ret;
+
+ parser = _str_to_parser(str);
+
+ if (parser)
+ return parser;
+
+ /* No parser found? Try loading a plugin */
+ ret = load_parser_plugin(str);
+ if (ret)
+ return NULL;
+
+ /* Try finding the parser again, maybe we got lucky and have it now */
+ return _str_to_parser(str);
+}