Changeset 86 for trunk/src

Show
Ignore:
Timestamp:
11/21/08 11:27:21 (14 years ago)
Author:
andreu
Message:

ticket #23

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r85 r86  
    299299                  } 
    300300              } 
     301              if ((pftmp->fieldType==16)||(pftmp->fieldType==17)){ 
     302                if ((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue)  
     303                    == ((unsigned short)*((unsigned long*)&buffer4))) 
     304                  { 
     305                    ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
     306                  } 
     307              } 
    301308              if (pftmp->fieldType==1){ 
    302309                agCache.bytes = *((unsigned long*)&buffer4); 
     
    331338              if (pftmp->fieldType==2){ 
    332339                agCache.pkts = *((unsigned long*)&buffer4); 
     340              } 
     341#endif 
     342#ifdef ASACC 
     343              if (pftmp->fieldType==16){ 
     344                agCache.asS = (unsigned short)*((unsigned long*)&buffer4); 
     345              }    
     346              if (pftmp->fieldType==17){ 
     347                agCache.asD = (unsigned short)*((unsigned long*)&buffer4); 
    333348              } 
    334349#endif 
     
    573588          } 
    574589#endif 
     590#ifdef ASACC 
     591          if (pftmp->fieldType==16){ 
     592            agCache.asS = (unsigned short)*((unsigned long*)&buffer4); 
     593          }        
     594          if (pftmp->fieldType==17){ 
     595            agCache.asD = (unsigned short)*((unsigned long*)&buffer4); 
     596          } 
     597#endif 
    575598          break; 
    576599        case 16: 
     
    611634          asres = bsearch(&asKey, myPtrs->currentASTab, myPtrs->asNb, sizeof(struct AS), asGlobalCmp); 
    612635          if (asres != NULL) { 
    613             if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1  ) {          
     636            if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1  ) { 
     637#if defined(MULTISAMPLING) 
     638              if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 
     639                /* OUT ("traffic from the AS")  */ 
     640                asres->bytesNbOUT += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     641                asres->pktsNbOUT += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     642              }else{ 
     643                asres->bytesNbOUT += agCache.bytes; 
     644                asres->pktsNbOUT += agCache.pkts; 
     645                (asres->flowNbOUT)++; 
     646              } 
     647#else 
    614648              if (myPtrs->currentRouterPtr->sampled != 0 ){ 
    615649                /* OUT ("traffic from the AS")  */ 
     
    622656                asres->sampling = myPtrs->currentRouterPtr->sampled; 
    623657              } 
     658#endif 
    624659              asres = NULL; 
    625660              asKey.as = agCache.asD; 
    626661              asres = bsearch(&asKey, myPtrs->currentASTab, myPtrs->asNb, sizeof(struct AS), asGlobalCmp); 
    627662              if (asres!=NULL){ 
     663#if defined(MULTISAMPLING) 
     664                if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 
     665                  /* IN ("traffic to the AS")  */ 
     666                  asres->bytesNbIN += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     667                  asres->pktsNbIN += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     668                }else{ 
     669                  asres->bytesNbIN += agCache.bytes; 
     670                  asres->pktsNbIN += agCache.pkts; 
     671                  (asres->flowNbIN)++; 
     672                } 
     673#else 
    628674                if (myPtrs->currentRouterPtr->sampled != 0 ){ 
    629675                  /* IN ("traffic to the AS")  */ 
     
    636682                  asres->sampling = myPtrs->currentRouterPtr->sampled; 
    637683                } 
     684#endif 
    638685                asres = NULL; 
    639686              } 
     
    645692            if (asres!=NULL){ 
    646693              if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1  ) { 
     694#if defined(MULTISAMPLING) 
     695                if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 
     696                  /* IN ("traffic to the AS")  */ 
     697                  asres->bytesNbIN += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     698                  asres->pktsNbIN += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 
     699                }else{ 
     700                  asres->bytesNbIN += agCache.bytes; 
     701                  asres->pktsNbIN += agCache.pkts; 
     702                  (asres->flowNbIN)++; 
     703                } 
     704#else 
    647705                if (myPtrs->currentRouterPtr->sampled != 0 ){ 
    648706                  /* IN ("traffic to the AS")  */ 
     
    655713                  asres->sampling = myPtrs->currentRouterPtr->sampled; 
    656714                } 
     715#endif 
    657716              } 
    658717            } 
  • trunk/src/get_conf.c

    r84 r86  
    434434  unsigned short counter = 0; 
    435435  unsigned short n0; 
     436#if defined(MULTISAMPLING) 
     437  unsigned short n1; 
     438#endif 
    436439  unsigned short buffer; 
    437440  int i = 0; 
    438   char ASStrTab[MAX_AS][7]; 
     441  char ASStrTab[MAX_AS][256]; 
    439442 
    440443  if (!(asFile = fopen(filename, "r"))) { 
     
    446449    ASTabPtr[i].sampling = 0; 
    447450  } 
    448   while (fgets(line, 7, asFile) != 0) 
     451  while (fgets(line, 256, asFile) != 0) 
    449452    { 
    450453      strcpy(ASStrTab[counter], line); 
     
    457460      } 
    458461    } 
    459   qsort(ASStrTab, counter, 7, compASStr); 
     462  qsort(ASStrTab, counter, 256, compASStr); 
    460463  for(i=0;i<counter;i++) 
    461464    { 
     465#if defined(MULTISAMPLING) 
     466      sscanf(ASStrTab[i],"%hu %hu\n", 
     467             &n0, 
     468             &n1); 
     469      buffer = (unsigned short)n0; 
     470      ASTabPtr[i].as = *((unsigned short*)&buffer); 
     471      buffer = (unsigned short)n1; 
     472      ASTabPtr[i].sampling = *((unsigned short*)&buffer); 
     473#else 
    462474      sscanf(ASStrTab[i],"%hu\n", 
    463475             &n0); 
     
    465477      ASTabPtr[i].as = *((unsigned short*)&buffer); 
    466478      ASTabPtr[i].sampling = 0; 
     479#endif 
    467480    } 
    468481  if( fclose(asFile) == 0) {