cleaned up ipfixlolib IPFIX typeid lookup (what a mess)

git-svn-id: file:///Users/braun/svn/vermont/branches/vermont/new-template@2365 aef3b71b-58ee-0310-9ba9-8811b9f0742f
This commit is contained in:
limmer 2010-05-20 12:23:12 +00:00
parent 2472e712aa
commit 8fdc798cc3
9 changed files with 147 additions and 1143 deletions

View File

@ -269,7 +269,7 @@ int string2typelength(const char*s);
// enterprise TYPEIDs // enterprise TYPEIDs
#define IPFIX_ELENGTH_frontPayloadLen IPFIX_LENGTH_unsigned32 #define IPFIX_ELENGTH_frontPayloadLen IPFIX_LENGTH_unsigned32
#define IPFIX_ELENGTH_dpaFlowCount IPFIX_LENGTH_unsigned32 #define IPFIX_ELENGTH_dpaFlowCount IPFIX_LENGTH_unsigned32
#define IPFIX_ELENGTH_dpaForcedExport IPFIX_LENGTH_unsigned8 #define IPFIX_ELENGTH_dpaForcedExport IPFIX_LENGTH_octet
// lengths for biflows elements // lengths for biflows elements
@ -278,7 +278,7 @@ int string2typelength(const char*s);
#define IPFIX_ELENGTH_revFlowStartNanoSeconds IPFIX_LENGTH_flowStartNanoSeconds #define IPFIX_ELENGTH_revFlowStartNanoSeconds IPFIX_LENGTH_flowStartNanoSeconds
#define IPFIX_ELENGTH_revFlowEndSeconds IPFIX_LENGTH_flowEndSeconds #define IPFIX_ELENGTH_revFlowEndSeconds IPFIX_LENGTH_flowEndSeconds
#define IPFIX_ELENGTH_revFlowEndMilliSeconds IPFIX_LENGTH_flowEndMilliSeconds #define IPFIX_ELENGTH_revFlowEndMilliSeconds IPFIX_LENGTH_flowEndMilliSeconds
#define IPFIX_ELENGTH_revFlowEndNanoSeconds I IPFIX_LENGTH_flowEndNanoSeconds #define IPFIX_ELENGTH_revFlowEndNanoSeconds IPFIX_LENGTH_flowEndNanoSeconds
#define IPFIX_ELENGTH_revOctetDeltaCount IPFIX_LENGTH_octetDeltaCount #define IPFIX_ELENGTH_revOctetDeltaCount IPFIX_LENGTH_octetDeltaCount
#define IPFIX_ELENGTH_revPacketDeltaCount IPFIX_LENGTH_packetDeltaCount #define IPFIX_ELENGTH_revPacketDeltaCount IPFIX_LENGTH_packetDeltaCount
#define IPFIX_ELENGTH_revTcpControlBits IPFIX_LENGTH_tcpControlBits #define IPFIX_ELENGTH_revTcpControlBits IPFIX_LENGTH_tcpControlBits

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@
extern "C" { extern "C" {
#endif #endif
struct ipfix_identifier { struct ipfix_identifier {
char *name;
uint16_t id; uint16_t id;
//FIXME: length has to be 16 bit long uint16_t length;
uint8_t length; char *name;
}; };
int ipfix_id_rangecheck(int id); int ipfix_id_rangecheck(int id);

View File

@ -57,11 +57,6 @@ Template* PacketReportingCfg::getTemplate()
t = new Template(templateId); t = new Template(templateId);
for (size_t i = 0; i != exportedFields.size(); ++i) { for (size_t i = 0; i != exportedFields.size(); ++i) {
int tmpId = exportedFields[i]->getIeId(); int tmpId = exportedFields[i]->getIeId();
if (!ipfix_id_rangecheck(tmpId)) {
msg(MSG_DIALOG, "Template: ignoring template field %s -> %d - rangecheck not ok",
exportedFields[i]->getName().c_str(), tmpId);
continue;
}
const ipfix_identifier *id = ipfix_id_lookup(tmpId); const ipfix_identifier *id = ipfix_id_lookup(tmpId);
if ((tmpId == -1) || (id == NULL)) { if ((tmpId == -1) || (id == NULL)) {

View File

@ -260,6 +260,8 @@
32897:frontPayloadLen:unsigned32: 32897:frontPayloadLen:unsigned32:
32898:maxPacketGap:unsigned32: 32898:maxPacketGap:unsigned32:
32899:frontPayloadPktCount:unsigned32: 32899:frontPayloadPktCount:unsigned32:
32900:dpaflowcount:unsigned32:
32901:dpaforcedexport:unsigned32:
# biflow flows (using enterprise typeids, 0x8400+<typeid>) # biflow flows (using enterprise typeids, 0x8400+<typeid>)
33793:revOctetDeltaCount:unsigned64: 33793:revOctetDeltaCount:unsigned64:
33794:revPacketDeltaCount:unsigned64: 33794:revPacketDeltaCount:unsigned64:

View File

@ -249,6 +249,8 @@ frontpayload, 32896
frontpayloadlen, 32897 frontpayloadlen, 32897
maxpacketgap, 32898 maxpacketgap, 32898
frontpayloadpktcount, 32899 frontpayloadpktcount, 32899
dpaflowcount, 32900
dpaforcedexport, 32901
revoctetdeltacount, 33793 revoctetdeltacount, 33793
revpacketdeltacount, 33794 revpacketdeltacount, 33794
revtcpcontrolbits, 33798 revtcpcontrolbits, 33798

View File

@ -17,7 +17,9 @@ static const struct ipfix_identifier SWITCHFLOWTAB[] = {
{ "revflowendnanoseconds", 33949, 8 }, { "revflowendnanoseconds", 33949, 8 },
{ "revmaxpacketgap", 33922, 4 }, { "revmaxpacketgap", 33922, 4 },
{ "maxpacketgap", 32898, 4}, { "maxpacketgap", 32898, 4},
{ "frontpayloadpktcount", 32899, 4} { "frontpayloadpktcount", 32899, 4},
{ "dpaflowcount", 32900, 4},
{ "dpaforcedexport", 32901, 1}
}; };
#define PSAMP_STARTING_ID 300 #define PSAMP_STARTING_ID 300

View File

@ -56,6 +56,10 @@ const struct ipfix_identifier * ipfix_id_lookup(int n)
return &SWITCHFLOWTAB[3]; return &SWITCHFLOWTAB[3];
case IPFIX_ETYPEID_frontPayloadPktCount: case IPFIX_ETYPEID_frontPayloadPktCount:
return &SWITCHFLOWTAB[4]; return &SWITCHFLOWTAB[4];
case IPFIX_ETYPEID_dpaFlowCount:
return &SWITCHFLOWTAB[5];
case IPFIX_ETYPEID_dpaForcedExport:
return &SWITCHFLOWTAB[6];
}; };
return NULL; return NULL;

View File

@ -1,7 +1,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "ipfix_names.h" #include "ipfix_names.h"
#include "concentrator/ipfix.hpp" #include "ipfix.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {