if (exporter == NULL) { fprintf (stderr, "ipfix_add_collector: Cannot add collector to NULL exporter!\n"); fprintf (stderr, "Error probably fatal. Exiting!\n"); exit (-1);  }
if(exporter == NULL) { msg(MSG_FATAL, "IPFIX: add_collector, exporter is NULL"); return -1; }
int ipfix_add_collector(ipfix_exporter *exporter, char *coll_ip4_addr, int coll_port, enum ipfix_transport_protocol proto){	int i=0;	int searching = TRUE;	DPRINTF(" ipfix_add_collector 0\n");	// check, if exporter is valid	if (exporter == NULL) {	  fprintf (stderr, "ipfix_add_collector: Cannot add collector to NULL exporter!\n");	  fprintf (stderr, "Error probably fatal. Exiting!\n");	  exit (-1);	}	// check if there is a free slot at all:	if ( exporter->collector_num >= exporter->collector_max_num ) {		fprintf (stderr, "No more free slots for new collectors available.\n");		fprintf (stderr, "Collector not added!\n");		return -1;	}	DPRINTF(" ipfix_add_collector 1\n");	while (searching && ( i< exporter->collector_max_num) ) {		DPRINTF(" ipfix_add_collector searching %i, i %i \n", searching, i);		if ( (*exporter).collector_arr[i].valid == FALSE ) {			// we have found a free slot:			/*			 FIXME: only a quick fix to make that work                         Must be copied, else pointered data must be around forever			 Better use binary/u_int32_t representation                         */			strncpy((*exporter).collector_arr[i].ipv4address, coll_ip4_addr, 16);			(*exporter).collector_arr[i].port_number = coll_port;			(*exporter).collector_arr[i].protocol = proto;			// open the socket: call an own function.			(*exporter).collector_arr[i].data_socket = ipfix_init_send_socket( coll_ip4_addr, coll_port, proto);			// error handling, in case we were unable to open the port:			if ( (*exporter).collector_arr[i].data_socket < 0 ) {				fprintf (stderr, "Initializing socket for %s:%i failed - skipping.\n", coll_ip4_addr, coll_port);				return -1;			}			// currently, the data socket and the template socket are the same.			// TODO, when SCTP is added!			(*exporter).collector_arr[i].template_socket =  (*exporter).collector_arr[i].data_socket;			// now, we may set the collector to valid;			(*exporter).collector_arr[i].valid = UNCLEAN;			// increase total number of collectors.			exporter->collector_num++;			searching = FALSE;		}		i++;	}	return 0;}