if (ti->fieldInfo[fieldNo].type.id & 0x80) {
if (ti->fieldInfo[fieldNo].type.id & IPFIX_ENTERPRISE_TYPE) {
static void processOptionsTemplateSet(IpfixReceiver* ipfixReceiver, SourceID sourceId, IpfixSetHeader* set) {	IpfixOptionsTemplateHeader* th = (IpfixOptionsTemplateHeader*)&set->data;	byte* endOfSet = (byte*)set + ntohs(set->length);	byte* record = (byte*)&th->data;	/* OptionsTemplateSets are >= 4 byte, so we stop processing when only 3 bytes are left */	while (record < endOfSet - 3) {		BufferedTemplate* bt = (BufferedTemplate*)malloc(sizeof(BufferedTemplate));		OptionsTemplateInfo* ti = (OptionsTemplateInfo*)malloc(sizeof(OptionsTemplateInfo));		bt->sourceID = sourceId;		bt->templateID = ntohs(th->templateId);		bt->recordLength = 0;		bt->setID = ntohs(set->id);		bt->optionsTemplateInfo = ti;		ti->userData = 0;		ti->scopeCount = ntohs(th->scopeCount);		ti->scopeInfo = (FieldInfo*)malloc(ti->scopeCount * sizeof(FieldInfo));		ti->fieldCount = ntohs(th->fieldCount)-ntohs(th->scopeCount);		ti->fieldInfo = (FieldInfo*)malloc(ti->fieldCount * sizeof(FieldInfo));		int isLengthVarying = 0;		uint16_t scopeNo;		for (scopeNo = 0; scopeNo < ti->scopeCount; scopeNo++) {			ti->scopeInfo[scopeNo].type.id = ntohs(*(uint16_t*)((byte*)record+0));			ti->scopeInfo[scopeNo].type.length = ntohs(*(uint16_t*)((byte*)record+2));			ti->scopeInfo[scopeNo].offset = bt->recordLength; bt->recordLength+=ti->scopeInfo[scopeNo].type.length;			if (ti->scopeInfo[scopeNo].type.length == 65535) isLengthVarying=1;			if (ti->scopeInfo[scopeNo].type.id & 0x80) {				ti->scopeInfo[scopeNo].type.eid = ntohl(*(uint32_t*)((byte*)record+4));				record = (byte*)((byte*)record+8);				} else {				ti->fieldInfo[scopeNo].type.eid = 0;				record = (byte*)((byte*)record+4);				}			}		uint16_t fieldNo;		for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) {			ti->fieldInfo[fieldNo].type.id = ntohs(*(uint16_t*)((byte*)record+0));			ti->fieldInfo[fieldNo].type.length = ntohs(*(uint16_t*)((byte*)record+2));			ti->fieldInfo[fieldNo].offset = bt->recordLength; bt->recordLength+=ti->fieldInfo[fieldNo].type.length;			if (ti->fieldInfo[fieldNo].type.length == 65535) isLengthVarying=1;			if (ti->fieldInfo[fieldNo].type.id & 0x80) {				ti->fieldInfo[fieldNo].type.eid = ntohl(*(uint32_t*)((byte*)record+4));				record = (byte*)((byte*)record+8);				} else {				ti->fieldInfo[fieldNo].type.eid = 0;				record = (byte*)((byte*)record+4);				}			}		if (isLengthVarying) {  			bt->recordLength = 65535;			for (fieldNo = 0; fieldNo < ti->scopeCount; fieldNo++) ti->scopeInfo[fieldNo].offset = 65535;			for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) ti->fieldInfo[fieldNo].offset = 65535;  			}		bufferTemplate(ipfixReceiver->templateBuffer, bt); 		// FIXME: Template expiration disabled for debugging		// bt->expires = time(0) + TEMPLATE_EXPIRE_SECS;		int n;				for (n = 0; n < ipfixReceiver->callbackCount; n++) {			CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];			if (ci->optionsTemplateCallbackFunction) ci->optionsTemplateCallbackFunction(ci->handle, sourceId, ti);			}  		}	}