break; case IPFIX_TYPEID_destinationIPv4Address: tfi = getDataTemplateFieldInfo(ti, &(FieldType){.id = IPFIX_TYPEID_destinationIPv4Mask, .eid = 0}); if (tfi) { if (hfi->type.length != 5) { fatalf("Tried to set mask of length %d IP address", hfi->type.length); } else { if (tfi->type.length == 1) { *(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(data + tfi->offset); } else { fatalf("Cannot process associated mask with invalid length %d", tfi->type.length); } }
} } break; case IPFIX_TYPEID_destinationIPv4Address: tfi = getDataTemplateFieldInfo(ti, &(FieldType){.id = IPFIX_TYPEID_destinationIPv4Mask, .eid = 0}); if (tfi) { if (hfi->type.length != 5) { fatalf("Tried to set mask of length %d IP address", hfi->type.length); } else { if (tfi->type.length == 1) { *(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(data + tfi->offset); } else { fatalf("Cannot process associated mask with invalid length %d", tfi->type.length);
void aggregateDataTemplateData(Hashtable* ht, DataTemplateInfo* ti, FieldData* data) {	int i;		/* Create data block to be inserted into buffer... */	FieldData* htdata = (FieldData*)malloc(ht->fieldLength);	for (i = 0; i < ht->dataTemplate->fieldCount; i++) {		FieldInfo* hfi = &ht->dataTemplate->fieldInfo[i];				/* Copy from matching variable field, should it exist */		FieldInfo* tfi = getDataTemplateFieldInfo(ti, &hfi->type);		if (tfi) {			copyData(&hfi->type, htdata + hfi->offset, &tfi->type, data + tfi->offset, ht->fieldModifier[i]);						/* copy associated mask, should there be one */			switch (hfi->type.id) {				case IPFIX_TYPEID_sourceIPv4Address:					tfi = getDataTemplateFieldInfo(ti, &(FieldType){.id = IPFIX_TYPEID_sourceIPv4Mask, .eid = 0});					if (tfi) {						if (hfi->type.length != 5) {							fatalf("Tried to set mask of length %d IP address", hfi->type.length);							} else {							if (tfi->type.length == 1) {								*(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(data + tfi->offset);								} else {								fatalf("Cannot process associated mask with invalid length %d", tfi->type.length);								}							}						}					break;				case IPFIX_TYPEID_destinationIPv4Address:					tfi = getDataTemplateFieldInfo(ti, &(FieldType){.id = IPFIX_TYPEID_destinationIPv4Mask, .eid = 0});					if (tfi) {						if (hfi->type.length != 5) {							fatalf("Tried to set mask of length %d IP address", hfi->type.length);							} else {							if (tfi->type.length == 1) {								*(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(data + tfi->offset);								} else {								fatalf("Cannot process associated mask with invalid length %d", tfi->type.length);								}							}						}					break;				default:					break;					}			continue;			}		/* No matching variable field. Copy from matching fixed field, should it exist */		tfi = getDataTemplateDataInfo(ti, &hfi->type);		if (tfi) {			copyData(&hfi->type, htdata + hfi->offset, &tfi->type, ti->data + tfi->offset, ht->fieldModifier[i]);						/* copy associated mask, should there be one */			switch (hfi->type.id) {				case IPFIX_TYPEID_sourceIPv4Address:					tfi = getDataTemplateDataInfo(ti, &(FieldType){.id = IPFIX_TYPEID_sourceIPv4Mask, .eid = 0});					if (tfi) {						if (hfi->type.length != 5) {							fatalf("Tried to set mask of length %d IP address", hfi->type.length);							} else {							if (tfi->type.length == 1) {								*(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(ti->data + tfi->offset);								} else {								fatalf("Cannot process associated mask with invalid length %d", tfi->type.length);								}							}						}					break;				case IPFIX_TYPEID_destinationIPv4Address:					tfi = getDataTemplateDataInfo(ti, &(FieldType){.id = IPFIX_TYPEID_destinationIPv4Mask, .eid = 0});					if (tfi) {						if (hfi->type.length != 5) {							fatalf("Tried to set mask of length %d IP address", hfi->type.length);							} else {							if (tfi->type.length == 1) {								*(uint8_t*)(htdata + hfi->offset + 4) = *(uint8_t*)(ti->data + tfi->offset);								} else {								fatalf("Cannot process associated mask with invalid length %d", tfi->type.length);								}							}						}					break;				default:					break;					}			continue;			}				fatalf("Flow to be buffered did not contain %s field", typeid2string(hfi->type.id));		continue;		}		/* ...then buffer it */	bufferDataBlock(ht, htdata);	}