Changeset 114 for trunk/src

Show
Ignore:
Timestamp:
06/24/09 17:54:07 (14 years ago)
Author:
andreu
Message:

add some counters in software (see renetcol_mib.h & dataFlowSet.c

Location:
trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r113 r114  
    255255                  == *((unsigned short*)&buffer2)) 
    256256                ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
     257              if (pftmp->fieldType==7){ 
     258                agCache.sPort = *((unsigned short*)&buffer2); 
     259              }    
     260              if (pftmp->fieldType==11){ 
     261                agCache.dPort = *((unsigned short*)&buffer2); 
     262              } 
    257263#if defined(IPV4AGGIDR) || defined(IPV4AGGIDSNMP) 
    258264              if (pftmp->fieldType==10){ 
     
    555561          buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
    556562          (*myPtrs->offsetV9Ptr)++; 
     563          if (pftmp->fieldType==7){ 
     564            agCache.sPort = *((unsigned short*)&buffer2); 
     565          }        
     566          if (pftmp->fieldType==11){ 
     567            agCache.dPort = *((unsigned short*)&buffer2); 
     568          } 
    557569#if defined(IPV4AGGIDR) || defined(IPV4AGGIDSNMP) 
    558570          if (pftmp->fieldType==10){ 
     
    756768        } 
    757769#endif 
     770        if ( (bool == 1) && (isMplsFlow == 0) ){ 
     771          /* Update the information db (aka RenetcolMIB) */ 
     772          myPtrs->currentMIB->ipv4Bytes += agCache.bytes; 
     773          myPtrs->currentMIB->ipv4Pckts += agCache.pkts; 
     774          myPtrs->currentMIB->ipv4Flow += 1; 
     775          switch (agCache.tProt){ 
     776          case 1: 
     777            myPtrs->currentMIB->ipv4IcmpFlowNb += 1; 
     778            myPtrs->currentMIB->ipv4IcmpBytesNb += agCache.bytes; 
     779            myPtrs->currentMIB->ipv4IcmpPktsNb += agCache.pkts; 
     780            break; 
     781          case 6: 
     782            myPtrs->currentMIB->ipv4TCPFlowNb += 1; 
     783            myPtrs->currentMIB->ipv4TCPBytesNb += agCache.bytes; 
     784            myPtrs->currentMIB->ipv4TCPPktsNb += agCache.pkts; 
     785            break; 
     786          case 17: 
     787            myPtrs->currentMIB->ipv4UDPFlowNb += 1; 
     788            myPtrs->currentMIB->ipv4UDPBytesNb += agCache.bytes; 
     789            myPtrs->currentMIB->ipv4UDPPktsNb += agCache.pkts; 
     790            break; 
     791          default: 
     792            myPtrs->currentMIB->ipv4OthersFlowNb += 1; 
     793            myPtrs->currentMIB->ipv4OthersBytesNb += agCache.bytes; 
     794            myPtrs->currentMIB->ipv4OthersPktsNb += agCache.pkts; 
     795            break; 
     796          } 
     797          if (agCache.pkts==1){ 
     798            myPtrs->currentMIB->ipv4FlowSizePcktsE1 += 1; 
     799          } else if (agCache.pkts<10) { 
     800            myPtrs->currentMIB->ipv4FlowSizePcktsLT10 += 1; 
     801          } else if (agCache.pkts<100) { 
     802            myPtrs->currentMIB->ipv4FlowSizePcktsLT100 += 1; 
     803          } else if (agCache.pkts<1000) { 
     804            myPtrs->currentMIB->ipv4FlowSizePcktsLT1k += 1; 
     805          } else if (agCache.pkts<10000) { 
     806            myPtrs->currentMIB->ipv4FlowSizePcktsLT10k += 1; 
     807          } else if (agCache.pkts>=10000) { 
     808            myPtrs->currentMIB->ipv4FlowSizePcktsMT10k += 1; 
     809          } 
     810          if (agCache.bytes<50){ 
     811            myPtrs->currentMIB->ipv4FlowSizeBytesLT50 += 1; 
     812          } else if (agCache.bytes<100) { 
     813            myPtrs->currentMIB->ipv4FlowSizeBytesLT100 += 1; 
     814          } else if (agCache.bytes<1000) { 
     815            myPtrs->currentMIB->ipv4FlowSizeBytesLT1k += 1; 
     816          } else if (agCache.bytes<10000) { 
     817            myPtrs->currentMIB->ipv4FlowSizeBytesLT10k += 1; 
     818          } else if (agCache.bytes<100000) { 
     819            myPtrs->currentMIB->ipv4FlowSizeBytesLT100k += 1; 
     820          } else if (agCache.bytes<1000000) { 
     821            myPtrs->currentMIB->ipv4FlowSizeBytesLT1M += 1; 
     822          } else if (agCache.bytes<10000000) { 
     823            myPtrs->currentMIB->ipv4FlowSizeBytesLT10M += 1; 
     824          } else if (agCache.bytes<100000000) { 
     825            myPtrs->currentMIB->ipv4FlowSizeBytesLT100M += 1; 
     826          } else if (agCache.bytes>=100000000) { 
     827            myPtrs->currentMIB->ipv4FlowSizeBytesMT100M += 1; 
     828          } 
     829          switch (agCache.dPort){ 
     830          case 53: 
     831            myPtrs->currentMIB->ipv4DNSFlowNb += 1; 
     832            myPtrs->currentMIB->ipv4DNSBytesNb += agCache.bytes; 
     833            myPtrs->currentMIB->ipv4DNSPcktsNb += agCache.pkts; 
     834            break; 
     835          case 80: 
     836            myPtrs->currentMIB->ipv4WebFlowNb += 1; 
     837            myPtrs->currentMIB->ipv4WebBytesNb += agCache.bytes; 
     838            myPtrs->currentMIB->ipv4WebPcktsNb += agCache.pkts; 
     839            break; 
     840          default: 
     841            myPtrs->currentMIB->ipv4OthersApFlowNb += 1; 
     842            myPtrs->currentMIB->ipv4OthersApBytesNb += agCache.bytes; 
     843            myPtrs->currentMIB->ipv4OthersApPcktsNb += agCache.pkts; 
     844            break; 
     845          }   
     846          /* end of mib update */ 
     847        } 
    758848        /* 
    759849         * PREFIX &/or MATRIX ACCOUNTING 
     
    11031193        bool = 0; 
    11041194#endif /* (IPV4AGGIDR) || (IPV4AGGIDSNMP) */ 
     1195        if ( ( isIPv6 == 1 ) && (isMplsFlow == 0) ){ 
    11051196#ifdef IPV6LINKAGG 
    1106         if ( ( isIPv6 == 1 ) && (isMplsFlow == 0) ){ 
    11071197          ((struct IndexV6 *)((myPtrs->currentV6IndexTab) 
    11081198                              +((myPtrs->currentRouterPtr->ID)*MAX_INDEX_BY_ROUTER) 
     
    11421232                              +((myPtrs->currentRouterPtr->ID)*MAX_INDEX_BY_ROUTER) 
    11431233                              +(agCache.outputSnmp)))->flowNbOUT++; 
    1144           isIPv6 = 0; 
    11451234/*        fprintf(stderr,"IPV6LINKAGG;IN;%hu;OUT;%hu;router;%lu;bytes;%lu\n", */ 
    11461235/*                agCache.inputSnmp, */ 
     
    11491238/*                agCache.bytes */ 
    11501239/*               ); */ 
     1240#endif /* IPV6LINKAGG */ 
     1241          /* Update the information db (aka RenetcolMIB) */ 
     1242          myPtrs->currentMIB->ipv6Bytes += agCache.bytes; 
     1243          myPtrs->currentMIB->ipv6Pckts += agCache.pkts; 
     1244          myPtrs->currentMIB->ipv6Flow += 1; 
     1245          switch (agCache.tProt){ 
     1246          case 1: 
     1247            myPtrs->currentMIB->ipv6IcmpFlowNb += 1; 
     1248            myPtrs->currentMIB->ipv6IcmpBytesNb += agCache.bytes; 
     1249            myPtrs->currentMIB->ipv6IcmpPktsNb += agCache.pkts; 
     1250            break; 
     1251          case 6: 
     1252            myPtrs->currentMIB->ipv6TCPFlowNb += 1; 
     1253            myPtrs->currentMIB->ipv6TCPBytesNb += agCache.bytes; 
     1254            myPtrs->currentMIB->ipv6TCPPktsNb += agCache.pkts; 
     1255            break; 
     1256          case 17: 
     1257            myPtrs->currentMIB->ipv6UDPFlowNb += 1; 
     1258            myPtrs->currentMIB->ipv6UDPBytesNb += agCache.bytes; 
     1259            myPtrs->currentMIB->ipv6UDPPktsNb += agCache.pkts; 
     1260            break; 
     1261          default: 
     1262            myPtrs->currentMIB->ipv6OthersFlowNb += 1; 
     1263            myPtrs->currentMIB->ipv6OthersBytesNb += agCache.bytes; 
     1264            myPtrs->currentMIB->ipv6OthersPktsNb += agCache.pkts; 
     1265            break; 
     1266          } 
     1267          if (agCache.pkts==1){ 
     1268            myPtrs->currentMIB->ipv6FlowSizePcktsE1 += 1; 
     1269          } else if (agCache.pkts<10) { 
     1270            myPtrs->currentMIB->ipv6FlowSizePcktsLT10 += 1; 
     1271          } else if (agCache.pkts<100) { 
     1272            myPtrs->currentMIB->ipv6FlowSizePcktsLT100 += 1; 
     1273          } else if (agCache.pkts<1000) { 
     1274            myPtrs->currentMIB->ipv6FlowSizePcktsLT1k += 1; 
     1275          } else if (agCache.pkts<10000) { 
     1276            myPtrs->currentMIB->ipv6FlowSizePcktsLT10k += 1; 
     1277          } else if (agCache.pkts>=10000) { 
     1278            myPtrs->currentMIB->ipv6FlowSizePcktsMT10k += 1; 
     1279          } 
     1280          if (agCache.bytes<50){ 
     1281            myPtrs->currentMIB->ipv6FlowSizeBytesLT50 += 1; 
     1282          } else if (agCache.bytes<100) { 
     1283            myPtrs->currentMIB->ipv6FlowSizeBytesLT100 += 1; 
     1284          } else if (agCache.bytes<1000) { 
     1285            myPtrs->currentMIB->ipv6FlowSizeBytesLT1k += 1; 
     1286          } else if (agCache.bytes<10000) { 
     1287            myPtrs->currentMIB->ipv6FlowSizeBytesLT10k += 1; 
     1288          } else if (agCache.bytes<100000) { 
     1289            myPtrs->currentMIB->ipv6FlowSizeBytesLT100k += 1; 
     1290          } else if (agCache.bytes<1000000) { 
     1291            myPtrs->currentMIB->ipv6FlowSizeBytesLT1M += 1; 
     1292          } else if (agCache.bytes<10000000) { 
     1293            myPtrs->currentMIB->ipv6FlowSizeBytesLT10M += 1; 
     1294          } else if (agCache.bytes<100000000) { 
     1295            myPtrs->currentMIB->ipv6FlowSizeBytesLT100M += 1; 
     1296          } else if (agCache.bytes>=100000000) { 
     1297            myPtrs->currentMIB->ipv6FlowSizeBytesMT100M += 1; 
     1298          } 
     1299          switch (agCache.dPort){ 
     1300          case 53: 
     1301            myPtrs->currentMIB->ipv6DNSFlowNb += 1; 
     1302            myPtrs->currentMIB->ipv6DNSBytesNb += agCache.bytes; 
     1303            myPtrs->currentMIB->ipv6DNSPcktsNb += agCache.pkts; 
     1304            break; 
     1305          case 80: 
     1306            myPtrs->currentMIB->ipv6WebFlowNb += 1; 
     1307            myPtrs->currentMIB->ipv6WebBytesNb += agCache.bytes; 
     1308            myPtrs->currentMIB->ipv6WebPcktsNb += agCache.pkts; 
     1309            break; 
     1310          default: 
     1311            myPtrs->currentMIB->ipv6OthersApFlowNb += 1; 
     1312            myPtrs->currentMIB->ipv6OthersApBytesNb += agCache.bytes; 
     1313            myPtrs->currentMIB->ipv6OthersApPcktsNb += agCache.pkts; 
     1314            break; 
     1315          }   
     1316          /* end of mib update */ 
     1317          isIPv6 = 0; 
    11511318        } 
    1152 #endif /* IPV6LINKAGG */ 
    11531319        isMplsFlow = 0; 
    11541320        /*  
  • trunk/src/dataFlowSet.h

    r61 r114  
    7575  unsigned char tProt; 
    7676  unsigned char ipProt; 
     77  unsigned short sPort; 
     78  unsigned short dPort;   
    7779  unsigned char sens; /* In/out field 61 */ 
    7880  unsigned short inputSnmp; 
  • trunk/src/renetcol.c

    r113 r114  
    991991  theMIB->flowNb = 0;           
    992992  theMIB->realFlowNb = 0;  
    993   theMIB->ipv4BytesIn = 0; 
    994   theMIB->ipv4BytesOut = 0; 
    995   theMIB->ipv4PcktsIn = 0; 
    996   theMIB->ipv4PcktsOut = 0; 
    997   theMIB->ipv4FlowIn = 0; 
    998   theMIB->ipv4FlowOut = 0;     
     993  theMIB->ipv4Bytes = 0; 
     994  theMIB->ipv4Pckts = 0; 
     995  theMIB->ipv4Flow = 0;     
    999996  theMIB->ipv4IcmpFlowNb = 0; 
    1000997  theMIB->ipv4IcmpBytesNb = 0; 
     
    10331030  theMIB->ipv4OthersApPcktsNb = 0; 
    10341031  theMIB->ipv4OthersApFlowNb = 0; 
    1035   theMIB->ipv6BytesIn = 0; 
    1036   theMIB->ipv6BytesOut = 0; 
    1037   theMIB->ipv6PcktsIn = 0; 
    1038   theMIB->ipv6PcktsOut = 0; 
    1039   theMIB->ipv6FlowIn = 0; 
    1040   theMIB->ipv6FlowOut = 0; 
     1032  theMIB->ipv6Bytes = 0; 
     1033  theMIB->ipv6Pckts = 0; 
     1034  theMIB->ipv6Flow = 0; 
    10411035  theMIB->ipv6IcmpFlowNb = 0; 
    10421036  theMIB->ipv6IcmpBytesNb = 0; 
     
    10651059  theMIB->ipv6FlowSizeBytesLT10M = 0;   
    10661060  theMIB->ipv6FlowSizeBytesLT100M = 0;  
    1067   theMIB->ipv6FlowSizeBytesMT10M = 0;   
     1061  theMIB->ipv6FlowSizeBytesMT100M = 0;   
    10681062  theMIB->ipv6WebBytesNb = 0; 
    10691063  theMIB->ipv6WebPcktsNb = 0; 
  • trunk/src/renetcol_mib.h

    r113 r114  
    5252   * IPv4 Section 
    5353   */ 
    54   unsigned long long ipv4BytesIn; 
    55   unsigned long long ipv4BytesOut; 
    56   unsigned long long ipv4PcktsIn; 
    57   unsigned long long ipv4PcktsOut; 
    58   unsigned long long ipv4FlowIn; 
    59   unsigned long long ipv4FlowOut; 
     54  unsigned long long ipv4Bytes; 
     55  unsigned long long ipv4Pckts; 
     56  unsigned long long ipv4Flow; 
    6057  /* L4 counters */ 
    6158  unsigned long long ipv4IcmpFlowNb; 
     
    10097   * IPv6 Section 
    10198   */ 
    102   unsigned long long ipv6BytesIn; 
    103   unsigned long long ipv6BytesOut; 
    104   unsigned long long ipv6PcktsIn; 
    105   unsigned long long ipv6PcktsOut; 
    106   unsigned long long ipv6FlowIn; 
    107   unsigned long long ipv6FlowOut; 
     99  unsigned long long ipv6Bytes; 
     100  unsigned long long ipv6Pckts; 
     101  unsigned long long ipv6Flow; 
    108102  /* L4 counters */ 
    109103  unsigned long long ipv6IcmpFlowNb; 
     
    135129  unsigned long long ipv6FlowSizeBytesLT10M;  /* < 10M bytes */ 
    136130  unsigned long long ipv6FlowSizeBytesLT100M;  /* < 100M bytes */ 
    137   unsigned long long ipv6FlowSizeBytesMT10M;  /* >= 100M bytes */ 
     131  unsigned long long ipv6FlowSizeBytesMT100M;  /* >= 100M bytes */ 
    138132  /* Counters based on Web/DNS/others flows distribution */ 
    139133  unsigned long long ipv6WebBytesNb;