int ipfix_update_template_sendbuffer (ipfix_exporter *exporter)
static int ipfix_update_template_sendbuffer (ipfix_exporter *exporter)
int ipfix_update_template_sendbuffer (ipfix_exporter *exporter){	int ret;	int i;	// first, some safety checks:	if (exporter == NULL) {		fprintf (stderr, "Exporter is NULL!\n");		return -1;	}	if (exporter->template_arr == NULL) {		fprintf (stderr, "Template store not initialized!\n");		return -1;	}	// clean the template sendbuffer	ret=ipfix_reset_sendbuffer(exporter->template_sendbuffer);	// place all valid templates to the template sendbuffer	// could be done just like put_data_field:	ipfix_sendbuffer* t_sendbuf = exporter->template_sendbuffer;	for (i = 0; i < exporter->ipfix_lo_template_maxsize; i++ )  {		// is the current template valid?		if ( (*exporter).template_arr[i].valid==COMMITED ) {			// link the data to the sendbuffer:			/*      ipfix_put_field2sendbuffer( (*exporter).template_sendbuffer ,  (*exporter).template_arr[i].template_fields, */			/* 				 (*exporter).template_arr[i].fields_length ); */			if (t_sendbuf->current >= t_sendbuf->length-2 ) {				fprintf (stderr, "Error: Template Sendbuffer too small to handle %i entries!\n", (*t_sendbuf).current );				return -1;			}			((*t_sendbuf).entries[ (*t_sendbuf).current ]).iov_base = (*exporter).template_arr[i].template_fields;			((*t_sendbuf).entries[ (*t_sendbuf).current ]).iov_len =  (*exporter).template_arr[i].fields_length;			t_sendbuf->current++;			// total_length += (*exporter).template_arr[i].fields_length;			t_sendbuf->commited_data_length +=  (*exporter).template_arr[i].fields_length;		}	} // end loop over all templates	// generate a header	// prepend a header to the sendbuffer	// ret = ipfix_prepend_header (exporter,  (*t_sendbuf).commited_data_length, t_sendbuf);	// done by send!	// that's it!	return 0;}