Changeset 57 for trunk/src

Show
Ignore:
Timestamp:
09/26/07 14:13:56 (15 years ago)
Author:
andreu
Message:

delete all CRIHAN code and some outputs; add param in check.sh

Location:
trunk/src
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r55 r57  
    6363  msgType myMsg; 
    6464  char *msgTextIndex; 
    65   char *msgToSend; 
     65 
    6666  unsigned short tplMsgType = 11; 
    6767  struct PrefixV4 prefixKey, *res, *res2; /* for bsearch */ 
     
    7373  int crazyCounter = 0; 
    7474 
    75 #ifdef CRIHAN 
    76   struct IPFLowCache ipFirstCache; 
    77   struct MPLSFlowCache mplsFirstCache; 
    78   unsigned long firstTime = 0;  
    79   unsigned long lastTime = 0;  
    80  
    81   ipFirstCache.ipProt = 0; 
    82   ipFirstCache.bytes = 0; 
    83   ipFirstCache.pkts = 0; 
    84   ipFirstCache.inSnmp = 0; 
    85   ipFirstCache.outSnmp = 0; 
    86   ipFirstCache.v4AdS = 0; 
    87   ipFirstCache.v4AdD = 0; 
    88   ipFirstCache.tProt = 0; 
    89   ipFirstCache.sPort = 0; 
    90   ipFirstCache.dPort = 0; 
    91   ipFirstCache.maskD = 0; 
    92   ipFirstCache.maskS = 0; 
    93   ipFirstCache.routerAd = 0; 
    94   ipFirstCache.liveTime = 0; 
    95   mplsFirstCache.ipProt = 0; 
    96   mplsFirstCache.v4AdS = 0; 
    97   mplsFirstCache.v4AdD = 0; 
    98   mplsFirstCache.routerAd = 0; 
    99   mplsFirstCache.mplsLabel1 = 0; 
    100 #endif /* CRIHAN */ 
    101  
    102   buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 
    103   buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 
     75  buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); 
     76  (*myPtrs->offsetV9Ptr)++; 
     77  buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); 
     78  (*myPtrs->offsetV9Ptr)++; 
    10479  (*myPtrs->currentFlowsetIdPtr) = *((unsigned short*)&buffer2); 
    105   buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 
    106   buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 
     80  buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); 
     81  (*myPtrs->offsetV9Ptr)++; 
     82  buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); 
     83  (*myPtrs->offsetV9Ptr)++; 
    10784  data_length = *((unsigned short*)&buffer2); 
    10885 
    109   if ( (tmp=existTplId(myPtrs->currentRouterPtr, myPtrs->currentHeaderV9Ptr->sourceId,  
    110                       (*myPtrs->currentFlowsetIdPtr)))!=NULL ) { 
     86  if ( (tmp=existTplId(myPtrs->currentRouterPtr,  
     87                       myPtrs->currentHeaderV9Ptr->sourceId,  
     88                       (*myPtrs->currentFlowsetIdPtr)))!=NULL ) { 
    11189#ifdef DEBUG 
    112     fprintf(stderr,"{d id: %hu, lg %hu", (*myPtrs->currentFlowsetIdPtr), data_length); 
     90    fprintf(stderr, 
     91            "{d id: %hu, lg %hu",  
     92            (*myPtrs->currentFlowsetIdPtr),  
     93            data_length); 
    11394    if ( (*myPtrs->currentFlowsetIdPtr) > TRESHOLD_TEMPLATE_ID ) { 
    11495/*      fprintf(stderr,"Bad TID from router: %lu.%lu.%lu.%lu\n", */ 
     
    155136#endif 
    156137 
    157 #ifdef CRIHAN 
    158     ipFirstCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd; 
    159     mplsFirstCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd; 
    160 #endif /* CRIHAN */ 
    161  
    162138    pftmp = tmp->lastField; 
    163139    secondPftmp = tmp->lastField;     
    164140    secondOffset = *myPtrs->offsetV9Ptr; 
    165141    secondOldOffset = secondOffset; 
    166     while ( (((*myPtrs->offsetV9Ptr)-48-shift) <= data_length) && (overflow!=1) ) {  
     142    while ( (((*myPtrs->offsetV9Ptr)-48-shift) <= data_length)  
     143            && (overflow!=1) ) {  
    167144      /*  
    168145       * progression in a data flow Set  
     
    179156      /* FIXME : this code is repeated, perhaps past before */ 
    180157      while ( ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j))) != NULL ) { 
    181         if  ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j)))->value->stor.lvalue) 
     158        if ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j)))->value->stor.lvalue) 
    182159              == myPtrs->pcktPtr->ipH->srcAdd ) 
    183160          { 
     
    206183            switch (field_size) { 
    207184            case 1: 
    208               buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     185              buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     186              (*myPtrs->offsetV9Ptr)++; 
    209187              /* rule check */ 
    210188              if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.cvalue  
     
    233211              } 
    234212#endif         
    235 #ifdef CRIHAN 
    236               if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 
    237                 ipFirstCache.maskS = *((unsigned char*)&buffer1); 
    238               } 
    239               if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ 
    240                 ipFirstCache.maskD = *((unsigned char*)&buffer1); 
    241               } 
    242               if (pftmp->fieldType==60){  
    243                 ipFirstCache.ipProt = *((unsigned char*)&buffer1);  
    244                 mplsFirstCache.ipProt = *((unsigned char*)&buffer1);  
    245               } 
    246               if (pftmp->fieldType==4){  
    247                 ipFirstCache.tProt = *((unsigned char*)&buffer1);  
    248               } 
    249 #endif 
    250213              break; 
    251214            case 2: 
    252               buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    253               buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     215              buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     216              (*myPtrs->offsetV9Ptr)++; 
     217              buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     218              (*myPtrs->offsetV9Ptr)++; 
    254219              if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue  
    255220                  == *((unsigned short*)&buffer2)) 
     
    260225              } 
    261226#endif 
    262 #ifdef CRIHAN 
    263               /* FIXME : add this two following bloc in the case N = 4 */ 
    264               if (pftmp->fieldType==10){ 
    265                 ipFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    266                 if ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue)  
    267                      == (*((unsigned short*)&buffer2)) 
    268                      ) 
    269                   { 
    270                     ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
    271                   } 
    272               } 
    273               if (pftmp->fieldType==14){ 
    274                 ipFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    275                 if ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue)  
    276                      == (*((unsigned short*)&buffer2)) 
    277                      ) 
    278                   { 
    279                     ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
    280                   } 
    281               } 
    282               if (pftmp->fieldType==7){ 
    283                 ipFirstCache.sPort = *((unsigned short*)&buffer2); 
    284                 if ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue)  
    285                      == (*((unsigned short*)&buffer2)) 
    286                      ) 
    287                   { 
    288                     ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
    289                   } 
    290               } 
    291               if (pftmp->fieldType==11){ 
    292                 ipFirstCache.dPort = *((unsigned short*)&buffer2); 
    293                 if ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue)  
    294                      == (*((unsigned short*)&buffer2)) 
    295                      ) 
    296                   { 
    297                     ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 
    298                   } 
    299               } 
    300 #endif 
    301227              break; 
    302228            case 3: 
    303229              buffer4[3]= 0; 
    304               buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    305               buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    306               buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     230              buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     231              (*myPtrs->offsetV9Ptr)++; 
     232              buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     233              (*myPtrs->offsetV9Ptr)++; 
     234              buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     235              (*myPtrs->offsetV9Ptr)++; 
    307236              if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue  
    308237                  == *((unsigned long*)&buffer4)) 
     
    313242                isMplsFlow = 1; 
    314243              } 
    315 #ifdef CRIHAN 
    316               if (pftmp->fieldType==70){ 
    317                 mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 
    318               } 
    319 #endif 
    320244              break; 
    321245            case 4: 
    322               buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    323               buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    324               buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    325               buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     246              buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     247              (*myPtrs->offsetV9Ptr)++; 
     248              buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     249              (*myPtrs->offsetV9Ptr)++; 
     250              buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     251              (*myPtrs->offsetV9Ptr)++; 
     252              buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     253              (*myPtrs->offsetV9Ptr)++; 
    326254              /* FIXME : here , add a check on the field type */ 
    327255              if ((pftmp->fieldType==8)||(pftmp->fieldType==12)){ 
     
    360288              } 
    361289#endif 
    362 #ifdef CRIHAN 
    363               if (pftmp->fieldType==8){ 
    364                 ipFirstCache.v4AdS = *((unsigned long*)&buffer4); 
    365                 mplsFirstCache.v4AdS = *((unsigned long*)&buffer4); 
    366               } 
    367               if (pftmp->fieldType==12){ 
    368                 ipFirstCache.v4AdD = *((unsigned long*)&buffer4); 
    369                 mplsFirstCache.v4AdD = *((unsigned long*)&buffer4); 
    370               } 
    371               if (pftmp->fieldType==1){ 
    372                 ipFirstCache.bytes = *((unsigned long*)&buffer4); 
    373               } 
    374               if (pftmp->fieldType==2){ 
    375                 ipFirstCache.pkts = *((unsigned long*)&buffer4); 
    376               } 
    377               if (pftmp->fieldType==22){ 
    378                 firstTime = *((unsigned long*)&buffer4); 
    379               } 
    380               if (pftmp->fieldType==21){ 
    381                 lastTime = *((unsigned long*)&buffer4); 
    382               } 
    383 #endif 
    384290              break; 
    385291            case 16: 
    386292              for (i=0; i<4; i++) { 
    387                 buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    388                 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    389                 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    390                 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     293                buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     294                (*myPtrs->offsetV9Ptr)++; 
     295                buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     296                (*myPtrs->offsetV9Ptr)++; 
     297                buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     298                (*myPtrs->offsetV9Ptr)++; 
     299                buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     300                (*myPtrs->offsetV9Ptr)++; 
    391301                if (1==moreIsNecessary){ 
    392302                  switch(i){ 
     
    532442        switch (field_size) { 
    533443        case 1: 
    534           buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     444          buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     445          (*myPtrs->offsetV9Ptr)++; 
    535446#ifdef IPV4AGG 
    536447          if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 
     
    553464          }        
    554465#endif 
    555 #ifdef CRIHAN 
    556           if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 
    557             ipFirstCache.maskS = *((unsigned char*)&buffer1); 
    558           } 
    559           if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ 
    560             ipFirstCache.maskD = *((unsigned char*)&buffer1); 
    561           } 
    562           if (pftmp->fieldType==60){  
    563             ipFirstCache.ipProt = *((unsigned char*)&buffer1);  
    564             mplsFirstCache.ipProt = *((unsigned char*)&buffer1);  
    565           } 
    566           if (pftmp->fieldType==4){  
    567             ipFirstCache.tProt = *((unsigned char*)&buffer1);  
    568           } 
    569 #endif 
    570466          break; 
    571467        case 2: 
    572           buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    573           buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     468          buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     469          (*myPtrs->offsetV9Ptr)++; 
     470          buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     471          (*myPtrs->offsetV9Ptr)++; 
    574472#ifdef IPV4AGG 
    575473          if (pftmp->fieldType==10){ 
     
    577475          }        
    578476#endif 
    579 #ifdef CRIHAN 
    580           if (pftmp->fieldType==10){ 
    581             ipFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    582           } 
    583           if (pftmp->fieldType==14){ 
    584             ipFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    585           } 
    586           if (pftmp->fieldType==7){ 
    587             ipFirstCache.sPort = *((unsigned short*)&buffer2); 
    588           } 
    589           if (pftmp->fieldType==11){ 
    590             ipFirstCache.dPort = *((unsigned short*)&buffer2); 
    591           } 
    592 #endif 
    593477          break; 
    594478        case 3: 
    595479          buffer4[3]= 0; 
    596           buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    597           buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    598           buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     480          buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     481          (*myPtrs->offsetV9Ptr)++; 
     482          buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     483          (*myPtrs->offsetV9Ptr)++; 
     484          buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     485          (*myPtrs->offsetV9Ptr)++; 
    599486          /* aggregation */ 
    600487          /* end aggregation */ 
     
    602489            isMplsFlow = 1; 
    603490          } 
    604 #ifdef CRIHAN 
    605           if (pftmp->fieldType==70){ 
    606             mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 
    607           } 
    608 #endif 
    609491          break; 
    610492        case 4: 
    611           buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    612           buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    613           buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    614           buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     493          buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     494          (*myPtrs->offsetV9Ptr)++; 
     495          buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     496          (*myPtrs->offsetV9Ptr)++; 
     497          buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     498          (*myPtrs->offsetV9Ptr)++; 
     499          buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     500          (*myPtrs->offsetV9Ptr)++; 
    615501#ifdef IPV4AGG 
    616502          if ((pftmp->fieldType==8)){ 
     
    625511          } 
    626512#endif 
    627 #ifdef CRIHAN 
    628           if (pftmp->fieldType==8){ 
    629             ipFirstCache.v4AdS = *((unsigned long*)&buffer4); 
    630             mplsFirstCache.v4AdS = *((unsigned long*)&buffer4); 
    631           } 
    632           if (pftmp->fieldType==12){ 
    633             ipFirstCache.v4AdD = *((unsigned long*)&buffer4); 
    634             mplsFirstCache.v4AdD = *((unsigned long*)&buffer4); 
    635           } 
    636           if (pftmp->fieldType==1){ 
    637             ipFirstCache.bytes = *((unsigned long*)&buffer4); 
    638           } 
    639           if (pftmp->fieldType==2){ 
    640             ipFirstCache.pkts = *((unsigned long*)&buffer4); 
    641           } 
    642           if (pftmp->fieldType==22){ 
    643             firstTime = *((unsigned long*)&buffer4); 
    644           } 
    645           if (pftmp->fieldType==21){ 
    646             lastTime = *((unsigned long*)&buffer4); 
    647           } 
    648 #endif 
    649513          break; 
    650514        case 16: 
    651515          for (i=0; i<4; i++) { 
    652             buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    653             buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    654             buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
    655             buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 
     516            buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     517            (*myPtrs->offsetV9Ptr)++; 
     518            buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     519            (*myPtrs->offsetV9Ptr)++; 
     520            buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     521            (*myPtrs->offsetV9Ptr)++; 
     522            buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));  
     523            (*myPtrs->offsetV9Ptr)++; 
    656524          } 
    657525          /* aggregation IPv6 */           
     
    669537         * end of one flow (not the flowset)  
    670538         */ 
    671 #ifdef CRIHAN 
    672         if ( mplsFirstCache.mplsLabel1 == 0 ) { 
    673           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->ipProt = ipFirstCache.ipProt; 
    674           ipFirstCache.ipProt = 0; 
    675           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->bytes = ipFirstCache.bytes; 
    676           ipFirstCache.bytes = 0; 
    677           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->pkts = ipFirstCache.pkts; 
    678           ipFirstCache.pkts = 0; 
    679           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->inSnmp = ipFirstCache.inSnmp; 
    680           ipFirstCache.inSnmp = 0; 
    681           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->outSnmp = ipFirstCache.outSnmp; 
    682           ipFirstCache.outSnmp = 0; 
    683           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->v4AdS = ipFirstCache.v4AdS; 
    684           ipFirstCache.outSnmp = 0; 
    685           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->v4AdD = ipFirstCache.v4AdD; 
    686           ipFirstCache.v4AdD = 0; 
    687           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->tProt = ipFirstCache.tProt; 
    688           ipFirstCache.tProt = 0; 
    689           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->sPort = ipFirstCache.sPort; 
    690           ipFirstCache.sPort = 0; 
    691           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->dPort = ipFirstCache.dPort; 
    692           ipFirstCache.dPort = 0; 
    693           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->maskD = ipFirstCache.maskD; 
    694           ipFirstCache.maskD = 0; 
    695           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->maskS = ipFirstCache.maskS; 
    696           ipFirstCache.maskS = 0; 
    697           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->routerAd = ipFirstCache.routerAd; 
    698           (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->liveTime = lastTime - firstTime; 
    699           firstTime = 0; lastTime = 0; 
    700           (*myPtrs->ipNbPtr)++; 
    701         } else { 
    702           (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->ipProt = mplsFirstCache.ipProt; 
    703           mplsFirstCache.ipProt = 0; 
    704           (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->v4AdS =  mplsFirstCache.v4AdS; 
    705           mplsFirstCache.v4AdS = 0; 
    706           (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->v4AdD =  mplsFirstCache.v4AdD;  
    707           mplsFirstCache.v4AdD = 0; 
    708           (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->routerAd =  mplsFirstCache.routerAd; 
    709           (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->mplsLabel1 =  mplsFirstCache.mplsLabel1; 
    710           mplsFirstCache.mplsLabel1 = 0; 
    711           (*myPtrs->mplsNbPtr)++; 
    712         } 
    713 #endif  
     539 
    714540        /* put aggregation cache information to IPv4 Prefixes table */ 
    715541        /* Aggregation mode must be enable in ./configure options   */ 
    716542        /* first we must know if the address belong to our prefix   */ 
    717         myPtrs->nbFluxTT++; 
    718543#ifdef IPV4AGG 
    719544        if ( (bool == 1) && (isMplsFlow == 0) ){ 
     
    723548          if (res!=NULL){ 
    724549            if ( myPtrs->routersID[res->routerNb] == agCache.routerAd  ) { 
    725               myPtrs->nbFluxSR4++; 
    726550              /* OUT ("traffic from the prefix/subnet")  */ 
    727551              res->bytesNbOUT += agCache.bytes; 
     
    733557                            sizeof(struct PrefixV4), prefGlobalCmp); 
    734558              if (res2!=NULL){ 
    735                 myPtrs->nbFluxIR4++; 
    736559                ((struct POP *)((myPtrs->matrixPOP) 
    737560                                +((res->routerNb)*ROUTER_INDEX_MAX) 
     
    744567                                +((res2->routerNb))))->flowNb++;  
    745568              } else { 
    746                 myPtrs->nbFluxSE++; 
    747569                ( 
    748570                 ((struct POP *)(myPtrs->matrixPOP) 
     
    799621              /*     -  prefix not referenced but not allowed to be routed */ 
    800622              /*     -  spoofing                                           */ 
    801               myPtrs->nbFluxUK++; 
    802623#ifdef PRINTUNKNOWNSUBNET  
    803624              fprintf(stderr, "%lu.%lu.%lu.%lu/%hu -> %lu.%lu.%lu.%lu/%hu (R:%lu.%lu.%lu.%lu) \n", 
     
    869690                                   );  
    870691            myMsg.type = 1; 
    871             /* OLD transfert type */ 
    872 /*          msgSend( myQueue, myMsg); */ 
     692 
     693 
    873694            /* NEW transfert type */ 
    874695            for ( ; tmpRL; tmpRL=tmpRL->next){ 
  • trunk/src/renetcol.c

    r47 r57  
    2929 
    3030struct SHMForAgg *shmForAgg; 
    31  
    32 struct IPFLowCache tabIP[MAX_IP_FLOW]; 
    33 struct MPLSFlowCache tabMPLS[MAX_MPLS_FLOW]; 
    34 unsigned long ipNb = 0;                     /* counter of IP flows number */ 
    35 unsigned long mplsNb = 0;                   /* counter of MPLS flow number */ 
    3631 
    3732unsigned short currentIPOutputFile = 0;    /* index on the current IP file */ 
     
    7873int reInitConf = 0; 
    7974 
    80 static time_t lastRock; 
    8175static struct tm *tmPtr; 
    8276 
     
    115109  } 
    116110 
    117 #ifdef CRIHAN 
    118   fprintf(stderr, "renetcol compilation with CRIHAN feature enable\n"); 
    119 #endif 
    120111#ifdef IPV4AGG 
    121112  fprintf(stderr, "renetcol compilation and execution with IPv4 Aggregation feature enable\n"); 
     
    203194  myPtrs.pcktPtr = (DatagramPtr) malloc(sizeof(struct Datagram)); 
    204195  myPtrs.currentFlowsetNumberPtr = &currentFlowsetNumber; 
    205   myPtrs.ipNbPtr =  &ipNb; 
    206   myPtrs.mplsNbPtr =  &mplsNb; 
    207196  myPtrs.routersID = &indexedRouterList; 
    208197  myPtrs.currentV4Tab = shmForAgg->prefixV4Tab[shmForAgg->currentTable]; 
    209198  myPtrs.secondV4Tab = shmForAgg->prefixV4Tab[shmForAgg->secondTable]; 
    210199  myPtrs.matrixPOP = &(shmForAgg->matrixPOP[shmForAgg->currentTable][0][0]); 
    211  
    212   myPtrs.nbFluxSR4 =0; 
    213   myPtrs.nbFluxSE =0; 
    214   myPtrs.nbFluxIR4 =0; 
    215   myPtrs.nbFluxUK = 0; 
    216   myPtrs.nbFluxTT = 0; 
    217200 
    218201  for (i=0; i<ROUTER_INDEX_MAX; i++){ 
     
    412395  int regRouter = 0; 
    413396  time_t now = time((time_t *)NULL); 
    414   int iIP, iMPLS, i, z, x; 
    415397  int loopNb = 0; 
    416398  int gardeFou = 0; 
    417399  time_t lastIPOutput, lastMPLSOutput; 
    418   time_t receptionTime; 
    419400 
    420401  now = time((time_t *)NULL); 
     
    438419      shmForAgg->readed = 1; 
    439420      myPtrs.matrixPOP = &(shmForAgg->matrixPOP[shmForAgg->currentTable][0][0]); 
    440       fprintf(stderr,"\n\nComptage FLUX:\n SR4: %llu\n SE: %llu\n IR4: %llu\n UK: %llu\n TT: %llu\n", 
    441               myPtrs.nbFluxSR4, 
    442               myPtrs.nbFluxSE, 
    443               myPtrs.nbFluxIR4, 
    444               myPtrs.nbFluxUK, 
    445               myPtrs.nbFluxTT 
    446               ); 
    447       myPtrs.nbFluxSR4 =0; 
    448       myPtrs.nbFluxSE =0; 
    449       myPtrs.nbFluxIR4 =0; 
    450       myPtrs.nbFluxUK = 0; 
    451       myPtrs.nbFluxTT = 0; 
    452421    } 
    453422    if (sigusr1Up == 1){ 
     
    487456                                      myPtrs.offsetV9Ptr, myPtrs.ptr_buffer); 
    488457        if ( currentFlowsetId == 0 ) { 
    489           if ( (shift = checkTemplateFlowSet(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
    490                                              myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 
     458          if ( (shift = checkTemplateFlowSet(myPtrs.currentRouterPtr,  
     459                                             myPtrs.offsetV9Ptr,  
     460                                             myPtrs.ptr_buffer,  
     461                                             myPtrs.currentHeaderV9Ptr, 
    491462                                             curTplFlSetPtr, 
    492463                                             myPtrs.currentFlowsetNumberPtr, 
     
    499470          writeAllTplFlSet(); 
    500471        } else if (currentFlowsetId == 1) { 
    501           if ( (shift = checkTemplateOption(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
    502                                       myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 
    503                                       curTplOptionPtr, 
     472          if ( (shift = checkTemplateOption(myPtrs.currentRouterPtr,  
     473                                            myPtrs.offsetV9Ptr,  
     474                                            myPtrs.ptr_buffer,  
     475                                            myPtrs.currentHeaderV9Ptr, 
     476                                            curTplOptionPtr, 
    504477                                            myPtrs.currentFlowsetNumberPtr) ) < 0 ) { 
    505478#ifdef DEBUG 
     
    549522    loopNb++; 
    550523 
    551 #ifdef CRIHAN 
    552     now = time((time_t *)NULL); 
    553     receptionTime = now; 
    554     if ( (ipNb > (MAX_IP_FLOW - 50)) ||  
    555          ( (now-lastIPOutput) > IP_TIME_THRESHOLD) ) { 
    556       outputName[0] = '\0'; 
    557       sprintf(cof_str, "%d", currentIPOutputFile); 
    558       strcat(outputName, OUTPUT_IP); 
    559       strcat(outputName, cof_str); 
    560       strcat(outputName, EXTENSION); 
    561       if (fopen(outputName, "x") == NULL) { 
    562         currentIPOutputFile = (currentIPOutputFile + 1)%MAX_IP_OUTPUT_FILES; 
    563         outputName[0] = '\0'; 
    564         sprintf(cof_str, "%d", currentIPOutputFile); 
    565         strcat(outputName, OUTPUT_IP); 
    566         strcat(outputName, cof_str); 
    567         strcat(outputName, EXTENSION); 
    568       }  
    569       if ((fIP = fopen(outputName, "w")) == NULL) { 
    570         syslog(LOG_ERR,"Error in OUTPUT_IP opening : %s", strerror(errno)); 
    571       } else { 
    572         for ( iIP = 0; iIP < ipNb; iIP++){ 
    573           if ( tabIP[iIP].ipProt == 0 ) { 
    574             fprintf(fIP, "%lu;%lu;%hu;%hu;%lu.%lu.%lu.%lu;%lu.%lu.%lu.%lu;%d;%hu;%hu;%d;%d;%lu.%lu.%lu.%lu;%lu;%d\n", 
    575                     tabIP[iIP].bytes, tabIP[iIP].pkts, 
    576                     tabIP[iIP].inSnmp,  tabIP[iIP].outSnmp, 
    577                     tabIP[iIP].v4AdS>>24, tabIP[iIP].v4AdS<<8>>24, 
    578                     tabIP[iIP].v4AdS<<16>>24, tabIP[iIP].v4AdS<<24>>24, 
    579                     tabIP[iIP].v4AdD>>24, tabIP[iIP].v4AdD<<8>>24, 
    580                     tabIP[iIP].v4AdD<<16>>24, tabIP[iIP].v4AdD<<24>>24, 
    581                     tabIP[iIP].tProt, tabIP[iIP].sPort, 
    582                     tabIP[iIP].dPort, tabIP[iIP].maskD, 
    583                     tabIP[iIP].maskS, tabIP[iIP].routerAd>>24, 
    584                     tabIP[iIP].routerAd<<8>>24, tabIP[iIP].routerAd<<16>>24, 
    585                     tabIP[iIP].routerAd<<24>>24, tabIP[iIP].liveTime, 
    586                     receptionTime 
    587                     ); 
    588           } 
    589         } 
    590         fclose(fIP); 
    591       } 
    592       ipNb = 0; 
    593       lastIPOutput = now; 
    594     } 
    595     now = time((time_t *)NULL); 
    596     if ( mplsNb > (MAX_MPLS_FLOW - 50) ||  
    597          ( (now-lastMPLSOutput) > MPLS_TIME_THRESHOLD) ) { 
    598       outputName[0] = '\0'; 
    599       sprintf(cof_str, "%d", currentMPLSOutputFile); 
    600       strcat(outputName, OUTPUT_MPLS); 
    601       strcat(outputName, cof_str); 
    602       strcat(outputName, EXTENSION); 
    603       if (fopen(outputName, "x") == NULL) { 
    604         currentMPLSOutputFile = (currentMPLSOutputFile + 1)%MAX_MPLS_OUTPUT_FILES; 
    605         outputName[0] = '\0'; 
    606         sprintf(cof_str, "%d", currentMPLSOutputFile); 
    607         strcat(outputName, OUTPUT_MPLS); 
    608         strcat(outputName, cof_str); 
    609         strcat(outputName, EXTENSION); 
    610       } 
    611       if ((fMPLS = fopen(outputName, "w")) == NULL) { 
    612         syslog(LOG_ERR,"Error in OUTPUT_MPLS opening : %s", strerror(errno)); 
    613       } else { 
    614         for ( iMPLS = 0; iMPLS < mplsNb; iMPLS++){ 
    615           if ( tabMPLS[iMPLS].ipProt == 0 ) { 
    616             fprintf(fMPLS, "%lu.%lu.%lu.%lu;%hu;%lu.%lu.%lu.%lu;%lu.%lu.%lu.%lu\n", 
    617                     tabMPLS[iMPLS].routerAd>>24,tabMPLS[iMPLS].routerAd<<8>>24, 
    618                     tabMPLS[iMPLS].routerAd<<16>>24, 
    619                     tabMPLS[iMPLS].routerAd<<24>>24, 
    620                     tabMPLS[iMPLS].mplsLabel1,tabMPLS[iMPLS].v4AdS>>24, 
    621                     tabMPLS[iMPLS].v4AdS<<8>>24,tabMPLS[iMPLS].v4AdS<<16>>24, 
    622                     tabMPLS[iMPLS].v4AdS<<24>>24,tabMPLS[iMPLS].v4AdD>>24, 
    623                     tabMPLS[iMPLS].v4AdD<<8>>24,tabMPLS[iMPLS].v4AdD<<16>>24, 
    624                     tabMPLS[iMPLS].v4AdD<<24>>24  
    625                     ); 
    626           } 
    627         } 
    628         fclose(fMPLS); 
    629       } 
    630       mplsNb = 0; 
    631       lastMPLSOutput = now; 
    632     } 
    633 #endif /* CRIHAN */ 
    634524    now = time((time_t *)NULL); 
    635525    tmPtr = localtime(&now); 
  • trunk/src/renetcolAgg.c

    r47 r57  
    4848  int rrd_create_er_ct = 0; 
    4949  int rrd_create_ok_ct = 0; 
    50   int rrd_ct = 0; 
    5150  int isFirstUpdate = 1; 
    5251  key_t key; 
     
    5857  char *opt[27]; 
    5958  char *optUpdate[3]; 
    60   int res_rrd = 0; 
    6159  FILE *fp; 
    6260  static time_t now, now2; 
    63   struct shmid_ds shminfo; 
    6461   
    6562  key = 8765; 
     
    338335        /* END MATRIX INTER POP ACC */ 
    339336        now2 = time((time_t *)NULL); 
    340         /* #ifdef DEBUGAGG */ 
     337#ifdef DEBUGAGG 
    341338        fprintf(stderr, "IPv4 subnet managment (rrd update) : \n %d sec, %d files updated, %d errors, total %d\n %d rrd file already created, %d errors in creation, %d new rrd file creations", 
    342                 now2-now, 
     339                (int)now2-now, 
    343340                rrd_update_ok_ct, 
    344341                rrd_update_er_ct, 
     
    347344                rrd_create_er_ct, 
    348345                rrd_create_ok_ct); 
    349         /* #endif */ 
     346#endif 
    350347        rrd_update_ok_ct = 0; 
    351348        rrd_update_er_ct = 0; 
  • trunk/src/renetcolParam.h

    r36 r57  
    3636#define FIELD_TYPE_NUMBER 89 
    3737#define MAX_RULES_PER_FIELD 10 /* maximum rules number for one field */ 
    38 #define MAX_IP_FLOW 10000 
    39 #define MAX_MPLS_FLOW 200 
    4038#define SHMSIZE 33554432 
    4139#define SOCKET_BUFFER_SIZE 1500 
    4240#define TIME_OUT 300 
    43  
    44 #ifdef CRIHAN 
    45 #define OUTPUT_IP "/tmp/ipflow" 
    46 #define EXTENSION ".txt"  
    47 #define OUTPUT_MPLS "/tmp/mplsflow" 
    48 #define MAX_IP_OUTPUT_FILES 3 
    49 #define MAX_MPLS_OUTPUT_FILES 3 
    50 #define IP_TIME_THRESHOLD 60 /* in sec */ 
    51 #define MPLS_TIME_THRESHOLD 60 /* in sec */ 
    52 #endif /* CRIHAN */ 
    5341 
    5442/* 
  • trunk/src/routers_mgmt.h

    r36 r57  
    6060  RuleDefPtr *rulesAddressPtr; 
    6161  RulesPtr rulesListPtr;                             /* Rules list */ 
    62   struct IPFLowCache *tabIPPtr; 
    63   struct MPLSFlowCache *tabMPLSPtr; 
    64   unsigned long *ipNbPtr; 
    65   unsigned long *mplsNbPtr; 
    6662  unsigned long *routersID; 
    6763  struct PrefixV4 *currentV4Tab; 
    6864  struct PrefixV4 *secondV4Tab; 
    6965  struct POP *matrixPOP; 
    70   unsigned long long nbFluxSR4; 
    71   unsigned long long nbFluxSE; 
    72   unsigned long long nbFluxIR4; 
    73   unsigned long long nbFluxUK; 
    74   unsigned long long nbFluxTT; 
    7566}; 
    7667