Commit 5d2a3f04 authored by Håvard Moås's avatar Håvard Moås
Browse files

Update IPFIXLIB to add support for returning pktdist/length average/stddev as...

Update IPFIXLIB to add support for returning pktdist/length average/stddev as sums + quadsums, so that a higher-precision calculation can be done on the values outside of ipfixlib. havard.mork@gmail.com

git-svn-id: file:///home/svn/mapi/branches/haavardm-mapi@61 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent e5d8e35f
......@@ -859,8 +859,8 @@ void addPktToHash(np_ctxt_t *npctxt,
if(npctxt->pktDistLengthStddevs>0) {
bkt->src2dst_expval_pktdist_x = 0;
bkt->src2dst_expval_pktdist_x2 = 0;
bkt->src2dst_expval_pktlength_x = 0;
bkt->src2dst_expval_pktlength_x2= 0;
bkt->src2dst_expval_pktlength_x = len;
bkt->src2dst_expval_pktlength_x2= len*len;
bkt->dst2src_expval_pktdist_x = 0;
bkt->dst2src_expval_pktdist_x2 = 0;
......
......@@ -50,7 +50,10 @@
#define FID_EXPVAL_PKT_DIST 32791
#define FID_VAR_PKT_LENGTH 32792
#define FID_EXPVAL_PKT_LENGTH 32793
#define FID_SUM_PKT_DIST 32794
#define FID_SUM_PKT_LENGTH 32795
#define FID_QSUM_PKT_DIST 32796
#define FID_QSUM_PKT_LENGTH 32797
#ifndef __KERNEL__
......@@ -780,8 +783,10 @@ static V9TemplateId ver9_templates[] = {
{ FID_EXPVAL_PKT_DIST, 4, "EXPVAL_PKT_DIST" }, // returns float-32
{ FID_VAR_PKT_LENGTH, 4, "VAR_PKT_LENGTH" }, // returns float-32
{ FID_EXPVAL_PKT_LENGTH,4, "EXPVAL_PKT_LENGTH" }, // returns float-32
{ FID_SUM_PKT_DIST, 8, "SUM_PKT_DIST" },
{ FID_SUM_PKT_LENGTH, 8, "SUM_PKT_LENGTH" },
{ FID_QSUM_PKT_DIST, 8, "QSUM_PKT_DIST" },
{ FID_QSUM_PKT_LENGTH, 8, "QSUM_PKT_LENGTH" },
{ 0, 0, NULL }
};
......@@ -1448,7 +1453,20 @@ static void handleTemplate(np_ctxt_t *npctxt, V9TemplateId *theTemplate,
copyFloat(f, outBuffer,outBufferBegin,outBufferMax);
}
break;
}
case FID_SUM_PKT_DIST:
copyInt64(direction==0?theFlow->src2dst_expval_pktdist_x:theFlow->dst2src_expval_pktdist_x, outBuffer, outBufferBegin,outBufferMax);
break;
case FID_SUM_PKT_LENGTH:
copyInt64(direction==0?theFlow->src2dst_expval_pktlength_x:theFlow->dst2src_expval_pktlength_x, outBuffer, outBufferBegin,outBufferMax);
break;
case FID_QSUM_PKT_DIST:
copyInt64(direction==0?theFlow->src2dst_expval_pktdist_x2:theFlow->dst2src_expval_pktdist_x2, outBuffer, outBufferBegin,outBufferMax);
break;
case FID_QSUM_PKT_LENGTH:
copyInt64(direction==0?theFlow->src2dst_expval_pktlength_x2:theFlow->dst2src_expval_pktlength_x2, outBuffer, outBufferBegin,outBufferMax);
break;
};
}
(*numElements) = (*numElements)+1;
......@@ -1507,6 +1525,10 @@ turnOnSpecialProcessing(np_ctxt_t *npctxt, u_int element) {
case FID_EXPVAL_PKT_DIST:
case FID_VAR_PKT_LENGTH:
case FID_EXPVAL_PKT_LENGTH:
case FID_SUM_PKT_DIST:
case FID_SUM_PKT_LENGTH:
case FID_QSUM_PKT_DIST:
case FID_QSUM_PKT_LENGTH:
npctxt->pktDistLengthStddevs = 1;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment