Hi Luca, Burton,
This adds some code in the drawGlobalIpProtoDistribution() function, that
will cause the drawn graph to include the bar for "Other TCP/UDP based
Prot.", as this value is also included in the table just above the graph.
Basically, I just copied the code that takes care of the "Other" row in the
table above the graph, and did some minor cleanups.
-- Robbert
PS. Still some work to do on the graph itself; the legend is too long to fit
in the graph, so I only get the legend of the first 12 protocols in the
graph. Also does it look like we've run out of colors for the bars as the
last few bars are all black.
--- graph.c.original 2003-07-23 12:10:42.000000000 +0200
+++ graph.c 2003-07-23 15:28:55.000000000 +0200
@@ -1555,8 +1555,25 @@
char *lbl[256];
FILE *fd;
int useFdOpen = 0;
+ float total, partialTotal;
+
+ total =
(float)myGlobals.device[myGlobals.actualReportDeviceId].ipBytes.value;
+
+ {
+ ProtocolsList *protoList = myGlobals.ipProtosList;
+ int idx1 = 0;
- p[myGlobals.numIpProtosToMonitor] = 0;
+ while(protoList != NULL) {
+ if(total >
(float)myGlobals.device[myGlobals.actualReportDeviceId].ipProtosList[idx1].v
alue)
+ total -=
(float)myGlobals.device[myGlobals.actualReportDeviceId].ipProtosList[idx1].v
alue;
+ else
+ total = 0;
+
+ idx1++, protoList = protoList->next;
+ }
+ }
+
+ partialTotal = 0;
for(i=0; i<myGlobals.numIpProtosToMonitor; i++) {
p[idx] =
(float)myGlobals.device[myGlobals.actualReportDeviceId].ipProtoStats[i].loca
l.value
@@ -1564,12 +1581,19 @@
p[idx] +=
(float)myGlobals.device[myGlobals.actualReportDeviceId].ipProtoStats[i].remo
te2local.value
+myGlobals.device[myGlobals.actualReportDeviceId].ipProtoStats[i].local2remo
te.value;
if(p[idx] > 0) {
- p[myGlobals.numIpProtosToMonitor] += p[idx];
+ partialTotal += p[idx];
lbl[idx] = myGlobals.protoIPTrafficInfos[i];
idx++;
}
}
+ // add a bar for the Other TCP/UDP based protocols
+ if (total > partialTotal) {
+ lbl[idx] = "Other";
+ p[idx] = total - partialTotal;
+ idx++;
+ }
+
#ifndef WIN32
/* Unices */
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev