if(configure_template( v, atoi(iniparser_getvalue(conf, "sampler", "template_id")), iniparser_getvalue(conf, "sampler", "template") )) { msg(MSG_FATAL, "Config: could not configure a template"); return 1; }
if(strcasecmp("off", iniparser_getvalue(conf, "sampler", "export_ip")) == 0) { msg(MSG_INFO, "Config: Template will not be build, because export_ip=off");  } else if(configure_template( v, atoi(iniparser_getvalue(conf, "sampler", "template_id")), iniparser_getvalue(conf, "sampler", "template") )) { msg(MSG_FATAL, "Config: could not configure a template"); return 1; }
int configure_sampler(struct v_objects *v){	dictionary *conf=v->v_config;        msg(MSG_DEBUG, "Config: now configuring the sampler subsystem");	if(configure_template(			       v,			       atoi(iniparser_getvalue(conf, "sampler", "template_id")),			       iniparser_getvalue(conf, "sampler", "template")			      )) {		msg(MSG_FATAL, "Config: could not configure a template");		return 1;	}        /*         configure an observer         will caputure packets         */        if(configure_observer(			       v,			       iniparser_getvalue(conf, "sampler", "interface"),			       atoi(iniparser_getvalue(conf, "sampler", "capturelen"))			      )) {		msg(MSG_FATAL, "Config: could not configure an observer(pcap)");		return 1;	}        subsys_on(&(v->v_subsystems), SUBSYS_SAMP_CAPTURE);        /*         configure a filter process         make main filter object         attach packetprocessors         */        if(configure_filter(			     v,			     iniparser_getvalue(conf, "sampler", "filters")			    )) {		msg(MSG_FATAL, "Config: could not configure the filter");                return 1;	}        subsys_on(&(v->v_subsystems), SUBSYS_SAMP_FILTER);        /*         we MUST have a sink, else we will memleak like hell         configure_sink() takes care to allocate one of:         ExporterSink() -> export IPFIX data         PacketSink() -> just free packets         */        /*         BIG FIXME: FIX PARAMETERS!         */        if(configure_sink(                          v,                          iniparser_getvalue(conf, "sampler", "export_ip")                         )) {		msg(MSG_FATAL, "Config: could not configure a packet sink (important)");                return 1;        }        subsys_on(&(v->v_subsystems), SUBSYS_SAMP_SINK);        /*	 now do virtual wiring:	 observer --> filter --> sink	 FIXME: HARDCODED WITH ALL 3 SYSTEMS	 */	msg(MSG_INFO, "Config: now doing wiring: observer->filter->sink");	assert(v->observer != 0);	assert(v->filter != 0);	assert(v->sink != 0);	v->observer->addReceiver(v->filter);        v->filter->setReceiver(v->sink);        msg(MSG_DEBUG, "Config: sampler subsystem successfully configured");        return 0;}