/** * Prints a DataRecord * @param sourceID SourceID of the exporting process * @param dataTemplateInfo Pointer to a structure defining the DataTemplate used * @param length Length of the data block supplied * @param data Pointer to a data block containing all variable fields */ void IpfixPrinter::onDataRecord(IpfixDataRecord* record) { if (lineOutput) { printOneLineRecord(record); } else { int i; /* we need a FieldInfo for printIPv4 */ IpfixRecord::FieldInfo::Type tmpInfo = {0, 4, false, 0}; // length=4 for IPv4 address printf("\n-+--- DataRecord (Template id=%u from ", record->templateInfo->templateId); if(record->sourceID->exporterAddress.len == 4) printIPv4(tmpInfo, &record->sourceID->exporterAddress.ip[0]); else printf("non-IPv4 address"); printf(":%d (", record->sourceID->exporterPort); tmpInfo.length = 1; // length=1 for protocol identifier printProtocol(tmpInfo, &record->sourceID->protocol); printf(") )\n"); printf(" `- variable data\n"); for (i = 0; i < record->templateInfo->fieldCount; i++) { printf(" ' `- "); printFieldData(record->templateInfo->fieldInfo[i].type, (record->data + record->templateInfo->fieldInfo[i].offset)); printf("\n"); } } record->removeReference(); }
/** * Prints a DataRecord * @param sourceID SourceID of the exporting process * @param dataTemplateInfo Pointer to a structure defining the DataTemplate used * @param length Length of the data block supplied * @param data Pointer to a data block containing all variable fields */ void IpfixPrinter::onDataRecord(IpfixDataRecord* record) { switch (outputType) { case LINE: printOneLineRecord(record); break; case TREE: printTreeRecord(record); break; case TABLE: printTableRecord(record); break; case NONE: break; } record->removeReference(); }