char vendor_specific = NOT_VENDOR_SPECIFIC; if(enterprise_id != 0) vendor_specific = VENDOR_SPECIFIC;   ret = write_extension_and_fieldID (&p_pos, p_end, type, vendor_specific);
ret = write_extension_and_fieldID(&p_pos, p_end, type);
int ipfix_put_template_field(ipfix_exporter *exporter, uint16_t template_id, uint16_t type, uint16_t length, uint32_t enterprise_id){	int found_index;	/* set pointers to the buffer */	int ret;	char *p_pos;	char *p_end;	found_index=ipfix_find_template(exporter, template_id,  UNCLEAN);	/* test for a valid slot */	if ( found_index < 0 || found_index >= exporter->ipfix_lo_template_maxsize ) {		fprintf (stderr, "Template not found. \n");		return -1;	}	/* beginning of the buffer */	p_pos =  (*exporter).template_arr[found_index].template_fields;	// end of the buffer	p_end = p_pos +  (*exporter).template_arr[found_index].max_fields_length;	DPRINTF("ipfix_put_template_field: template found at %i\n", found_index);	DPRINTF("ipfix_put_template_field: A p_pos %u, p_end %u\n", p_pos, p_end);	DPRINTF("ipfix_put_template_field: max_fields_len %u \n", (*exporter).template_arr[found_index].max_fields_length);	DPRINTF("ipfix_put_template_field: fieldss_len %u \n", (*exporter).template_arr[found_index].fields_length);	// add offset to the buffer's beginning: this is, where we will write to.	p_pos += (*exporter).template_arr[found_index].fields_length;	DPRINTF("ipfix_put_template_field: B p_pos %u, p_end %u\n", p_pos, p_end);	// now write the fields to the buffer:	char vendor_specific = NOT_VENDOR_SPECIFIC;	if(enterprise_id != 0) vendor_specific = VENDOR_SPECIFIC;	// write the vendor specific bit & the field type:	ret = write_extension_and_fieldID (&p_pos, p_end, type, vendor_specific);	// write the field length	ret = write_unsigned16 (&p_pos, p_end, length);	// add the 4 bytes to the written length:	(*exporter).template_arr[found_index].fields_length += 4;	if (enterprise_id != 0) { // write the vendor specific id:		ret = write_unsigned32 (&p_pos, p_end, enterprise_id);		(*exporter).template_arr[found_index].fields_length += 4;	}	return 0;}